/* =========================================================================
   The Morrow Years — Design System
   A typography-first, editorial reading experience.
   Sections: Tokens · Reset · Base · Layout · Header · Footer · Buttons ·
   Tags · Cards · Newsletter · Article prose · Utilities · Motion
   ========================================================================= */

/* ---------------------------------------------------------------- Tokens */
:root {
  /* Warm off-white light theme */
  --bg: #fcfbf8;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f2ec;
  --surface-3: #efece4;

  --ink: #242424;
  --ink-strong: #1a1a1a;
  --ink-soft: #57595e;
  --ink-faint: #86888d;

  --accent: #147a5b;
  --accent-strong: #0e5e46;
  --accent-contrast: #ffffff;
  --accent-soft: #e7f1ec;

  --community: #b5502e;
  --community-strong: #973f22;
  --community-contrast: #ffffff;
  --community-soft: #f7e6de;

  --border: #e8e4db;
  --border-strong: #d9d4c8;

  --shadow-sm: 0 1px 2px rgba(38, 30, 18, 0.04), 0 1px 3px rgba(38, 30, 18, 0.06);
  --shadow-md: 0 4px 12px rgba(38, 30, 18, 0.06), 0 2px 4px rgba(38, 30, 18, 0.05);
  --shadow-lg: 0 18px 40px -12px rgba(38, 30, 18, 0.16), 0 6px 14px rgba(38, 30, 18, 0.06);

  --header-bg: rgba(252, 251, 248, 0.72);

  /* Fonts */
  --font-serif: "Source Serif 4", Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  /* Layout */
  --measure: 720px;         /* article column */
  --measure-narrow: 640px;  /* intro / lede text */
  --measure-wide: 1120px;   /* homepage + listing shell */
  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --header-h: 72px;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Radii */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

/* Warm dark theme — applied when the OS prefers dark and the user hasn't
   forced light, or when the user explicitly selects dark via the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171613;
    --bg-elevated: #1e1c18;
    --surface: #201e1a;
    --surface-2: #262420;
    --surface-3: #2d2a24;

    --ink: #e9e6de;
    --ink-strong: #f5f2ea;
    --ink-soft: #aba79d;
    --ink-faint: #7c786f;

    --accent: #52c29a;
    --accent-strong: #6fd3ae;
    --accent-contrast: #10231c;
    --accent-soft: rgba(82, 194, 154, 0.13);

    --community: #e8916b;
    --community-strong: #f0a883;
    --community-contrast: #2a1710;
    --community-soft: rgba(232, 145, 107, 0.14);

    --border: #322f29;
    --border-strong: #433f36;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 22px 48px -14px rgba(0, 0, 0, 0.6), 0 8px 18px rgba(0, 0, 0, 0.35);

    --header-bg: rgba(23, 22, 19, 0.72);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #171613;
  --bg-elevated: #1e1c18;
  --surface: #201e1a;
  --surface-2: #262420;
  --surface-3: #2d2a24;

  --ink: #e9e6de;
  --ink-strong: #f5f2ea;
  --ink-soft: #aba79d;
  --ink-faint: #7c786f;

  --accent: #52c29a;
  --accent-strong: #6fd3ae;
  --accent-contrast: #10231c;
  --accent-soft: rgba(82, 194, 154, 0.13);

  --community: #e8916b;
  --community-strong: #f0a883;
  --community-contrast: #2a1710;
  --community-soft: rgba(232, 145, 107, 0.14);

  --border: #322f29;
  --border-strong: #433f36;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 22px 48px -14px rgba(0, 0, 0, 0.6), 0 8px 18px rgba(0, 0, 0, 0.35);

  --header-bg: rgba(23, 22, 19, 0.72);
  color-scheme: dark;
}

/* ----------------------------------------------------------------- Reset */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; }

button { font: inherit; cursor: pointer; }

::selection { background: var(--accent-soft); color: var(--ink-strong); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0.5rem;
  transform: translate(-50%, -140%);
  z-index: 100;
  background: var(--ink-strong);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ Base */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--ink-strong);
  letter-spacing: -0.018em;
  text-wrap: balance;
}

p { text-wrap: pretty; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

/* ---------------------------------------------------------------- Layout */
.shell {
  width: 100%;
  max-width: var(--measure-wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell--reading { max-width: calc(var(--measure) + var(--gutter) * 2); }

main { flex: 1 0 auto; display: block; }

.section { padding-block: clamp(2.75rem, 6vw, 4.5rem); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.section-head h2 {
  font-size: 1.05rem;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-strong);
  margin: 0;
}
.section-head .see-all {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s var(--ease);
}
.section-head .see-all:hover { color: var(--accent-strong); }

.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* ---------------------------------------------------------------- Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.site-header.is-scrolled {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: var(--border);
}
.site-header__inner {
  max-width: var(--measure-wide);
  margin-inline: auto;
  height: var(--header-h);
  padding-inline: 1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  text-decoration: none;
}
/* Stacked one-word-per-line label (The / Morrow / Years) sitting beside the
   badge — keeps the wordmark narrow so it never collides with the nav or the
   footer columns, and short enough for the fixed-height header. */
.wordmark__text {
  line-height: 1.04;
}
/* Solid brand badge (white lockup on the brand-green square). It carries its own
   background, so it reads the same on either theme — no per-theme adjustment. */
.wordmark__logo {
  display: block;
  height: 52px;
  width: auto;
  border-radius: 11px;
}
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.site-nav a {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.site-nav a:hover { color: var(--ink-strong); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.icon-btn:hover { color: var(--ink-strong); background: var(--surface-2); }
.icon-btn svg { width: 19px; height: 19px; }

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

@media (max-width: 560px) {
  .site-nav .nav-link--hide-sm { display: none; }
}

/* ---------------------------------------------------------------- Footer */
.site-footer {
  margin-top: var(--space-9);
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.site-footer__inner {
  max-width: var(--measure-wide);
  margin-inline: auto;
  padding: clamp(2.5rem, 5vw, 3.5rem) var(--gutter) 2.5rem;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 2rem;
}
.site-footer__brand .wordmark { margin-bottom: 0.85rem; font-size: 1.35rem; }
.site-footer__brand .wordmark__logo { height: 72px; }
.site-footer__brand p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0;
  max-width: 34ch;
}
.footer-col h3 {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.9rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.footer-col a {
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}
.footer-col a:hover { color: var(--accent); }
.site-footer__base {
  max-width: var(--measure-wide);
  margin-inline: auto;
  padding: 1.4rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--ink-faint);
}
@media (max-width: 720px) {
  .site-footer__inner { grid-template-columns: 1fr 1fr; gap: 2rem 1.5rem; }
  .site-footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .site-footer__inner { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background-color 0.18s var(--ease),
    border-color 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--accent-strong); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--ink-strong); }
.btn--ghost:hover { border-color: var(--ink-soft); background: var(--surface-2); }
.btn--community { background: var(--community); color: var(--community-contrast); }
.btn--community:hover { background: var(--community-strong); box-shadow: var(--shadow-md); }
.btn--block { width: 100%; }

/* ------------------------------------------------------------------ Tags */
.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.42rem 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.tag:hover { color: var(--accent-strong); background: var(--accent-soft); }
.tag--accent { color: var(--accent-strong); background: var(--accent-soft); }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.badge-premium {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  padding: 0.28rem 0.7rem;
}

/* ----------------------------------------------------------------- Avatar */
.avatar {
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.01em;
  flex: none;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

/* ------------------------------------------------------------------ Cards */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.card:hover .card__media img { transform: scale(1.045); }
.card__body { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.2rem 1.3rem 1.4rem; flex: 1; }
.card__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.28rem;
  line-height: 1.25;
  color: var(--ink-strong);
  margin: 0;
  transition: color 0.15s var(--ease);
}
.card:hover .card__title { color: var(--accent-strong); }
.card__excerpt { font-size: 0.95rem; line-height: 1.6; color: var(--ink-soft); margin: 0; }
.card__meta {
  margin-top: auto;
  padding-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.card__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Compact list row (e.g. popular list) */
.post-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.15rem 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.post-row:first-child { border-top: 0; }
.post-row__num {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--border-strong);
  width: 1.6ch;
  flex: none;
  transition: color 0.15s var(--ease);
}
.post-row:hover .post-row__num { color: var(--accent); }
.post-row__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.06rem;
  line-height: 1.3;
  color: var(--ink-strong);
  margin: 0 0 0.35rem;
  transition: color 0.15s var(--ease);
}
.post-row:hover .post-row__title { color: var(--accent-strong); }
.post-row__meta { font-family: var(--font-sans); font-size: 0.78rem; color: var(--ink-faint); }

/* -------------------------------------------------------------- Newsletter */
.newsletter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.newsletter__eyebrow { justify-content: center; margin-bottom: 0.75rem; }
.newsletter h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  line-height: 1.2;
  margin: 0 0 0.6rem;
  color: var(--ink-strong);
}
.newsletter p {
  max-width: 46ch;
  margin: 0 auto 1.5rem;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.6;
}
.newsletter__form {
  display: flex;
  gap: 0.6rem;
  max-width: 30rem;
  margin: 0 auto;
}
.input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink-strong);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 0.8rem 1.2rem;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input::placeholder { color: var(--ink-faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.newsletter__fine { margin: 1rem auto 0; font-size: 0.78rem; color: var(--ink-faint); }
@media (max-width: 480px) {
  .newsletter__form { flex-direction: column; }
  .newsletter__form .btn { width: 100%; }
}

/* --------------------------------------------------------- Article prose */
.article { padding-block: clamp(1.5rem, 4vw, 2.5rem) var(--space-8); }
.article__header { max-width: var(--measure); margin-inline: auto; }
.article__kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.article__title {
  font-size: clamp(2.1rem, 5.2vw, 3.15rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 1.1rem;
}
.article__subtitle {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.2rem, 2.6vw, 1.4rem);
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 1.75rem;
}
.byline {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-block: 1.25rem;
  border-block: 1px solid var(--border);
}
.byline__author { font-family: var(--font-sans); font-weight: 600; font-size: 0.95rem; color: var(--ink-strong); text-decoration: none; }
.byline__author:hover { color: var(--accent); }
.byline__meta { font-family: var(--font-sans); font-size: 0.82rem; color: var(--ink-faint); margin-top: 0.15rem; }
.byline__share { margin-left: auto; display: flex; gap: 0.35rem; }

.article__cover { margin: 2rem 0 0; }
.article__cover img { width: 100%; border-radius: var(--radius-lg); }
.article__cover figcaption { margin-top: 0.7rem; text-align: center; font-family: var(--font-sans); font-size: 0.82rem; color: var(--ink-faint); }

/* Body typography */
.prose {
  max-width: var(--measure);
  margin-inline: auto;
  margin-top: 2.5rem;
}
.prose > * { margin-inline: auto; }
.prose p,
.prose ul,
.prose ol {
  font-family: var(--font-serif);
  font-size: 1.24rem;
  line-height: 1.8;
  color: var(--ink);
  margin: 0 0 1.6rem;
}
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: 0.6rem; padding-left: 0.25rem; }
.prose li::marker { color: var(--accent); }

.prose h2 {
  font-size: clamp(1.55rem, 3.2vw, 1.9rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 3rem 0 1rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}
.prose h3 {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 2.4rem 0 0.8rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}
.prose h2 .heading-anchor,
.prose h3 .heading-anchor {
  opacity: 0;
  margin-left: 0.4rem;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s var(--ease);
}
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor { opacity: 1; }

.prose a {
  color: var(--ink-strong);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s var(--ease), color 0.15s var(--ease);
}
.prose a:hover { color: var(--accent-strong); text-decoration-color: var(--accent-strong); }

.prose strong { color: var(--ink-strong); font-weight: 700; }

.prose blockquote {
  margin: 2.5rem 0;
  padding: 0.4rem 0 0.4rem 1.6rem;
  border-left: 3px solid var(--accent);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.45;
  color: var(--ink-strong);
}
.prose blockquote p { font-size: inherit; line-height: inherit; margin-bottom: 0.6rem; }
.prose blockquote p:last-child { margin-bottom: 0; }

/* Callout boxes: <div class="callout callout--note"> in markdown */
.callout {
  margin: 2rem 0;
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout p { font-size: 1.05rem; line-height: 1.65; }
.callout__label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem;
}
.callout--warn { border-left-color: #b7791f; }
.callout--warn .callout__label { color: #b7791f; }

/* Pull quote: <p class="pullquote"> */
.prose .pullquote {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.5vw, 1.9rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-strong);
  text-align: center;
  margin: 2.75rem auto;
  padding: 0;
  max-width: 22ch;
  letter-spacing: -0.01em;
}

.prose img { border-radius: var(--radius); margin: 2.25rem 0 0.6rem; box-shadow: var(--shadow-sm); }
.prose figure { margin: 2.25rem 0; }
.prose figure img { margin: 0; }
.prose figcaption { font-family: var(--font-sans); font-size: 0.82rem; color: var(--ink-faint); text-align: center; margin-top: 0.7rem; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.12rem 0.4rem;
}
.prose pre {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
  overflow-x: auto;
  margin: 2rem 0;
  font-size: 0.92rem;
  line-height: 1.65;
  box-shadow: var(--shadow-sm);
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.prose hr {
  border: 0;
  height: 1.5rem;
  margin: 2.5rem auto;
  text-align: center;
}
.prose hr::before {
  content: "\00B7 \00B7 \00B7";
  color: var(--ink-faint);
  letter-spacing: 0.6em;
  font-size: 1.2rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  margin: 2rem 0;
}
.prose th, .prose td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); }
.prose th { font-weight: 600; color: var(--ink-strong); }

/* ------------------------------------------------------ Article scaffolding */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: var(--accent);
  z-index: 60;
  will-change: transform;
}

/* Layout with desktop TOC rail */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 1080px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 3.5rem;
    max-width: calc(var(--measure) + 240px + 3.5rem);
    margin-inline: auto;
    align-items: start;
  }
  .article-layout .prose,
  .article-layout .article__header,
  .article-layout .article-footer { margin-inline: 0; max-width: var(--measure); }
}
.toc {
  display: none;
}
@media (min-width: 1080px) {
  .toc {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 2rem);
    align-self: start;
    padding-top: 0.4rem;
  }
  .toc h2 {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 0.9rem;
  }
  .toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
  .toc a {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--ink-soft);
    text-decoration: none;
    padding: 0.35rem 0 0.35rem 0.85rem;
    border-left: 2px solid var(--border);
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
  }
  .toc a.is-sub { padding-left: 1.7rem; font-size: 0.82rem; }
  .toc a:hover { color: var(--ink-strong); }
  .toc a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
}

/* Share buttons */
.share-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.share-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.share-btn svg { width: 16px; height: 16px; }

/* Article footer: tags, author card, related */
.article-footer { max-width: var(--measure); margin: 3rem auto 0; }
.author-card {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  padding: 1.6rem;
  margin-top: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.author-card__name { font-family: var(--font-sans); font-weight: 700; font-size: 1.02rem; color: var(--ink-strong); margin: 0; }
.author-card__role { font-size: 0.82rem; color: var(--accent); margin: 0.1rem 0 0.6rem; }
.author-card__bio { font-size: 0.92rem; line-height: 1.6; color: var(--ink-soft); margin: 0; }

/* Community CTA — funnels article readers toward the app community thread */
.community-cta {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  max-width: var(--measure);
  margin: 2.75rem auto;
  padding: 1.6rem 1.9rem;
  background: var(--community-soft);
  border: 1px solid color-mix(in srgb, var(--community) 30%, var(--border));
  border-radius: var(--radius-lg);
}
.community-cta__body { flex: 1; min-width: 0; }
.community-cta h3 { font-family: var(--font-serif); font-size: 1.15rem; margin: 0 0 0.3rem; color: var(--ink-strong); }
.community-cta p { font-family: var(--font-sans); font-size: 0.92rem; line-height: 1.55; color: var(--ink-soft); margin: 0; }
.community-cta .btn { flex-shrink: 0; }
@media (max-width: 640px) {
  .community-cta { flex-direction: column; align-items: flex-start; text-align: left; }
  .community-cta .btn { width: 100%; }
}

/* Paywall */
.paywall {
  position: relative;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-md);
}
.paywall::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -120px;
  height: 120px;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
}
.paywall h3 { font-family: var(--font-serif); font-size: 1.35rem; margin: 0 0 0.5rem; color: var(--ink-strong); }
.paywall p { font-family: var(--font-sans); font-size: 0.98rem; line-height: 1.6; color: var(--ink-soft); margin: 0 auto 1.25rem; max-width: 40ch; }

/* ------------------------------------------------------- Listing / page header */
.page-header {
  padding-block: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--border);
}
.page-header__inner { max-width: var(--measure-wide); margin-inline: auto; padding-inline: var(--gutter); }
.page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0.6rem 0 0.7rem;
}
.page-header p {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
  max-width: 52ch;
}
.page-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}
.page-header .back-link:hover { color: var(--accent); }

.empty-state {
  text-align: center;
  padding: clamp(3rem, 8vw, 5rem) 1rem;
  color: var(--ink-soft);
}
.empty-state h2 { font-family: var(--font-serif); font-size: 1.5rem; color: var(--ink-strong); margin: 0 0 0.5rem; }
.empty-state p { margin: 0 auto 1.5rem; max-width: 40ch; }

/* Search */
.search-box { position: relative; max-width: 40rem; margin-top: 1.5rem; }
.search-box svg {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--ink-faint);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--ink-strong);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 0.95rem 1.3rem 0.95rem 3rem;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search-box input::placeholder { color: var(--ink-faint); }
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-count { margin-top: 1rem; font-size: 0.85rem; color: var(--ink-faint); }

/* Big 404 */
.notfound { text-align: center; padding-block: clamp(3.5rem, 12vw, 7rem); }
.notfound__code {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(5rem, 20vw, 10rem);
  line-height: 0.9;
  color: var(--accent);
  letter-spacing: -0.03em;
  margin: 0;
}
.notfound h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 1rem 0 0.6rem; }
.notfound p { color: var(--ink-soft); font-size: 1.1rem; margin: 0 auto 1.75rem; max-width: 42ch; }

/* --------------------------------------------------------------- Utilities */
.stack { display: grid; gap: var(--space-4); }
.text-center { text-align: center; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------- Motion */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
