/* ==========================================================================
   raybolouriblog.com - Editorial Idea Map
   Light-first editorial design system.
   Tokens per Final Website Build Pack, Sections 11 and 13.
   ========================================================================== */

/* ---- Tokens ---- */
:root {
  /* Color - light-first */
  --site-bg: #FAF8F4;          /* warm white / soft paper base */
  --site-surface: #FFFFFF;     /* card and module surface */
  --site-surface-elevated: #FFFFFF;
  --site-border: #E4DFD6;      /* thin editorial rules and card borders */
  --site-border-strong: #D3CCC0;
  --site-text: #1A1A17;        /* deep ink body and headlines */
  --site-text-muted: #6B6660;  /* graphite metadata */
  --site-primary: #1A1A17;     /* solid ink primary action */
  --site-primary-hover: #000000;
  --site-accent: #9A3B2E;      /* muted signal accent */
  --site-accent-soft: #F3E7E3; /* accent tint background */
  --site-accent-2: #3B5B6B;    /* second muted signal accent */
  --site-accent-2-soft: #E7EDF0;
  --site-focus-ring: #3B5B6B;
  --site-dark: #1E1D1A;        /* restrained dark accent zone */
  --site-dark-text: #F3EFE8;
  --site-dark-muted: #B4ADA2;

  /* Shape */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Elevation - minimal, prefer borders */
  --shadow-sm: 0 1px 2px rgba(26, 26, 23, 0.05);
  --shadow-md: 0 4px 12px rgba(26, 26, 23, 0.08);

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 48px;
  --space-xl: 96px;

  /* Fluid type */
  --fs-hero: clamp(2rem, 1.2rem + 3.2vw, 4.25rem);      /* 32 -> 68 */
  --fs-h2: clamp(1.5rem, 1.2rem + 1.2vw, 2.625rem);     /* 24 -> 42 */
  --fs-feature: clamp(1.75rem, 1.3rem + 1.6vw, 3.125rem);/* 28 -> 50 */
  --fs-card: clamp(1.125rem, 1.05rem + 0.3vw, 1.5rem);  /* 18 -> 24 */
  --fs-body: clamp(1.0625rem, 1.0rem + 0.2vw, 1.25rem); /* 17 -> 20 */
  --fs-meta: clamp(0.8125rem, 0.8rem + 0.1vw, 0.875rem);/* 13 -> 14 */

  /* Type families */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Reading measure */
  --measure: 68ch;
  --content-max: 1200px;
  --wide-max: 1360px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--site-bg);
  color: var(--site-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--site-text);
  line-height: 1.12;
  font-weight: 560;
  margin: 0;
  text-wrap: balance;
  letter-spacing: 0;
}

p { margin: 0 0 var(--space-sm); }

a { color: var(--site-text); text-decoration-color: var(--site-border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--site-accent); }

/* Focus */
:focus-visible {
  outline: 2px solid var(--site-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--site-text);
  color: #fff;
  padding: 12px 18px;
  z-index: 200;
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus { left: 0; }

/* ---- Layout helpers ---- */
.wrap { width: 100%; max-width: var(--content-max); margin-inline: auto; padding-inline: clamp(20px, 5vw, 56px); }
.wrap--wide { max-width: var(--wide-max); }
.wrap--reading { max-width: 760px; }

.section { padding-block: clamp(48px, 7vw, var(--space-xl)); }
.section--tight { padding-block: clamp(32px, 5vw, 64px); }
.section + .section { border-top: 1px solid var(--site-border); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--site-text-muted);
  margin: 0 0 var(--space-sm);
}

.section-head { margin-bottom: var(--space-lg); max-width: 62ch; }
.section-head h2 { font-size: var(--fs-h2); }
.section-head p { color: var(--site-text-muted); margin-top: var(--space-sm); }

.stack-sm > * + * { margin-top: var(--space-sm); }
.stack-md > * + * { margin-top: var(--space-md); }

/* ---- Buttons / CTAs ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.03em;
  line-height: 1;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--site-primary);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.btn--primary { background: var(--site-primary); color: #fff; }
.btn--primary:hover { background: var(--site-primary-hover); border-color: var(--site-primary-hover); }
.btn--outline { background: transparent; color: var(--site-text); }
.btn--outline:hover { background: var(--site-text); color: #fff; }
.btn:focus-visible { outline: 2px solid var(--site-focus-ring); outline-offset: 2px; }

/* Text-link CTA */
.tlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.03em;
  color: var(--site-text);
  text-decoration: none;
  border-bottom: 1px solid var(--site-border-strong);
  padding-bottom: 2px;
  min-height: 24px;
}
.tlink:hover { border-color: var(--site-accent); color: var(--site-accent); }
.tlink .arrow { transition: transform .18s ease; }
.tlink:hover .arrow { transform: translateX(3px); }

/* ---- Chips / metadata ---- */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  color: var(--site-text-muted);
  letter-spacing: 0.02em;
}
.meta-row .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--site-border-strong); }

.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.02em;
  color: var(--site-accent);
  background: var(--site-accent-soft);
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
}
a.topic-chip:hover { border-color: var(--site-accent); }

.flag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--site-text-muted);
  background: var(--site-bg);
  border: 1px dashed var(--site-border-strong);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Conceptual notice */
.notice {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  color: var(--site-text-muted);
  background: var(--site-accent-2-soft);
  border: 1px solid #d5dee2;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  line-height: 1.5;
}

/* ==========================================================================
   Header / navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--site-bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--site-border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 68px;
}
.brand {
  display: inline-flex;
  flex-direction: column;
  text-decoration: none;
  line-height: 1.05;
}
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--site-text); }
.brand__tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--site-text-muted); margin-top: 3px; }

.nav__links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.02em;
  color: var(--site-text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}
.nav__links a:hover { background: var(--site-surface); color: var(--site-accent); }
.nav__links a[aria-current="page"] { color: var(--site-accent); text-decoration: underline; text-decoration-color: var(--site-accent); }
.nav__links .nav__ext { color: var(--site-text-muted); }
.nav__links .nav__ext::after { content: " \2197"; }
/* Search lives in the header pill on desktop; the menu copy is for small screens */
.nav__links .nav__menu-only { display: none; }

.nav__actions { display: flex; align-items: center; gap: 10px; }
.nav__search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--site-border-strong);
  background: var(--site-surface);
  border-radius: 999px;
  padding: 0 6px 0 14px;
  min-height: 40px;
  color: var(--site-text-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  text-decoration: none;
}
.nav__search:hover { border-color: var(--site-accent); color: var(--site-accent); }
.nav__search .k { border: 1px solid var(--site-border); border-radius: 4px; padding: 2px 6px; font-size: 11px; }

.nav__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--site-border-strong);
  background: var(--site-surface);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.nav__toggle svg { width: 20px; height: 20px; }

/* ==========================================================================
   Hero / idea map (first screen)
   ========================================================================== */
.hero { position: relative; overflow: hidden; padding-block: clamp(40px, 6vw, 84px); }
.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  position: relative;
  z-index: 2;
}
.hero__intro { max-width: none; }
.hero__title { font-size: var(--fs-hero); font-weight: 540; }
.hero__title em { font-style: italic; color: var(--site-accent); }
.hero__premise { color: var(--site-text-muted); font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.3125rem); margin-top: var(--space-md); max-width: 48ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: var(--space-lg); }

/* Featured essay card in hero */
.feature-card {
  position: relative;
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 3vw, 36px);
  box-shadow: var(--shadow-md);
}
.feature-card__label {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--site-accent);
  margin-bottom: var(--space-sm);
  display: flex; align-items: center; gap: 10px;
}
.feature-card h2 { font-size: var(--fs-feature); margin-bottom: var(--space-sm); }
.feature-card__dek { color: var(--site-text-muted); margin-bottom: var(--space-md); }
.feature-card .meta-row { margin-bottom: var(--space-md); }
.feature-card__media {
  display: block;
  margin: calc(-1 * clamp(24px, 3vw, 36px)) calc(-1 * clamp(24px, 3vw, 36px)) var(--space-md);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: 1px solid var(--site-border);
  background: var(--site-accent-2-soft);
}
.feature-card__media img { width: 100%; height: 100%; object-fit: cover; }
.feature-card--loading { min-height: 420px; box-shadow: none; }

/* Idea-map connective lines + topic nodes */
.idea-map__lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.idea-map__lines line, .idea-map__lines path { stroke: var(--site-border-strong); stroke-width: 1; fill: none; }
.idea-map__nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: var(--space-lg);
  position: relative;
  z-index: 2;
}
.idea-map__nodes .eyebrow { width: 100%; margin-bottom: 4px; }

/* ==========================================================================
   Cards / article index entries
   ========================================================================== */
.card-grid { display: grid; gap: var(--space-md); }
.card-grid--3 { grid-template-columns: repeat(3, 1fr); }
.card-grid--2 { grid-template-columns: repeat(2, 1fr); }

.article-card {
  display: flex;
  flex-direction: column;
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
  height: 100%;
}
.article-card__media { display: block; aspect-ratio: 16 / 10; background: var(--site-accent-2-soft); border-bottom: 1px solid var(--site-border); }
.article-card__media img { width: 100%; height: 100%; object-fit: cover; }
.article-card__body { display: flex; flex-direction: column; flex: 1; padding: var(--space-md); }
.article-card .topic-chip { align-self: flex-start; margin-bottom: 14px; }
/* Articles in more than one category: chips side by side */
.article-card__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.article-card__chips .topic-chip { margin-bottom: 0; }
.article-card .meta-row { flex-wrap: nowrap; white-space: nowrap; }
.article-card:hover { border-color: var(--site-border-strong); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.article-card__title { font-size: var(--fs-card); margin-bottom: 10px; }
.article-card__title a { text-decoration: none; }
.article-card__title a::after { content: ""; position: absolute; inset: 0; }
.article-card { position: relative; }
.article-card__dek { color: var(--site-text-muted); font-size: 1rem; line-height: 1.55; margin-bottom: var(--space-md); flex: 1; }
.article-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; }

/* Topic pathway panels */
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.topic-panel {
  position: relative;
  display: block;
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-left: 3px solid var(--site-accent);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.topic-panel:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.topic-panel__name { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 8px; }
.topic-panel__desc { color: var(--site-text-muted); font-size: 0.98rem; line-height: 1.55; margin: 0 0 var(--space-md); }
.topic-panel__more { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-accent); }

/* Selected reading / thread */
.thread { display: grid; gap: var(--space-md); }
.thread__step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-md);
  align-items: start;
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-decoration: none;
  transition: border-color .18s ease;
}
.thread__step:hover { border-color: var(--site-accent); }
.thread__num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #fff;
  background: var(--site-text);
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.thread__title { display: block; font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 4px; }
.thread__meta { display: block; font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); }

/* ==========================================================================
   Search & archive access band
   ========================================================================== */
.discover {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}
.discover > * { min-width: 0; }
.searchbox {
  display: flex;
  gap: 10px;
  background: var(--site-surface);
  border: 1px solid var(--site-border-strong);
  border-radius: var(--radius-md);
  padding: 8px;
}
.searchbox:focus-within { outline: 2px solid var(--site-focus-ring); outline-offset: 2px; }
.searchbox label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--site-text);
  padding: 8px 12px;
  min-height: 44px;
}
.searchbox input:focus { outline: none; }

.archive-mini { display: grid; gap: 10px; }
.archive-mini__row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--site-border);
  text-decoration: none;
}
.archive-mini__row:hover .archive-mini__title { color: var(--site-accent); }
.archive-mini__date { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); white-space: nowrap; min-width: 6.5ch; }
.archive-mini__title { min-width: 0; font-family: var(--font-display); font-size: 1.05rem; }

/* ==========================================================================
   Author block (dark accent zone allowed here as footer-adjacent contrast)
   ========================================================================== */
.author {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-lg);
  align-items: center;
  background: var(--site-dark);
  color: var(--site-dark-text);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 4vw, 48px);
}
.author__portrait {
  width: 120px; height: 120px;
  border-radius: var(--radius-md);
  background: #2a2925;
  display: grid; place-items: center;
  color: var(--site-dark-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  padding: 8px;
  border: 1px solid #35332e;
}
.author h2 { color: var(--site-dark-text); font-size: var(--fs-h2); margin-bottom: var(--space-sm); }
.author p { color: var(--site-dark-muted); }
.author .btn--outline { color: var(--site-dark-text); border-color: var(--site-dark-muted); }
.author .btn--outline:hover { background: var(--site-dark-text); color: var(--site-dark); border-color: var(--site-dark-text); }
.author__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: var(--space-md); }
/* Light focus ring on dark blocks: the default blue ring is only 2.3:1 here */
.author :focus-visible, .diagram-panel :focus-visible { outline-color: var(--site-dark-text); }

/* ==========================================================================
   Article detail
   ========================================================================== */
.article-head { padding-block: clamp(32px, 5vw, 64px) var(--space-lg); border-bottom: 1px solid var(--site-border); }
.article-head h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3.25rem); margin-block: var(--space-sm); max-width: 20ch; }
.article-head__dek { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.375rem); color: var(--site-text-muted); max-width: 46ch; margin-bottom: var(--space-md); }
.prose { max-width: var(--measure); margin-inline: auto; }
.prose p, .prose ul, .prose ol, .prose blockquote { font-size: var(--fs-body); }
.prose h2 { font-size: clamp(1.4rem, 1.2rem + 0.9vw, 2rem); margin-top: var(--space-lg); margin-bottom: var(--space-sm); }
.prose h3 { font-size: 1.3rem; margin-top: var(--space-md); margin-bottom: 8px; }
.prose blockquote {
  margin: var(--space-md) 0;
  padding: 4px 0 4px var(--space-md);
  border-left: 3px solid var(--site-accent);
  font-style: italic;
  color: var(--site-text);
}
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 8px; }
.diagram-panel {
  background: var(--site-dark);
  color: var(--site-dark-text);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 36px);
  margin: var(--space-lg) 0;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
}
.diagram-panel .flag { color: var(--site-dark-muted); border-color: #3a382f; background: transparent; }
.diagram-cols { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-md); align-items: center; margin-top: var(--space-md); }
.diagram-cols .col { border: 1px solid #3a382f; border-radius: var(--radius-md); padding: var(--space-md); }
.diagram-cols .col h3 { color: var(--site-dark-text); font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 8px; }
.diagram-cols .col p { color: var(--site-dark-muted); font-family: var(--font-body); font-size: 0.95rem; margin: 0; }
.diagram-cols .arrow-mid { color: var(--site-accent); font-size: 1.5rem; text-align: center; }

/* Related reading */
.related { border-top: 1px solid var(--site-border); }

/* ==========================================================================
   Legal pages
   ========================================================================== */
.legal { padding-block: clamp(32px, 5vw, 64px); }
.legal h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3rem); margin-bottom: var(--space-sm); }
.legal .updated { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); margin-bottom: var(--space-lg); }
.legal h2 { font-size: 1.3rem; margin-top: var(--space-lg); margin-bottom: 8px; }
.legal p { max-width: var(--measure); }

/* ==========================================================================
   Search page
   ========================================================================== */
.search-hero { padding-block: clamp(32px, 5vw, 64px) var(--space-lg); }
.search-hero h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3rem); margin-bottom: var(--space-md); }
.search-results { display: grid; gap: var(--space-md); }
.result-count { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); margin-bottom: var(--space-md); }
.empty-state {
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
}
.empty-state h2 { font-size: 1.3rem; margin-bottom: var(--space-sm); }
.empty-state p { color: var(--site-text-muted); }
.empty-state__links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: var(--space-md); }

/* Archive full */
.year-group { margin-bottom: var(--space-lg); }
.year-group h2 { font-size: 1.6rem; padding-bottom: 8px; border-bottom: 2px solid var(--site-text); margin-bottom: var(--space-sm); }
.archive-row {
  display: grid;
  grid-template-columns: 8ch 1fr auto;
  gap: var(--space-md);
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--site-border);
  text-decoration: none;
}
.archive-row:hover .archive-row__title { color: var(--site-accent); }
.archive-row__date { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); }
.archive-row__title { font-family: var(--font-display); font-size: 1.15rem; }
.archive-row__topic { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); }

/* Page intro (secondary pages) */
.page-intro { padding-block: clamp(32px, 5vw, 64px) var(--space-lg); }
.page-intro h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3.25rem); margin-bottom: var(--space-md); }
.page-intro p { color: var(--site-text-muted); max-width: 52ch; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--site-surface); border-top: 1px solid var(--site-border); padding-block: var(--space-lg) var(--space-md); margin-top: var(--space-xl); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--space-lg); }
.footer-brand .brand__name { font-size: 1.3rem; }
.footer-brand p { color: var(--site-text-muted); font-size: 0.95rem; max-width: 32ch; margin-top: var(--space-sm); }
.footer-col h3 { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--site-text-muted); margin-bottom: var(--space-sm); font-weight: 400; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-col a { font-size: 0.98rem; color: var(--site-text); text-decoration: none; }
.footer-col a:hover { color: var(--site-accent); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  margin-top: var(--space-lg); padding-top: var(--space-md);
  border-top: 1px solid var(--site-border);
  font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted);
}
.footer-bottom a { color: var(--site-text-muted); text-decoration: none; }
.footer-bottom a:hover { color: var(--site-accent); }

/* ==========================================================================
   Article collection: shared helpers
   ========================================================================== */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.section--flush { padding-top: 0; }
.section-foot { margin-top: var(--space-lg); }
.footer-brand__name { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; }
.author__eyebrow { color: var(--site-dark-muted); }


/* Homepage: about-the-blog band + discover helpers */
.intro-band { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(24px, 4vw, 64px); align-items: start; }
.intro-band h2 { font-size: var(--fs-h2); }
.intro-band p { color: var(--site-text-muted); max-width: 60ch; }
.discover__title { font-size: var(--fs-h2); }
.discover__text { color: var(--site-text-muted); max-width: 44ch; margin-top: var(--space-sm); }
.discover__form { margin-top: var(--space-md); position: relative; }
.discover__count { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); margin-top: var(--space-sm); }
.discover__more { margin-top: var(--space-md); }
.archive-mini { margin-top: var(--space-sm); }
.archive-mini__empty { color: var(--site-text-muted); }

/* Gallery controls */
.gallery { padding-top: 0; }
.gallery-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: var(--space-sm);
  align-items: end;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-lg);
}
.gallery-controls .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gallery-controls .field[hidden] { display: none; }
.gallery-controls .field--search { grid-column: 1 / -1; }
.gallery-controls label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--site-text-muted);
}
.gallery-controls .searchbox label { position: absolute; }
.gallery-controls select {
  width: 100%;
  min-height: 44px;
  padding: 8px 34px 8px 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--site-text);
  background: var(--site-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236B6660' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 8px;
  border: 1px solid #A39B8E;
  border-radius: var(--radius-md);
  appearance: none;
  -webkit-appearance: none;
}
.gallery-controls .searchbox { border-color: #A39B8E; }
.gallery-controls .btn[disabled] { opacity: 0.45; cursor: default; }
.gallery-controls .btn[disabled]:hover { background: transparent; color: var(--site-text); }
#gallery-more { margin-inline: auto; display: flex; }
#gallery-more[hidden] { display: none; }
.gallery .section-foot { text-align: center; }

/* Topics: tag list */
.tag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: var(--fs-meta);
  color: var(--site-text); text-decoration: none;
  border: 1px solid var(--site-border-strong); border-radius: 999px;
  padding: 6px 14px; min-height: 36px; background: var(--site-surface);
}
.tag:hover { border-color: var(--site-accent); color: var(--site-accent); }
.tag__count { color: var(--site-text-muted); }

/* Archive */
.year-jump { list-style: none; margin: var(--space-md) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.year-jump a { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px; font-family: var(--font-mono); font-size: var(--fs-meta); border: 1px solid var(--site-border-strong); border-radius: 999px; text-decoration: none; }
.year-jump a:hover { border-color: var(--site-accent); color: var(--site-accent); }
.year-group { scroll-margin-top: 96px; }
.year-group__count { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); font-weight: 400; vertical-align: middle; }
.year-group__more { margin-top: var(--space-sm); }

/* Article reading page */
.breadcrumb ol { list-style: none; margin: 0 0 var(--space-md); padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--site-border-strong); }
.breadcrumb li[aria-current] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.breadcrumb a { color: var(--site-text-muted); }
.article-head__chips { margin-bottom: var(--space-sm); }
.article-hero { margin: var(--space-lg) 0 0; }
.article-hero img { width: 100%; height: auto; max-height: 640px; object-fit: cover; border-radius: var(--radius-lg); border: 1px solid var(--site-border); background: var(--site-accent-2-soft); }
.article-body { padding-top: var(--space-lg); }
.article-note { font-family: var(--font-mono); font-size: var(--fs-meta); line-height: 1.55; color: var(--site-text-muted); border-left: 3px solid var(--site-border-strong); padding: 4px 0 4px var(--space-sm); margin-bottom: var(--space-lg) !important; }
.prose a { color: var(--site-accent-2); text-decoration-color: currentColor; overflow-wrap: anywhere; }
.article-sources { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--site-border); }
.article-sources h2 { font-size: 1.3rem !important; margin-top: 0 !important; }
.article-sources li { font-size: 0.98rem; }
.article-tags ul { list-style: none; padding: 0 !important; margin: var(--space-lg) 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.article-tags li { margin: 0 !important; }
.article-back { margin-top: var(--space-lg); }

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Large tablet / iPad Pro (921-1279px): avoid squeeze */
@media (max-width: 1279px) {
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1023px) {
  .card-grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .hero__grid { grid-template-columns: 1fr; gap: var(--space-lg); }
  .hero__intro { max-width: none; }
  .idea-map__lines { display: none; }
  .discover { grid-template-columns: 1fr; }
  .gallery-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .intro-band { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-md) var(--space-lg); }
  .footer-brand { grid-column: 1 / -1; }
}

/* Tablet */
@media (max-width: 900px) {
  .nav__links, .nav__search { display: none; }
  .nav__toggle { display: inline-flex; }
  .nav.is-open .nav__links {
    display: flex;
    position: absolute;
    left: 0; right: 0; top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--site-surface);
    border-bottom: 1px solid var(--site-border);
    padding: var(--space-sm) clamp(20px, 5vw, 56px);
    box-shadow: var(--shadow-md);
  }
  .nav.is-open .nav__links .nav__menu-only { display: list-item; }
  .nav.is-open .nav__links a { min-height: 48px; padding: 12px; border-bottom: 1px solid var(--site-border); }
  .diagram-cols { grid-template-columns: 1fr; }
  .diagram-cols .arrow-mid { transform: rotate(90deg); }
  .author { grid-template-columns: 1fr; text-align: left; }
}

/* Mobile */
@media (max-width: 680px) {
  .card-grid--3, .card-grid--2, .topic-grid { grid-template-columns: 1fr; }
  .hero__actions { gap: 10px; }
  .hero__actions .btn { flex: 1 1 auto; justify-content: center; }
  .archive-row { grid-template-columns: 1fr; gap: 4px; }
  .archive-row__topic { justify-self: start; }
  .footer-grid { grid-template-columns: 1fr; }
  .gallery-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--space-sm); }
  .gallery-controls .field--action { grid-column: 1 / -1; }
  .gallery-controls .field--action .btn { width: 100%; justify-content: center; }
  .article-card .meta-row { white-space: normal; flex-wrap: wrap; }
  .thread__step { grid-template-columns: 1fr; }
  .thread__num { margin-bottom: 4px; }
}

/* Large desktop: keep hierarchy, prevent stretch */
@media (min-width: 1600px) {
  :root { --content-max: 1280px; --wide-max: 1440px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Print (legal pages) */
@media print {
  .site-header, .site-footer, .btn, .tlink { display: none !important; }
  body { background: #fff; }
}

/* ==========================================================================
   Homepage-first layout (simplified site)
   ========================================================================== */

/* Simple header: brand + two links at every width (no menu toggle) */
.nav--simple .nav__links { display: flex !important; position: static; flex-direction: row; gap: 4px; padding: 0; background: none; border: 0; box-shadow: none; }
.nav--simple .nav__links a { min-height: 44px; }

/* Compact hero */
.hero--compact { padding-block: clamp(32px, 5vw, 64px) clamp(20px, 3vw, 32px); }
.hero--compact .hero__title { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.5rem); max-width: 22ch; }
.hero--compact .hero__premise { margin-top: var(--space-sm); max-width: 62ch; }
.hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: var(--space-md) 0 0; font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--site-text-muted); }
.hero__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--site-border-strong); }

/* Gallery */
.gallery { padding-top: clamp(8px, 2vw, 16px); border-top: 0 !important; scroll-margin-top: 72px; }
.gallery-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-bottom: var(--space-sm); }
.gallery-bar__search { position: relative; padding: 4px 4px 4px 8px; }
.gallery-bar__search input { padding-right: 44px; }
.gallery-bar__search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.searchbox__clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; color: var(--site-text-muted); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.searchbox__clear:hover { background: var(--site-bg); color: var(--site-text); }
.searchbox__clear[hidden] { display: none; }
.gallery-bar__sort { display: flex; flex-direction: column; gap: 6px; }
.gallery-bar__sort label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--site-text-muted); }
.gallery-bar__sort select {
  min-height: 54px; min-width: 180px; padding: 8px 36px 8px 14px;
  font-family: var(--font-body); font-size: 1rem; color: var(--site-text);
  background: var(--site-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236B6660' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center / 12px 8px;
  border: 1px solid #A39B8E; border-radius: var(--radius-md); appearance: none; -webkit-appearance: none;
}
.gallery-bar .searchbox { border-color: #A39B8E; }

.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-md); }
.filter-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px;
  font-family: var(--font-mono); font-size: var(--fs-meta); letter-spacing: 0.02em;
  color: var(--site-text); background: var(--site-surface);
  border: 1px solid var(--site-border-strong); border-radius: 999px; cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}
.filter-pill:hover { border-color: var(--site-accent); color: var(--site-accent); }
.filter-pill[aria-pressed="true"] { background: var(--site-text); border-color: var(--site-text); color: #fff; }
.filter-pill__count { color: var(--site-text-muted); }
.filter-pill[aria-pressed="true"] .filter-pill__count { color: var(--site-dark-muted); }

.gallery-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: var(--space-md); min-height: 24px; }
.gallery-status .result-count { margin: 0; }
.gallery-status .tlink { background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; }
.gallery-status .tlink[hidden] { display: none; }
.gallery__more { text-align: center; }
.gallery__notice { grid-column: 1 / -1; }
.noscript-list { margin-top: var(--space-lg); columns: 2 320px; font-size: 1rem; }

/* Whole-card click target; empty-image fallback keeps the grid even */
.article-card:focus-within { border-color: var(--site-text); box-shadow: var(--shadow-sm); }
.article-card__title a:focus-visible { outline: none; }
.article-card__title a:focus-visible::after { outline: 2px solid var(--site-focus-ring); outline-offset: -2px; border-radius: var(--radius-md); }
.article-card__media--empty { display: grid; place-items: center; background: var(--site-accent-soft); }
.article-card__media--empty span { font-family: var(--font-display); font-size: 1.4rem; color: var(--site-accent); }

/* Minimal footer */
.site-footer--min { margin-top: var(--space-lg); padding-block: var(--space-md); }
.footer-min { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--space-md); }
.footer-min__brand { max-width: 52ch; }
.footer-min__brand .footer-brand__name { text-decoration: none; }
.footer-min__brand p { margin: 6px 0 0; color: var(--site-text-muted); font-size: 0.98rem; }
.footer-min__links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer-min__links a { display: inline-flex; align-items: center; min-height: 32px; font-size: 0.98rem; text-decoration: none; }
.footer-min__links a:hover { color: var(--site-accent); }
.site-footer--min .footer-bottom { margin-top: var(--space-md); }

@media (max-width: 680px) {
  .gallery-bar { grid-template-columns: 1fr; }
  .gallery-bar__sort { flex-direction: row; align-items: center; gap: 10px; }
  .gallery-bar__sort select { min-height: 44px; flex: 1; min-width: 0; }
  .filter-pills { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * clamp(20px, 5vw, 56px)); padding-inline: clamp(20px, 5vw, 56px); scrollbar-width: none; }
  .filter-pills::-webkit-scrollbar { display: none; }
  .filter-pill { flex: none; }
  .nav--simple .nav__links a { padding-inline: 8px; }
}

@media (max-width: 400px) {
  .nav--simple { gap: 8px; }
  .nav--simple .brand__tag { display: none; }
  .nav--simple .nav__links { gap: 0; }
  .nav--simple .nav__links a { padding-inline: 6px; font-size: 0.8rem; }
}
.filter-pills:empty { min-height: 40px; }
.gallery-status .result-count:empty::before { content: "\00a0"; }
.hero--compact .feature-card h2 { font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); }
.hero--compact .feature-card__media { aspect-ratio: 16 / 8; }
