@font-face {
  font-family: 'Spectral';
  src: url('../fonts/spectral-400.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Spectral';
  src: url('../fonts/spectral-700.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Spectral';
  src: url('../fonts/spectral-400-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
/* Public Sans and JetBrains Mono ship as variable fonts: one file each, with
   the weight axis declared as a range so the browser instantiates the real
   weight instead of falling back to the default instance. */
@font-face {
  font-family: 'Public Sans';
  src: url('../fonts/public-sans.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
}

/* ============================================================
   AINAPTIC — Hi-fi production styles
   Design tokens + base + components. Mobile-first responsive.
   ------------------------------------------------------------
   Color modes via [data-mode] on <html>. Five modes:
   - light (default)  - hyper-light  - sepia  - dark  - onyx
   Theme accents are hardcoded to the Editor signature palette:
   persimmon (primary) + butter gold (secondary, Editor's Picks).
   ============================================================ */

:root {
  /* Type stack — Spectral (heads) + Public Sans (body) + JetBrains Mono */
  --font-head: 'Spectral', 'Source Serif 4', Georgia, serif;
  --font-body: 'Public Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Type scale (mobile defaults) */
  --fs-xs: 11px;    /* meta, tags */
  --fs-sm: 13px;    /* small body, captions */
  --fs-base: 15px;  /* body */
  --fs-md: 17px;    /* large body, lead */
  --fs-lg: 21px;    /* card titles */
  --fs-xl: clamp(28px, 2.5vw, 36px);  /* section / H2 — fluid like the page H1s */
  --fs-2xl: 36px;   /* H2 / hero mobile */
  --fs-3xl: 56px;   /* feature headline desktop */
  --fs-4xl: 72px;   /* category page H1 */

  /* Spacing */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px;  --s-4: 16px;
  --s-5: 20px; --s-6: 28px; --s-7: 40px;  --s-8: 56px;
  --s-9: 80px;

  /* Radius */
  --r-0: 0;     --r-sm: 3px;   --r-md: 6px;
  --r-lg: 10px; --r-pill: 999px;

  /* Transitions */
  --t-fast: 120ms cubic-bezier(.2,.7,.3,1);
  --t-base: 180ms cubic-bezier(.2,.7,.3,1);
  --t-slow: 320ms cubic-bezier(.2,.7,.3,1);

  /* Layout */
  --container: 1280px;
  --container-narrow: 760px;

  /* Accents (Editor signature) */
  --accent: #b93600;                    /* accessible persimmon */
  --accent-ink: #fff;
  --accent-soft: oklch(0.96 0.05 38);
  --accent-2: oklch(0.78 0.14 85);     /* butter gold */
  --accent-2-ink: #1c1820;
  --warn: oklch(0.65 0.18 28);
  --live: oklch(0.62 0.20 28);
}

/* ============================================================
   COLOR MODES — applied to <html data-mode="...">
   Scoped to :root so descendants carrying data-mode (the mode
   picker buttons) cannot redeclare the palette locally.
   ============================================================ */

:root, :root[data-mode="light"] {
  --paper:   #f6f4f1;
  --paper-2: #ecebe6;
  --paper-3: #dcdad3;
  --paper-4: #c9c6bc;
  --ink:     #1c1820;
  --ink-2:   #37323e;
  --ink-3:   #6a6470;
  --ink-4:   #a59faa;
  --shadow-sm: 0 1px 2px rgba(28, 24, 32, 0.04);
  --shadow-md: 0 4px 12px rgba(28, 24, 32, 0.06);
  --shadow-lg: 0 12px 32px rgba(28, 24, 32, 0.08);
}

:root[data-mode="hyperlight"] {
  --paper:   #fcfcfb;
  --paper-2: #f3f3f1;
  --paper-3: #e6e6e3;
  --paper-4: #d2d2cf;
  --ink:     #0a0a0c;
  --ink-2:   #2a2a2e;
  --ink-3:   #62626a;
  --ink-4:   #a5a5ac;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
}

:root[data-mode="sepia"] {
  --paper:   #f1e6cf;
  --paper-2: #e7dac0;
  --paper-3: #d3c4a3;
  --paper-4: #b9a982;
  --ink:     #3a2418;
  --ink-2:   #56392b;
  --ink-3:   #7d6451;
  --ink-4:   #a89a85;
  --shadow-sm: 0 1px 2px rgba(58, 36, 24, 0.06);
  --shadow-md: 0 4px 12px rgba(58, 36, 24, 0.10);
  --shadow-lg: 0 12px 32px rgba(58, 36, 24, 0.12);
}

:root[data-mode="dark"] {
  --paper:   #161020;
  --paper-2: #1f1828;
  --paper-3: #2b2335;
  --paper-4: #3d3447;
  --ink:     #ebe5d7;
  --ink-2:   #c4bfb2;
  --ink-3:   #8a857a;
  --ink-4:   #5a564f;
  --accent: #ff7b40;
  --accent-ink: #161020;
  --accent-soft: #3a1f1a;
  --accent-2-ink: #ebe5d7;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

:root[data-mode="onyx"] {
  --paper:   #000000;
  --paper-2: #0d0d0d;
  --paper-3: #1c1c1c;
  --paper-4: #2e2e2e;
  --ink:     #ffffff;
  --ink-2:   #cccccc;
  --ink-3:   #999999;
  --ink-4:   #555555;
  --accent: #ff7b40;
  --accent-ink: #000000;
  --accent-soft: #26130d;
  --accent-2-ink: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.8);
}

/* ============================================================
   RESET + BASE
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--t-base), color var(--t-base);
}

img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: 0; padding: 0; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }

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

/* ============================================================
   TYPOGRAPHY — heading components
   ============================================================ */

.h-display, .h-1, .h-2, .h-3, .h-4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.022em;
  color: var(--ink);
}
.h-display { font-size: var(--fs-2xl); }       /* mobile */
.h-1       { font-size: var(--fs-2xl); }
.h-2       { font-size: var(--fs-xl); line-height: 1.1; }
.h-3       { font-size: var(--fs-lg); line-height: 1.15; font-weight: 600; }
.h-4       { font-size: var(--fs-md); line-height: 1.2; font-weight: 600; letter-spacing: -0.012em; }

.lede {
  font-family: var(--font-head);
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--ink-2);
  font-weight: 400;
}

.meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.meta--accent { color: var(--accent); font-weight: 600; }
.meta--ink { color: var(--ink); }

.muted { color: var(--ink-3); }

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--s-4);
  padding-right: var(--s-4);
}
.container-narrow {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding-left: var(--s-4);
  padding-right: var(--s-4);
}

.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-6); }
.stack-xl > * + * { margin-top: var(--s-7); }

.row { display: flex; align-items: center; gap: var(--s-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.flex-grow { flex: 1; }

/* ============================================================
   COMPONENTS — Header / Nav
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  backdrop-filter: saturate(1.1);
  transition: background var(--t-base);
}
.nav {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  padding: 12px var(--s-4);
  max-width: 1440px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.brand-mark {
  width: 22px;
  height: 22px;
  background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 60% 100%, 0 100%);
  position: relative;
  transition: background var(--t-base);
}
.brand-mark::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
.brand-name {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.primary-nav {
  display: none;  /* mobile-first: hide, show on desktop */
  flex: 1;
  justify-content: center;
  gap: var(--s-5);
}
.primary-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.primary-nav a:hover { color: var(--ink); }
.primary-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.nav-actions { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }

.search-pill {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  font-size: 13px;
  color: var(--ink-3);
  min-width: 220px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.search-pill:hover { background: var(--paper-3); }
.search-pill .icon { font-family: var(--font-mono); font-size: 13px; }

.mode-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--paper-3);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.mode-toggle:hover { background: var(--paper-2); border-color: var(--ink-3); }

.icon-btn {
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--paper-3);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.icon-btn:hover { background: var(--paper-2); border-color: var(--ink-3); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-ghost {
  background: transparent;
  border-color: var(--paper-3);
}
.btn-ghost:hover { background: var(--paper-2); }

/* Mobile menu toggle */
.menu-toggle { display: inline-flex; }
@media (min-width: 1080px) { .menu-toggle { display: none; } }

/* ============================================================
   COMPONENTS — Tags
   ============================================================ */

.tag {
  display: inline-block;
  padding: 3px 9px;
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.tag--accent { background: var(--accent); color: var(--accent-ink); }
.tag--accent2 { background: var(--accent-2); color: var(--accent-2-ink); }
.tag--ghost { background: transparent; border: 1px solid var(--ink-3); }
.tag--live::before {
  content: '●';
  color: var(--live);
  margin-right: 4px;
  animation: pulse 1.2s infinite;
}
.tag--sm { font-size: 9px; padding: 2px 7px; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--paper-3); flex-shrink: 0;
  object-fit: cover;
}
.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 56px; height: 56px; }

@keyframes pulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.3; }
}

/* ============================================================
   COMPONENTS — Cards, articles, feeds
   ============================================================ */

/* 2-col responsive grid used by AI/ML block */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
}
@media (min-width: 768px) { .grid-2col { grid-template-columns: repeat(2, 1fr); gap: var(--s-7); } }

.card {
  background: var(--paper);
  border: 1px solid var(--paper-3);
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.card:hover { border-color: var(--ink); }
.card-inner { padding: var(--s-5); }
.card-img { aspect-ratio: 16/9; object-fit: cover; width: 100%; display: block; }

/* Article card (used in grids) */
.article-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.article-card-image {
  aspect-ratio: 16/9;
  object-fit: cover;
  width: 100%;
  background: var(--paper-2);
  transition: transform var(--t-base);
}
.article-card:hover .article-card-image { transform: scale(1.02); }
.article-card-title {
  font-family: var(--font-head);
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.012em;
}
.article-card a { display: block; }
.article-card a:hover .article-card-title { color: var(--accent); }
.article-card-meta-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* List item (side rails) */
.list-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--paper-3);
}
.list-item:last-child { border-bottom: 0; }
.list-item-image {
  aspect-ratio: 4/3;
  object-fit: cover;
  width: 100%;
  background: var(--paper-2);
}
.list-item-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

/* Numbered list item */
.numbered-list { display: flex; flex-direction: column; }
.numbered-list-item {
  display: grid;
  grid-template-columns: auto 80px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--paper-3);
}
.numbered-list-item:last-child { border-bottom: 0; }
.numbered-numeral {
  font-family: var(--font-head);
  font-size: 38px;
  font-weight: 800;
  line-height: 0.85;
  color: var(--accent);
  letter-spacing: -0.04em;
  font-variant-numeric: lining-nums;
}

/* ============================================================
   COMPONENTS — Section heading w/ big numeral
   ============================================================ */

.section-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: var(--s-6);
}
.section-numeral {
  font-family: var(--font-head);
  font-size: clamp(38px, 3.4vw, 52px);
  font-weight: 800;
  color: var(--accent);
  line-height: 0.85;
  letter-spacing: -0.04em;
}
.section-title {
  font-family: var(--font-head);
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.section-sub {
  font-size: clamp(13px, 1.05vw, 15px);
  color: var(--ink-2);
  margin-top: 6px;
  max-width: 72ch;
}
.section-link {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  display: none;
}
@media (min-width: 768px) {
  .section-link { display: inline; }
}

.block { padding: var(--s-7) 0; }

/* Issue stripe (masthead-ish) */
.issue-stripe {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  padding: 6px var(--s-4);
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-2);
  max-width: 1440px;
  margin: 0 auto;
}
.issue-stripe span:not(:first-child) { display: none; }
.issue-stripe span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 640px) {
  .issue-stripe span:not(:first-child) { display: inline; }
}

/* ============================================================
   COMPONENTS — Newsletter, Footer
   ============================================================ */

.newsletter-block {
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  padding: var(--s-7) var(--s-4);
  max-width: 760px;
  margin: var(--s-7) auto;
  border-radius: var(--r-md);
}
.newsletter-title {
  font-family: var(--font-head);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  color: var(--paper);
  margin: 10px 0 12px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.newsletter-text {
  font-size: 15px;
  color: var(--paper-3);
  line-height: 1.5;
  max-width: 460px;
  margin: 0 auto 24px;
}
.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
}
@media (min-width: 480px) {
  .newsletter-form { flex-direction: row; }
}
.newsletter-input {
  flex: 1;
  padding: 11px 16px;
  background: var(--paper-2);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  border: 0;
  outline: 0;
}
.newsletter-input:focus { box-shadow: 0 0 0 2px var(--accent); }
/* Both newsletter forms sit on an inked panel that inverts in dark modes, so
   the notice tracks --paper rather than an accent that would lose contrast. */
.newsletter-notice {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--paper);
}
.newsletter-notice--ok { font-weight: 600; }

.newsletter-foot {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--paper-4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.site-footer {
  background: var(--ink);
  color: var(--paper-3);
  padding: var(--s-7) var(--s-4) var(--s-5);
  margin-top: var(--s-7);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
  max-width: var(--container);
  margin: 0 auto;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1.4fr; gap: var(--s-7); }
}
.footer-brand .brand-name { color: var(--paper); }
.footer-brand .brand-mark { background: var(--paper); }
.footer-tag {
  font-size: 13px;
  line-height: 1.5;
  margin-top: 12px;
  max-width: 280px;
  color: var(--paper-3);
}
.footer-h {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--paper);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}
.footer-col ul { display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 13px; color: var(--paper-3); transition: color var(--t-fast); }
.footer-col a:hover { color: var(--paper); }
.footer-bottom {
  border-top: 1px solid var(--ink-3);
  margin-top: var(--s-6);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  color: var(--paper-4);
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 640px) {
  .footer-bottom { flex-direction: row; justify-content: space-between; align-items: center; }
}
.footer-bottom-links { display: flex; gap: 18px; }

/* ============================================================
   UTILITIES + responsive helpers
   ============================================================ */

.hide-mobile { display: none; }
@media (min-width: 1080px) {
  .hide-mobile { display: initial; }
  .hide-desktop { display: none !important; }
  .primary-nav { display: flex; }
  .search-pill { display: inline-flex; }
}

/* Scroll reveal — applied by JS via .is-visible */
.reveal { opacity: 1; transform: none; }
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--t-slow), transform var(--t-slow);
}
.js .reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Mode-toggle dropdown */
.mode-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--r-sm);
  padding: 6px;
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity var(--t-fast), transform var(--t-fast);
  z-index: 60;
}
.mode-menu[hidden] { display: none; }
.mode-menu.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.mode-menu-wrap { position: relative; }
.mode-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.mode-menu-item:hover { background: var(--paper-2); }
.mode-menu-item[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mode-swatch {
  display: inline-flex;
  width: 22px; height: 16px;
  border-radius: 3px;
  border: 1px solid var(--ink-3);
  overflow: hidden;
  flex-shrink: 0;
}
.mode-swatch span:first-child { flex: 1; }
.mode-swatch span:last-child  { width: 40%; }

/* Mobile drawer */
.mobile-drawer {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--t-base);
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px var(--s-4);
  border-bottom: 1px solid var(--ink);
}
.mobile-drawer nav {
  padding: var(--s-5) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.mobile-drawer nav a {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  padding: 8px 0;
  border-bottom: 1px solid var(--paper-3);
}

/* ============================================================
   ACCESSIBILITY, MOTION, FOCUS, PRINT  (shared, all pages)
   ============================================================ */

/* Visible keyboard focus — applies to links, buttons, inputs, cards */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 1px;
}
/* Don't show the ring on mouse-click for these (focus-visible handles it) */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
summary:focus:not(:focus-visible) { outline: none; }

/* Screen-reader-only utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip-to-content link — visible on focus */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 300;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  transform: translateY(-150%);
  transition: transform var(--t-fast);
}
.skip-link:focus { transform: translateY(0); }

/* Honour reduced-motion preference */
@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;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .tag--live::before, .day-badge::before { animation: none !important; }
}

/* Print: clean, ink-on-paper, drop chrome */
@media print {
  .site-header, .issue-stripe, .mobile-drawer, .site-footer,
  .read-progress, .repos-toolbar, .cat-filters, .tools-page-filter-bar,
  .copy-ai, .share-row, .newsletter-block, .skip-link, .reveal { box-shadow: none !important; }
  .site-header, .mobile-drawer, .read-progress, .copy-ai,
  .newsletter-block, .cat-newsletter-block, .skip-link { display: none !important; }
  html, body { background: #fff; color: #000; }
  .reveal { opacity: 1 !important; transform: none !important; }
  a { color: #000; text-decoration: underline; }
  .cmp-table-wrap, .repo-card, .pillar-card { break-inside: avoid; }
}

/* ============================================================
   TOOLS FILTER — real select controls + sort + empty state
   ============================================================ */
.filter--select {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.filter--select .filter-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.filter--select select {
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  padding: 2px 18px 2px 0;
  max-width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
}
#toolsSort button {
  font-size: 13px;
  color: var(--ink-3);
  padding: 2px 4px;
  transition: color var(--t-fast);
}
#toolsSort button:hover { color: var(--ink); }
#toolsSort button.active { color: var(--accent); font-weight: 600; }
.tools-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 16px;
  color: var(--ink-3);
  font-size: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
#toolsActiveTags [data-clear] { cursor: pointer; border: 0; font: inherit; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.cat-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
/* Empty states stay quiet — they must not inherit the desktop H2 step-up. */
.tools-empty .h-2,
.cat-empty .h-2 { font-size: 26px; }



/* ============================================================
   COPY-FOR-AI dropdown (shared component)
   ============================================================ */
.copy-ai { position: relative; display: inline-block; }
.copy-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-sm);
  background: var(--paper);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.copy-ai-btn:hover { background: var(--ink); color: var(--paper); }
.copy-ai-btn .cai-ico { font-family: var(--font-mono); font-size: 13px; }
.copy-ai-btn .cai-chev { font-family: var(--font-mono); font-size: 10px; transition: transform var(--t-fast); }
.copy-ai.open .copy-ai-btn .cai-chev { transform: rotate(180deg); }
.copy-ai.open .copy-ai-btn { background: var(--ink); color: var(--paper); }

.copy-ai-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 296px;
  max-width: 86vw;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.copy-ai-menu[hidden] { display: none; }
.copy-ai.open .copy-ai-menu { opacity: 1; pointer-events: auto; transform: translateY(0); }
.copy-ai-menu.align-left { right: auto; left: 0; }

.copy-ai-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border-radius: var(--r-sm);
  text-align: left;
  color: var(--ink);
  transition: background var(--t-fast);
}
.copy-ai-item:hover { background: var(--paper-2); }
.copy-ai-ico {
  width: 34px; height: 34px;
  border-radius: 7px;
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  flex-shrink: 0;
}
.copy-ai-item:hover .copy-ai-ico { background: var(--paper); border-color: var(--ink-3); }
.copy-ai-tt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.copy-ai-t {
  font-size: 13.5px;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.copy-ai-t .ext { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }
.copy-ai-d { font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.copy-ai-divider {
  height: 1px;
  background: var(--paper-3);
  margin: 6px 8px;
}
.copy-ai-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  padding: 8px 10px 6px;
}

/* tiny toast on copy */
.cai-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base), transform var(--t-base);
  z-index: 200;
}
.cai-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* WordPress shell integration */
.primary-nav-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-5);
  width: 100%;
}
.mobile-menu-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.search-pill--drawer {
  display: flex;
  width: calc(100% - (2 * var(--s-4)));
  min-width: 0;
  margin: var(--s-4);
}
.mode-toggle,
.icon-btn { position: relative; }
.mode-toggle::before,
.icon-btn::before {
  content: '';
  position: absolute;
  inset: -5px;
}
.newsletter-input { font-size: 16px; }
.footer-meta { margin-top: 18px; color: var(--paper-4); }
.footer-newsletter-form {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.footer-newsletter-form .newsletter-input { min-width: 0; padding: 8px 12px; }
.footer-socials {
  display: flex;
  gap: 14px;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.index-page { min-height: 50vh; }
.index-grid { margin-top: var(--s-6); }
.index-excerpt {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.5;
}
.navigation.pagination { margin-top: var(--s-7); }
.navigation.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}
.navigation.pagination .page-numbers {
  display: inline-flex;
  min-width: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--paper-3);
  padding: 6px 10px;
}
.navigation.pagination .current {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
@media screen and (max-width: 782px) {
  body.admin-bar .site-header { top: 46px; }
  body.admin-bar .mobile-drawer { top: 46px; }
}
@media screen and (min-width: 783px) {
  body.admin-bar .site-header { top: 32px; }
  body.admin-bar .mobile-drawer { top: 32px; }
}

/* WordPress content templates */
.feature-image-link { display: block; margin-top: 22px; }
.media-placeholder {
  display: block;
  background-color: var(--paper-2);
  background:
    linear-gradient(135deg, transparent 38%, color-mix(in oklch, var(--accent) 22%, transparent) 38% 62%, transparent 62%),
    var(--paper-2);
}
.article-card-media { overflow: hidden; }
.card-excerpt,
.archive-lead-excerpt {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}
.archive-lead-excerpt { font-size: 15px; }
.review-featured .h-2 { margin-top: 10px; }
.review-featured .h-2 a:hover,
.review-small-title a:hover,
.pillar-card-title a:hover { color: var(--accent); }
.article-taxonomy-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
}
.article-caption { display: block; margin-top: 6px; }
.prose h2.takeaways-title { margin: 0; font-size: 19px; line-height: 1.25; }
.author-bio-links { display: flex; gap: 8px; margin-top: 12px; }
.related-title { margin-top: 4px; }
.archive-byline { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.cat-count { padding: 0 0 12px; }
.video-title {
  margin-top: 8px;
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
}
.page-content { padding-top: var(--s-7); padding-bottom: var(--s-7); }
.page-prose { max-width: var(--container-narrow); margin: 0 auto; }

/* Branded not-found page */
.nf-wrap {
  min-height: 70dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s-7) var(--s-6);
  gap: var(--s-5);
}
.nf-mark {
  font-family: var(--font-head);
  font-size: clamp(96px, 22vw, 200px);
  font-weight: 700;
  line-height: .85;
  letter-spacing: -.04em;
}
.nf-mark span { color: var(--accent); }
.nf-eyebrow { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); font-weight: 600; }
.nf-title { max-width: 18ch; font-family: var(--font-head); font-size: clamp(24px, 4vw, 34px); font-weight: 700; letter-spacing: -.02em; }
.nf-sub { max-width: 46ch; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.nf-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.nf-brand { display: flex; align-items: center; gap: 8px; margin-top: var(--s-6); }
