/* ==========================================================================
   STELLA — project page
   Local system fonts only. No external requests.
   ========================================================================== */

:root {
  --accent: #0f5c6e;
  --accent-ink: #0b4655;
  --accent-soft: #eef4f5;
  --accent-line: #c9dde1;

  --ink: #111518;
  --ink-2: #2b3237;
  --muted: #5f6a72;
  --faint: #8b959c;
  --line: #e7eaec;
  --line-2: #f0f2f3;
  --bg: #ffffff;
  --bg-soft: #f7f9f9;

  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --container: 1100px;
  --gutter: clamp(20px, 5vw, 40px);
  --header-h: 64px;
  --radius: 10px;
}

/* Chinese: CJK glyphs fall back to PingFang (crisper than Songti at body sizes) */
html[lang="zh-CN"] {
  --serif: "Iowan Old Style", "Charter", Palatino, Georgia, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html.preload *, html.preload *::before, html.preload *::after { transition: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
::selection { background: #d5e8ec; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon {
  width: 1.05em; height: 1.05em;
  flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Placeholder (to be filled in) ---------- */
.ph {
  display: inline-block;
  padding: 0 .4em;
  border: 1px dashed #d9b44a;
  border-radius: 4px;
  background: #fff9e6;
  color: #7a5a00;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.header-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-logo { width: 30px; height: 30px; object-fit: contain; mix-blend-mode: multiply; }
.brand-text {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: .08em;
}
/* With a logo present, show logo + wordmark; without, wordmark only */
.brand.no-logo .brand-logo { display: none; }

.nav { display: flex; gap: 28px; margin-left: auto; }
.nav a {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .01em;
  transition: color .15s ease;
}
.nav a:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 14px; }

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}
.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 .78rem/1 var(--sans);
  letter-spacing: .03em;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 500 .95rem/1 var(--sans);
  letter-spacing: .01em;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { height: 36px; padding: 0 16px; font-size: .86rem; }

.btn-outline { color: var(--ink); border-color: #d6dbde; background: #fff; }
.btn-outline:hover { color: var(--ink); border-color: var(--ink); }

.btn-accent {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 92, 110, .18), 0 6px 18px -8px rgba(15, 92, 110, .55);
}
.btn-accent:hover { color: #fff; background: var(--accent-ink); }
.btn-accent .icon { transition: transform .15s ease; }
.btn-accent:hover .icon { transform: translateX(2px); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding-top: clamp(56px, 10vw, 112px);
  padding-bottom: clamp(40px, 7vw, 72px);
  background:
    radial-gradient(1200px 420px at 50% -120px, rgba(15, 92, 110, .07), transparent 70%),
    var(--bg);
}
.hero-inner { text-align: center; }

.hero-logo-wrap { display: flex; justify-content: center; margin-bottom: 28px; }
.hero-logo-wrap { margin-bottom: 30px; }
.hero-logo { width: 84px; height: 84px; object-fit: contain; mix-blend-mode: multiply; }

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(3.4rem, 10vw, 6.25rem);
  line-height: 1;
  letter-spacing: .04em;
  color: var(--ink);
}

.subtitle {
  margin: 22px auto 0;
  max-width: 34ch;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.3rem, 2.8vw, 1.9rem);
  line-height: 1.3;
  color: var(--ink-2);
  text-wrap: balance;
}
html[lang="zh-CN"] .subtitle { max-width: 22em; letter-spacing: .02em; }

.authors { margin: 40px auto 0; max-width: 860px; }
.authors p { margin: 0; }
.author-list {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px 18px;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink);
}
.author-list span { white-space: nowrap; }
.authors sup {
  font-size: .64em;
  margin-left: 2px;
  color: var(--accent);
  font-variant-numeric: lining-nums;
}
.affiliations {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 2px 16px;
  margin-top: 18px !important;
  font-size: .84rem;
  line-height: 1.7;
  color: var(--muted);
}
.affiliations sup { color: var(--faint); margin-right: 2px; margin-left: 0; }
.author-notes { margin-top: 8px !important; font-size: .8rem; color: var(--faint); }
.author-notes sup { margin-right: 3px; }

.actions {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 12px;
  margin-top: 36px;
}

.tagline {
  margin: 32px auto 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 1.02rem;
  text-wrap: balance;
}

/* Key numbers */
.stats {
  margin: clamp(48px, 7vw, 80px) 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat { padding: 26px 22px; text-align: left; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat dt {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}
.stat dd { margin: 8px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.unit { font-size: .62em; margin-left: 1px; color: var(--ink-2); }
.arrow { display: inline-block; margin: 0 .22em; font-size: .7em; color: var(--accent); transform: translateY(-.08em); }

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding-block: clamp(56px, 8vw, 104px); }
.section + .section { border-top: 1px solid var(--line-2); }

.section-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 40px;
}
.section-body { max-width: 740px; min-width: 0; }

.section-label {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  align-self: start;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-top: 6px;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
}
.section-label .num {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: .04em;
}

h2 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -.005em;
  color: var(--ink);
  text-wrap: balance;
}
h3 { color: var(--ink); }

.section-body p { margin: 0 0 1.1em; }
.lead {
  font-size: 1.14rem;
  line-height: 1.7;
  color: var(--ink);
}
#abstract .section-body p { text-align: justify; hyphens: auto; }
#abstract .section-body p.lead { font-family: var(--serif); font-size: 1.22rem; line-height: 1.65; text-align: left; }
html[lang="zh-CN"] #abstract .section-body p { text-align: left; }

.sub {
  margin: 48px 0 10px;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
h2 + .sub { margin-top: 28px; }

/* ==========================================================================
   Architecture diagram
   ========================================================================== */
.arch {
  margin: 40px 0 8px;
  padding: clamp(20px, 4vw, 36px);
  padding-right: clamp(12px, 2vw, 20px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 1px 1px, #e4e8ea 1px, transparent 1.2px) 0 0 / 18px 18px,
    var(--bg-soft);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
}
.arch-main { min-width: 0; display: flex; flex-direction: column; align-items: stretch; }

.arch-goal {
  align-self: center;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .04em;
}

.arch-v { align-self: center; width: 1.5px; height: 26px; background: #b9c3c7; }

.arch-node {
  position: relative;
  padding: 14px 16px;
  border: 1px solid #dde3e5;
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
  box-shadow: 0 1px 2px rgba(17, 21, 24, .04);
}
.node-name { font-weight: 600; font-size: .92rem; color: var(--ink); letter-spacing: .005em; }
.node-role { margin-top: 3px; font-size: .78rem; line-height: 1.45; color: var(--muted); }

.arch-manager { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 92, 110, .08); padding-block: 18px; }
.arch-manager .node-name { color: var(--accent); font-size: 1rem; }

/* fan connectors: share the 3-column geometry of .arch-row */
.arch-row, .arch-fan {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-inline: -6px;
}
.arch-row > .arch-node { margin-inline: 6px; }

.arch-fan { position: relative; height: 30px; }
.arch-fan::before { /* horizontal bus */
  content: ""; position: absolute; top: 50%;
  left: calc(100% / 6); right: calc(100% / 6);
  height: 1.5px; background: #b9c3c7; transform: translateY(-50%);
}
.arch-fan::after { /* center stub to/from the single box */
  content: ""; position: absolute; left: 50%; top: 0; height: 50%;
  width: 1.5px; background: #b9c3c7; transform: translateX(-50%);
}
.arch-fan i { position: relative; }
.arch-fan i::before { /* drop into each node */
  content: ""; position: absolute; left: 50%; top: 50%; bottom: 0;
  width: 1.5px; background: #b9c3c7; transform: translateX(-50%);
}
.arch-fan-in::after { top: 50%; height: 50%; }
.arch-fan-in i::before { top: 0; bottom: 50%; }

.arch-layer {
  position: relative;
  padding: 26px 14px 14px;
  border: 1px dashed var(--accent-line);
  border-radius: 14px;
  background: rgba(238, 244, 245, .85);
}
.layer-tag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.arch-layer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.arch-node-soft { border-color: var(--accent-line); }

/* feedback loop (desktop): from the self-evolving layer back to the Manager */
.arch-loop { position: relative; }
.arch-loop::before {
  content: "";
  position: absolute;
  left: 0; right: 16px;
  top: var(--loop-top, 90px);
  bottom: var(--loop-bottom, 60px);
  border: 1.5px solid var(--accent);
  border-left: 0;
  border-radius: 0 14px 14px 0;
}
.arch-loop::after { /* arrowhead pointing into Manager */
  content: "";
  position: absolute;
  left: -1px;
  top: calc(var(--loop-top, 90px) - 4.25px);
  border: 5px solid transparent;
  border-right: 7px solid var(--accent);
  border-left: 0;
}
.arch-loop-label {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translate(50%, -50%) rotate(180deg);
  writing-mode: vertical-rl;
  padding: 8px 2px;
  background: var(--bg-soft);
  color: var(--accent);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
html[lang="zh-CN"] .arch-loop-label { transform: translate(50%, -50%); letter-spacing: .2em; }
.arch-loop-mobile { display: none; }

/* ==========================================================================
   Components list
   ========================================================================== */
.components {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
  counter-reset: comp;
}
.components li {
  counter-increment: comp;
  padding: 20px 0 18px;
  border-top: 1px solid var(--line);
}
.components h3 {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
}
.components h3::before {
  content: counter(comp, decimal-leading-zero);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  color: var(--accent);
}
.components p { margin: 0; font-size: .94rem; color: var(--muted); line-height: 1.65; }

/* ==========================================================================
   Results
   ========================================================================== */
/* Benchmarks */
.bench-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.bench-card {
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, var(--bg-soft) 100%);
}
.section-body .bench-card p { margin: 0; }
.bench-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.bench-badge .icon { width: .95em; height: .95em; stroke-width: 2; }
.bench-name {
  margin-top: 14px !important;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.25;
  color: var(--ink);
}
.bench-meta { margin-top: 2px !important; color: var(--muted); font-size: .84rem; }

/* Lab results: text + visual rows */
.results { margin-top: 8px; border-top: 1px solid var(--line); }
.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 36px;
  align-items: center;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}
.section-body .result p { margin: 0; }
.result-kind {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.result-title {
  margin: 8px 0 8px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.25;
  color: var(--ink);
  text-wrap: balance;
}
.result-desc { font-size: .92rem; line-height: 1.6; color: var(--muted); }

.result-viz {
  padding: 20px 22px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line-2);
}

/* bars */
.bar-row {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 12px;
}
.bar-row + .bar-row { margin-top: 12px; }
.bar-label { font-size: .8rem; color: var(--muted); }
.bar-track { position: relative; height: 12px; border-radius: 999px; background: #e9eef0; overflow: hidden; }
.bar-fill {
  position: absolute; inset: 0 auto 0 0;
  width: var(--w);
  border-radius: 999px;
  background: linear-gradient(90deg, #1a7489, var(--accent));
  transform-origin: left center;
  transition: transform 1s cubic-bezier(.2, .7, .2, 1);
}
.bar-fill.is-muted { background: #b7c2c7; }
.bar-fill.is-open { /* ">" — fades out at the end to suggest "more than" */
  -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
  mask-image: linear-gradient(90deg, #000 82%, transparent);
}
.bar-value {
  font-family: var(--serif);
  font-size: 1.08rem;
  color: var(--ink-2);
  font-variant-numeric: lining-nums tabular-nums;
  text-align: right;
}
.bar-value.is-accent { color: var(--accent); font-weight: 600; }
.bar-axis {
  display: flex; justify-content: space-between;
  margin: 8px calc(3rem + 12px) 0 calc(4.6rem + 12px);
  font-size: .68rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
/* animate in when scrolled into view (JS adds .is-ready / .is-visible) */
.is-ready .bar-fill { transform: scaleX(0); }
.is-ready.is-visible .bar-fill { transform: scaleX(1); }
.is-ready.is-visible .bar-row + .bar-row .bar-fill { transition-delay: .15s; }

/* cells */
.viz-cells { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.cells { display: flex; gap: clamp(10px, 2.4vw, 18px); }
.cell {
  position: relative;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #e3eef0 70%);
  border: 1.5px solid var(--accent-line);
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), opacity .5s ease;
}
.cell::before { /* nucleus */
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #9fc3cb;
  transform: translate(-50%, -50%);
}
.cell i { /* check badge */
  position: absolute; right: -4px; bottom: -4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-soft);
}
.cell i::after {
  content: "";
  position: absolute; left: 6px; top: 3.5px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(45deg);
}
.is-ready .cell { transform: scale(.6); opacity: 0; }
.is-ready.is-visible .cell { transform: none; opacity: 1; }
.is-ready.is-visible .cell:nth-child(2) { transition-delay: .1s; }
.is-ready.is-visible .cell:nth-child(3) { transition-delay: .2s; }
.is-ready.is-visible .cell:nth-child(4) { transition-delay: .3s; }
.viz-caption { font-size: .8rem; color: var(--muted); letter-spacing: .02em; }
.viz-caption strong { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; color: var(--accent); margin-right: 2px; }

@media (prefers-reduced-motion: reduce) {
  .is-ready .bar-fill, .is-ready .cell { transform: none; opacity: 1; transition: none; }
}

/* ==========================================================================
   Related
   ========================================================================== */
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.related-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 22px;
  padding: 26px 26px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #fff 0%, var(--accent-soft) 100%);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.related-card:hover { border-color: var(--accent-line); box-shadow: 0 14px 36px -22px rgba(15, 92, 110, .45); }
.related-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.related-link:hover { color: var(--accent-ink); }
.related-link:hover .icon { transform: translate(2px, -2px); }

.powered {
  margin: 14px 0 0;
  font-size: .8rem;
  color: var(--faint);
  letter-spacing: .01em;
}
.powered a { color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); }
.powered a:hover { color: var(--accent); border-bottom-color: var(--accent-line); }
.related-card h3 { margin: 4px 0 6px; font-family: var(--serif); font-weight: 500; font-size: 1.7rem; line-height: 1.15; }
.section-body .related-card p { margin: 0; }
.related-kicker { font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.related-text p:last-child { color: var(--muted); }
.related-link {
  display: inline-flex; align-items: center; gap: 6px;
  flex: none;
  color: var(--accent);
  font-size: .9rem;
  font-weight: 500;
}
.related-link .icon { transition: transform .15s ease; }

/* ==========================================================================
   BibTeX
   ========================================================================== */
.bibtex {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}
.bibtex pre {
  margin: 0;
  padding: 24px 24px 22px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.75;
  color: var(--ink-2);
  tab-size: 2;
}
.copy-btn {
  position: absolute; top: 12px; right: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: 500 .76rem/1 var(--sans);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.copy-btn:hover { color: var(--ink); border-color: #cfd5d8; }
.copy-btn.is-copied { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.ph-note { margin-top: 12px !important; font-size: .8rem; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 36px calc(36px + env(safe-area-inset-bottom, 0px));
  font-size: .86rem;
  color: var(--muted);
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.footer-mark { font-family: var(--serif); font-weight: 600; letter-spacing: .08em; color: var(--ink); }
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--ink); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
  .nav { display: none; }
  .header-actions { margin-left: auto; }
  .section-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .section-label { position: static; padding-top: 0; }
  .section-body { max-width: none; }
}

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .components { grid-template-columns: minmax(0, 1fr); }
  .result { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 26px 0; }
  .bench-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .bench-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
  .bench-card .bench-badge { grid-column: 2; grid-row: 1 / span 2; }
  .section-body .bench-card .bench-name { margin-top: 0 !important; grid-row: 1; }
  .bench-card .bench-meta { grid-row: 2; }
  .related-grid { grid-template-columns: minmax(0, 1fr); }
  .related-card { padding: 24px; }
}

@media (max-width: 600px) {
  :root { --header-h: 58px; }
  .header-inner { gap: 12px; }
  .header-actions { gap: 8px; }
  .lang-switch button { padding: 6px 9px; }
  .btn-sm { padding: 0 13px; }

  .actions .btn { flex: 1 1 auto; }
  .actions .btn-accent { flex-basis: 100%; }

  /* diagram stacks vertically */
  .arch { grid-template-columns: minmax(0, 1fr); padding: 22px 16px; }
  .arch-loop { display: none; }
  .arch-row { grid-template-columns: minmax(0, 1fr); margin-inline: 0; gap: 10px; }
  .arch-row > .arch-node { margin-inline: 0; }
  .arch-fan { display: block; height: 22px; margin-inline: 0; }
  .arch-fan::before, .arch-fan i { display: none; }
  .arch-fan::after, .arch-fan-in::after { top: 0; height: 100%; }
  .arch-layer-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .arch-loop-mobile {
    display: block;
    margin: 14px 0 0;
    text-align: center;
    color: var(--accent);
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
  }

  .result-viz { padding: 18px 16px; }
  .bar-row { grid-template-columns: 3.8rem minmax(0, 1fr) 2.6rem; gap: 10px; }
  .bar-axis { margin-inline: calc(3.8rem + 10px) calc(2.6rem + 10px); }
  .cell { width: 40px; height: 40px; }

  .bibtex pre { padding-top: 52px; }
  #abstract .section-body p { text-align: left; hyphens: manual; }
}

@media (max-width: 380px) {
  .brand-text { display: none; }
  .brand.no-logo .brand-text { display: inline; }
}
