/* Shared styles for /blog pages — same palette + dark-mode logic as index.html */

:root {
  --bg: #f6f1e7;
  --surface: #fffcf5;
  --text: #1d1b16;
  --muted: #5f5a4f;
  --line: #e4dccb;
  --line-strong: #cdc2ab;
  --accent: #2a3fb0;
  --accent-hover: #1f3090;
  --accent-fg: #ffffff;
  --tint: #e8ebfa;
  --coral: #d4552f;
  --coral-tint: #fbe4da;
  --sun: #e9b949;
  --sun-tint: #fbf0d2;
  --sage: #3f8a63;
  --sage-tint: #dfefe5;
  --danger: #a33a2b;
  --max: 760px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
}

:root[data-theme="dark"] {
  --bg: #16140f;
  --surface: #1f1c16;
  --text: #f0ebe0;
  --muted: #a8a193;
  --line: #2f2b23;
  --line-strong: #453f33;
  --accent: #93a6f2;
  --accent-hover: #b1c0f6;
  --accent-fg: #10131f;
  --tint: #222844;
  --coral: #f08a64;
  --coral-tint: #3a2419;
  --sun: #f2cb6b;
  --sun-tint: #372d15;
  --sage: #7fc29b;
  --sage-tint: #1b3025;
  --danger: #e08a76;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16140f;
    --surface: #1f1c16;
    --text: #f0ebe0;
    --muted: #a8a193;
    --line: #2f2b23;
    --line-strong: #453f33;
    --accent: #93a6f2;
    --accent-hover: #b1c0f6;
    --accent-fg: #10131f;
    --tint: #222844;
    --coral: #f08a64;
    --coral-tint: #3a2419;
    --sun: #f2cb6b;
    --sun-tint: #372d15;
    --sage: #7fc29b;
    --sage-tint: #1b3025;
    --danger: #e08a76;
  }
}

html { color-scheme: light dark; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: var(--accent-fg); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
img, svg { max-width: 100%; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 clamp(1.25rem, 5vw, 2rem); }

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1080px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.1rem;
}
.wordmark { font-family: var(--mono); font-weight: 500; color: var(--text); }
.nav-links { display: flex; align-items: center; gap: 1.5rem; font-family: var(--mono); font-size: 0.85rem; }
.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle .icon { width: 1rem; height: 1rem; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}

/* ---------- post header ---------- */
main { padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(4rem, 10vw, 6rem); }
.post-eyebrow { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.post-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.9rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 0.7rem;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1.1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}
.post-meta .sep { opacity: 0.5; }
.post-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.4rem; }
.pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
}
.post-links { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 1.6rem; }
.post-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}

/* ---------- prose ---------- */
.prose { margin-top: clamp(2.5rem, 6vw, 3.5rem); }
.prose > * + * { margin-top: 1.3rem; }
.prose h2 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2.6rem;
  line-height: 1.3;
}
.prose p { color: var(--text); }
.prose strong { font-weight: 600; }
.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--tint);
  color: var(--accent);
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
}
.prose pre {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
}
.prose pre code { background: none; color: var(--text); padding: 0; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.prose th, .prose td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
.prose th { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: 0.4rem; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.4rem 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.back-link:hover { color: var(--accent); text-decoration: none; }

/* ---------- post-nav footer ---------- */
.post-footer {
  margin-top: clamp(3rem, 7vw, 4.5rem);
  padding-top: 1.8rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

footer.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 1.6rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; max-width: 1080px; }

/* ---------- blog index cards ---------- */
.post-card {
  display: block;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
}
.post-card:hover .post-card-title { color: var(--accent); }
.post-card-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}
.post-card-desc { color: var(--muted); margin-top: 0.5rem; font-size: 0.98rem; }
.post-card-meta { margin-top: 0.6rem; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }

@media (max-width: 500px) {
  .nav-links { gap: 1rem; font-size: 0.78rem; }
}
