/* page-level styles · dark cinematic */

/* ============ NAV ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--hairline);
  height: 56px;
}
.nav-inner { display: flex; align-items: center; height: 100%; gap: var(--space-7); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; }
.brand-glyph { width: 22px; height: 22px; }
.nav-links { display: flex; gap: var(--space-6); margin-left: auto; }
.nav-links a { color: var(--ink-soft); font-size: 14px; font-weight: 400; transition: color 150ms ease; white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: var(--space-4); }
.lang-toggle { display: inline-flex; border: 1px solid var(--hairline-strong); border-radius: 999px; overflow: hidden; font-family: var(--font-mono); font-size: 11px; }
.lang-toggle button { background: transparent; border: 0; padding: 5px 11px; color: var(--ink-muted); cursor: pointer; font-family: inherit; font-size: inherit; }
.lang-toggle button.on { background: var(--ink); color: var(--canvas); }
.gh-icon { width: 18px; height: 18px; color: var(--ink-soft); }
.gh-icon:hover { color: var(--ink); }
@media (max-width: 768px) { .nav-links { display: none; } }

/* ============ HERO ============ */
.hero-stage {
  position: relative;
  padding: 140px 0 var(--space-9);
  display: flex; align-items: center;
  overflow: hidden;
  isolation: isolate;
}
.hero-bg-grid {
  position: absolute; inset: 0; z-index: -2;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}
.hero-bg-glow {
  position: absolute; z-index: -1;
  width: 800px; height: 800px;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(90,159,212,0.18) 0%, transparent 60%);
  filter: blur(60px);
  pointer-events: none;
}
.hero-eyebrow-row { display: inline-flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-6); padding: 6px 14px 6px 10px; background: rgba(255,255,255,0.04); border: 1px solid var(--hairline); border-radius: 999px; }
.hero-eyebrow-row .badge { font-family: var(--font-mono); font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--accent-tint); color: var(--accent-soft); letter-spacing: 0.06em; }
.hero-eyebrow-row .text { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); letter-spacing: 0.06em; }
.hero-h1 { margin: 0; max-width: 1100px; }
.hero-h1 .line { display: block; }
.hero-h1 .line-2 { color: var(--ink-muted); }
.hero-lead { margin: var(--space-7) 0 var(--space-8); max-width: 640px; }
.hero-cta { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.hero-cta .meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); margin-left: var(--space-4); letter-spacing: 0.06em; }

/* Hero animated viz wrapper */
.hero-viz {
  position: relative;
  margin-top: var(--space-9);
  padding: var(--space-7);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005));
  border: 1px solid var(--hairline);
  border-radius: var(--radius-4);
  overflow: hidden;
}
.hero-viz::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  background: linear-gradient(135deg, transparent 30%, rgba(90,159,212,0.4) 50%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  padding: 1px; opacity: 0.5; pointer-events: none;
}
.hero-viz-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-5); padding-bottom: var(--space-4); border-bottom: 1px solid var(--hairline); }
.hero-viz-title { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); letter-spacing: 0.06em; }
.hero-viz-meta .live { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.06em; }
.hero-viz-meta .live .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse-soft 1.6s ease-in-out infinite; }
.hero-viz svg { display: block; width: 100%; height: auto; }

/* ============ BIG STAT BAND ============ */
.mega-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.mega-stats .ms { padding: var(--space-7) var(--space-6); border-right: 1px solid var(--hairline); }
.mega-stats .ms:last-child { border-right: 0; }
.mega-stats .ms-v { font-size: clamp(40px, 5vw, 64px); line-height: 1; letter-spacing: -0.03em; font-weight: 500; font-variation-settings: "opsz" 32; }
.mega-stats .ms-v .unit { font-size: 0.5em; color: var(--ink-muted); margin-left: 4px; }
.mega-stats .ms-l { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-top: var(--space-3); }
.mega-stats .ms-d { font-size: 14px; color: var(--ink-soft); margin-top: 8px; max-width: 220px; }
@media (max-width: 980px) { .mega-stats { grid-template-columns: repeat(2, 1fr); } .mega-stats .ms { border-right: 0; border-bottom: 1px solid var(--hairline); } .mega-stats .ms:nth-child(2n) { border-right: 0; } }

/* ============ SECTION ============ */
.section { padding: var(--space-11) 0; position: relative; }
.section-tight { padding: var(--space-9) 0; }
.section-eyebrow { margin-bottom: var(--space-6); }
.section-title { margin: 0 0 var(--space-5); max-width: 880px; }
.section-blurb { color: var(--ink-soft); max-width: 680px; }
.section-head { margin-bottom: var(--space-9); }
.section-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; }

/* ============ FEATURE TRIPTYCH (large 3-up) ============ */
.feature-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.feature-trio .ft {
  position: relative;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-4);
  display: flex; flex-direction: column;
  min-height: 460px;
  overflow: hidden;
  transition: border-color 250ms ease, transform 250ms ease;
}
.feature-trio .ft:hover { border-color: var(--hairline-strong); transform: translateY(-2px); }
.feature-trio .ft-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: var(--space-4); }
.feature-trio .ft-title { font-size: 28px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 500; margin: 0 0 var(--space-3); }
.feature-trio .ft-blurb { color: var(--ink-soft); font-size: 15px; line-height: 1.55; margin: 0 0 var(--space-6); }
.feature-trio .ft-viz { margin-top: auto; height: 200px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-3); padding: var(--space-4); }
.feature-trio .ft-viz svg { display: block; width: 100%; height: 100%; }
@media (max-width: 980px) { .feature-trio { grid-template-columns: 1fr; } }

/* ============ COMPARE 3-UP (large illustration cards) ============ */
.compare-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.compare-3 .cmp { padding: var(--space-7); background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-4); display: flex; flex-direction: column; gap: var(--space-5); position: relative; overflow: hidden; }
.compare-3 .cmp.is-pgrac { border-color: var(--accent-deep); background: linear-gradient(180deg, rgba(90,159,212,0.06), transparent 80%); }
.compare-3 .cmp.is-pgrac::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.compare-3 .cmp-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); letter-spacing: 0.1em; text-transform: uppercase; }
.compare-3 .cmp.is-pgrac .cmp-eyebrow { color: var(--accent); }
.compare-3 .cmp-title { font-size: 24px; font-weight: 500; letter-spacing: -0.01em; margin: 0; }
.compare-3 .cmp-svg { height: 200px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-3); }
.compare-3 .cmp-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.compare-3 .cmp-list li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; font-size: 14px; color: var(--ink-soft); align-items: baseline; }
.compare-3 .cmp-list .ic { color: var(--ink-faint); font-family: var(--font-mono); }
.compare-3 .cmp.is-pgrac .cmp-list .ic { color: var(--accent); }
.compare-3 .cmp-verdict { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); padding-top: var(--space-4); border-top: 1px solid var(--hairline); margin-top: auto; letter-spacing: 0.04em; }
.compare-3 .cmp.is-pgrac .cmp-verdict { color: var(--accent); }
@media (max-width: 980px) { .compare-3 { grid-template-columns: 1fr; } }

/* ============ TERMINAL / CODE BLOCKS ============ */
.terminal { background: var(--code-bg); border: 1px solid var(--hairline); border-radius: var(--radius-3); overflow: hidden; font-family: var(--font-mono); }
.terminal-bar { display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-4); border-bottom: 1px solid var(--hairline); background: rgba(255,255,255,0.02); }
.terminal-bar .dots { display: inline-flex; gap: 6px; }
.terminal-bar .dots i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255,255,255,0.18); display: inline-block; }
.terminal-bar .label { font-size: 11px; color: var(--ink-muted); letter-spacing: 0.06em; }
.terminal-body { padding: var(--space-5); font-size: 13.5px; line-height: 1.7; color: var(--code-text); }
.terminal-body .prompt { color: var(--accent); }
.terminal-body .out { color: var(--ink-soft); }
.terminal-body .ok { color: var(--status-measured); }
.terminal-body .kw { color: var(--code-keyword); }
.terminal-body .str { color: var(--code-string); }
.terminal-body .com { color: var(--code-comment); }
.terminal-body .hl { color: var(--code-highlight); }

/* parallel terminals (3-up wow) */
.terminal-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.terminal-trio .label-row { display: flex; justify-content: space-between; padding: 0 var(--space-3); margin-bottom: var(--space-3); }
.terminal-trio .label-row .node { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.06em; }
.terminal-trio .label-row .ts { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); }
@media (max-width: 980px) { .terminal-trio { grid-template-columns: 1fr; } }

/* ============ STORY ROWS (alternating image/text) ============ */
.story-row { display: grid; grid-template-columns: 1fr 1.1fr; gap: var(--space-9); align-items: center; padding: var(--space-9) 0; }
.story-row.flip { grid-template-columns: 1.1fr 1fr; }
.story-row.flip .story-text { order: 2; }
.story-row.flip .story-viz { order: 1; }
.story-text .num { font-family: var(--font-mono); font-size: 13px; color: var(--accent); letter-spacing: 0.1em; margin-bottom: var(--space-4); }
.story-text h3 { font-size: clamp(28px, 3vw, 40px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 500; margin: 0 0 var(--space-5); }
.story-text p { color: var(--ink-soft); font-size: 17px; line-height: 1.55; margin: 0 0 var(--space-4); max-width: 520px; }
.story-text .pts { display: flex; flex-direction: column; gap: 12px; margin-top: var(--space-6); }
.story-text .pts .pt { display: flex; gap: 14px; font-size: 14px; color: var(--ink-soft); align-items: baseline; }
.story-text .pts .pt::before { content: ""; flex-shrink: 0; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin-top: 9px; box-shadow: 0 0 8px var(--accent-glow); }
.story-viz { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-4); padding: var(--space-6); aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.story-viz svg { display: block; width: 100%; height: 100%; }
@media (max-width: 980px) { .story-row, .story-row.flip { grid-template-columns: 1fr; gap: var(--space-6); } .story-row.flip .story-text { order: 1; } .story-row.flip .story-viz { order: 2; } }

/* ============ MARQUEE / SCROLLER ============ */
.marquee { overflow: hidden; mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent); -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent); }
.marquee-track { display: flex; gap: var(--space-7); animation: marquee 40s linear infinite; }
.marquee-track > * { flex-shrink: 0; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ============ FOOTER ============ */
.footer { border-top: 1px solid var(--hairline); padding: var(--space-9) 0 var(--space-7); margin-top: var(--space-11); position: relative; overflow: hidden; }
.footer-mark { font-size: clamp(80px, 14vw, 200px); font-weight: 500; letter-spacing: -0.04em; line-height: 1; color: var(--ink); opacity: 0.06; user-select: none; pointer-events: none; margin-bottom: var(--space-7); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--space-7); }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer .col h4 { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500; margin: 0 0 var(--space-4); }
.footer .col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer .col a { color: var(--ink-soft); font-size: 14px; }
.footer .col a:hover { color: var(--ink); }
.footer .brand-tag { color: var(--ink-soft); font-size: 13px; max-width: 280px; line-height: 1.55; }
.footer-bottom { display: flex; justify-content: space-between; padding-top: var(--space-5); margin-top: var(--space-7); border-top: 1px solid var(--hairline); color: var(--ink-muted); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }

/* ============ PAGE-SPECIFIC (preserved/adapted) ============ */
.metric-table { width: 100%; border-collapse: collapse; }
.metric-table th { text-align: left; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.08em; padding: var(--space-4); border-bottom: 1px solid var(--hairline); }
.metric-table td { padding: var(--space-4); border-bottom: 1px solid var(--hairline); font-size: 14.5px; vertical-align: top; color: var(--ink-soft); }
.metric-table .m-label { color: var(--ink); font-weight: 500; }
.metric-table tr:hover td { background: rgba(255,255,255,0.02); }

.diagram-frame { background: var(--surface); }
.diagram-frame svg { display: block; width: 100%; height: auto; }

/* Topology legend */
.topology-wrap { width: 100%; }
.topology-legend { display: flex; flex-wrap: wrap; gap: var(--space-5); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--hairline); margin-top: var(--space-3); }
.topology-legend .lg { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); letter-spacing: 0.04em; }
.topology-legend .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); display: inline-block; }
.topology-legend .dot.ring { background: transparent; border: 1px solid var(--ink-muted); }
.topology-legend .line { width: 22px; height: 0; border-top: 1.5px solid var(--ink-muted); display: inline-block; }
.topology-legend .line.solid { border-top-style: solid; border-top-color: var(--ink-soft); }
.topology-legend .line.dashed { border-top-style: dashed; border-top-color: var(--accent); }
.topology-legend .line.warm { border-top-style: dashed; border-top-color: #c9a878; }

/* feat grid (Features page) */
body[data-page="features"] .feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
@media (max-width: 980px) { body[data-page="features"] .feat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { body[data-page="features"] .feat-grid { grid-template-columns: 1fr; } }
.feat-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-3); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); min-height: 240px; transition: border-color 200ms ease, transform 200ms ease; }
.feat-card:hover { border-color: var(--hairline-strong); transform: translateY(-2px); }
.feat-card .tier-badge { font-family: var(--font-mono); font-size: 10.5px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; }
.feat-card.tier-A .tier-badge { color: var(--ink-soft); }
.feat-card.tier-B .tier-badge { color: var(--ink-muted); }
.feat-card .feat-title { font-size: 19px; font-weight: 500; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
.feat-card .feat-line { color: var(--ink-soft); font-size: 14px; line-height: 1.55; flex: 1; }
.feat-card .feat-meta { display: flex; justify-content: space-between; align-items: baseline; padding-top: var(--space-3); border-top: 1px solid var(--hairline); font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.feat-card .feat-meta .arrow { color: var(--accent); }

/* AD grid (Architecture) */
.ad-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
@media (max-width: 768px) { .ad-grid { grid-template-columns: 1fr; } }
.ad-card { background: var(--surface); border: 1px solid var(--hairline); border-left: 2px solid var(--accent); border-radius: var(--radius-3); padding: var(--space-5); }
.ad-card .ad-label { font-family: var(--font-mono); font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; display: block; margin-bottom: 8px; }
.ad-card .ad-title { font-size: 17px; font-weight: 500; color: var(--ink); margin: 0 0 8px; line-height: 1.4; }
.ad-card .ad-body { color: var(--ink-soft); font-size: 14px; line-height: 1.6; margin: 0; }

/* roadmap rows (legacy support) */
.roadmap-mini { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-4); padding: var(--space-7); }
.roadmap-svg { display: flex; flex-direction: column; gap: var(--space-3); }
.rm-row { display: grid; grid-template-columns: 32px 1fr 60px; align-items: center; gap: var(--space-4); }
.rm-num { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); text-align: right; }
.rm-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); margin-bottom: 8px; }
.rm-label { font-size: 15px; color: var(--ink); font-weight: 500; }
.rm-detail { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.rm-track { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; border: 1px solid var(--hairline); }
.rm-fill { height: 100%; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); transition: width 800ms ease-out; box-shadow: 0 0 12px var(--accent-glow); }
.rm-pct { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); text-align: right; }
.rm-pct.active { color: var(--accent); }

.stage-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid var(--hairline-strong); background: var(--surface); border-radius: 999px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em; }
.stage-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--status-measured); display: inline-block; box-shadow: 0 0 8px var(--status-measured); }

/* legacy aliases */
.compose-list { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { font-family: var(--font-mono); font-size: 12px; padding: 7px 14px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 999px; color: var(--ink-soft); letter-spacing: 0.04em; transition: border-color 200ms ease, color 200ms ease; }
.chip:hover { border-color: var(--accent-deep); color: var(--accent-soft); }

.tri-compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.tri-compare .col { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-3); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.tri-compare .col.is-pgrac { border-color: var(--accent-deep); background: linear-gradient(180deg, rgba(90,159,212,0.06), transparent 80%); }
.tri-compare .col-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.tri-compare .col.is-pgrac .col-eyebrow { color: var(--accent); }
.tri-compare .col-title { font-size: 22px; font-weight: 500; margin: 0; letter-spacing: -0.01em; }
.tri-compare .col-svg { height: 180px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-2); }
.tri-compare .verdict { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); padding-top: var(--space-3); border-top: 1px solid var(--hairline); margin-top: auto; }
.tri-compare .col.is-pgrac .verdict { color: var(--accent); }
@media (max-width: 980px) { .tri-compare { grid-template-columns: 1fr; } }

/* ============ MANUAL READER (Oracle 3-col layout) ============ */
.manual-shell { padding: 80px 0 var(--space-8); }
.manual-shell-inner {
  max-width: 1440px; margin: 0 auto; padding: 0 var(--space-5);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: var(--space-6);
}
@media (max-width: 1200px) {
  .manual-shell-inner { grid-template-columns: 240px minmax(0, 1fr); }
  .manual-toc-right { display: none; }
}
@media (max-width: 1024px) {
  .manual-shell-inner { grid-template-columns: 1fr; }
  .manual-aside { position: static !important; max-height: none !important; }
}

/* breadcrumb */
.manual-breadcrumb {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-muted); letter-spacing: 0.06em;
  margin-bottom: var(--space-5);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.manual-breadcrumb a { color: var(--ink-muted); text-decoration: none; transition: color 160ms ease; }
.manual-breadcrumb a:hover { color: var(--accent); }
.manual-breadcrumb .sep { color: var(--ink-dim); }
.manual-breadcrumb .current { color: var(--ink-soft); }

/* right in-page TOC */
.manual-toc-right {
  position: sticky; top: 100px;
  max-height: calc(100vh - 120px); overflow-y: auto;
  padding-left: var(--space-3);
  border-left: 1px solid var(--line);
}
.manual-toc-right ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.manual-toc-right li { margin: 0; }
.manual-toc-right li a {
  display: block; padding: 6px 10px; border-radius: var(--radius-2);
  color: var(--ink-muted); font-size: 13px; line-height: 1.4;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease;
}
.manual-toc-right li a:hover { color: var(--ink); background: var(--surface-2); }
.manual-toc-right li.lvl-3 a { padding-left: 22px; font-size: 12px; }

/* related topics */
.manual-related {
  margin-top: var(--space-7);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
}
.manual-related ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.manual-related a { color: var(--accent); text-decoration: none; font-size: 14px; border-bottom: 1px solid transparent; }
.manual-related a:hover { border-bottom-color: var(--accent-soft, rgba(90,159,212,0.30)); }

/* Oracle-style callout boxes (Note / Tip / Caution / Important / See Also) */
.manual-prose .callout {
  margin: var(--space-4) 0;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 0 var(--radius-2) var(--radius-2) 0;
  background: var(--surface-2);
}
.manual-prose .callout > .label {
  display: inline-block;
  font-family: var(--font-mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.18em;
  margin-bottom: 6px;
  color: var(--ink-muted);
}
.manual-prose .callout > p:last-child { margin-bottom: 0; }
.manual-prose .callout-note     { border-left-color: var(--accent); }
.manual-prose .callout-note .label     { color: var(--accent); }
.manual-prose .callout-tip      { border-left-color: var(--good, #7fb86b); }
.manual-prose .callout-tip .label      { color: var(--good, #7fb86b); }
.manual-prose .callout-caution  { border-left-color: var(--warn, #d4a05a); }
.manual-prose .callout-caution .label  { color: var(--warn, #d4a05a); }
.manual-prose .callout-important{ border-left-color: var(--danger, #d4615a); }
.manual-prose .callout-important .label{ color: var(--danger, #d4615a); }
.manual-prose .callout-seealso  { border-left-color: var(--ink-soft); }
.manual-prose .callout-seealso .label  { color: var(--ink-soft); }

/* Figure caption (Figure 1-1, etc.) */
.manual-prose figure {
  margin: var(--space-5) 0;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
}
.manual-prose figure > img,
.manual-prose figure > svg { width: 100%; height: auto; display: block; }
.manual-prose figcaption {
  margin-top: var(--space-3);
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--ink-muted); letter-spacing: 0.04em;
  text-align: center;
}
.manual-prose figcaption strong { color: var(--accent); font-weight: 500; }

/* Section numbering hooks (for Step 2.2 port script: it can prefix
   .num-section spans inside h2/h3 with 1.1 / 1.1.1 etc.) */
.manual-prose .num-section {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  margin-right: 12px;
  font-weight: 400;
}

/* sidebar */
.manual-aside {
  position: sticky; top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: var(--space-3);
}
.manual-sidebar .eyebrow { font-family: var(--font-mono); font-size: 11px; }
.manual-toc { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.manual-toc li { margin: 0; }
.manual-toc li.is-appendix { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.manual-toc a {
  display: grid; grid-template-columns: 28px 1fr; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-2);
  color: var(--ink-soft); font-size: 14px; line-height: 1.4;
  text-decoration: none; transition: background 160ms ease, color 160ms ease;
}
.manual-toc a:hover { background: var(--surface-2); color: var(--ink); }
.manual-toc a .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); text-align: right; padding-top: 1px; }
.manual-toc a .t { color: inherit; }
.manual-toc li.is-current a { background: var(--accent-bg, rgba(90,159,212,0.10)); color: var(--ink); border-left: 2px solid var(--accent); padding-left: 10px; }
.manual-toc li.is-current a .n { color: var(--accent); }
.manual-lang-link { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); text-decoration: none; letter-spacing: 0.04em; text-transform: uppercase; }
.manual-lang-link:hover { color: var(--accent); }

/* article */
.manual-article { min-width: 0; }
.manual-header { margin-bottom: var(--space-7); padding-bottom: var(--space-5); border-bottom: 1px solid var(--line); }
.manual-title { margin: 0; max-width: 800px; }

/* prose */
.manual-prose {
  max-width: 760px;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink-soft);
}
.manual-prose > * + * { margin-top: var(--space-4); }
.manual-prose h2 {
  margin-top: var(--space-7); margin-bottom: var(--space-4);
  font-size: 28px; font-weight: 500; letter-spacing: -0.01em;
  color: var(--ink); padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}
.manual-prose h3 {
  margin-top: var(--space-6); margin-bottom: var(--space-3);
  font-size: 20px; font-weight: 500; color: var(--ink);
}
.manual-prose h4 {
  margin-top: var(--space-5); margin-bottom: var(--space-3);
  font-size: 16px; font-weight: 500; color: var(--ink);
  font-family: var(--font-mono); letter-spacing: 0.02em;
}
.manual-prose p { margin: 0; }
.manual-prose strong { color: var(--ink); font-weight: 500; }
.manual-prose em { color: var(--ink); font-style: italic; }
.manual-prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft, rgba(90,159,212,0.30)); }
.manual-prose a:hover { border-bottom-color: var(--accent); }
.manual-prose ul, .manual-prose ol { padding-left: 24px; margin: var(--space-3) 0; }
.manual-prose li { margin: 6px 0; }
.manual-prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--ink);
}
.manual-prose pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: var(--space-4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  margin: var(--space-4) 0;
}
.manual-prose pre code { background: none; border: none; padding: 0; font-size: inherit; }
.manual-prose blockquote {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-5);
  border-left: 2px solid var(--accent);
  background: var(--accent-bg, rgba(90,159,212,0.05));
  color: var(--ink-soft);
  border-radius: 0 var(--radius-2) var(--radius-2) 0;
}
.manual-prose blockquote p { margin: 0; }
.manual-prose table {
  width: 100%; border-collapse: collapse;
  margin: var(--space-4) 0;
  font-size: 14px;
}
.manual-prose th, .manual-prose td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.manual-prose th {
  background: var(--surface-2);
  font-weight: 500; color: var(--ink);
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.manual-prose hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-7) 0; }
.manual-prose img { max-width: 100%; border-radius: var(--radius-2); }
.manual-prose .aside, .manual-prose aside {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-4) 0;
}

/* prev/next */
.manual-prevnext {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4);
}
.manual-prevnext-card {
  display: block;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  text-decoration: none;
  transition: border-color 200ms ease, background 200ms ease;
}
.manual-prevnext-card:hover { border-color: var(--accent-soft, rgba(90,159,212,0.30)); background: var(--surface-2); }
.manual-prevnext-card.right { text-align: right; }
.manual-prevnext-card .eyebrow {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.manual-prevnext-card .t { color: var(--ink); font-size: 15px; line-height: 1.4; }

/* ============ ADR (Architecture Decision Record) cards ============ */
.adr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
@media (max-width: 1024px) { .adr-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .adr-grid { grid-template-columns: 1fr; } }
.adr-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-3);
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: flex; flex-direction: column;
  gap: var(--space-3);
}
.adr-svg {
  margin: calc(var(--space-4) * -1) calc(var(--space-5) * -1) 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  overflow: hidden;
}
.adr-svg svg { display: block; }
.adr-label {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--accent); text-transform: uppercase; letter-spacing: 0.18em;
  margin-top: var(--space-3);
}
.adr-title {
  font-size: 17px; font-weight: 500;
  color: var(--ink); margin: 0;
  line-height: 1.4;
}
.adr-body {
  color: var(--ink-soft); font-size: 13.5px; line-height: 1.65;
  margin: 0;
}
.adr-link {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-muted);
  text-decoration: none;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: auto;
  transition: color 160ms ease;
}
.adr-link:hover { color: var(--accent); }
.adr-link .btn-arrow { display: inline-block; margin-left: 2px; }

/* ============================================================
 * Mobile / tablet — hamburger menu + drawer + visual tuning
 * ============================================================ */

/* Hamburger button (hidden on desktop) */
.nav-hamburger {
  display: none;
  width: 44px; height: 44px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-2);
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
  margin-left: 4px;
  transition: background 160ms ease, border-color 160ms ease;
}
.nav-hamburger:hover { background: var(--surface2); border-color: var(--accent); }
.nav-hamburger svg { width: 22px; height: 22px; }
.nav-hamburger svg line { transition: transform 220ms ease, opacity 160ms ease; transform-origin: center; }
body.nav-open .nav-hamburger .hb-l1 { transform: translate(0, 5px) rotate(45deg); }
body.nav-open .nav-hamburger .hb-l2 { opacity: 0; }
body.nav-open .nav-hamburger .hb-l3 { transform: translate(0, -5px) rotate(-45deg); }

/* Drawer (off-canvas) */
.nav-drawer {
  position: fixed; inset: 0;
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 80px var(--space-5) var(--space-7);
}
body.nav-open .nav-drawer { transform: translateX(0); }
body.nav-open { overflow: hidden; }

.nav-drawer-inner {
  display: flex; flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
}
.nav-drawer-links {
  display: flex; flex-direction: column;
  gap: 2px;
  padding-top: var(--space-4);
}
.nav-drawer-links a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 4px;
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  transition: color 160ms ease, padding-left 160ms ease;
}
.nav-drawer-links a:hover, .nav-drawer-links a.active { color: var(--accent); padding-left: 8px; }
.nav-drawer-links a .arrow {
  font-family: var(--font-mono); font-size: 16px;
  color: var(--ink-muted);
  transition: transform 160ms ease, color 160ms ease;
}
.nav-drawer-links a:hover .arrow, .nav-drawer-links a.active .arrow { color: var(--accent); transform: translateX(4px); }

.nav-drawer-foot { margin-top: auto; padding-top: var(--space-7); }
.nav-drawer-gh {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-2);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease;
}
.nav-drawer-gh:hover { border-color: var(--accent); color: var(--accent); }

/* Show hamburger / hide drawer on desktop */
@media (max-width: 768px) {
  .nav-hamburger { display: inline-flex; }
  .nav-right .nav-gh { display: none; }  /* dedupe — drawer has its own GH link */
}
@media (min-width: 769px) {
  .nav-drawer { display: none !important; }
}

/* Compare / Cache Fusion metric tables: horizontal scroll on narrow screens.
 * The wrap div has inline overflow:hidden so we need !important here. */
@media (max-width: 720px) {
  .metric-table { min-width: 640px; }
  .metric-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Touch target accessibility — bump button/link minimum hit zones on mobile */
@media (max-width: 768px) {
  .btn { min-height: 44px; }
  .lang-toggle button { min-height: 36px; min-width: 36px; padding: 6px 10px; }
  .cmp-list li, .pts .pt { padding-top: 2px; padding-bottom: 2px; }
}

/* Hero typography: linear clamp from 320px to 1440px */
@media (max-width: 768px) {
  .t-mega { font-size: clamp(40px, 11vw, 84px); line-height: 1.04; letter-spacing: -0.02em; }
  .t-hero { font-size: clamp(32px, 8.5vw, 64px); line-height: 1.08; }
  .t-display { font-size: clamp(28px, 7.2vw, 56px); }
  .t-h2 { font-size: clamp(22px, 5.6vw, 36px); }
  .t-lead { font-size: clamp(15px, 4.2vw, 19px); line-height: 1.55; }
  .hero-eyebrow-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .hero-cta { flex-wrap: wrap; gap: var(--space-3); }
  .hero-cta .meta { width: 100%; }
}

/* Mega-stats: single column on iPhone SE / small phones */
@media (max-width: 480px) {
  .mega-stats {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .mega-stats .ms {
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
    padding: var(--space-4) 0;
  }
  .mega-stats .ms:last-child { border-bottom: 0; }
  .mega-stats .ms-v { font-size: clamp(36px, 9vw, 56px); }
}

/* Footer: single column on phones */
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-5); }
  .footer-mark { font-size: clamp(60px, 22vw, 140px); }
}

/* Wide SVG diagrams (viewBox ≥ 800): allow horizontal swipe inside their frame */
@media (max-width: 720px) {
  .diagram-frame {
    overflow: hidden;  /* keep the frame rounded */
  }
  .diagram-frame .diagram-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* hint that there's more content */
    background:
      linear-gradient(to right, var(--surface) 30%, transparent),
      linear-gradient(to left, var(--surface) 30%, transparent) right,
      linear-gradient(to right, rgba(90,159,212,0.18), transparent 24%),
      linear-gradient(to left,  rgba(90,159,212,0.18), transparent 24%) right;
    background-repeat: no-repeat;
    background-size: 24px 100%, 24px 100%, 8px 100%, 8px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  .diagram-frame .diagram-body > svg {
    min-width: 720px;  /* keep readable text size by enforcing min-width */
    display: block;
  }
  /* Home page in-flow SVGs (not in .diagram-frame) — keep them inline-scrollable too */
  .story-row .story-viz {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .story-row .story-viz > svg { min-width: 100%; max-width: 100%; }  /* mini SVGs are 400×300, small enough */
}

/* Same-answer diagram (1200×560) — let it scroll too */
@media (max-width: 720px) {
  section.section .reveal > svg[aria-label*="answer"],
  section.section .reveal[style*="overflow"] > svg {
    min-width: 1000px;
  }
  section.section .reveal {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Story rows on mobile: reduce viz height so text stays priority */
@media (max-width: 600px) {
  .story-viz { max-height: 320px; }
  .story-viz svg { max-height: 320px; height: 100%; width: auto !important; }
}

/* Architecture process-model annotation: keep the SVG min-width to stay legible */
@media (max-width: 720px) {
  section.section .diagram-body > svg[aria-label*="process"],
  section.section .diagram-body > svg[aria-label*="进程"] {
    min-width: 900px;
  }
}

/* Section padding tighter on phones */
@media (max-width: 480px) {
  .section { padding-block: clamp(48px, 12vw, 80px); }
  .section-tight { padding-block: clamp(32px, 8vw, 56px); }
  .hero-stage { padding-top: 96px !important; padding-bottom: 32px !important; }
}

/* Nav: shrink padding on phones, keep brand visible */
@media (max-width: 480px) {
  .nav-inner { padding-block: 10px; }
  .nav-right { gap: 6px; }
  .lang-toggle { font-size: 12px; }
}

/* Hero topology (1200×520 SVG) — allow horizontal swipe on phones */
@media (max-width: 720px) {
  .hero-viz { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hero-viz > svg { min-width: 900px; }
}

/* Hero lead in announcement mode — bigger font, single line on wide screens */
.hero-lead-wide {
  max-width: 1100px !important;
  font-size: clamp(17px, 1.7vw, 24px);
  line-height: 1.45;
  font-weight: 500;
  color: var(--ink) !important;
}
@media (min-width: 920px) {
  .hero-lead-wide { white-space: nowrap; }
}
