.highlight-call {
  display: inline-block;
  background: color-mix(in srgb, var(--accent), white 22%);
  color: #07111d;
  font-weight: 700;
  padding: 2px 12px;
  border-radius: 999px;
  font-family: "Atkinson Hyperlegible", serif;
  letter-spacing: 0.01em;
  margin: 0 2px;
  box-shadow: 0 1px 6px 0 color-mix(in srgb, var(--accent), transparent 90%);
  border: 2px solid color-mix(in srgb, var(--accent), black 8%);
  transition:
    background 0.18s,
    color 0.18s;
}

body.light .highlight-call {
  background: color-mix(in srgb, var(--accent), black 14%);
  color: #fff;
  border-color: color-mix(in srgb, var(--accent), black 22%);
  box-shadow: 0 1px 8px 0 color-mix(in srgb, var(--accent), transparent 80%);
}
.pill--highlight {
  box-shadow:
    0 0 0 2px var(--accent),
    0 2px 8px 0 color-mix(in srgb, var(--accent), transparent 80%);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 78%);
  color: #07111d;
  font-weight: 700;
  transition:
    box-shadow 0.18s,
    border-color 0.18s,
    background 0.18s,
    color 0.18s;
}

/* Strategy-specific highlight colors for filter pills */
/* Improved contrast for strategy pills */
.pill--s1.pill--highlight {
  background: var(--s1);
  color: #fff;
  border: 2px solid var(--s1);
  box-shadow: 0 2px 12px 0 color-mix(in srgb, var(--s1), transparent 55%);
  font-weight: 700;
}
.pill--s2.pill--highlight {
  background: var(--s2);
  color: #fff;
  border: 2px solid var(--s2);
  box-shadow: 0 2px 12px 0 color-mix(in srgb, var(--s2), transparent 55%);
  font-weight: 700;
}
.pill--s3.pill--highlight {
  background: var(--s3);
  color: #fff;
  border: 2px solid var(--s3);
  box-shadow: 0 2px 12px 0 color-mix(in srgb, var(--s3), transparent 55%);
  font-weight: 700;
}
.pill--s4.pill--highlight {
  background: var(--s4);
  color: #fff;
  border: 2px solid var(--s4);
  box-shadow: 0 2px 12px 0 color-mix(in srgb, var(--s4), transparent 55%);
  font-weight: 700;
}
.pill--s5.pill--highlight {
  background: var(--s5);
  color: #fff;
  border: 2px solid var(--s5);
  box-shadow: 0 2px 12px 0 color-mix(in srgb, var(--s5), transparent 55%);
  font-weight: 700;
}

/* Dimmed state — non-selected pills when a filter is active */
.pill--dim {
  opacity: 0.22;
  filter: grayscale(0.65);
  transition:
    opacity 0.2s,
    filter 0.2s;
}

/* Selected pill in overlay: white ring + full saturation pop */
.paper-strats-overlay .pill.pill--highlight {
  outline: 2.5px solid rgba(255, 255, 255, 0.9);
  outline-offset: 1.5px;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.18),
    0 2px 10px rgba(0, 0, 0, 0.28);
  transform: scale(1.1);
  opacity: 1 !important;
  filter: none !important;
}

body.light .pill--highlight {
  /* per-strategy overrides (pill--s1 through pill--s5) handle specific colors;
   * this fallback should not apply accent color since accent ≠ any strategy */
  background: transparent;
  color: var(--ink);
}

.top__authors {
  margin: 8px 0 0 0;
  font-family: "Atkinson Hyperlegible", serif;
  font-size: 1.08rem;
  line-height: 1.35;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
/* ─── Design Tokens ─────────────────────────────────────────────────────────── */

:root {
  --bg: #100d0b; /* slightly deeper for stronger contrast headroom */
  --ink: #f7f1e6; /* brighter warm cream — higher contrast against bg */
  --ink-soft: #d8ccba; /* lifted warm tan — more readable */
  --ink-muted: #a8977f; /* lifted muted brown — readable at small sizes */
  --surface: rgba(255, 245, 230, 0.09); /* stronger card separation */
  --surface-strong: rgba(255, 245, 225, 0.17);
  --line: rgba(240, 235, 220, 0.18);
  --line-strong: rgba(240, 235, 220, 0.38);
  --radius: 14px;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.52), 0 1px 3px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 12px 44px rgba(0, 0, 0, 0.66);

  /* Warm brass/steel accent — still neutral UI chrome, but with warmth */
  --accent: #c4aa84; /* brighter brass — more legible on dark bg */

  /*
   * Five strategy colors — perceptually distinct, tested for common
   * colorblindness types (deuteranopia, protanopia, tritanopia).
   * Hues are spread across the wheel; no adjacent pair is red/green.
   * All reach ≥ 4.5:1 contrast ratio against --bg on dark, against
   * light surfaces in light mode.
   */
  --s1: #5ba8e5; /* blue        — Ensemble Use     */
  --s2: #4ec49a; /* teal-green  — Highlighting     */
  --s3: #f2bb4e; /* amber       — Text Descriptions */
  --s4: #b87ef5; /* purple      — Caption Coherence */
  --s5: #f07272; /* coral-red   — Numeric Emphasis  */

  /* On active filled chips: bright strategy colors need dark text in dark mode */
  --chip-active-fg: #0a0f16;
}

body.light {
  --bg: #f5ede0; /* richer, more saturated warm parchment */
  --ink: #1a1409; /* deeper warm near-black for maximum contrast */
  --ink-soft: #2e2418; /* deep warm umber */
  --ink-muted: #5a4830; /* richer mid-brown */
  --surface: rgba(255, 248, 234, 0.96);
  --surface-strong: #fff8ee;
  --line: rgba(60, 42, 18, 0.18);
  --line-strong: rgba(60, 42, 18, 0.36);
  --shadow: 0 2px 10px rgba(40, 24, 8, 0.14), 0 1px 3px rgba(40, 24, 8, 0.09);
  --shadow-lg: 0 10px 32px rgba(40, 24, 8, 0.2);
  --accent: #5a4018; /* darker warm brass — higher contrast on light bg */
  --s1: #1960a5;
  --s2: #1a6e4f;
  --s3: #8a5410;
  --s4: #5e2d9c;
  --s5: #9e2828;

  /* Light mode strategy colors are dark enough for white chip text */
  --chip-active-fg: #ffffff;
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Atkinson Hyperlegible", serif;
  font-size: 18px;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.72;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

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

.skip-link {
  position: absolute;
  left: 14px;
  top: -40px;
  z-index: 1200;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.skip-link:focus {
  top: 10px;
}

.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;
}

code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.875em;
  background: color-mix(in srgb, var(--accent), transparent 90%);
  border: 1px solid color-mix(in srgb, var(--accent), transparent 78%);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ─── Ambient Background ─────────────────────────────────────────────────────── */

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(
      800px 400px at -8% -12%,
      rgba(190, 130, 60, 0.12),
      transparent 60%
    ),
    radial-gradient(
      600px 300px at 108% 12%,
      rgba(200, 100, 60, 0.08),
      transparent 55%
    ),
    radial-gradient(
      700px 350px at 52% 108%,
      rgba(184, 126, 245, 0.07),
      transparent 58%
    );
}

.ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.1;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 5px,
    rgba(255, 240, 200, 0.05) 5px,
    rgba(255, 240, 200, 0.05) 6px
  );
}

body.light .ambient {
  background:
    radial-gradient(
      800px 400px at -8% -12%,
      rgba(180, 120, 40, 0.1),
      transparent 60%
    ),
    radial-gradient(
      600px 300px at 108% 12%,
      rgba(160, 100, 30, 0.07),
      transparent 55%
    ),
    radial-gradient(
      700px 350px at 52% 108%,
      rgba(200, 140, 60, 0.08),
      transparent 58%
    );
}

body.light .ambient::before {
  opacity: 0.07;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 5px,
    rgba(80, 50, 10, 0.05) 5px,
    rgba(80, 50, 10, 0.05) 6px
  );
}

/* ─── Header / Nav ───────────────────────────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 500;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
}

.top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--s1) 18%,
    var(--s2) 36%,
    var(--s3) 54%,
    var(--s4) 72%,
    var(--s5) 88%,
    transparent 100%
  );
  opacity: 0.7;
}

.top__inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 14px 24px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 20px;
  align-items: center;
}

.top__title h1 {
  margin: 0;
  font-family: "Crimson Text", serif;
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.top__venue {
  margin: 0 0 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.top__actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

/* Buttons */
.btn,
.icon-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  padding: 6px 14px;
  text-decoration: none;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
  white-space: nowrap;
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent), transparent 40%);
  background: var(--surface-strong);
}

.btn:focus-visible,
.icon-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.btn:active,
.icon-btn:active {
  transform: translateY(0);
  transition-duration: 0.08s;
}

/* Icon-only button (close button etc.) */
.btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  border-radius: 8px;
  line-height: 1;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

#drawerClose {
  position: absolute;
  top: 14px;
  right: 14px;
}

.btn--solid {
  background: var(--accent);
  color: #fff;
  border-color: color-mix(in srgb, var(--accent), black 15%);
}

.btn--solid:hover {
  background: color-mix(in srgb, var(--accent), black 12%);
  border-color: color-mix(in srgb, var(--accent), black 25%);
}

/* ─── Theme Toggle Switch ───────────────────────────────────────────────────── */

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}

.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 38%);
  background: var(--surface-strong);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.theme-toggle__track {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px;
}

.theme-toggle__thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.36);
}

body.light .theme-toggle__thumb {
  transform: translateX(20px);
}

.theme-ico {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.theme-ico--moon {
  fill: rgba(255, 255, 255, 0.92);
  stroke: none;
}

.theme-ico--sun {
  display: none;
}

body.light .theme-ico--moon {
  display: none;
}
body.light .theme-ico--sun {
  display: block;
}

/* Nav links */
.top__nav {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.top__nav a {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 10px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--ink);
  text-decoration: none;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}

.top__nav a:hover {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}

.top__nav a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.top__nav a.is-active {
  border-color: color-mix(in srgb, var(--accent), transparent 50%);
  background: color-mix(in srgb, var(--accent), transparent 90%);
  color: var(--accent);
}

/* ─── Page Layout ────────────────────────────────────────────────────────────── */

.page {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 24px 64px;
}

/* ─── Hero ───────────────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 28px 30px;
  box-shadow: var(--shadow-lg);
}

.hero__left p.sec-tag {
  margin-bottom: 10px;
}

.hero h2 {
  margin: 0 0 12px;
  font-family: "Atkinson Hyperlegible", serif;
  font-size: clamp(1.45rem, 2.8vw, 2.3rem);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero__left > p {
  margin: 0;
  color: var(--ink);
  max-width: 60ch;
  font-size: 1.03rem;
  line-height: 1.62;
  font-family: "Atkinson Hyperlegible", serif;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.stat {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 14px 14px;
}

.stat__n {
  font-family: "Atkinson Hyperlegible", serif;
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.stat__l {
  margin-top: 5px;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.35;
  font-family: "Atkinson Hyperlegible", serif;
}

/* ─── Sections ───────────────────────────────────────────────────────────────── */

.section {
  margin-top: 36px;
  scroll-margin-top: calc(var(--header-h, 148px) + 20px);
}

.sec-head {
  margin-bottom: 14px;
}

.sec-tag {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 64%);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 92%);
}

.sec-head h3 {
  margin: 0;
  font-family: "Crimson Text", serif;
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.sec-head p {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.58;
  max-width: 70ch;
  font-family: "Atkinson Hyperlegible", serif;
}

/* ─── Strategy Grid ──────────────────────────────────────────────────────────── */

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.strategy-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid transparent;
  border-radius: var(--radius);
  padding: 14px 13px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
  position: relative;
  transition:
    box-shadow 0.22s ease,
    transform 0.22s ease,
    border-color 0.22s ease;
}

.strategy-card:hover {
  box-shadow:
    var(--shadow-lg),
    0 0 0 1.5px color-mix(in srgb, var(--accent), transparent 58%);
  transform: translateY(-3px);
}

.strategy-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  transition-duration: 0.08s;
}

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

.strategy-card[data-sid="S1"] {
  border-top-color: var(--s1);
}
.strategy-card[data-sid="S2"] {
  border-top-color: var(--s2);
}
.strategy-card[data-sid="S3"] {
  border-top-color: var(--s3);
}
.strategy-card[data-sid="S4"] {
  border-top-color: var(--s4);
}
.strategy-card[data-sid="S5"] {
  border-top-color: var(--s5);
}

.strategy-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.strategy-id {
  display: inline-flex;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 9px;
}

/* Strategy ID badge colors match their respective strategy color */
.strategy-id--s1 {
  color: var(--s1);
  border-color: color-mix(in srgb, var(--s1), transparent 55%);
  background: color-mix(in srgb, var(--s1), transparent 90%);
}
.strategy-id--s2 {
  color: var(--s2);
  border-color: color-mix(in srgb, var(--s2), transparent 55%);
  background: color-mix(in srgb, var(--s2), transparent 90%);
}
.strategy-id--s3 {
  color: var(--s3);
  border-color: color-mix(in srgb, var(--s3), transparent 55%);
  background: color-mix(in srgb, var(--s3), transparent 90%);
}
.strategy-id--s4 {
  color: var(--s4);
  border-color: color-mix(in srgb, var(--s4), transparent 55%);
  background: color-mix(in srgb, var(--s4), transparent 90%);
}
.strategy-id--s5 {
  color: var(--s5);
  border-color: color-mix(in srgb, var(--s5), transparent 55%);
  background: color-mix(in srgb, var(--s5), transparent 90%);
}

.strategy-section {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.strategy-card h4 {
  margin: 0;
  font-family: "Atkinson Hyperlegible", serif;
  font-size: 1.1rem;
  line-height: 1.32;
  font-weight: 600;
}

.strategy-card p {
  margin: 0;
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.48;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* CTA label at the bottom of clickable cards — pill button style */
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.card-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 9px;
  background: transparent;
  pointer-events: none; /* parent card handles the click */
  white-space: nowrap;
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

/* Implication teaser — compact accent callout on strategy cards */
.card-implication {
  font-family: "Atkinson Hyperlegible", serif;
  font-size: 0.8rem;
  line-height: 1.42;
  color: var(--ink-muted);
  padding: 5px 9px 5px 10px;
  border-left: 2px solid color-mix(in srgb, var(--accent), transparent 52%);
  background: color-mix(in srgb, var(--accent), transparent 93%);
  border-radius: 0 5px 5px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.strategy-card:hover .card-cta,
.paper-card:hover .card-cta {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent), transparent 48%);
  background: color-mix(in srgb, var(--accent), transparent 91%);
}

/* Active card state — shown while its drawer is open */
.strategy-card.is-active,
.strategy-card.is-active:hover {
  transform: translateY(-3px);
}
.strategy-card[data-sid="S1"].is-active {
  box-shadow:
    var(--shadow-lg),
    0 0 0 2px var(--s1),
    0 0 18px 0 color-mix(in srgb, var(--s1), transparent 60%);
}
.strategy-card[data-sid="S2"].is-active {
  box-shadow:
    var(--shadow-lg),
    0 0 0 2px var(--s2),
    0 0 18px 0 color-mix(in srgb, var(--s2), transparent 60%);
}
.strategy-card[data-sid="S3"].is-active {
  box-shadow:
    var(--shadow-lg),
    0 0 0 2px var(--s3),
    0 0 18px 0 color-mix(in srgb, var(--s3), transparent 60%);
}
.strategy-card[data-sid="S4"].is-active {
  box-shadow:
    var(--shadow-lg),
    0 0 0 2px var(--s4),
    0 0 18px 0 color-mix(in srgb, var(--s4), transparent 60%);
}
.strategy-card[data-sid="S5"].is-active {
  box-shadow:
    var(--shadow-lg),
    0 0 0 2px var(--s5),
    0 0 18px 0 color-mix(in srgb, var(--s5), transparent 60%);
}
.paper-card.is-active,
.paper-card.is-active:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--shadow-lg),
    0 0 0 2px var(--accent),
    0 0 14px 0 color-mix(in srgb, var(--accent), transparent 66%);
}

/* ─── Filter Row ─────────────────────────────────────────────────────────────── */

.filter-wrap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--bg) 94%, white 6%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: sticky;
  top: var(--header-h, 148px);
  z-index: 40;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
}

.filter-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
}

.btn--compact {
  border-radius: 10px;
  padding: 5px 11px;
  font-size: 12px;
}

.btn:disabled,
.icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.filter-title {
  margin: 0 0 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 13px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  cursor: pointer;
  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent), transparent 40%);
  color: var(--ink);
  background: color-mix(in srgb, var(--accent), transparent 93%);
}

.chip:active {
  transform: translateY(0);
  transition-duration: 0.08s;
}

.chip:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Generic active state */
.chip.is-on {
  background: var(--accent);
  color: var(--chip-active-fg);
  border-color: var(--accent);
}

/* Per-strategy chip active states */
.chip[data-sid="S1"].is-on {
  background: var(--s1);
  border-color: var(--s1);
  color: var(--chip-active-fg);
}
.chip[data-sid="S2"].is-on {
  background: var(--s2);
  border-color: var(--s2);
  color: var(--chip-active-fg);
}
.chip[data-sid="S3"].is-on {
  background: var(--s3);
  border-color: var(--s3);
  color: var(--chip-active-fg);
}
.chip[data-sid="S4"].is-on {
  background: var(--s4);
  border-color: var(--s4);
  color: var(--chip-active-fg);
}
.chip[data-sid="S5"].is-on {
  background: var(--s5);
  border-color: var(--s5);
  color: var(--chip-active-fg);
}

.meta-line {
  margin: 0 0 14px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--ink-muted);
}

/* ─── Paper / Examples Grid ──────────────────────────────────────────────────── */

.paper-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.paper-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.paper-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.paper-card:hover {
  box-shadow:
    var(--shadow-lg),
    0 0 0 1.5px color-mix(in srgb, var(--accent), transparent 58%);
  transform: translateY(-3px);
}

.paper-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  transition-duration: 0.08s;
}

.paper-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.paper-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.32s ease;
}

.paper-card:hover .paper-thumb img {
  transform: scale(1.03);
}

.paper-figure-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(13, 17, 23, 0.82);
  color: #f0ede6;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Strategy pills overlay on paper card thumbnail */
.paper-strats-overlay {
  position: absolute;
  top: 7px;
  right: 7px;
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 60%;
}

.paper-strats-overlay .pill {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  color: #fff;
  border: 1.5px solid currentColor;
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: var(--s1); /* default fallback, overridden below */
}
.paper-strats-overlay .pill.pill--s1 {
  background: color-mix(in srgb, var(--s1), black 18%);
  border-color: var(--s1);
  color: #fff;
}
.paper-strats-overlay .pill.pill--s2 {
  background: color-mix(in srgb, var(--s2), black 18%);
  border-color: var(--s2);
  color: #fff;
}
.paper-strats-overlay .pill.pill--s3 {
  background: color-mix(in srgb, var(--s3), black 18%);
  border-color: var(--s3);
  color: #fff;
}
.paper-strats-overlay .pill.pill--s4 {
  background: color-mix(in srgb, var(--s4), black 18%);
  border-color: var(--s4);
  color: #fff;
}
.paper-strats-overlay .pill.pill--s5 {
  background: color-mix(in srgb, var(--s5), black 18%);
  border-color: var(--s5);
  color: #fff;
}

/* Dimmed (non-selected) pill — strong fade when a filter is active */
.pill--dim {
  opacity: 0.14;
  filter: grayscale(1) brightness(0.7);
  transition:
    opacity 0.2s,
    filter 0.2s;
}

/* Selected overlay pill: keep full color + white ring to pop */
.paper-strats-overlay .pill.pill--highlight {
  outline: 2.5px solid #fff;
  outline-offset: 1.5px;
  opacity: 1 !important;
  filter: none !important;
  transform: scale(1.12);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.18),
    0 2px 10px 0 rgba(0, 0, 0, 0.28);
}

.paper-body {
  padding: 16px 18px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.paper-title {
  margin: 0 0 4px;
  font-family: "Atkinson Hyperlegible", serif;
  font-size: 1.06rem;
  line-height: 1.38;
  font-weight: 600;
}

.paper-source {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--ink);
}

.paper-rationale {
  margin: 0 0 10px;
  font-size: 0.96rem;
  color: var(--ink);
  line-height: 1.46;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.paper-strats {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 0 8px;
}

/* ─── Strategy Pills ─────────────────────────────────────────────────────────── */

.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}

.pill--s1 {
  color: var(--s1);
  border-color: color-mix(in srgb, var(--s1), transparent 58%);
  background: color-mix(in srgb, var(--s1), transparent 91%);
}
.pill--s2 {
  color: var(--s2);
  border-color: color-mix(in srgb, var(--s2), transparent 58%);
  background: color-mix(in srgb, var(--s2), transparent 91%);
}
.pill--s3 {
  color: var(--s3);
  border-color: color-mix(in srgb, var(--s3), transparent 58%);
  background: color-mix(in srgb, var(--s3), transparent 91%);
}
.pill--s4 {
  color: var(--s4);
  border-color: color-mix(in srgb, var(--s4), transparent 58%);
  background: color-mix(in srgb, var(--s4), transparent 91%);
}
.pill--s5 {
  color: var(--s5);
  border-color: color-mix(in srgb, var(--s5), transparent 58%);
  background: color-mix(in srgb, var(--s5), transparent 91%);
}

.paper-open {
  margin-top: auto;
}

/* Remove paper-open button if still rendered (legacy) */

/* ─── Citation ───────────────────────────────────────────────────────────────── */

.citation-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.citation-text {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 1.06rem;
  line-height: 1.65;
}

.citation-text a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent), transparent 55%);
}

.citation-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.bibtex {
  margin: 0;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
  color: var(--ink-soft);
}

/* ─── Overlay & Drawer ───────────────────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 9, 18, 0.68);
  z-index: 900;
}

body.light .overlay {
  background: rgba(26, 34, 44, 0.44);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(1040px, 97vw);
  height: 100vh;
  z-index: 920;
  display: grid;
  grid-template-rows: auto 1fr;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, white 8%);
  box-shadow: -16px 0 56px rgba(0, 0, 0, 0.22);
}

.drawer__head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  position: relative; /* for absolute positioning of close button */
}

.drawer__head > div {
  flex: 1;
  min-width: 0;
}

.drawer__meta {
  margin: 0 0 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.drawer__head h4 {
  margin: 0;
  font-family: "Atkinson Hyperlegible", serif;
  font-size: clamp(1.25rem, 1.85vw, 1.62rem);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.drawer__body {
  overflow-y: auto;
  padding: 12px 18px 24px;
  scroll-behavior: smooth;
}

/* Drawer image */
.drawer-img {
  width: 100%;
  max-height: min(40vh, 380px);
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
  margin-bottom: 6px;
  cursor: zoom-in;
  transition: opacity 0.15s;
}

.drawer-img:hover {
  opacity: 0.9;
}

/* Zoomable image wrapper with hover hint */
.drawer-img-wrap {
  position: relative;
  display: block;
}

.drawer-img-wrap::after {
  content: "\2295\00A0 Enlarge";
  position: absolute;
  bottom: 14px;
  right: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}

.drawer-img-wrap:hover::after {
  opacity: 1;
}

/* ─── Image Lightbox ─────────────────────────────────────────────────────────── */

.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.img-lightbox__inner {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
}

.img-lightbox__inner img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  border-radius: 6px;
  object-fit: contain;
  cursor: default;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.img-lightbox__close {
  position: absolute;
  top: -14px;
  right: -14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.img-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.6);
}

.img-lightbox__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ─── Drawer Sections (new structured layout) ───────────────────────────────── */

.drawer-section {
  margin-top: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-left: 3px solid var(--line-strong);
  border-radius: 0;
}

.drawer-section:first-child {
  margin-top: 0;
}

.drawer-section--lead {
  background: transparent;
  border-color: color-mix(in srgb, var(--accent), transparent 60%);
  padding: 10px 12px;
  border-left-width: 3px;
  border-left-style: solid;
}

.drawer-section--implication {
  background: color-mix(in srgb, var(--accent), transparent 96%);
  border-color: color-mix(in srgb, var(--accent), transparent 50%);
  border-left: 3px solid color-mix(in srgb, var(--accent), transparent 50%);
  padding: 10px 12px;
}

.drawer-section--compact {
  margin-top: 0;
}

.drawer-summary-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 8px;
}

.drawer-summary-grid .drawer-section {
  margin-top: 0;
}

.drawer-top-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 8px;
  align-items: start;
}

.drawer-example-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 8px;
}

.drawer-example-side {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface), transparent 40%);
  padding: 10px 12px;
}

.drawer-lead-text {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.58;
  color: var(--ink);
  font-weight: 500;
}

.drawer-implication-text {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.54;
  color: var(--ink-soft);
  font-weight: 400;
}

/* Section label: small all-caps label with accent color and subtle styling */
.drawer-sec-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  opacity: 0.95;
}

/* Section header row with label + expand toggle */
.drawer-sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.drawer-sec-header .drawer-sec-label {
  margin-bottom: 0;
}

/* Item count badge next to section label */
.drawer-sec-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent), transparent 84%);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
}

/* Expand / Collapse all toggle */
.drawer-expand-toggle {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 9px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.drawer-expand-toggle:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent), transparent 40%);
}

.drawer-expand-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Drawer Navigation Bar ──────────────────────────────────────────────────── */

.drawer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.drawer-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 9px;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.drawer-nav__btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
}

.drawer-nav__btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.drawer-nav__btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.drawer-nav__pos {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-align: center;
  flex: 1;
  padding: 0 8px;
}

.drawer-nav__sep {
  opacity: 0.4;
  margin: 0 1px;
}

.drawer-nav__filtered {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-left: 4px;
}

.drawer-nav__hint {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-align: center;
  margin: 4px 0 0;
  opacity: 0.65;
}

/* ─── Back to Top ────────────────────────────────────────────────────────────── */

.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 300;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--bg) 90%, white 10%);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 40%);
  background: color-mix(in srgb, var(--accent), transparent 88%);
  color: var(--accent);
}

.back-to-top:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.back-to-top:active {
  transform: translateY(1px);
  transition-duration: 0.08s;
}

/* ─── Drawer Jump CTA ────────────────────────────────────────────────────────── */

.drawer-jump {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-start;
}

.drawer-sec-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-strong);
  opacity: 0.6;
}

/* Numbered annotation list */
.drawer-anno-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: anno-counter;
}

.drawer-anno-list li {
  counter-increment: anno-counter;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.91rem;
  line-height: 1.48;
  color: var(--ink-soft);
}

.drawer-anno-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.drawer-anno-list li::before {
  content: counter(anno-counter);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 88%);
  border: 1px solid color-mix(in srgb, var(--accent), transparent 65%);
  border-radius: 999px;
  width: 20px;
  height: 20px;
  line-height: 1;
  margin-top: 2px;
}

/* Numbered discussion list */
.drawer-disc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: disc-counter;
}

.drawer-disc-list li {
  counter-increment: disc-counter;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.drawer-disc-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.drawer-disc-list li::before {
  content: counter(disc-counter);
  flex-shrink: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  margin-top: 3px;
  min-width: 18px;
}

.drawer-disc-list--split {
  column-count: 2;
  column-gap: 12px;
}

.drawer-disc-list--split li {
  break-inside: avoid;
  margin-bottom: 4px;
}

/* ─── Collapsible Discussion Items ────────────────────────────────────────────── */

/* Make <details> fill the remaining flex space inside the numbered li */
.drawer-disc-list .drawer-detail,
.drawer-anno-list .drawer-detail {
  flex: 1;
  min-width: 0;
}

.drawer-detail summary {
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  line-height: 1.5;
  user-select: none;
}

.drawer-detail summary::-webkit-details-marker {
  display: none;
}
.drawer-detail summary::marker {
  display: none;
}

.drawer-detail summary::before {
  content: "\25B8  ";
  font-size: 0.75em;
  color: var(--accent);
  opacity: 0.75;
  transition: content 0.15s;
}

details[open].drawer-detail summary::before {
  content: "\25BE  ";
}

.drawer-detail__body {
  margin: 6px 0 2px 14px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.52;
}

/* Two-column grid inside a drawer */
.drawer-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.drawer-2col > .drawer-section {
  margin-top: 0;
}

/* Figure pills row below image */
.drawer-fig-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}

.drawer-fig-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Mapping blocks — left colored border + tinted background by strategy */
.mapping-block[data-sid="S1"] {
  border-left: 3px solid var(--s1);
  background: color-mix(in srgb, var(--s1), transparent 93%);
}
.mapping-block[data-sid="S2"] {
  border-left: 3px solid var(--s2);
  background: color-mix(in srgb, var(--s2), transparent 93%);
}
.mapping-block[data-sid="S3"] {
  border-left: 3px solid var(--s3);
  background: color-mix(in srgb, var(--s3), transparent 93%);
}
.mapping-block[data-sid="S4"] {
  border-left: 3px solid var(--s4);
  background: color-mix(in srgb, var(--s4), transparent 93%);
}
.mapping-block[data-sid="S5"] {
  border-left: 3px solid var(--s5);
  background: color-mix(in srgb, var(--s5), transparent 93%);
}

/* Drawer section blocks (legacy — kept for any residual use) */
.drawer-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 12px 14px;
  margin-top: 10px;
}

.drawer-block--callout {
  border-color: color-mix(in srgb, var(--accent), transparent 65%);
  background: color-mix(in srgb, var(--accent), transparent 93%);
}

.drawer-block--inset {
  margin-top: 10px;
  background: color-mix(in srgb, var(--bg), transparent 15%);
}

.drawer-block h5 {
  margin: 0 0 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.drawer-block p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.62;
}

.drawer-block p + p {
  margin-top: 9px;
}

.drawer-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
}

.drawer-block li {
  font-size: 1rem;
  line-height: 1.55;
  margin-bottom: 7px;
}

.drawer-block li:last-child {
  margin-bottom: 0;
}

/* Example meta line below drawer image */
.drawer-example-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 3px;
  font-size: 0.91rem;
  font-weight: 600;
  line-height: 1.3;
  flex-wrap: wrap;
}

.drawer-sub {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.87rem;
  line-height: 1.5;
  padding: 7px 10px 7px 12px;
  border-left: 2px solid color-mix(in srgb, var(--accent), transparent 55%);
  background: color-mix(in srgb, var(--accent), transparent 95%);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

/* ─── Strategy Mapping Blocks (in figure drawers) ────────────────────────────── */

.mapping-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
  margin-top: 5px;
}

.mapping-block:first-child {
  margin-top: 0;
}

.mapping-block__head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.mapping-block__head strong {
  font-size: 1rem;
  color: var(--ink);
}

.mapping-block p {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.45;
}

/* ─── Drawer Links ───────────────────────────────────────────────────────────── */

.drawer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.drawer-links--tight {
  margin-top: 10px;
}

.drawer-link {
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--ink-soft);
  border-radius: 7px;
  padding: 6px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition:
    border-color 0.18s ease,
    color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.drawer-link:hover {
  border-color: color-mix(in srgb, var(--accent), transparent 40%);
  color: var(--ink);
  background: color-mix(in srgb, var(--accent), transparent 92%);
  transform: translateY(-1px);
}

.drawer-link:active {
  transform: translateY(0);
  transition-duration: 0.08s;
}

.drawer-link:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ─── Drawer & Overlay Animations ───────────────────────────────────────────── */

@keyframes drawerSlideIn {
  from {
    transform: translateX(calc(100% + 24px));
  }
  to {
    transform: translateX(0);
  }
}

@keyframes drawerSlideOut {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(100% + 24px));
  }
}

@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes overlayFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.drawer:not([hidden]) {
  animation: drawerSlideIn 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer.is-closing {
  animation: drawerSlideOut 0.22s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.overlay:not([hidden]) {
  animation: overlayFadeIn 0.24s ease;
}

.overlay.is-closing {
  animation: overlayFadeOut 0.22s ease forwards;
}

/* ─── Utilities ──────────────────────────────────────────────────────────────── */

[hidden] {
  display: none !important;
}

body.drawer-open {
  overflow: hidden;
}

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

/* Scroll-reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .strategy-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .paper-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .drawer-top-grid,
  .drawer-summary-grid,
  .drawer-example-grid {
    grid-template-columns: 1fr;
  }
  .drawer-disc-list--split {
    column-count: 1;
  }
}

@media (max-width: 860px) {
  .top__inner {
    grid-template-columns: 1fr;
  }
  .top__actions {
    justify-content: flex-start;
  }
  .hero {
    grid-template-columns: 1fr;
    padding: 24px 22px;
  }
  .filter-wrap {
    grid-template-columns: 1fr;
    position: static;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
  }
  .strategy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .drawer-2col {
    grid-template-columns: 1fr;
  }
  .drawer-top-grid,
  .drawer-summary-grid,
  .drawer-example-grid {
    grid-template-columns: 1fr;
  }
  .drawer__head {
    padding: 18px 20px 16px;
  }
  .drawer__body {
    padding: 18px 20px 40px;
  }
}

@media (max-width: 580px) {
  /* ─── Viewport & Page ────────────────────────────────────────────────── */
  .page {
    padding: 16px 14px 80px; /* increased bottom padding for thumb reach */
  }

  /* ─── Grids ──────────────────────────────────────────────────────────── */
  .strategy-grid {
    grid-template-columns: 1fr;
    gap: 10px; /* increase gap for touch spacing */
  }
  .paper-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* ─── Hero ───────────────────────────────────────────────────────────── */
  .hero {
    padding: 18px 16px;
    grid-template-columns: 1fr; /* stack on mobile */
  }
  .hero__stats {
    grid-template-columns: 1fr;
  }
  .stat {
    padding: 12px 12px; /* reduce drawer-like density */
  }
  .stat__n {
    font-size: 1.8rem;
  }
  .stat__l {
    font-size: 0.9rem;
  }

  /* ─── Buttons & Touch Targets ────────────────────────────────────────── */
  .btn,
  .icon-btn {
    min-height: 44px; /* Touch-safe height */
    padding: 8px 16px;
    font-size: 13px;
  }
  .btn--compact {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 13px;
  }
  .btn--icon {
    width: 44px; /* Thumb-safe square button */
    height: 44px;
    padding: 0;
  }
  .icon-btn svg,
  .btn--icon svg {
    width: 18px;
    height: 18px;
  }

  /* ─── Filter Chips ───────────────────────────────────────────────────── */
  .chip {
    min-height: 44px;
    padding: 8px 14px;
    font-size: 13px;
  }
  .filter-wrap {
    padding: 12px 12px; /* reduce filter panel density */
    gap: 10px; /* increase spacing */
  }
  .filter-title {
    margin: 6px 0 8px;
    font-size: 11px;
  }
  .chip-row {
    gap: 8px; /* more space between filter pills */
  }

  /* ─── Drawer Sizing ──────────────────────────────────────────────────── */
  .drawer {
    width: 100vw; /* full viewport width on mobile */
    max-width: none;
    margin: 0;
    border-radius: 0; /* edge-to-edge */
  }
  .drawer__head {
    padding: 16px 16px 12px; /* tighten further for mobile */
  }
  .drawer__body {
    padding: 12px 14px 40px; /* tighter padding */
    max-height: calc(100vh - 180px); /* leave room for close button */
  }

  /* ─── Drawer Close Button ────────────────────────────────────────────── */
  #drawerClose {
    width: 44px;
    height: 44px;
    right: 12px;
    top: 12px;
    padding: 0;
  }
  #drawerClose svg {
    width: 20px;
    height: 20px;
  }

  /* ─── Drawer Text Sizing ─────────────────────────────────────────────── */
  .drawer-sec-label {
    font-size: 11px;
    margin-bottom: 6px;
  }
  .drawer-lead-text {
    font-size: 0.96rem;
    line-height: 1.5;
  }
  .drawer-implication-text {
    font-size: 0.95rem;
    line-height: 1.48;
  }
  .drawer-title h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
  }

  /* ─── Drawer Grids ───────────────────────────────────────────────────── */
  .drawer-summary-grid,
  .drawer-top-grid,
  .drawer-example-grid {
    grid-template-columns: 1fr; /* collapse all grids to single column */
    gap: 8px;
  }
  .drawer-section {
    margin-top: 10px;
    padding: 10px 12px;
  }
  .drawer-section:first-child {
    margin-top: 0;
  }
  .drawer-example-side {
    margin-top: 8px;
    padding: 10px 12px;
  }

  /* ─── Drawer Lists ───────────────────────────────────────────────────── */
  .drawer-anno-list,
  .drawer-disc-list {
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 0 0 0 18px;
  }
  .drawer-disc-list--split {
    column-count: 1; /* no columns on mobile */
  }
  .drawer-disco-item {
    margin-bottom: 6px;
  }

  /* ─── Strategy Card CTA ───────────────────────────────────────────────── */
  .card-cta {
    padding: 6px 12px;
    font-size: 11px;
    min-height: 28px;
  }

  /* ─── Links in Drawers ───────────────────────────────────────────────── */
  .drawer-link {
    padding: 8px 11px;
    font-size: 12px;
    min-height: 36px;
  }
  .drawer-links {
    gap: 6px;
  }
}
