/* ============================================================
   CoRA Case File — CSS
   Aesthetic: security-advisory / forensic case file. Ink + paper
   duotone, diff-authentic evidence rendering, monospace utility type.
   ============================================================ */

/* ---------- Custom Properties ---------- */
:root {
  --ink: #111720;
  --ink-soft: #1c2531;
  --paper: #f8f6f1;
  --surface: #fffdf8;
  --text-color: #171b22;
  --text-light: #4c5561;
  --text-muted: #6d7580;
  --theme-color: #c7442c;
  --theme-bg: rgba(199, 68, 44, 0.075);
  --verified: #11756a;
  --verified-bg: rgba(17, 117, 106, 0.085);
  --diff-add: #1a7f37;
  --diff-add-bg: rgba(46, 160, 67, 0.16);
  --diff-del: #ff9b93;
  --diff-del-bg: rgba(248, 81, 73, 0.16);
  --bg-color: #f4f1ea;
  --divider-color: rgba(17, 23, 32, 0.13);
  --divider-strong: rgba(17, 23, 32, 0.26);
  --code-bg: rgba(17, 23, 32, 0.065);
  --shadow-sm: 0 1px 3px rgba(17, 23, 32, 0.09);
  --shadow-md: 0 10px 28px rgba(17, 23, 32, 0.13);
  --radius: 10px;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --content-width: 68rem;
  --wide-width: 68rem;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  scroll-padding-bottom: 5.5rem;
}

body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text-color);
  background: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizelegibility;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  font-variant-numeric: oldstyle-nums proportional-nums;
  overflow-x: hidden;
}

/* ---------- Layout: fluid centering ---------- */
.container {
  max-width: var(--content-width);
  margin-inline: auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: var(--wide-width);
  margin-inline: auto;
  padding: 0 1.5rem;
}

/* ---------- Desktop notice ---------- */
.desktop-notice {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--divider-color);
}

@media (min-width: 1024px) {
  .desktop-notice { display: none; }
}

/* ---------- Hero / case-file header ---------- */
.hero-band {
  background: var(--ink);
  color: var(--paper);
}

header {
  text-align: center;
  padding: clamp(3.25rem, 7vw, 5rem) 0 clamp(2.75rem, 6vw, 4rem);
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(237, 239, 236, 0.55);
  margin-bottom: 1.1rem;
}

.hero-eyebrow .hero-eyebrow-mark { color: var(--theme-color); }

h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 1.35rem + 1.6vw, 2.5rem);
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.015em;
  font-variant-numeric: lining-nums;
  text-wrap: balance;
  color: var(--paper);
}

.paper-byline {
  max-width: 54rem;
  margin: 1.45rem auto 0;
  color: rgba(237, 239, 236, 0.86);
  text-align: center;
}

.paper-authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 0.45rem;
  font-size: clamp(0.98rem, 0.9rem + 0.25vw, 1.08rem);
  font-weight: 600;
}

.paper-authors a {
  color: var(--paper);
  text-decoration-color: rgba(199, 68, 44, 0.75);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.paper-authors a:not(:last-child)::after {
  content: ",";
  color: rgba(237, 239, 236, 0.62);
  text-decoration: none;
}

.paper-authors a:hover,
.paper-authors a:focus-visible {
  color: #fff;
  text-decoration-color: var(--theme-color);
}

.paper-affiliation {
  margin-top: 0.55rem;
  font-size: 0.92rem;
  text-align: center;
}

.paper-emails {
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 0.62rem + 0.18vw, 0.78rem);
  color: rgba(237, 239, 236, 0.58);
  overflow-wrap: anywhere;
  text-align: center;
}

.venue {
  color: rgba(237, 239, 236, 0.6);
  font-size: 0.9rem;
  font-style: italic;
}

/* Docket: case chips inside the hero, linked to each demo slide */
.docket {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.85rem;
  padding: 0 1.5rem;
}

.docket a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(237, 239, 236, 0.18);
  border-radius: 999px;
  color: rgba(237, 239, 236, 0.72);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.docket a:hover,
.docket a:focus-visible {
  border-color: var(--theme-color);
  color: var(--paper);
  outline: 0;
}

.docket-num {
  color: var(--theme-color);
  font-weight: 600;
}

/* ---------- Typography ---------- */
section {
  margin: 2.5rem 0;
}

h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
  font-variant-numeric: lining-nums;
}

h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.3;
  margin-top: 2.5rem;
  margin-bottom: 0.6rem;
  letter-spacing: -0.005em;
  font-variant-numeric: lining-nums;
}

/* Case number label above each demo slide's h2 */
.case-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--theme-color);
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  text-align: left;
}

@media (min-width: 640px) {
  p { text-align: left; hyphens: none; }

  p:has(code) {
    text-align: left;
    hyphens: none;
  }
}

.abstract-text {
  font-size: 1em;
  line-height: 1.6;
}

p a, li a {
  color: var(--text-color);
  text-decoration-color: var(--divider-strong);
  text-underline-offset: 0.15em;
  transition: color 0.15s, text-decoration-color 0.15s;
}

p a:hover, li a:hover,
p a:focus-visible, li a:focus-visible {
  color: var(--theme-color);
  text-decoration-color: var(--theme-color);
}

p code, li code {
  color: var(--text-color);
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

/* ---------- Figures ---------- */
.figure {
  margin: 2rem 0;
  text-align: center;
}

.figure img {
  max-width: min(100%, 42rem);
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* Figures inside a grid column are already narrower than the column cap;
   let them fill their column instead of shrinking further. */
.figure-grid .figure img {
  max-width: 100%;
}

.figure-caption {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 0.75rem;
  text-align: center;
  line-height: 1.55;
  max-width: 80ch;
  margin-left: auto;
  margin-right: auto;
}

.figure-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

@media (min-width: 560px) {
  .figure-grid { grid-template-columns: 1fr 1fr; }
}

.figure-grid.figure-grid-stack {
  grid-template-columns: minmax(0, 1fr);
}

/* ---------- Callout (verdict stamp) ---------- */
.callout {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--divider-color);
  border-left: 3px solid var(--theme-color);
  border-radius: 0 6px 6px 0;
  padding: 1rem 1.2rem 0.95rem;
  margin: 1.25rem 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

.callout::before {
  content: "End condition";
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--theme-color);
  margin-bottom: 0.4rem;
}

.callout strong {
  color: var(--theme-color);
}

/* ---------- Tables ---------- */
.table-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border-radius: var(--radius);
}

/* Scroll hint gradient on right edge when table overflows */
.table-wrap.has-overflow::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2rem;
  background: linear-gradient(to right, transparent, rgba(237,239,236,0.9));
  pointer-events: none;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.table-wrap.scrolled-end::after { opacity: 0; }

table.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.86rem, 0.82rem + 0.16vw, 0.98rem);
  line-height: 1.55;
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}

table.results-table th {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.78em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: right;
  padding: 0.62rem 0.8rem;
  border-bottom: 2px solid var(--text-color);
  background: var(--surface);
}

table.results-table th:first-child { text-align: left; }

table.results-table td {
  text-align: right;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--divider-color);
}

table.results-table td:first-child { text-align: left; }

table.results-table tbody tr {
  transition: background 0.15s;
}

table.results-table tbody tr:hover { background: rgba(18,21,27,0.03); }

table.results-table tr.ours td { background: var(--verified-bg); }
table.results-table tr.ours:hover td { background: rgba(21,122,110,0.14); }

table.results-table tr.ours-best td { background: var(--theme-bg); }
table.results-table tr.ours-best:hover td { background: rgba(214,71,43,0.13); }

/* Tappable row active state (mobile) */
table.results-table tbody tr[data-desc]:active td { background: var(--theme-bg); }

table.results-table tr.ours-best td:first-child {
  border-left: 3px solid var(--theme-color);
}

table.results-table.text-table {
  table-layout: fixed;
  white-space: normal;
}

table.results-table.text-table th,
table.results-table.text-table td {
  text-align: left;
  vertical-align: top;
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  overflow-wrap: anywhere;
}

table.results-table.text-table th:first-child,
table.results-table.text-table td:first-child {
  width: 4.5rem;
  white-space: nowrap;
}

table.results-table.text-table code {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-caption {
  font-size: 0.86rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  line-height: 1.45;
}

.taxonomy-caption {
  text-align: center;
}

.markup-catalog-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  margin: 1rem 0 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--divider-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-light);
  font-size: 0.82rem;
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.markup-catalog-link > span:first-child {
  color: var(--text-color);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.markup-catalog-link > span:last-child {
  color: var(--theme-color);
  font-size: 1rem;
}

.markup-catalog-link:hover,
.markup-catalog-link:focus-visible {
  border-color: var(--theme-color);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  outline: 0;
}

@media (max-width: 560px) {
  .markup-catalog-link {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .markup-catalog-link > span:first-child {
    grid-column: 1 / -1;
  }
}

/* ---------- Attack-vector taxonomy ---------- */
table.results-table.text-table.attack-vector-table th:first-child,
table.results-table.text-table.attack-vector-table td:first-child {
  width: 30%;
  white-space: normal;
}

.attack-vector-table tbody tr:hover { background: transparent; }

.taxonomy-category {
  cursor: help;
  transition: background 0.18s;
}

.taxonomy-category:hover,
.taxonomy-category:focus-visible {
  background: rgba(17, 23, 32, 0.035);
  outline: 0;
}

.taxonomy-desc {
  display: none;
}

.margin-desc.taxonomy-desc {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.taxonomy-category-note,
.taxonomy-vector-note {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.taxonomy-vector-note {
  display: none;
  margin-top: 0.65rem;
  font-size: 0.74rem;
  line-height: 1.5;
}

.taxonomy-hover-wrap[data-vector-active] .taxonomy-vector-note {
  display: block;
}

.taxonomy-desc-panel {
  display: none;
}

.taxonomy-hover-wrap:has(.taxonomy-category:hover) .taxonomy-desc,
.taxonomy-hover-wrap[data-taxonomy-active] .taxonomy-desc {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.taxonomy-hover-wrap:has(.taxonomy-category[data-taxonomy="sources"]:hover) .taxonomy-desc-sources,
.taxonomy-hover-wrap[data-taxonomy-active="sources"] .taxonomy-desc-sources,
.taxonomy-hover-wrap:has(.taxonomy-category[data-taxonomy="markup"]:hover) .taxonomy-desc-markup,
.taxonomy-hover-wrap[data-taxonomy-active="markup"] .taxonomy-desc-markup,
.taxonomy-hover-wrap:has(.taxonomy-category[data-taxonomy="logic"]:hover) .taxonomy-desc-logic,
.taxonomy-hover-wrap[data-taxonomy-active="logic"] .taxonomy-desc-logic {
  display: block;
}

.vector-family {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  vertical-align: middle;
}

.attack-vector-item {
  display: grid;
  grid-template-columns: 2.7rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: baseline;
  scroll-margin-top: 1.5rem;
  border-radius: 4px;
  cursor: help;
  transition: background 0.18s;
}

.attack-vector-item:hover,
.attack-vector-item:focus-visible {
  background: rgba(17, 23, 32, 0.035);
  outline: 0;
}

.attack-vector-item + .attack-vector-item {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dotted var(--divider-color);
}

.vector-id {
  color: var(--theme-color);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}

.taxonomy-vector-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  color: var(--text-color);
}

.taxonomy-vector-heading > span {
  flex: 0 0 auto;
  padding: 0.08rem 0.34rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
}

.taxonomy-vector-heading strong {
  font-size: 0.76rem;
  line-height: 1.35;
}

.case-vector-ref {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.8rem 0 1.35rem;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--theme-color);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(255, 253, 248, 0.7);
}

.case-vector-label {
  margin-right: 0.15rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.case-vector-ref a {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 2rem;
  padding: 0.3rem 0.62rem 0.3rem 0.4rem;
  border: 1px solid var(--divider-color);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-light);
  font-size: 0.74rem;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.case-vector-ref a strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.15rem;
  height: 1.25rem;
  padding: 0 0.34rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.02em;
}

.case-vector-ref a:hover,
.case-vector-ref a:focus-visible {
  border-color: var(--theme-color);
  color: var(--text-color);
  box-shadow: var(--shadow-sm);
  outline: 0;
  transform: translateY(-1px);
}

.case-vector-related {
  border-left-color: var(--text-muted);
}

@media (max-width: 560px) {
  table.results-table.text-table.attack-vector-table th:first-child,
  table.results-table.text-table.attack-vector-table td:first-child {
    width: 36%;
  }

  .vector-family {
    display: flex;
    margin: 0 0 0.45rem;
  }

  .attack-vector-item {
    grid-template-columns: 2.25rem minmax(0, 1fr);
    gap: 0.35rem;
  }
}

/* ---------- Side-by-side tables (ablation) ---------- */
.table-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

@media (min-width: 560px) {
  .table-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

/* ---------- Method table + margin description ---------- */
.method-table-wrap {
  position: relative;
}

/* Margin description: right panel on wide screens */
.margin-desc {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 1.5rem;
  width: 300px;
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.55;
  transition: opacity 0.25s;
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 1301px) {
  .workflow-table-wrap > #methodDesc {
    min-height: 5rem;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--divider-color);
    border-radius: var(--radius);
    pointer-events: none;
  }
}

/* On narrow screens: show as tooltip below the table */
@media (max-width: 1680px) {
  .margin-desc {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    margin-top: 0.75rem;
    margin-left: 0;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--divider-color);
  }

  .margin-desc[data-visible="true"] {
    opacity: 1;
  }
}

/* ---------- BibTeX ---------- */
.bibtex-block {
  position: relative;
}

pre {
  background: var(--surface);
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: clamp(0.75rem, 0.72rem + 0.15vw, 0.85rem);
  line-height: 1.55;
  font-variant-numeric: lining-nums tabular-nums;
  overflow-x: auto;
}

pre code { background: 0; padding: 0; }

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg-color);
  border: 1px solid var(--divider-color);
  border-radius: 4px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text-light);
  font-family: var(--font-sans);
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.copy-btn:hover {
  color: var(--text-color);
  border-color: var(--text-color);
  box-shadow: var(--shadow-sm);
}

/* ---------- Section nav (left sidebar) ---------- */
.section-nav {
  position: fixed;
  left: max(1rem, calc((100vw - var(--content-width)) / 2 - 150px - 2rem));
  top: 50%;
  transform: translateY(-50%);
  width: 150px;
  font-size: 0.86rem;
  line-height: 1.5;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.35s;
}

.section-nav.visible { opacity: 1; }

.section-nav a {
  display: block;
  padding: 0.25rem 0.55rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.section-nav a.nested {
  padding-left: 1.05rem;
  font-size: 0.78rem;
}

/* Case-scoped subsection block: the currently active demo case only. */
.section-nav-case {
  margin: 0.3rem 0;
  padding: 0.3rem 0 0.3rem 0.55rem;
  border-top: 1px solid var(--divider-color);
  border-bottom: 1px solid var(--divider-color);
}

.section-nav-case a.case-current {
  display: block;
  padding: 0.25rem 0;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  text-decoration: none;
  border-left: none;
}

.section-nav-case a.case-current:hover,
.section-nav-case a.case-current.active { color: var(--text-color); }

.section-nav a:hover { color: var(--text-color); }

.section-nav a.active {
  color: var(--text-color);
  border-left-color: var(--theme-color);
  font-weight: 600;
}

/* Hide sidebar when it would overlap content */
@media (max-width: 1424px) {
  .section-nav { display: none; }
}

/* ---------- Mobile bottom nav (replaces sidebar on small screens) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(18, 21, 27, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -1px 0 rgba(237, 239, 236, 0.08), 0 -8px 24px rgba(18, 21, 27, 0.18);
  padding: 0.55rem 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0.35rem;
  scroll-padding-inline: 1.5rem;
  mask-image: linear-gradient(to right, transparent 0, #000 0.85rem, #000 calc(100% - 0.85rem), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 0.85rem, #000 calc(100% - 0.85rem), transparent 100%);
}

.bottom-nav::-webkit-scrollbar { display: none; }

.bottom-nav a {
  flex-shrink: 0;
  padding: 0.42rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: rgba(237, 239, 236, 0.55);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 99px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.bottom-nav a.active {
  background: rgba(214, 71, 43, 0.14);
  border-color: rgba(214, 71, 43, 0.4);
  color: var(--paper);
}

.bottom-nav a:hover { color: var(--paper); }

@media (max-width: 1424px) {
  .bottom-nav { display: flex; }
  body { padding-bottom: 5.25rem; }
}

/* ---------- Video embed ----------
   Sized to each clip's own aspect ratio (set inline per <video> via the
   `aspect-ratio` style) and capped well short of the content column so the
   player doesn't stretch edge-to-edge; native controls provide fullscreen. */
.video-wrap {
  max-width: 40rem;
  margin: 1.5rem auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-md);
}

.video-wrap iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.video-wrap video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

.demo-iframe {
  width: 100%;
  height: 460px;
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
  background: #fcfaf6;
}

.blog-preview {
  height: auto;
  min-height: 420px;
  overflow: hidden;
  color: #1f1d1a;
  text-align: left;
  font: 1rem/1.65 Georgia, serif;
}

.blog-preview-header,
.blog-preview-main,
.blog-preview-footer {
  max-width: 660px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.blog-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 34px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e9e3d8;
  font-family: var(--font-sans);
}

.blog-preview-brand {
  font-weight: 600;
  color: #1f1d1a;
}

.blog-preview-brand span,
.blog-preview a {
  color: #8a4d2b;
}

.blog-preview nav {
  display: flex;
  gap: 1rem;
  color: #6f6a63;
  font-size: 0.9rem;
}

.blog-preview-main {
  padding-top: 30px;
}

.blog-preview-intro {
  color: #6f6a63;
  padding-bottom: 24px;
  border-bottom: 1px solid #e9e3d8;
}

.blog-preview article {
  padding: 20px 0;
  border-bottom: 1px solid #e9e3d8;
}

.blog-preview h4 {
  margin: 0 0 0.35rem;
  font-family: Georgia, serif;
  font-size: 1.12rem;
  line-height: 1.25;
}

.blog-preview article p:last-child {
  margin-bottom: 0;
  color: #6f6a63;
}

.blog-preview-meta {
  margin-bottom: 0.4rem;
  color: #aaa49a;
  font: 0.78rem/1.4 var(--font-sans);
}

.blog-preview-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 22px;
  padding-bottom: 26px;
  color: #aaa49a;
  font: 0.78rem/1.4 var(--font-sans);
}

.artifact-details {
  margin: 1rem 0;
}

.artifact-details summary {
  cursor: pointer;
  font-weight: 600;
}

.code-scroll {
  max-height: 360px;
}

/* ---------- Embedded case artifacts ---------- */
.mechanism-sequence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 1.5rem;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.mechanism-sequence li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  min-height: 7.2rem;
  padding: 1rem;
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: var(--shadow-sm);
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.55;
}

.mechanism-sequence li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 7px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
}

.mechanism-sequence strong {
  color: var(--text-color);
}

.artifact-embed {
  position: relative;
  margin: 1.4rem 0 2.1rem;
}

.artifact-embed-frame {
  display: block;
  width: 100%;
  border: 1px solid var(--divider-strong);
  border-radius: 12px;
  background: #f6f8fa;
  box-shadow: var(--shadow-md);
}

.artifact-embed-code {
  height: min(42rem, 72vh);
  min-height: 34rem;
}

.artifact-embed-issue {
  height: min(44rem, 74vh);
  min-height: 36rem;
}

.artifact-embed-caption {
  max-width: 78ch;
  margin: 0.75rem auto 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
}

.artifact-tree mark {
  padding: 0.08rem 0.25rem;
  border-radius: 4px;
  background: rgba(207, 68, 45, 0.12);
  color: var(--theme-color);
  font-weight: 600;
}

.artifact-tree {
  max-height: none;
}

.artifact-detail-note {
  margin: 0;
  padding: 0.9rem 1rem 0;
  color: var(--text-light);
  font-size: 0.82rem;
  line-height: 1.55;
}

.artifact-side-note {
  display: none;
  color: var(--text-light);
  font-size: 0.76rem;
  line-height: 1.52;
}

.artifact-side-note.active {
  display: block;
}

.artifact-side-note-panel {
  display: none;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.artifact-side-note-panel.active {
  display: block;
}

.artifact-side-note-kicker {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--theme-color);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.artifact-side-note strong {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--text-color);
  font-size: 0.78rem;
  line-height: 1.35;
}

.artifact-side-note p {
  margin: 0;
}

.artifact-side-note code {
  font-size: 0.76em;
}

@media (min-width: 1681px) {
  .artifact-side-note {
    position: absolute;
    left: calc(100% + 1.25rem);
    top: 0;
    width: 200px;
  }
}

@media (max-width: 1680px) {
  .artifact-side-note.active {
    width: 100%;
    margin-top: 0.75rem;
  }
}

@media (max-width: 680px) {
  .mechanism-sequence {
    grid-template-columns: minmax(0, 1fr);
  }

  .mechanism-sequence li {
    min-height: 0;
  }

  .artifact-embed-code,
  .artifact-embed-issue {
    height: 35rem;
    min-height: 0;
  }
}

.flow-figure-wrap {
  margin: 1.75rem 0 2.25rem;
}

.flow-canvas {
  position: relative;
  margin: 0 auto;
  /* Match the figure image cap. The old 50rem wrapper was wider than its
     42rem image, which shifted percentage-positioned hotspots to the right. */
  max-width: 42rem;
}

.flow-canvas img {
  display: block;
  width: 100%;
  border: 1px solid var(--divider-color);
  box-shadow: var(--shadow-sm);
}

.flow-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: transparent;
  box-shadow: none;
  cursor: pointer;
  font-size: 0;
  padding: 0;
}

.flow-hotspot:hover,
.flow-hotspot:focus {
  border-color: rgba(214, 71, 43, 0.45);
  background: rgba(214, 71, 43, 0.045);
  color: transparent;
  outline: 0;
  box-shadow: 0 0 0 2px rgba(214, 71, 43, 0.08);
}

.flow-user {
  left: 19.2%;
  top: 23.8%;
  width: 17%;
  height: 20%;
}

.flow-claude {
  left: 48.8%;
  top: 23.8%;
  width: 20%;
  height: 20%;
}

.flow-site {
  left: 79.7%;
  top: 23.8%;
  width: 17%;
  height: 20%;
}

.flow-source {
  left: 28.6%;
  top: 63.4%;
  width: 13%;
  height: 18.5%;
}

.flow-skills {
  left: 51.9%;
  top: 63.4%;
  width: 14%;
  height: 18.5%;
}

.flow-shell {
  left: 78.8%;
  top: 63.4%;
  width: 15%;
  height: 18.5%;
}

.flow-figure-wrap .flow-desc {
  opacity: 0;
  pointer-events: none;
}

.flow-desc,
.trace-desc,
.bundle-desc {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
}

.flow-desc-panel {
  display: none;
}

.flow-figure-wrap:has(.flow-hotspot:hover) .flow-desc,
.flow-figure-wrap[data-flow-active] .flow-desc {
  opacity: 1;
  pointer-events: auto;
}

.flow-desc pre,
.trace-desc pre,
.bundle-desc pre {
  margin: 0.55rem 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.66rem;
  line-height: 1.45;
  max-height: 12rem;
}

.flow-figure-wrap:has(.flow-hotspot:hover) .flow-desc-default {
  display: none;
}

.flow-figure-wrap[data-flow-active] .flow-desc-default {
  display: none;
}

.flow-figure-wrap:has(.flow-user:hover) .flow-desc-user,
.flow-figure-wrap:has(.flow-claude:hover) .flow-desc-claude,
.flow-figure-wrap:has(.flow-site:hover) .flow-desc-site,
.flow-figure-wrap:has(.flow-source:hover) .flow-desc-source,
.flow-figure-wrap:has(.flow-skills:hover) .flow-desc-skills,
.flow-figure-wrap:has(.flow-shell:hover) .flow-desc-shell {
  display: block;
}

.flow-figure-wrap[data-flow-active="user"] .flow-desc-user,
.flow-figure-wrap[data-flow-active="claude"] .flow-desc-claude,
.flow-figure-wrap[data-flow-active="site"] .flow-desc-site,
.flow-figure-wrap[data-flow-active="source"] .flow-desc-source,
.flow-figure-wrap[data-flow-active="skills"] .flow-desc-skills,
.flow-figure-wrap[data-flow-active="shell"] .flow-desc-shell {
  display: block;
}

.trace-wrap {
  margin: 1.75rem 0 2.25rem;
}

.trace-wrap .figure {
  margin-top: 0;
}

.trace-term {
  color: var(--theme-color);
  font-weight: 700;
  border-bottom: 1px dotted rgba(214, 71, 43, 0.55);
  cursor: help;
}

.trace-term:hover,
.trace-term:focus {
  background: rgba(214, 71, 43, 0.09);
  border-radius: 3px;
  outline: 0;
}

.trace-wrap .trace-desc {
  opacity: 0;
  pointer-events: none;
}

.trace-desc-panel {
  display: none;
}

.trace-wrap:has(.trace-term:hover) .trace-desc,
.trace-wrap[data-trace-active] .trace-desc {
  opacity: 1;
  pointer-events: auto;
}

.trace-wrap:has(.trace-term:hover) .trace-desc-default,
.trace-wrap[data-trace-active] .trace-desc-default {
  display: none;
}

.trace-wrap:has(.trace-runtime:hover) .trace-desc-runtime,
.trace-wrap:has(.trace-temp:hover) .trace-desc-temp,
.trace-wrap:has(.trace-load:hover) .trace-desc-load,
.trace-wrap:has(.trace-execute:hover) .trace-desc-execute {
  display: block;
}

.trace-wrap[data-trace-active="runtime"] .trace-desc-runtime,
.trace-wrap[data-trace-active="temp"] .trace-desc-temp,
.trace-wrap[data-trace-active="load"] .trace-desc-load,
.trace-wrap[data-trace-active="execute"] .trace-desc-execute {
  display: block;
}

.bundle-layout-wrap {
  margin: 1.25rem 0 2rem;
}

.bundle-card {
  background: var(--surface);
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.bundle-tree {
  margin: 0;
  padding: 1.8rem 2rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: clamp(0.88rem, 0.8rem + 0.22vw, 1.05rem);
  line-height: 1.7;
  color: var(--text-color);
  text-align: left;
  white-space: pre;
  background: var(--surface);
}

.bundle-node {
  color: var(--theme-color);
  background: transparent;
  border: 0;
  border-bottom: 1px dotted rgba(214, 71, 43, 0.45);
  border-radius: 0;
  cursor: pointer;
  font-weight: 600;
}

.bundle-node:hover,
.bundle-node:focus {
  background: rgba(214, 71, 43, 0.09);
  outline: 0;
}

.bundle-layout-wrap .bundle-desc {
  opacity: 0;
  pointer-events: none;
}

.bundle-desc-panel {
  display: none;
}

.bundle-layout-wrap:has(.bundle-node:hover) .bundle-desc,
.bundle-layout-wrap[data-bundle-active] .bundle-desc {
  opacity: 1;
  pointer-events: auto;
}

.bundle-layout-wrap:has(.bundle-node:hover) .bundle-desc-default,
.bundle-layout-wrap[data-bundle-active] .bundle-desc-default {
  display: none;
}

.bundle-layout-wrap:has(.bundle-claude:hover) .bundle-desc-claude,
.bundle-layout-wrap:has(.bundle-skills:hover) .bundle-desc-skills,
.bundle-layout-wrap:has(.bundle-vibe:hover) .bundle-desc-vibe,
.bundle-layout-wrap:has(.bundle-skill:hover) .bundle-desc-skill {
  display: block;
}

.bundle-layout-wrap[data-bundle-active="claude"] .bundle-desc-claude,
.bundle-layout-wrap[data-bundle-active="skills"] .bundle-desc-skills,
.bundle-layout-wrap[data-bundle-active="vibe"] .bundle-desc-vibe,
.bundle-layout-wrap[data-bundle-active="skill"] .bundle-desc-skill {
  display: block;
}

@media (max-width: 560px) {
  .demo-iframe {
    height: 380px;
  }

  .flow-hotspot {
    font-size: 0;
    padding: 0;
  }
}

/* ---------- Evidence links (linked GitHub PRs / branches / commits) ---------- */
.evidence-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1.1rem 0 1.6rem;
}

.evidence-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--divider-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-color);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.evidence-link:hover,
.evidence-link:focus-visible {
  border-color: var(--theme-color);
  color: var(--theme-color);
  box-shadow: var(--shadow-sm);
  outline: 0;
}

.evidence-link::after {
  content: "\2197";
  font-size: 0.85em;
  color: var(--text-muted);
}

.evidence-link:hover::after { color: var(--theme-color); }

/* Evidence referenced by name only, without a public link (private repo). */
.evidence-link-static {
  cursor: default;
}

.evidence-link-static:hover,
.evidence-link-static:focus-visible {
  border-color: var(--divider-strong);
  color: var(--text-color);
  box-shadow: none;
}

.evidence-link-static::after {
  content: none;
}

.evidence-status {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.evidence-link[data-status="merged"] .evidence-status,
.evidence-link[data-status="approved"] .evidence-status {
  color: var(--theme-color);
}

.evidence-link[data-status="rejected"] .evidence-status,
.evidence-link[data-status="open"] .evidence-status {
  color: var(--verified);
}

/* ---------- Verdict stamp (bot review outcome) ---------- */
.verdict {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  margin-bottom: 0.6rem;
}

.verdict-approved {
  background: var(--theme-bg);
  color: var(--theme-color);
  border: 1px solid rgba(214, 71, 43, 0.35);
}

.verdict-rejected {
  background: var(--verified-bg);
  color: var(--verified);
  border: 1px solid rgba(21, 122, 110, 0.35);
}

.verdict-block {
  background: var(--surface);
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
  margin: 0.9rem 0 1.5rem;
  font-size: 0.92rem;
  line-height: 1.55;
}

.verdict-block .verdict-confidence {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ---------- Diff block (authentic git-diff evidence) ---------- */
.diff-block {
  font-family: var(--font-mono);
  font-size: 0.79rem;
  line-height: 1.65;
  background: var(--ink);
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
}

.diff-file-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #e8ebee;
  border-bottom: 1px solid rgba(237, 239, 236, 0.1);
}

.diff-file-header .diff-file-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(237, 239, 236, 0.5);
}

.diff-body {
  padding: 0.5rem 0;
}

.diff-line {
  display: block;
  padding: 0.05rem 1.1rem;
  white-space: pre;
  color: #c3c9d1;
}

.diff-add {
  background: var(--diff-add-bg);
  color: #8fe0a8;
}

.diff-del {
  background: var(--diff-del-bg);
  color: var(--diff-del);
}

.diff-meta {
  color: #7d8590;
}

/* ---------- Attack demo carousel ---------- */
.demo-carousel {
  margin-top: 1.75rem;
}

.demo-tabs {
  display: none;
}

.demo-switcher {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0.65rem;
  width: 100%;
  max-width: none;
  margin: 0 auto 1.75rem;
  position: relative;
}

.demo-case-menu {
  position: relative;
  min-width: 0;
}

.demo-case-menu > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  min-height: 4.5rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--divider-color);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  color: var(--text-color);
  cursor: pointer;
  list-style: none;
  box-shadow: 0 5px 18px rgba(17, 23, 32, 0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.demo-case-menu > summary:hover {
  border-color: var(--divider-strong);
  box-shadow: 0 8px 24px rgba(17, 23, 32, 0.11);
}

.demo-case-menu[open] > summary {
  border-color: rgba(199, 68, 44, 0.55);
  box-shadow: 0 0 0 3px var(--theme-bg), 0 10px 24px rgba(17, 23, 32, 0.1);
}

.demo-case-menu > summary::-webkit-details-marker {
  display: none;
}

.demo-case-menu > summary:focus-visible {
  outline: 2px solid var(--theme-color);
  outline-offset: 3px;
}

.demo-current-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--paper);
  box-shadow: inset 0 -2px 0 rgba(199, 68, 44, 0.75);
}

.demo-current-copy {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.demo-current-copy > span {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.demo-current-copy strong {
  overflow: hidden;
  color: var(--text-color);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-menu-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  padding: 0.35rem 0.55rem 0.35rem 0.7rem;
  border: 1px solid var(--divider-color);
  border-radius: 999px;
  background: var(--bg-color);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
}

.demo-menu-action::after {
  content: "↓";
  color: var(--theme-color);
  font-size: 0.8rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.demo-case-menu[open] .demo-menu-action::after {
  transform: rotate(180deg);
}

.demo-menu-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.65rem);
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  max-height: min(28rem, 70vh);
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid var(--divider-color);
  border-radius: calc(var(--radius) + 2px);
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 24px 60px rgba(17, 23, 32, 0.2), 0 4px 12px rgba(17, 23, 32, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.demo-menu-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  padding: 0.15rem 0.2rem 0.55rem;
  border-bottom: 1px solid var(--divider-color);
}

.demo-menu-heading > div {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.demo-menu-heading span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.demo-menu-heading strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.demo-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 4.5rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
  background: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(17, 23, 32, 0.03);
  transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.demo-choice strong {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}

.demo-choice:hover,
.demo-choice:focus-visible {
  position: relative;
  z-index: 1;
  border-color: rgba(199, 68, 44, 0.55);
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(17, 23, 32, 0.09);
  outline: 0;
  transform: translateY(-2px);
}

.demo-choice.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 8px 18px rgba(17, 23, 32, 0.16);
}

.demo-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0.55rem;
  border: 1px solid var(--divider-color);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.demo-arrow {
  flex-shrink: 0;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--divider-color);
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.demo-arrow:hover { border-color: var(--theme-color); color: var(--theme-color); box-shadow: var(--shadow-sm); }

.demo-arrow:disabled { opacity: 0.3; cursor: default; pointer-events: none; }

.demo-counter {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 3.75rem;
  text-align: center;
}

.demo-viewport {
  position: relative;
  overflow: hidden;
  transition: height 0.35s ease;
}

.demo-track {
  display: flex;
  align-items: flex-start;
  transition: transform 0.35s ease;
  will-change: transform;
}

.demo-slide {
  flex: 0 0 100%;
  max-width: 100%;
  min-width: 0;
}

/* Keep case-specific explanation panels inside their own carousel slide.
   The template's wide-screen margin positioning otherwise places panels
   from Case 01 over the neighboring Codex slide. */
.demo-slide .margin-desc {
  position: relative;
  left: auto;
  top: auto;
  width: 100%;
  margin: 0.75rem 0 0;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
}

/* On true wide layouts, expose the active case's diagram annotation as a
   Meta-Harness-style right margin panel. Inactive carousel slides must be
   hidden because the viewport intentionally allows the active panel to
   extend beyond the main reading column. */
@media (min-width: 1681px) {
  .demo-viewport {
    overflow: clip;
    overflow-clip-margin: 244px;
  }

  .demo-slide[aria-hidden="true"] {
    visibility: hidden;
  }

  .demo-slide .method-table-wrap > .margin-desc {
    position: absolute;
    left: 100%;
    top: 0;
    width: 200px;
    min-height: 10rem;
    max-height: 28rem;
    margin: 0 0 0 1.25rem;
    overflow-y: auto;
  }

  .taxonomy-hover-wrap > .margin-desc {
    width: 200px;
    min-height: 10rem;
    max-height: none;
    margin-left: 1.25rem;
    overflow-y: visible;
  }
}

@media (min-width: 561px) and (max-width: 900px) {
  .demo-menu-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demo-choice {
    min-height: 5rem;
  }

  .demo-choice strong {
    white-space: normal;
  }
}

.demo-placeholder-intro {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.demo-placeholder {
  border: 1px dashed var(--divider-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 0.75rem 0 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--surface);
}

@media (max-width: 560px) {
  .demo-switcher {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
  }

  .demo-case-menu > summary {
    min-height: 4rem;
    padding: 0.7rem 0.8rem;
  }

  .demo-menu-action {
    font-size: 0;
  }

  .demo-menu-panel {
    position: static;
    grid-template-columns: minmax(0, 1fr);
    margin-top: 0.55rem;
  }

  .demo-menu-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.3rem;
  }

  .case-vector-ref {
    align-items: stretch;
  }

  .case-vector-label {
    width: 100%;
  }

  .case-vector-ref a {
    width: 100%;
  }

  .demo-controls {
    justify-content: space-between;
    padding: 0.4rem;
  }

  .demo-counter {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-track, .demo-viewport { transition: none; }
}

/* ---------- Interaction hint (adapts hover/tap text) ---------- */
.interaction-hint::after {
  content: "Hover over each row";
}

@media (hover: none) {
  .interaction-hint::after {
    content: "Tap a row";
  }
}

/* ---------- Section divider ---------- */
.section-rule {
  border: 0;
  border-top: 1px solid var(--divider-color);
  margin: clamp(2rem, 4vw, 3.5rem) 0;
}

/* ---------- Footer ---------- */
footer {
  margin-top: clamp(2rem, 4vw, 3.5rem);
  padding: 1.75rem 1rem;
  background: var(--ink);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: rgba(237, 239, 236, 0.55);
}

footer a {
  color: rgba(237, 239, 236, 0.85);
  text-decoration: none;
}

footer a:hover { text-decoration: underline; }

/* ---------- Scroll-triggered fade-in ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Tooltip (mobile hover fallback) ---------- */
.tooltip {
  display: none;
  position: fixed;
  bottom: 4rem;
  left: 1rem;
  right: 1rem;
  z-index: 40;
  background: var(--bg-color);
  border: 1px solid var(--divider-color);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.55;
  box-shadow: var(--shadow-md);
  animation: tooltipIn 0.2s ease;
}

.tooltip.active { display: block; }

.tooltip-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}

@keyframes tooltipIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 1301px) {
  .tooltip { display: none !important; }
}
