/* === DISPATCH — minimal theme for founders & indie hackers === */

:root {
  --bg:         #F8F6F2;
  --bg-subtle:  #F0EDE7;
  --text:       #18181B;
  --muted:      #71717A;
  --faint:      #A1A1AA;
  --accent:     #C4622D;
  --border:     #E4DDD4;
  --serif:      'Lora', Georgia, serif;
  --sans:       'DM Sans', system-ui, sans-serif;
  --mono:       'JetBrains Mono', monospace;
  --max-w:      680px;
  --toggle-size: 2rem;
}

[data-theme="dark"] {
  --bg:        #141412;
  --bg-subtle: #1E1C19;
  --text:      #EDEBE7;
  --muted:     #8C8983;
  --faint:     #5C5955;
  --accent:    #E07848;
  --border:    #2A2825;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #141412;
    --bg-subtle: #1E1C19;
    --text:      #EDEBE7;
    --muted:     #8C8983;
    --faint:     #5C5955;
    --accent:    #E07848;
    --border:    #2A2825;
  }
}

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

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  color-scheme: light dark;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* Layout */
.site-header, .main, .site-footer {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 1.5rem;
}
.main { flex: 1; padding-block: 3.5rem; }

/* Header */
.site-header { padding-block: 1.75rem; border-bottom: 1px solid var(--border); }
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.site-title:hover { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 1.75rem; }
.site-nav__link {
  font-size: 0.875rem;
  color: var(--muted);
  position: relative;
  transition: color 0.15s;
}
.site-nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.site-nav__link:hover,
.site-nav__link--active { color: var(--text); }
.site-nav__link:hover::after,
.site-nav__link--active::after { transform: scaleX(1); }

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--toggle-size);
  height: var(--toggle-size);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--faint);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-subtle);
}
.theme-toggle svg {
  width: 1rem;
  height: 1rem;
  display: block;
  transition: opacity 0.15s, transform 0.3s ease;
}
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Footer */
.site-footer {
  padding-block: 1.75rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer__copy { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); }
.site-footer__links { display: flex; gap: 1.25rem; }
.site-footer__links a { font-size: 0.8125rem; color: var(--muted); transition: color 0.15s; }
.site-footer__links a:hover { color: var(--accent); }

/* Home intro */
.intro { margin-bottom: 3rem; padding-bottom: 2.5rem; border-bottom: 1px solid var(--border); }
.intro__text { font-family: var(--serif); font-size: 1.2rem; line-height: 1.7; }
.intro__text a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Post list */
.post-list__label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1.5rem;
}
.post-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.5rem 1.25rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.post-item:last-child { border-bottom: none; }
.post-item__date { font-family: var(--mono); font-size: 0.75rem; color: var(--faint); white-space: nowrap; }
.post-item__title {
  display: block;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.4;
  transition: color 0.15s;
}
.post-item__title:hover { color: var(--accent); }
.post-item__desc { margin-top: 0.3rem; font-size: 0.875rem; color: var(--muted); line-height: 1.55; }
.post-list__empty { color: var(--muted); font-style: italic; }

/* Single post header */
.post-header { margin-bottom: 2.75rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.post-header__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
  margin-bottom: 1rem;
}
.post-header__sep { color: var(--border); }
.post-header__tag { color: var(--accent); transition: opacity 0.15s; }
.post-header__tag:hover { opacity: 0.7; }
.post-header__title {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}
.post-header__desc {
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
}

/* Post content */
.post-content { font-family: var(--serif); font-size: 1.0625rem; line-height: 1.8; }
.post-content > * + * { margin-top: 1.5em; }
.post-content h2 { font-size: 1.3rem; font-weight: 600; margin-top: 2.5em; margin-bottom: 0.5em; }
.post-content h3 { font-size: 1.1rem; font-weight: 600; margin-top: 2em; margin-bottom: 0.4em; }
.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.post-content a:hover { opacity: 0.75; }
.post-content ul, .post-content ol { padding-left: 1.5em; }
.post-content li + li { margin-top: 0.35em; }
.post-content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
  color: var(--muted);
  font-style: italic;
}
.post-content code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15em 0.45em;
}
.post-content pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.65;
  margin-block: 2em;
}
.post-content pre code { background: none; border: none; padding: 0; font-size: inherit; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin-block: 2.5em; }
.post-content img { border-radius: 6px; margin-block: 2em; }

/* Post footer nav */
.post-footer { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.post-footer__nav { display: flex; justify-content: space-between; gap: 1rem; }
.post-footer__prev, .post-footer__next { display: flex; flex-direction: column; gap: 0.2rem; max-width: 45%; }
.post-footer__next { text-align: right; margin-left: auto; }
.post-footer__nav-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.post-footer__nav-title { font-family: var(--serif); font-size: 0.9375rem; color: var(--muted); line-height: 1.4; transition: color 0.15s; }
.post-footer__prev:hover .post-footer__nav-title,
.post-footer__next:hover .post-footer__nav-title { color: var(--accent); }

/* Page header (list pages) */
.page-header { margin-bottom: 2.5rem; padding-bottom: 1.75rem; border-bottom: 1px solid var(--border); }
.page-header__title { font-family: var(--serif); font-size: 1.75rem; font-weight: 500; }
.page-header__desc { margin-top: 0.5rem; color: var(--muted); font-size: 0.9375rem; }

/* Responsive */
@media (max-width: 520px) {
  .post-item { grid-template-columns: 1fr; gap: 0.25rem; }
  .post-footer__nav { flex-direction: column; }
  .post-footer__prev, .post-footer__next { max-width: 100%; text-align: left; }
  .site-footer__inner { flex-direction: column; align-items: flex-start; }
}
