@font-face {
  font-family: "Portfolio Serif";
  src: url("./fonts/portfolio-serif.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Portfolio Sans";
  src: url("./fonts/portfolio-sans.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Portfolio Sans";
  src: url("./fonts/portfolio-sans-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Portfolio Mono";
  src: url("./fonts/portfolio-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #FAF9FC;
  --panel: #F0EEF6;
  --panel-alt: #F6F5FA;
  --code-bg: #F4F2F9;
  --rule: #D1CCDD;
  --rule-strong: #ABA3BE;
  --text: #0D0B12;
  --muted: #474156;
  --link: #2A4FC6;
  --link-hover: #1E3CA0;
  --primary-bg: #1B2A6B;
  --primary-fg: #FAF9FC;
  --primary-hover: #142054;
  --tag-pass-bg: #E8EEFB;
  --tag-pass-fg: #1E3A8A;
  --tag-gate-bg: #FCECF2;
  --tag-gate-fg: #881337;
  --tag-neutral-bg: #EAE7F3;
  --tag-neutral-fg: #342E42;
  --syn-kw: #7C1D5F;
  --syn-str: #1C5D49;
  --syn-num: #1E40AF;
  --syn-cmt: #5C546E;
  --syn-key: #2A4FC6;
  --shadow-sm: 0 1px 2px rgba(13, 11, 18, 0.05);
  --font-serif: "Portfolio Serif", Georgia, "Times New Roman", serif;
  --font-sans: "Portfolio Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Portfolio Mono", Consolas, Menlo, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D0B12;
  --panel: #16131E;
  --panel-alt: #1C1826;
  --code-bg: #120F19;
  --rule: #342E42;
  --rule-strong: #534A68;
  --text: #FAF9FC;
  --muted: #C7C2D5;
  --link: #9BBDFF;
  --link-hover: #BDD4FF;
  --primary-bg: #9BBDFF;
  --primary-fg: #0D0B12;
  --primary-hover: #B8D1FF;
  --tag-pass-bg: #172554;
  --tag-pass-fg: #BFDBFE;
  --tag-gate-bg: #3D1226;
  --tag-gate-fg: #FBCFE8;
  --tag-neutral-bg: #252033;
  --tag-neutral-fg: #DDD8EA;
  --syn-kw: #F4A3C8;
  --syn-str: #8CD6B9;
  --syn-num: #9BBDFF;
  --syn-cmt: #9D96B0;
  --syn-key: #A8C5FF;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.56;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

::selection {
  background: var(--link);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--link-hover);
}

figure {
  margin: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--primary-bg);
  color: var(--primary-fg);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  left: 16px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 6px 24px;
  min-height: 56px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.brand-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-link:hover {
  color: var(--link);
}
.brand-mark {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: block;
}

.header-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font-size: 15px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
}
.header-nav a:hover {
  color: var(--text);
  background: var(--panel);
}

.header-actions {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-ext {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
}
.header-ext:hover {
  background: var(--panel);
  text-decoration: underline;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.theme-btn:hover {
  border-color: var(--rule-strong);
  background: var(--panel-alt);
}
.theme-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Layout shell */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

main {
  padding-bottom: 84px;
}

section {
  scroll-margin-top: 72px;
}

/* Hero */
.hero {
  padding: 40px 0 34px;
  border-bottom: 1px solid var(--rule);
  container-type: inline-size;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  gap: 32px;
  align-items: start;
}

.hero-copy {
  min-width: 0;
}

.hero-preview {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--panel-alt);
  padding: 18px;
  min-width: 0;
}

.hero-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.hero-preview-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.hero-preview-file {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.hero-preview-q {
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--rule);
  font-size: 13.5px;
  color: var(--text);
}

.hero-preview-json {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.48;
  color: var(--text);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.hero h1 {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.0rem, 4.1cqw, 2.95rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
  max-width: 22ch;
}

.hero-lead {
  margin: 0 0 22px;
  max-width: 64ch;
  font-size: 17px;
  line-height: 1.56;
  color: var(--muted);
}

.proof-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 26px;
  margin: 0 0 28px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  list-style: none;
}

.proof-strip li {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-size: 15px;
  color: var(--muted);
}

.proof-strip strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-bg);
  color: var(--primary-fg);
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--primary-fg);
}

.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border-color: var(--rule);
}
.btn-secondary:hover {
  border-color: var(--rule-strong);
  color: var(--text);
  background: var(--panel-alt);
}

.btn-small {
  min-height: 44px;
  padding: 0 14px;
  font-size: 14px;
}

.hero-note {
  margin: 0;
  font-size: 14.5px;
  font-style: normal;
  color: var(--text);
  max-width: 68ch;
}

.arch-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.arch-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.arch-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1.5px solid var(--rule-strong);
  background: var(--panel-alt);
}

.arch-swatch-gate {
  border-color: var(--tag-gate-fg);
  background: var(--tag-gate-bg);
}

.mobile-select-label {
  display: block;
  margin-bottom: 6px;
}

.file-item-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.file-item-dir {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-name {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item[aria-current="true"] .file-item-dir {
  color: var(--tag-pass-fg);
  opacity: 0.85;
}

.scroll-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* Section headers */
.section-block {
  padding: 40px 0 0;
}

.section-head {
  margin-bottom: 24px;
}

.section-head h2 {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.55rem, 2.5vw, 2.05rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  font-size: 16.5px;
}

.principle-quote {
  margin: 0 0 26px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.45;
  color: var(--text);
}

/* Implementation Tabs */
.impl-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.impl-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-height: 60px;
  padding: 12px 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel-alt);
  color: var(--text);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
}

.impl-tab:hover {
  border-color: var(--rule-strong);
}

.impl-tab[aria-selected="true"] {
  background: var(--bg);
  border-color: var(--link);
  box-shadow: inset 0 0 0 1px var(--link);
}

.impl-tab-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
}

.impl-tab-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.impl-panel {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--panel-alt);
  padding: 26px;
}

.impl-panel[hidden] {
  display: none;
}

.impl-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.impl-top-text {
  min-width: 0;
  flex: 1 1 460px;
}

.impl-top h3 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.impl-top p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  max-width: 68ch;
}

/* Architecture pipeline diagram (pure geometry, zero overflow) */
.arch-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin: 0 0 24px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.arch-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--panel-alt);
  min-width: 0;
}

.arch-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -13px;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid var(--rule-strong);
  border-right: 1.5px solid var(--rule-strong);
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
}

.arch-step-gate {
  border-color: var(--tag-gate-fg);
}

.arch-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--tag-neutral-bg);
  color: var(--tag-neutral-fg);
  white-space: nowrap;
}

.arch-badge-gate {
  background: var(--tag-gate-bg);
  color: var(--tag-gate-fg);
}

.arch-badge-code {
  background: var(--tag-pass-bg);
  color: var(--tag-pass-fg);
}

.arch-step-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.arch-step-detail {
  font-size: 13.5px;
  line-height: 1.42;
  color: var(--muted);
}

/* Implementation details & live interactive runner split */
.impl-body-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 24px;
  align-items: start;
}

.impl-points {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.impl-points li {
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--text);
}

.impl-points code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--panel);
  border: 1px solid var(--rule);
}

/* Interactive scenario runner */
.sim-box {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 16px;
  min-width: 0;
}

.sim-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.sim-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.sim-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.sim-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.sim-btn {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.sim-btn:hover {
  border-color: var(--rule-strong);
}
.sim-btn[aria-pressed="true"] {
  background: var(--primary-bg);
  color: var(--primary-fg);
  border-color: var(--primary-bg);
}

.sim-input-preview {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--panel-alt);
  border: 1px solid var(--rule);
  font-size: 14px;
  color: var(--text);
  overflow-wrap: break-word;
}

.sim-trace {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.sim-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--tag-neutral-bg);
  color: var(--tag-neutral-fg);
}
.sim-pill-pass {
  background: var(--tag-pass-bg);
  color: var(--tag-pass-fg);
}
.sim-pill-gate {
  background: var(--tag-gate-bg);
  color: var(--tag-gate-fg);
}

.sim-output {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  overflow-x: auto;
  max-height: 280px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Verification Matrix */
.matrix-wrap {
  margin-bottom: 24px;
}

.verify-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel-alt);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  font-size: 15px;
}

.verify-table th,
.verify-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
  overflow-wrap: break-word;
  word-break: normal;
}

.verify-table thead th {
  background: var(--panel);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.verify-table tbody tr:last-child td {
  border-bottom: none;
}

.num-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--tag-pass-bg);
  color: var(--tag-pass-fg);
  white-space: nowrap;
  margin-bottom: 4px;
}

.scope-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.scope-box {
  padding: 20px 22px;
  background: var(--panel-alt);
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.scope-box h3 {
  margin: 0 0 10px;
  font-size: 16.5px;
  font-weight: 600;
}

.scope-list {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 15px;
  color: var(--muted);
}
.scope-list strong {
  color: var(--text);
}
.scope-list code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}

.cmd-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cmd-pre {
  margin: 0;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.55;
  overflow-x: auto;
}

.raw-log {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel-alt);
  overflow: hidden;
}

.raw-log summary {
  padding: 14px 18px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
}
.raw-log summary::-webkit-details-marker {
  display: none;
}
.raw-log summary::after {
  content: "Show output";
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--link);
}
.raw-log[open] summary::after {
  content: "Hide output";
}
.raw-log summary:hover {
  background: var(--panel);
}

.raw-log pre {
  margin: 0;
  padding: 16px 18px;
  border-top: 1px solid var(--rule);
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  max-height: 420px;
  overflow: auto;
  white-space: pre;
}

/* Source Code Viewer */
.code-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.group-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--panel-alt);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.filter-pill:hover {
  border-color: var(--rule-strong);
}
.filter-pill[aria-pressed="true"] {
  background: var(--primary-bg);
  color: var(--primary-fg);
  border-color: var(--primary-bg);
}

.file-search {
  min-height: 44px;
  width: 260px;
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
}
.file-search::placeholder {
  color: var(--muted);
}

.mobile-file-select-wrap {
  display: none;
  margin-bottom: 12px;
}

.mobile-file-select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
}

.code-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
}

.file-tree {
  position: relative;
  border-right: 1px solid var(--rule);
  background: var(--panel-alt);
  max-height: 620px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-item {
  flex-shrink: 0;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.file-item:hover {
  background: var(--panel);
}
.file-item[aria-current="true"] {
  background: var(--tag-pass-bg);
  color: var(--tag-pass-fg);
  font-weight: 600;
}
.file-item-lines {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.file-item[aria-current="true"] .file-item-lines {
  color: var(--tag-pass-fg);
}

.code-viewer {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.code-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}

.code-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  min-width: 0;
}

.code-path {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.code-stats {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.code-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.code-scroll {
  overflow: auto;
  max-height: 560px;
  padding: 14px 0;
  background: var(--code-bg);
}

.code-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}

.code-table td {
  vertical-align: top;
}

.code-table td.code-ln {
  width: 52px;
  min-width: 46px;
  padding: 0 12px 0 10px;
  text-align: right;
  color: var(--muted);
  user-select: none;
  font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--rule);
}

.code-table td.code-line {
  padding: 0 18px 0 16px;
  white-space: pre;
  color: var(--text);
}

.tok-kw { color: var(--syn-kw); font-weight: 600; }
.tok-str { color: var(--syn-str); }
.tok-num { color: var(--syn-num); }
.tok-cmt { color: var(--syn-cmt); font-style: italic; }
.tok-key { color: var(--syn-key); }

/* Toast (non-green restrained palette) */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--link);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 28px 0 40px;
  font-size: 14.5px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Responsive breakpoints */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .arch-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .arch-step:not(:last-child)::after {
    display: none;
  }
  .impl-body-grid {
    grid-template-columns: 1fr;
  }
  .scope-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 959px) {
  .code-shell {
    grid-template-columns: 1fr;
  }
  .file-tree {
    display: none;
  }
  .mobile-file-select-wrap {
    display: block;
  }
}

@media (max-width: 820px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    padding: 5px 16px;
    min-height: 54px;
  }
  .header-nav {
    display: none;
  }
  .wrap {
    padding: 0 16px;
  }
  .hero {
    padding: 32px 0 28px;
  }
  .hero-lead {
    font-size: 16.5px;
  }
  .impl-tabs {
    grid-template-columns: 1fr;
  }
  .impl-panel {
    padding: 18px 16px;
  }
  .arch-flow {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .file-search {
    width: 100%;
  }

  /* Stacked card rows for verification table on narrow screens */
  .verify-table,
  .verify-table thead,
  .verify-table tbody,
  .verify-table th,
  .verify-table td,
  .verify-table tr {
    display: block;
  }
  .verify-table {
    background: transparent;
    border: none;
    overflow: visible;
  }
  .verify-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .verify-table tbody {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .verify-table tr {
    border: 1px solid var(--rule);
    border-radius: 10px;
    background: var(--panel-alt);
    padding: 14px 16px;
  }
  .verify-table td {
    padding: 8px 0;
    border-bottom: 1px solid var(--rule);
  }
  .verify-table td:first-child {
    padding-top: 0;
    font-weight: 600;
    font-size: 16px;
  }
  .verify-table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .verify-table td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .verify-table td:first-child::before {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-cta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-cta-row .btn {
    width: 100%;
  }
  .sim-buttons {
    flex-direction: column;
  }
  .sim-btn {
    width: 100%;
  }
  .theme-label {
    display: none;
  }
}
