/* spread — design system */

:root {
  --bg: #ffffff;
  --fg: #0f0f0f;
  --muted: #f5f5f5;
  --border: #e5e5e5;
  --link: #1d4ed8;
  --link-hover: #1e40af;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    'Liberation Mono', monospace;
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --fg: #fafafa;
  --muted: #1a1a1a;
  --border: #2a2a2a;
  --link: #93bbfc;
  --link-hover: #b4d0fd;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  transition: color 0.3s, background-color 0.3s;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Container */

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Header */

.site-header {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.2em;
  text-transform: lowercase;
}

.site-title:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  color: var(--fg);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  transition: color 0.3s;
}

.site-nav a:hover {
  color: var(--link);
  text-decoration: none;
}

/* Main */

main {
  flex: 1;
  padding: 3.5rem 0;
}

/* Prose */

.prose {
  max-width: 65ch;
}

.prose h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.prose h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.prose h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
}

.prose p {
  margin-bottom: 1.5rem;
}

.prose ul,
.prose ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--fg);
  opacity: 0.8;
  transition: border-color 0.3s;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--muted);
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  transition: background-color 0.3s;
}

.prose pre {
  background: var(--muted);
  padding: 1.25rem 1.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  transition: background-color 0.3s;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.prose th,
.prose td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s;
}

.prose th {
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg);
  opacity: 0.6;
}

.prose thead th {
  border-bottom: 2px solid var(--border);
}

.prose tbody tr:last-child td {
  border-bottom: none;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
  transition: border-color 0.3s;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

/* About page */

.about {
  max-width: 65ch;
}

.about-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.about-avatar {
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  margin-bottom: 1rem;
}

.about-name {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 0;
}

.about-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

/* Post meta */

.post-date {
  font-size: 0.875rem;
  color: var(--fg);
  opacity: 0.6;
  margin-bottom: 2.5rem;
  display: block;
}

/* Post list (index) */

.post-list {
  list-style: none;
  padding: 0;
  max-width: 65ch;
}

.post-list li {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s;
}

.post-list li:first-child {
  padding-top: 0;
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list a {
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--fg);
  transition: color 0.3s;
}

.post-list a:hover {
  color: var(--link);
  text-decoration: none;
}

.post-list .post-date {
  margin-bottom: 0;
  margin-top: 0.35rem;
}

.post-list .post-description {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.65;
  line-height: 1.5;
}

/* Footer */

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  opacity: 0.65;
  transition: border-color 0.3s;
}

.site-footer a {
  color: var(--fg);
}

.site-footer a:hover {
  color: var(--link);
}

/* Theme toggle */

.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, border-color 0.3s;
  z-index: 100;
}

.theme-toggle:hover {
  background: var(--muted);
}

.theme-icon {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--fg);
  transition: background-color 0.3s, box-shadow 0.3s;
}

[data-theme="dark"] .theme-icon {
  background: transparent;
  box-shadow: inset -4px -2px 0 0 var(--fg);
}

/* Responsive */

@media (max-width: 768px) {
  .site-header .container {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .site-header {
    padding: 1.5rem 0;
  }

  .prose h1 {
    font-size: 1.75rem;
  }

  main {
    padding: 2.5rem 0;
  }
}
