/* =========================================================================
   Artificial Finance — corporate-modern, light-mode finance theme.
   Tokens transcribed from DESIGN.md. Single source of truth for colour,
   type, spacing and shape.
   ========================================================================= */

:root {
  /* ---- colour (from design tokens) ---- */
  --surface: #faf9f8;
  --surface-dim: #dbdad9;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f5f3f2;
  --surface-container: #efeeec;
  --surface-container-high: #e9e8e7;
  --surface-container-highest: #e3e2e1;
  --on-surface: #1b1c1b;
  --on-surface-variant: #584239;
  --inverse-surface: #303130;
  --inverse-on-surface: #f2f0ef;
  --outline: #8b7168;
  --outline-variant: #dfc0b5;

  --primary: #a53c00;
  --on-primary: #ffffff;
  --primary-container: #fd7b41;
  --on-primary-container: #652100;

  --secondary: #3c4044;          /* dark slate for structure/text accents */
  --on-secondary: #ffffff;
  --secondary-container: #e0e3e8;

  --tertiary: #7a573a;
  --tertiary-container: #c39876;
  --peach: #ebbe9a;

  --error: #ba1a1a;

  /* neutral border used throughout the mockup */
  --border: #e3e1de;
  --border-strong: #d6d3cf;

  /* ---- type ---- */
  --font-head: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ---- shape ---- */
  --r-sm: 0.125rem;
  --r: 0.25rem;
  --r-md: 0.375rem;
  --r-lg: 0.5rem;
  --r-xl: 0.75rem;
  --r-full: 9999px;

  /* ---- spacing / layout ---- */
  --container: 1200px;
  --narrow: 720px;
  --gutter: 24px;
  --margin: 40px;
  --s-1: 8px;
  --s-2: 16px;
  --s-3: 32px;
  --s-4: 64px;

  --shadow-lift: 0 4px 20px rgba(60, 64, 68, 0.08);
  --shadow-press: 0 1px 3px rgba(60, 64, 68, 0.12);

  /* dark top bar — warm charcoal tuned to the off-white/orange palette */
  --header-bg: #431406;
  --header-fg: #f4efeb;
  --header-muted: #c3b8b1;
  --header-hover: #fd7b41;
  --header-border: rgba(255, 255, 255, 0.09);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }

/* Every thumbnail slot is 2:1 (aspect-ratio is set inline per element). Cover
   crops real photos to fit; generated SVGs use their own preserveAspectRatio. */
.thumb-img { width: 100%; height: auto; object-fit: cover; }

a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-container); }

::selection { background: var(--primary-container); color: #fff; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--primary); color: #fff; padding: 0.65rem 1rem; border-radius: 0 0 var(--r) 0;
}
.skip-link:focus { left: 0; }

/* --------------------------------------------------------------- layout */
.shell { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--margin); }
.shell-narrow { max-width: calc(var(--narrow) + var(--margin) * 2); }
main { display: block; padding-bottom: var(--s-4); }

/* ---------------------------------------------------------------- chips */
.chip {
  display: inline-flex; align-items: center; gap: 0.35em;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; line-height: 1;
  color: var(--secondary); background: var(--surface-container-high);
  padding: 0.42em 0.6em; border-radius: var(--r); text-decoration: none;
  white-space: nowrap;
}
a.chip:hover { background: var(--peach); color: var(--on-surface); }
.chip-solid { background: var(--primary); color: #fff; }
.chip-solid:hover { background: var(--primary); color: #fff; }
.chip-alert { background: var(--error); color: #fff; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-body); font-size: 15px; font-weight: 600; line-height: 1;
  padding: 0.75rem 1.25rem; border-radius: var(--r); border: 1px solid transparent;
  text-decoration: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.btn-sm { font-size: 13px; padding: 0.55rem 0.9rem; }
.btn-primary { background: var(--primary-container); color: #fff; }
.btn-primary:hover { background: var(--primary); color: #fff; }
.btn-primary:active { box-shadow: var(--shadow-press); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #2b2f33; color: #fff; }
.btn-ghost { background: transparent; color: var(--secondary); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--secondary); color: var(--secondary); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
}
.header-inner { display: flex; align-items: center; gap: var(--s-3); min-height: 68px; }

.wordmark { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--on-surface); white-space: nowrap; }
.site-header .wordmark { color: var(--header-fg); }
.wordmark-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: var(--r-md); background: var(--primary); color: #fff; flex: none;
}
.wordmark-mark svg { width: 18px; height: 18px; fill: currentColor; }
.wordmark-text { font-family: var(--font-head); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.wordmark-static { margin: 0; }

.primary-nav { margin-right: auto; }
.primary-nav ul { display: flex; gap: 1.75rem; list-style: none; margin: 0; padding: 0; }
.primary-nav a {
  font-family: var(--font-mono); font-size: 13px; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--header-muted); text-decoration: none; padding-block: 0.5rem;
  border-bottom: 2px solid transparent;
}
.primary-nav a:hover { color: var(--header-fg); }
.primary-nav a[aria-current="page"] { color: var(--header-hover); border-bottom-color: var(--header-hover); }

.header-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--r-full); border: 1px solid transparent; background: transparent;
  color: var(--header-fg); cursor: pointer; text-decoration: none; transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--header-hover); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.profile-btn { background: var(--primary-container); color: #fff; }
.profile-btn:hover { background: var(--primary); color: #fff; }

/* header search: icon that expands a field */
.search { position: relative; display: flex; align-items: center; }
.search-field {
  position: relative; width: 0; overflow: visible; opacity: 0; pointer-events: none;
  transition: width .2s ease, opacity .2s ease; margin-left: 0;
}
.search.is-open .search-field { width: 240px; opacity: 1; pointer-events: auto; margin-left: 0.4rem; }
.search-field input {
  width: 100%; font-family: var(--font-body); font-size: 14px; color: var(--on-surface);
  background: var(--surface-container-low); border: 1px solid var(--border-strong);
  border-radius: var(--r); padding: 0.5rem 2rem 0.5rem 0.7rem;
}
.search-field input:focus { outline: none; border-color: var(--primary-container); box-shadow: 0 0 0 3px rgba(253,123,65,0.2); background: #fff; }
.search-field kbd {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px; color: var(--on-surface-variant);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 0.1rem 0.3rem; pointer-events: none;
}
.search-field input:focus ~ kbd { opacity: 0; }
.search-panel {
  position: absolute; top: calc(100% + 0.5rem); right: 0; width: min(380px, 84vw);
  max-height: 60vh; overflow-y: auto; padding: 0.4rem;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lift);
}
.search-panel[hidden] { display: none; }
.search-result { display: block; padding: 0.55rem 0.6rem; border-radius: var(--r); text-decoration: none; color: var(--on-surface); }
.search-result:hover, .search-result.is-active { background: var(--surface-container); }
.search-result strong { display: block; font-family: var(--font-head); font-size: 14px; font-weight: 600; }
.search-result span { display: block; font-size: 12px; color: var(--on-surface-variant); }
.search-empty { padding: 0.7rem; font-size: 13px; color: var(--on-surface-variant); margin: 0; }

.nav-toggle { display: none; flex-direction: column; gap: 4px; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--header-fg); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ------------------------------------------------------------ home grid */
.home { padding-top: var(--s-3); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-4); align-items: start; }
.home-main { min-width: 0; }

/* -------------------------------------------------------- featured card */
.featured { margin-bottom: var(--s-3); }
.featured-media {
  position: relative; display: block; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--border);
}
.featured-media .thumb-img { width: 100%; height: auto; }
.featured-badges { position: absolute; left: 16px; bottom: 16px; display: flex; gap: 8px; }
.featured-body { padding-top: var(--s-2); }
.featured-title {
  font-family: var(--font-head); font-size: clamp(30px, 2.2vw + 18px, 48px); font-weight: 700;
  line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 0.5rem;
}
.featured-title a { color: inherit; text-decoration: none; }
.featured-title a:hover { color: var(--primary); }
.featured-dek { font-size: 18px; line-height: 1.55; color: var(--on-surface-variant); margin: 0 0 var(--s-2); max-width: 60ch; }

/* byline (shared: featured + article head) */
.byline { display: flex; align-items: center; gap: 0.7rem; }
.byline-avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-full); background: var(--surface-container-high); color: var(--secondary); flex: none; }
.byline-avatar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.byline-text { display: flex; flex-direction: column; }
.byline-author { font-weight: 600; font-size: 14px; color: var(--on-surface); }
.byline-meta { font-size: 12px; color: var(--on-surface-variant); }

/* --------------------------------------------------------- section head */
.section { margin-top: var(--s-3); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-2); }
.section-label {
  font-size: 13px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--on-surface-variant); margin: 0; padding-bottom: 0.6rem;
}
.section-label a { color: inherit; text-decoration: none; }
.section-head { border-bottom: 1px solid var(--border); }
.section-head .segmented { margin-bottom: 0.4rem; }
.section-title { font-family: var(--font-head); font-size: 32px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.section-sub { color: var(--on-surface-variant); margin: 0.35rem 0 0; }

.page-intro { padding: var(--s-3) 0; }

/* segmented sort control */
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r); overflow: hidden; }
.segmented button {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--secondary); background: #fff; border: 0; padding: 0.45rem 0.75rem; cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented button.is-active { background: var(--secondary); color: #fff; }

.empty-state { padding: var(--s-3); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); color: var(--on-surface-variant); }
.empty-state code { font-family: var(--font-mono); font-size: 13px; background: var(--surface-container); padding: 0.1rem 0.35rem; border-radius: var(--r-sm); }

/* ----------------------------------------------------------- story list */
.story-list { display: flex; flex-direction: column; }
.story { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--gutter); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.story:first-child { padding-top: var(--s-2); }
.story-media { display: block; align-self: start; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); }
.story-media .thumb-img { width: 100%; height: auto; }
.story-cat { margin: 0 0 0.4rem; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.story-cat a { color: var(--primary); text-decoration: none; font-weight: 500; }
.story-title { font-family: var(--font-head); font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 0.4rem; }
.story-title a { color: inherit; text-decoration: none; }
.story-title a:hover { color: var(--primary); }
.story-dek { color: var(--on-surface-variant); margin: 0 0 0.6rem; font-size: 15px; line-height: 1.5; }
.story-meta { font-size: 12px; color: var(--on-surface-variant); display: flex; gap: 0.5rem; }

/* ---------------------------------------------------------- home aside */
.side-panel { position: sticky; top: 88px; display: flex; flex-direction: column; gap: var(--s-3); }

/* article + sidebar layout (single posts) */
.post-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-4); align-items: start; }
.post-main { min-width: 0; }
.panel { background: var(--surface-container-lowest); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.panel-title {
  display: flex; align-items: center; gap: 0.5rem; margin: 0;
  font-family: var(--font-head); font-size: 16px; font-weight: 600;
  padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface-container-low);
}
.panel-icon { width: 18px; height: 18px; fill: var(--primary); }

.toplist-group { padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); }
.toplist-group:last-child { border-bottom: 0; }
.toplist-head { display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: var(--primary); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; margin-bottom: 0.7rem; }
.toplist-head svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toplist-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.toplist-items a { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 0.7rem; align-items: start; text-decoration: none; color: var(--on-surface); }
.toplist-thumb { display: block; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); }
.toplist-thumb .thumb-img { width: 100%; height: auto; }
.toplist-item-body { min-width: 0; }
.toplist-item-title { display: block; font-family: var(--font-head); font-size: 14px; font-weight: 600; line-height: 1.25; }
.toplist-items a:hover .toplist-item-title { color: var(--primary); }
.toplist-item-meta { display: block; font-size: 11px; color: var(--on-surface-variant); margin-top: 0.25rem; letter-spacing: 0.04em; }

/* --------------------------------------------------------- newsletter */
.newsletter-card { background: var(--primary-container); color: #fff; border-radius: var(--r-lg); padding: 1.25rem; }
.newsletter-eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; margin: 0 0 0.4rem; }
.newsletter-heading { font-family: var(--font-head); font-size: 22px; font-weight: 700; margin: 0 0 0.4rem; }
.newsletter-body { font-size: 14px; line-height: 1.5; margin: 0 0 1rem; opacity: 0.95; }
.newsletter-card .subscribe-form { display: flex; flex-direction: column; gap: 0.5rem; }
.newsletter-card .subscribe-input { width: 100%; }
.newsletter-card .subscribe-btn { width: 100%; background: var(--primary); color: #fff; }
.newsletter-card .subscribe-btn:hover { background: #7e2c00; }
.newsletter-note { font-size: 11px; opacity: 0.8; margin: 0.6rem 0 0; }
.newsletter-note code { background: rgba(255,255,255,0.2); padding: 0.05rem 0.3rem; border-radius: var(--r-sm); }

.subscribe-input {
  font-family: var(--font-body); font-size: 14px; color: var(--on-surface);
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--r); padding: 0.6rem 0.75rem;
}
.subscribe-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(253,123,65,0.25); }

/* ------------------------------------------------------- cards (grids) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gutter); }
.card { display: flex; flex-direction: column; background: var(--surface-container-lowest); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; transition: box-shadow .18s, transform .18s, border-color .18s; }
.card { border-top: 3px solid var(--border); }
.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); border-top-color: var(--peach); }
.card-media { display: block; border-bottom: 1px solid var(--border); }
.card-media .thumb-img { width: 100%; height: auto; }
.card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.card-eyebrow { margin: 0; }
.card-title { font-family: var(--font-head); font-size: 18px; font-weight: 700; line-height: 1.25; margin: 0; }
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { color: var(--primary); }
.card-dek { color: var(--on-surface-variant); font-size: 14px; line-height: 1.5; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin: auto 0 0; font-size: 12px; color: var(--on-surface-variant); display: flex; gap: 0.5rem; padding-top: 0.3rem; }

/* --------------------------------------------------------- pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px solid var(--border); }
.pagination-status { color: var(--on-surface-variant); font-size: 13px; }

/* ------------------------------------------------------------- article */
.article-head { padding-top: var(--s-4); }
.article-kicker { margin: 0 0 var(--s-2); display: flex; gap: 0.5rem; }
.article-title { font-family: var(--font-head); font-size: clamp(30px, 2vw + 20px, 48px); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 var(--s-2); }
.article-dek { font-family: var(--font-head); font-size: 20px; font-weight: 400; line-height: 1.4; color: var(--on-surface-variant); margin: 0 0 var(--s-2); }
.article-head .byline { padding-bottom: var(--s-2); border-bottom: 1px solid var(--border); }

.article-hero { margin: var(--s-3) 0 0; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); }
.article-hero .thumb-img { width: 100%; height: auto; }
.article-hero figcaption { font-size: 12px; color: var(--on-surface-variant); padding: 0.6rem 0.8rem; background: var(--surface-container-low); }

.article-layout { padding-top: var(--s-3); padding-bottom: var(--s-3); }
/* summary callout — replaces the old table of contents */
.summary {
  background: var(--surface-container-low);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary-container);
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
  margin-bottom: var(--s-3);
}
.summary-label { margin: 0 0 0.4rem; font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--primary); }
.summary-text { margin: 0; font-size: 16px; line-height: 1.6; color: var(--on-surface-variant); }

/* -------------------------------------------------------------- prose */
.prose { font-size: 18px; line-height: 1.7; color: var(--on-surface); }
.prose > * + * { margin-top: 1.4rem; }
.prose h2, .prose h3, .prose h4 { font-family: var(--font-head); letter-spacing: -0.01em; line-height: 1.25; scroll-margin-top: 92px; }
.prose h2 { font-size: 28px; font-weight: 700; margin-top: 2.6rem; }
.prose h3 { font-size: 22px; font-weight: 700; margin-top: 2rem; }
.prose h4 { font-size: 18px; font-weight: 600; }
.heading-anchor { margin-left: 0.4rem; color: var(--outline); text-decoration: none; opacity: 0; font-weight: 400; }
.prose h2:hover .heading-anchor, .prose h3:hover .heading-anchor, .heading-anchor:focus { opacity: 1; }
.prose a { color: var(--primary); text-decoration: underline; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.4rem; }
.prose li::marker { color: var(--primary); }
.prose blockquote { margin: 0; padding: 0.4rem 0 0.4rem 1.2rem; border-left: 3px solid var(--primary-container); color: var(--on-surface-variant); font-size: 19px; }
.prose img { border-radius: var(--r-lg); border: 1px solid var(--border); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-3) 0; }
.prose code { font-family: var(--font-mono); font-size: 0.86em; background: var(--surface-container); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0.1em 0.35em; }
.prose pre { background: #1d2430; color: #e8eaed; border-radius: var(--r-lg); padding: 1.1rem 1.3rem; overflow-x: auto; font-size: 14px; }
.prose pre code { background: none; border: 0; padding: 0; font-size: 13.5px; line-height: 1.6; color: inherit; }
.prose mark { background: var(--peach); padding: 0.05em 0.25em; border-radius: var(--r-sm); }

/* financial data tables (design spec: dark header, zebra rows, mono figures) */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose thead { background: var(--secondary); }
.prose th { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: #fff; text-align: left; padding: 0.7rem 0.9rem; }
.prose td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-dim) 40%, transparent); }
.prose tbody tr:last-child td { border-bottom: 0; }

.article-tags { margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.article-tags-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-surface-variant); }

/* article prev/next */
.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); padding-bottom: var(--s-3); }
.article-nav-item { display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--r-lg); text-decoration: none; color: inherit; background: var(--surface-container-lowest); transition: box-shadow .15s, border-color .15s; }
.article-nav-item:hover { box-shadow: var(--shadow-lift); border-color: var(--peach); }
.article-nav-next { text-align: right; }
.article-nav-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-surface-variant); }
.article-nav-title { font-family: var(--font-head); font-weight: 600; line-height: 1.25; }

.related { margin-top: var(--s-4); }

/* ------------------------------------------------------- listing pages */
.listing-head { padding: var(--s-4) 0 var(--s-2); border-bottom: 1px solid var(--border); margin-bottom: var(--s-3); }
.listing-head .section-label { padding-bottom: 0; }
.listing-title { font-family: var(--font-head); font-size: 40px; font-weight: 700; letter-spacing: -0.02em; margin: 0.4rem 0 0.3rem; }
.listing-sub { color: var(--on-surface-variant); margin: 0; }
.listing-head .segmented { margin-top: var(--s-2); }

.term-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--gutter); }
.term-card { display: flex; flex-direction: column; gap: 0.3rem; padding: 1.1rem 1.2rem; border: 1px solid var(--border); border-top: 3px solid var(--border); border-radius: var(--r-lg); text-decoration: none; color: inherit; background: var(--surface-container-lowest); transition: box-shadow .15s, border-color .15s; }
.term-card:hover { box-shadow: var(--shadow-lift); border-top-color: var(--peach); }
.term-name { font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.term-count { font-size: 12px; color: var(--on-surface-variant); letter-spacing: 0.04em; }

/* archive */
.archive-year + .archive-year { margin-top: var(--s-3); }
.archive-year-title { font-family: var(--font-head); font-size: 24px; font-weight: 700; display: flex; align-items: baseline; gap: 0.6rem; margin: 0 0 var(--s-1); padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); scroll-margin-top: 92px; }
.archive-year-count { font-size: 13px; color: var(--on-surface-variant); border: 1px solid var(--border-strong); border-radius: var(--r-full); padding: 0.1rem 0.5rem; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-row { display: grid; grid-template-columns: 4rem auto 1fr auto; align-items: center; gap: 0.9rem; padding: 0.6rem 0.3rem; border-radius: var(--r); }
.archive-row:hover { background: var(--surface-container-low); }
.archive-date, .archive-time { font-size: 12px; color: var(--on-surface-variant); letter-spacing: 0.04em; }
.archive-title { font-weight: 500; color: var(--on-surface); text-decoration: none; }
.archive-row:hover .archive-title { color: var(--primary); }
.year-jump { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: var(--s-2); }
.year-jump a { font-size: 13px; color: var(--on-surface-variant); text-decoration: none; border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 0.2rem 0.5rem; }
.year-jump a:hover { color: var(--primary); border-color: var(--primary); }

/* 404 */
.notfound { text-align: center; padding-block: var(--s-4); }
.notfound-title { font-family: var(--font-head); font-size: clamp(30px, 4vw, 48px); font-weight: 700; letter-spacing: -0.02em; margin: 0.4rem 0; }
.notfound-sub { color: var(--on-surface-variant); max-width: 48ch; margin: 0 auto var(--s-2); }
.notfound-actions { display: flex; gap: 0.75rem; justify-content: center; }

/* --------------------------------------------------------------- footer */
.site-footer { margin-top: var(--s-4); background: var(--surface-container); border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--s-3); padding-block: var(--s-4) var(--s-3); }
.footer-brand .wordmark-text { font-size: 18px; }
.footer-blurb { color: var(--on-surface-variant); font-size: 14px; max-width: 40ch; margin: var(--s-2) 0 0; }
.footer-social { display: flex; gap: 1rem; list-style: none; margin: var(--s-2) 0 0; padding: 0; font-size: 14px; flex-wrap: wrap; }
.footer-social a { color: var(--secondary); text-decoration: none; }
.footer-social a:hover { color: var(--primary); }
.footer-col-title { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-surface-variant); margin: 0 0 var(--s-2); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.footer-col a { color: var(--on-surface); text-decoration: none; font-size: 14px; }
.footer-col a:hover { color: var(--primary); }
.footer-base { padding-block: var(--s-2); border-top: 1px solid var(--border); }
.footer-base p { margin: 0; font-size: 12px; color: var(--on-surface-variant); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1024px) {
  .home-grid, .post-grid { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}

@media (max-width: 860px) {
  :root { --margin: 24px; }
  .primary-nav {
    position: absolute; top: 100%; left: 0; right: 0; display: none;
    background: var(--header-bg); border-bottom: 1px solid var(--header-border);
    padding: var(--s-2) var(--margin);
  }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 0.25rem; }
  .primary-nav a { display: block; padding: 0.6rem 0; border-bottom: 0; }
  .primary-nav a[aria-current="page"] { border-bottom: 0; }
  .nav-toggle { display: inline-flex; }
  .header-inner { min-height: 60px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  :root { --margin: 16px; }
  .search.is-open .search-field { width: 160px; }
  .story { grid-template-columns: 110px minmax(0, 1fr); gap: var(--s-2); }
  .story-title { font-size: 18px; }
  .story-dek { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .archive-row { grid-template-columns: 3.5rem 1fr; row-gap: 0.2rem; }
  .archive-chip { grid-column: 1; }
  .archive-title { grid-column: 2; }
  .archive-time { display: none; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav-next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media print {
  .site-header, .site-footer, .segmented, .article-nav, .related, .skip-link, .side-panel { display: none !important; }
  body { background: #fff; }
  .prose { font-size: 12pt; }
}
