/* ==========================================================================
   2026 FRONTIER AI EVALUATION SURVEY | EDITORIAL RESEARCH MONOGRAPH STYLESHEET
   Pure white canvas, calibrated figure proportions, 60fps compositor motion.
   ========================================================================== */

:root {
  --bg: #FFFFFF;
  --surface: #F8FAFC;
  --surface-2: #F1F5F9;
  --border: #E5E8EE;
  --border-strong: #CBD5E1;

  --ink: #111827;
  --ink-2: #2E3440;
  --muted: #5B6472;
  --faint: #8792A2;

  /* Restrained semantic palette (argument weight only, zero decoration) */
  --accent: #1F4E79;
  --accent-hover: #143656;
  --accent-soft: #F0F5FA;
  --rust: #A84A32;
  --rust-soft: #FDF3F0;
  --sage: #2D6A5B;
  --sage-soft: #EDF6F4;
  --amber: #8C6239;
  --amber-soft: #FAF5EE;

  /* Zero-dependency native CJK/Latin typography stacks */
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Harmonized 3-tier editorial width rhythm (Lil'Log-inspired reading measure) */
  --prose-w: 724px;
  --fig-w: 840px;
  --wide-w: 980px;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.025), 0 4px 16px rgba(15, 23, 42, 0.02);
  --shadow-float: 0 8px 28px rgba(15, 23, 42, 0.12);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

[id] {
  scroll-margin-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.84;
  overflow-x: clip;
  font-feature-settings: "kern" 1;
}

/* ==========================================================================
   STICKY TRANSLUCENT HEADER + HARDWARE-ACCELERATED READING PROGRESS BAR
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  border-bottom: 1px solid rgba(229, 232, 238, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header-inner {
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.site-brand {
  text-decoration: none;
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  transition: opacity 0.15s ease;
}

.site-brand:hover { opacity: 0.78; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.header-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 13.6px;
  font-weight: 500;
  position: relative;
  transition: color 0.15s ease;
}

.header-nav a:hover {
  color: var(--ink);
}

.header-nav a.is-active {
  color: var(--accent);
  font-weight: 600;
}

.header-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.read-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--sage) 100%);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
  pointer-events: none;
}

/* ==========================================================================
   SINGLE-COLUMN EDITORIAL FLOW
   ========================================================================== */
main.page {
  padding: 0 20px 88px;
}

.prose {
  max-width: var(--prose-w);
  margin: 0 auto;
  min-width: 0;
}

.post-header {
  max-width: var(--prose-w);
  margin: 42px auto 24px;
}

.post-header h1 {
  font-size: clamp(27px, 3.6vw, 36px);
  font-weight: 750;
  line-height: 1.26;
  letter-spacing: -0.022em;
  color: var(--ink);
  margin: 0 0 14px;
}

.post-meta {
  font-size: 13.4px;
  color: var(--muted);
  margin: 0 0 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-variant-numeric: tabular-nums;
}

.post-meta span {
  white-space: nowrap;
}

.post-lead {
  font-size: 15.6px;
  line-height: 1.86;
  color: var(--ink-2);
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* Compact 2-Column Editorial Table of Contents */
details.toc-box {
  max-width: var(--prose-w);
  margin: 22px auto 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 20px 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

details.toc-box summary {
  cursor: pointer;
  font-size: 13.8px;
  font-weight: 650;
  color: var(--ink);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

details.toc-box summary::-webkit-details-marker { display: none; }

details.toc-box summary::before {
  content: "▸";
  font-size: 12px;
  color: var(--accent);
  display: inline-block;
  transition: transform 0.18s var(--ease-out);
}

details.toc-box[open] summary::before {
  transform: rotate(90deg);
}

.toc-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 0.91fr 1.09fr;
  gap: 12px 16px;
}

.toc-list > li { margin: 0; min-width: 0; }

.toc-list a {
  text-decoration: none;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.52;
  transition: color 0.14s ease;
}

.toc-list a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.toc-list .toc-main {
  font-weight: 650;
  color: var(--ink);
  display: inline-block;
  margin-bottom: 3px;
}

.toc-sub {
  list-style: none;
  margin: 2px 0 0;
  padding-left: 14px;
  border-left: 1.5px solid var(--border);
}

.toc-sub li { margin: 3px 0; }
.toc-sub a { font-size: 12.8px; color: var(--muted); }

.toc-foot {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
}

.toc-foot a {
  font-size: 12.8px;
  font-weight: 600;
  color: var(--muted);
}

.toc-foot a.toc-dir-cta {
  margin-left: auto;
  color: var(--accent);
}

/* ==========================================================================
   CHAPTERS, HEADINGS & PROSE
   ========================================================================== */
article.chapter {
  margin: 0 auto 58px;
}

article.chapter + article.chapter {
  border-top: 1px solid var(--border);
  padding-top: 46px;
}

.chapter h2 {
  max-width: var(--prose-w);
  margin: 0 auto 16px;
  font-size: clamp(22px, 2.5vw, 26px);
  font-weight: 750;
  line-height: 1.34;
  letter-spacing: -0.018em;
  color: var(--ink);
  scroll-margin-top: 76px;
}

.chapter-lead {
  max-width: var(--prose-w);
  margin: 0 auto 24px;
  font-size: 15.4px;
  line-height: 1.84;
  color: var(--muted);
}

.prose h3 {
  font-size: 19.5px;
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 38px 0 13px;
  scroll-margin-top: 76px;
}

.prose h4 {
  font-size: 16.4px;
  font-weight: 680;
  color: var(--ink);
  margin: 26px 0 9px;
  line-height: 1.45;
  scroll-margin-top: 76px;
}

.prose h5 {
  font-size: 14.8px;
  font-weight: 650;
  color: var(--ink);
  margin: 20px 0 7px;
  line-height: 1.48;
  letter-spacing: -0.005em;
}

/* Lil'Log-style hover heading permalink (#) */
.h-anchor {
  margin-left: 7px;
  color: var(--faint);
  text-decoration: none !important;
  font-weight: 400;
  font-size: 0.82em;
  opacity: 0;
  transition: opacity 0.14s ease, color 0.14s ease;
}

h2:hover .h-anchor,
h3:hover .h-anchor,
h4:hover .h-anchor,
.h-anchor:focus {
  opacity: 0.85;
}

.h-anchor:hover {
  color: var(--accent);
  opacity: 1;
}

.prose p {
  font-size: 15.6px;
  line-height: 1.9;
  color: var(--ink-2);
  margin: 0 0 17px;
  overflow-wrap: break-word;
}

.prose blockquote {
  margin: 18px 0 20px;
  padding: 11px 16px;
  background: var(--surface);
  border-left: 3px solid var(--border-strong);
  border-radius: 0 6px 6px 0;
  color: var(--ink-2);
  font-size: 14.6px;
  line-height: 1.8;
}

.prose blockquote p {
  font-size: 14.6px;
  line-height: 1.8;
  margin: 0 0 8px;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose blockquote.accent-quote {
  border-left-color: var(--accent);
  background: #F7FAFD;
}

.prose .note-aside {
  font-size: 13.8px;
  line-height: 1.76;
  color: var(--muted);
  margin: -4px 0 16px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.prose strong { color: var(--ink); font-weight: 640; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(31, 78, 121, 0.32);
  text-underline-offset: 3px;
  transition: color 0.14s ease, text-decoration-color 0.14s ease;
}

.prose a:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-hover);
}

/* Inline clickable link that opens the dossier drawer */
.prose a.bench-ref {
  text-decoration: none;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px dashed rgba(31, 78, 121, 0.45);
  cursor: pointer;
  padding-bottom: 0.5px;
  transition: color 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.prose a.bench-ref:hover {
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-bottom-style: solid;
  border-bottom-color: var(--accent-hover);
  border-radius: 2px;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--surface-2);
  padding: 1.5px 5.5px;
  margin: 0 1px;
  border-radius: 4px;
  color: var(--ink);
  border: 1px solid rgba(203, 213, 225, 0.45);
}

.prose ul, .prose ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--ink-2);
}

.prose li {
  font-size: 15.4px;
  line-height: 1.84;
  margin-bottom: 9px;
}

/* Inline Toggleable Footnotes */
.sn-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
  color: var(--accent);
  vertical-align: super;
  line-height: 1;
  margin: 0 2px;
  cursor: pointer;
  user-select: none;
}

.sn-ref::before { content: "["; }
.sn-ref::after  { content: "]"; }
.sn-ref:hover { text-decoration: underline; }

.sidenote {
  display: none;
  margin: 10px 0 16px;
  padding: 11px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 13.4px;
  line-height: 1.7;
  color: var(--muted);
}

.sidenote.open { display: block; }
.sidenote .sn-num { font-family: var(--font-mono); font-weight: 650; color: var(--ink); margin-right: 5px; }

/* Callout */
.callout {
  max-width: var(--prose-w);
  margin: 22px auto;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 14.6px;
  line-height: 1.78;
  color: var(--ink-2);
}

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

/* Case Study Structured Header (quiet academic monograph divider) */
.case-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 34px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.case-head h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 680;
  color: var(--ink);
  letter-spacing: -0.012em;
}

.case-meta-tag {
  font-family: var(--font-mono);
  font-size: 11.4px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5px 7px;
  font-variant-numeric: tabular-nums;
}

/* Code Block */
.code-tree {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  background: #F8FAFC;
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 14px 0;
}

.code-tree .cm { color: #64748B; }
.code-tree .hi-blue { color: var(--accent); font-weight: 600; }
.code-tree .hi-red { color: var(--rust); font-weight: 600; }
.code-tree .hi-sage { color: var(--sage); font-weight: 600; }

.case-box .code-tree {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11.7px;
  line-height: 1.62;
  padding: 10px 12px;
  margin: 10px 0;
  background: #FFFFFF;
}

/* Quiet Case Strip */
.case-strip {
  max-width: var(--prose-w);
  margin: 20px auto 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.case-box {
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ink);
  border-radius: 8px;
  min-width: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.case-box:hover {
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.045);
}

.case-box.rust { border-left-color: var(--rust); }
.case-box.accent { border-left-color: var(--accent); }
.case-box.sage { border-left-color: var(--sage); }

.case-label {
  font-size: 13.2px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 7px;
  line-height: 1.45;
}

.case-box p {
  font-size: 13.7px;
  line-height: 1.74;
  margin: 0 0 8px;
  color: var(--ink-2);
}

.case-box p:last-child { margin-bottom: 0; }

/* ==========================================================================
   ELEVATED EDITORIAL FIGURES, CALIBRATED PROPORTIONS & CLICK-TO-ZOOM
   ========================================================================== */
.figure-card {
  max-width: var(--fig-w);
  margin: 28px auto 36px;
  padding: 20px 24px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.figure-card.full {
  max-width: var(--wide-w);
}

.fig-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #F1F4F8;
}

.fig-header > div:first-child {
  flex: 1 1 380px;
  min-width: 0;
}

.fig-title {
  font-size: 15.6px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.42;
  letter-spacing: -0.01em;
}

.fig-sub {
  font-size: 12.7px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.54;
}

.fig-caption {
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px solid #F1F4F8;
  font-size: 12px;
  line-height: 1.62;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-variant-numeric: tabular-nums;
}

/* Harmonized image framing with subtle zoom cue */
.fig-img-wrap {
  position: relative;
  background: #FBFCFD;
  border: 1px solid #EAEEF4;
  border-radius: 8px;
  padding: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.fig-img-wrap:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.045);
}

.fig-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: zoom-in;
  transition: transform 0.22s var(--ease-out);
}

.fig-img-wrap.is-zoomable::after {
  content: "点击查看大图";
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(17, 24, 39, 0.72);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.fig-img-wrap.is-zoomable:hover::after {
  opacity: 1;
  transform: translateY(0);
}

html[lang="en"] .fig-img-wrap.is-zoomable::after {
  content: "Click to enlarge";
}

/* Calibrated aspect-ratio height constraints (prevents vertical monolith bloat!) */
.fig-img-wrap.media-wide {
  background: #FFFFFF;
  padding: 12px 14px;
}
.fig-img-wrap.media-wide img {
  width: 100%;
  height: auto;
}

.fig-img-wrap.media-std {
  padding: 12px 14px;
}
.fig-img-wrap.media-std img {
  width: auto;
  max-width: 100%;
  max-height: 430px;
  height: auto;
  margin: 0 auto;
}

.fig-img-wrap.media-quad {
  padding: 12px 14px;
}
.fig-img-wrap.media-quad img {
  width: auto;
  max-width: 100%;
  max-height: 470px;
  height: auto;
  margin: 0 auto;
}

.fig-img-wrap.media-tall {
  padding: 12px 14px;
}
.fig-img-wrap.media-tall img {
  width: auto;
  max-width: 100%;
  max-height: 500px;
  height: auto;
  margin: 0 auto;
}

.fig-img-wrap.media-strip {
  padding: 10px 14px;
}
.fig-img-wrap.media-strip img {
  width: auto;
  max-width: 100%;
  max-height: 245px;
  height: auto;
  margin: 0 auto;
}

.fig-img-cap {
  width: 100%;
  margin-top: 9px;
  font-size: 11.9px;
  color: var(--muted);
  line-height: 1.54;
  text-align: left;
}

/* Dual-image side-by-side grid (equalized visual height for Fig 1.3!) */
.fig-img-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.fig-img-grid.ratio-13 {
  grid-template-columns: 1.62fr 1.94fr;
}

.fig-img-grid .fig-img-wrap {
  justify-content: space-between;
  background: #FFFFFF;
}

.fig-img-stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fig-img-stage img {
  width: 100%;
  height: auto;
}

/* Calibrate compact SVG chart widths so SVG typography matches 1:1 */
#chart-aa-overnight,
#chart-code-pareto,
#diagram-tbs-exec,
#diagram-binder-pipeline,
#diagram-autobench-arch,
#diagram-briefcase-flow,
#diagram-rli-anatomy,
#diagram-osworld-dag,
#diagram-realtime-clock,
#diagram-harbor,
#diagram-coevolution {
  max-width: 820px;
  margin: 0 auto;
}

/* Independent Per-Benchmark Table Grouped by Subtle Colored Domain Plates */
.dom-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}

.dom-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dom-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  display: inline-block;
}

table.bench-stats-table { min-width: 920px; font-size: 12.4px; }
table.bench-stats-table tbody tr.dom-code td:first-child { border-left: 3.5px solid #1F4E79; }
table.bench-stats-table tbody tr.dom-code { background: #F5F8FC; }
table.bench-stats-table tbody tr.dom-sci td:first-child { border-left: 3.5px solid #2D6A5B; }
table.bench-stats-table tbody tr.dom-sci { background: #F3F8F6; }
table.bench-stats-table tbody tr.dom-off td:first-child { border-left: 3.5px solid #8C6239; }
table.bench-stats-table tbody tr.dom-off { background: #FBF7F1; }
table.bench-stats-table tbody tr.dom-cua td:first-child { border-left: 3.5px solid #4B5563; }
table.bench-stats-table tbody tr.dom-cua { background: #F5F6F9; }
table.bench-stats-table tbody tr.dom-phys td:first-child { border-left: 3.5px solid #A84A32; }
table.bench-stats-table tbody tr.dom-phys { background: #FCF4F1; }
table.bench-stats-table tbody tr:hover { filter: brightness(0.98); }
table.bench-stats-table td:first-child { padding-left: 11px; }

/* Dual-panel figure (Calibrated 1.24fr : 1fr ratio matches 450x290 vs 360x290 SVGs!) */
.dual-fig-grid {
  display: grid;
  grid-template-columns: 1.24fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.dual-subpanel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 15px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dual-subpanel > div:last-child,
.dual-subpanel > svg {
  margin-top: auto;
}

.dual-subpanel-title {
  font-size: 12.6px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.dual-subpanel-title span {
  font-family: var(--font-mono);
  font-size: 10.6px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

/* Minimal Segmented Controls */
.seg-tabs {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}

.seg-btn {
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5.5px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}

.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--surface-2); color: var(--ink); }
.seg-btn.active { background: var(--ink); color: #FFFFFF; }

/* Stacked Bars & Info Grids */
.stack-bar {
  display: flex;
  height: 28px;
  border-radius: 5px;
  overflow: hidden;
  margin: 10px 0 14px;
  font-size: 11.6px;
  font-weight: 600;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
}

.stack-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  padding: 0 6px;
}

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

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

.info-card {
  padding: 14px 15px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--border-strong);
  border-radius: 8px;
  min-width: 0;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.info-card:hover {
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}

.info-card .ic-k {
  font-family: var(--font-mono);
  font-size: 11.1px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 5px;
}

.info-card h4 {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
  line-height: 1.4;
}

.info-card p {
  font-size: 13.3px;
  line-height: 1.66;
  color: var(--muted);
  margin: 0 0 8px;
}

.info-card p:last-child { margin-bottom: 0; }

/* Collapsible Appendix Details */
details.deep-dive {
  max-width: var(--prose-w);
  margin: 18px auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
  overflow: hidden;
}

details.deep-dive.wide { max-width: var(--wide-w); }

details.deep-dive summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 18px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  font-size: 14.2px;
  font-weight: 650;
  color: var(--ink);
  transition: background 0.14s ease;
}

details.deep-dive[open] summary {
  border-bottom: 1px solid var(--border);
}

details.deep-dive summary::-webkit-details-marker { display: none; }
details.deep-dive summary:hover { background: var(--surface-2); }

.dd-chevron { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

.dd-body { padding: 16px 18px 18px; font-size: 14px; line-height: 1.76; color: var(--ink-2); }

/* ==========================================================================
   ACADEMIC THREE-LINE TABLES & 16+3 INTERACTIVE EXPLORER
   ========================================================================== */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.ed-table, table.master {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.9px;
  line-height: 1.56;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  font-variant-numeric: tabular-nums;
}

table.ed-table thead th, table.master thead th {
  background: var(--bg);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
  font-size: 12px;
}

table.ed-table tbody td, table.master tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--ink-2);
}

table.ed-table tbody tr:last-child td, table.master tbody tr:last-child td { border-bottom: none; }
table.ed-table tbody tr:hover, table.master tbody tr:hover { background: var(--surface); }

.mx-cell { text-align: center !important; font-size: 11.6px; white-space: nowrap; }
.mx-early { background: #F0F5FA; color: #1F4E79; font-weight: 600; }
.mx-nov   { background: #F8F9FA; color: #4B5563; }
.mx-cn-ok { background: #EDF6F4; color: #2D6A5B; font-weight: 600; }
.mx-gap   { background: #FDF3F0; color: #A84A32; }

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 550;
  padding: 1.5px 6.5px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  line-height: 1.45;
}

.tag.hyb { background: var(--amber-soft); color: var(--amber); border-color: #E5D4BE; }
.tag.priv { background: var(--rust-soft); color: var(--rust); border-color: #EACBC2; }
.tag.open { background: var(--sage-soft); color: var(--sage); border-color: #C3DFD8; }

.ev-wrap { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 3px; }
.b-name { font-weight: 650; font-size: 12.8px; color: var(--ink); display: block; }
.b-sub { font-size: 11.3px; color: var(--faint); margin-top: 2px; display: block; line-height: 1.45; }
.warn-note { color: var(--ink-2); font-size: 12.2px; line-height: 1.55; }

/* Explorer Controls */
.explorer-toolbar {
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
}

.filter-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.filter-label { font-size: 12px; font-weight: 650; color: var(--muted); margin-right: 2px; }

.pill {
  padding: 3.5px 9.5px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.pill:hover { background: var(--surface-2); color: var(--ink); }
.pill.active { background: var(--ink); color: #FFFFFF; }

.search-input {
  padding: 5.5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 12.6px;
  min-width: 220px;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.1);
}

.hint-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.2px;
  color: var(--muted);
  margin-bottom: 8px;
}

table.master { min-width: 880px; font-size: 12.4px; }
table.master thead th { cursor: pointer; user-select: none; }
table.master thead th:hover { color: var(--accent); }
table.master tbody tr { cursor: pointer; transition: background 0.12s ease; }
table.master tbody tr.legacy-row { color: var(--muted); background: #FAFAFA; }

/* ==========================================================================
   SMOOTH SLIDE-OUT DOSSIER DRAWER (GPU-COMPOSITED TRANSFORM)
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 300;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.drawer {
  width: min(580px, 95vw);
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 28px 30px 44px;
  box-shadow: -12px 0 36px rgba(15, 23, 42, 0.12);
  transform: translateX(100%);
  transition: transform 0.28s var(--ease-out);
  will-change: transform;
}

.drawer-backdrop.open .drawer {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 15px;
  margin-bottom: 16px;
}

.drawer-head h3 { font-size: 20px; font-weight: 700; margin: 0; color: var(--ink); }

.close-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.close-btn:hover { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }

.d-section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.d-section:last-child { border-bottom: none; }
.d-section h4 { font-size: 12.5px; font-weight: 650; color: var(--muted); margin: 0 0 8px; }
.d-section p, .d-section li { font-size: 13.6px; line-height: 1.72; color: var(--ink-2); margin: 0; }
.d-section ul { padding-left: 18px; margin: 0; }
.d-section li { margin-bottom: 6px; }
.d-section a { color: var(--accent); font-weight: 600; }

.d-lesson {
  background: var(--surface);
  border-left: 3px solid var(--ink);
  border-radius: 6px;
  padding: 12px 15px;
  margin-top: 12px;
}

/* ==========================================================================
   FULL-RESOLUTION IMAGE LIGHTBOX (CLICK ANY FIGURE TO INSPECT)
   ========================================================================== */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 360;
  background: rgba(15, 23, 42, 0.84);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  cursor: zoom-out;
}

.lightbox-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox-frame {
  max-width: min(94vw, 1320px);
  max-height: 86vh;
  background: #FFFFFF;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  transform: scale(0.96);
  transition: transform 0.24s var(--ease-out);
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-backdrop.open .lightbox-frame {
  transform: scale(1);
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(86vh - 64px);
  width: auto;
  height: auto;
  border-radius: 4px;
}

.lightbox-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.lightbox-cap {
  font-size: 12.6px;
  color: var(--ink-2);
  line-height: 1.5;
}

.lightbox-close {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}

.lightbox-close:hover {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

/* ==========================================================================
   FLOATING BACK-TO-TOP PILL (APPEARS SMOOTHLY AFTER SCROLLING)
   ========================================================================== */
#back-to-top {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 110;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 12.4px;
  font-weight: 600;
  box-shadow: var(--shadow-float);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.22s var(--ease-out), border-color 0.15s ease;
}

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

#back-to-top:hover {
  border-color: var(--ink);
  background: #FFFFFF;
}

/* ==========================================================================
   REFERENCES, BIBTEX & FOOTER
   ========================================================================== */
.refs-wrap { max-width: var(--prose-w); margin: 44px auto 0; padding-top: 26px; border-top: 1px solid var(--border); }
.refs-wrap h2 {
  font-size: 22px;
  font-weight: 750;
  margin: 0 0 8px;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.refs-sub { font-size: 13.4px; color: var(--muted); margin: 0 0 20px; line-height: 1.65; }
.ref-group { margin-bottom: 22px; }
.ref-group h4 {
  font-size: 12.6px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 9px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.ref-list { list-style: none; margin: 0; padding: 0; }
.ref-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.4px;
  line-height: 1.68;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.ref-idx {
  font-family: var(--font-mono);
  font-size: 11.8px;
  color: var(--faint);
  min-width: 32px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.ref-list a { color: var(--accent); text-decoration: none; }
.ref-list a:hover { text-decoration: underline; text-underline-offset: 2px; }
.ref-host {
  font-family: var(--font-mono);
  font-size: 11.1px;
  color: var(--faint);
  margin-left: 6px;
  white-space: nowrap;
}

.citation-wrap { max-width: var(--prose-w); margin: 36px auto 0; padding-top: 24px; border-top: 1px solid var(--border); }
.citation-wrap h2 { font-size: 20px; font-weight: 750; margin: 0 0 10px; color: var(--ink); }
.citation-wrap p { font-size: 14px; color: var(--ink-2); margin: 0 0 10px; line-height: 1.72; }
.cite-inline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 11px 15px;
  font-size: 13.6px;
  color: var(--ink-2);
  margin: 0 0 14px;
}

.bibtex-wrap { position: relative; margin-top: 14px; }

/* Header Directory Link & Standalone Directory Page */
.nav-dir-link {
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--ink) !important;
  font-weight: 600 !important;
  font-size: 12.6px !important;
  background: var(--surface);
  text-decoration: none !important;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.nav-dir-link:hover { border-color: var(--ink); background: var(--surface-2); }

/* Header Language Switcher (中文 / EN segmented toggle) */
.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}

.lang-opt {
  padding: 3.5px 8.5px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--muted) !important;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}

.lang-opt:first-child {
  border-right: 1px solid var(--border);
}

a.lang-opt:hover {
  background: var(--surface-2);
  color: var(--ink) !important;
}

.lang-opt.active {
  background: var(--ink);
  color: #FFFFFF !important;
  cursor: default;
}

.page-wide { max-width: 1120px; margin: 0 auto; padding: 0 20px 72px; }
.page-wide .figure-card.full,
.page-wide details.deep-dive.wide { max-width: 100%; }
.dir-header {
  max-width: 1120px;
  margin: 36px auto 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.dir-header h1 { font-size: 28px; font-weight: 750; margin: 0 0 10px; letter-spacing: -0.02em; color: var(--ink); }
.dir-header p { font-size: 15px; color: var(--ink-2); margin: 0 0 12px; max-width: 780px; line-height: 1.78; }
.dir-back { font-size: 13.4px; color: var(--accent); text-decoration: none; font-weight: 650; }
.dir-back:hover { text-decoration: underline; }

/* Domain Playbook Table & Action Steps */
table.playbook-table { min-width: 940px; font-size: 12.6px; }
table.playbook-table td:first-child { font-weight: 650; color: var(--ink); min-width: 120px; }

.action-steps { display: flex; flex-direction: column; gap: 14px; margin: 18px 0 24px; }
.action-step {
  padding: 15px 19px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.action-step:hover {
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}
.action-step-title {
  font-size: 14.8px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
}
.action-step-title .step-tag {
  font-family: var(--font-mono);
  font-size: 11.8px;
  font-weight: 650;
  color: var(--accent);
  margin-right: 8px;
}
.action-step p {
  font-size: 14.2px;
  line-height: 1.78;
  color: var(--ink-2);
  margin: 0;
}

.dir-callout {
  max-width: var(--prose-w);
  margin: 22px auto;
  padding: 13px 18px;
  background: var(--accent-soft);
  border: 1px solid #D3E1EE;
  border-radius: 8px;
  font-size: 13.8px;
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.dir-callout a { color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap; }
.dir-callout a:hover { text-decoration: underline; }

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--bg);
  color: var(--ink-2);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 11.6px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.copy-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }

/* Compositor-only GPU Tooltip (Zero layout thrash on mousemove!) */
#svg-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  padding: 9px 13px;
  border-radius: 7px;
  font-size: 12.2px;
  max-width: 320px;
  line-height: 1.56;
  box-shadow: var(--shadow-float);
  opacity: 0;
  visibility: hidden;
  z-index: 400;
  border: 1px solid var(--border-strong);
  transform: translate3d(-9999px, -9999px, 0);
  transition: opacity 0.12s ease;
  will-change: transform, opacity;
}

#svg-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

footer.site-footer {
  max-width: var(--prose-w);
  margin: 44px auto 0;
  border-top: 1px solid var(--border);
  padding: 24px 20px 56px;
  font-size: 13px;
  color: var(--muted);
}

.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-inner a { color: var(--accent); text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .post-header { margin: 28px auto 18px; }
  .figure-card { padding: 15px 15px 14px; border-radius: 8px; }
  .toc-list { grid-template-columns: 1fr; gap: 10px; }
  .toc-foot a.toc-dir-cta { margin-left: 0; }
  .grid-2, .grid-3, .case-strip, .dual-fig-grid, .fig-img-grid, .fig-img-grid.ratio-13 { grid-template-columns: 1fr; }
  .search-input { width: 100%; min-width: 0; }
  #back-to-top { right: 14px; bottom: 16px; }
}

@media print {
  .site-header, .drawer-backdrop, .lightbox-backdrop, #svg-tooltip, #back-to-top, .seg-tabs, .explorer-toolbar { display: none !important; }
  .prose, .figure-card, details.deep-dive { max-width: 100%; box-shadow: none; }
}
