/* ───────── Fonts ───────── */
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/InstrumentSerif-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/InstrumentSerif-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}

/* ───────── Tokens ───────── */
:root {
  --bg: #05070f;
  --bg-2: #0a0e1c;
  --ink: #eef1fa;
  --muted: #a3acc6;
  --faint: #6f7895;
  --line: rgba(255, 255, 255, 0.1);
  --line-2: rgba(255, 255, 255, 0.18);
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.08);
  --acc: #9fc0ff;
  --acc-rgb: 159, 192, 255;
  --good: #7be0a8;
  --side-w: 344px;
  --serif: "Instrument Serif", "Iowan Old Style", "Songti SC", "Noto Serif SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
[data-project="tw"]   { --acc: #ffb169; --acc-rgb: 255, 177, 105; }
[data-project="sae"]  { --acc: #b7a8ff; --acc-rgb: 183, 168, 255; }
[data-project="leaf"] { --acc: #6fe3b4; --acc-rgb: 111, 227, 180; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  transition: grid-template-columns 0.7s var(--ease);
}
body[data-view="slide"] { --side-w: 92px; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, video { display: block; max-width: 100%; }

/* ───────── Sky ───────── */
.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 78% 18%, rgba(var(--acc-rgb), 0.13), transparent 70%),
    radial-gradient(50% 45% at 30% 95%, rgba(64, 86, 190, 0.2), transparent 70%),
    radial-gradient(40% 40% at 5% 10%, rgba(30, 44, 110, 0.35), transparent 70%),
    linear-gradient(180deg, #05070f, #070a16 60%, #05070f);
  transition: background 0.8s;
}
.sky canvas { width: 100%; height: 100%; display: block; }

/* ───────── Side panel ───────── */
.side {
  position: relative;
  height: 100dvh;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.side-full {
  width: 344px; height: 100%;
  padding: 28px 28px 22px;
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto;
  transition: opacity 0.35s, transform 0.6s var(--ease);
}
.side-top { display: flex; align-items: center; gap: 16px; flex: none; }
.side-head { min-width: 0; }
.portrait {
  position: relative;
  width: clamp(88px, 14dvh, 112px);
  aspect-ratio: 4 / 4.8;
  border-radius: 18px;
  overflow: hidden;
  flex: none;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--line-2);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; }
.portrait::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 28%, transparent 70%, rgba(5, 7, 15, 0.45));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.eyebrow {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--acc); line-height: 1.5;
  transition: color 0.6s;
}
.side h1 { display: flex; align-items: baseline; gap: 2px 12px; flex-wrap: wrap; line-height: 1.15; margin-top: 8px; }
.side h1 .zh { font-size: 28px; font-weight: 600; letter-spacing: 0.04em; }
.side h1 .en { font-family: var(--serif); font-style: italic; font-size: 23px; color: var(--muted); font-weight: 400; }
.bio { color: var(--muted); font-size: 14.5px; line-height: 1.7; }
.cv { display: grid; gap: 9px; font-size: 13.5px; line-height: 1.5; }
.cv li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; color: var(--muted); }
.cv time { color: var(--faint); font-family: var(--mono); font-size: 11.5px; padding-top: 2px; white-space: nowrap; }
.cv b { color: var(--ink); font-weight: 500; }
.links { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel);
  font-size: 13px; text-decoration: none; color: var(--ink);
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
  cursor: pointer;
}
.pill:hover { background: var(--panel-2); border-color: rgba(var(--acc-rgb), 0.6); transform: translateY(-1px); }
.pill.sm { padding: 3px 11px; font-size: 12px; margin-left: 4px; border-color: rgba(var(--acc-rgb), 0.45); }
.tags { align-items: center; }
.pill svg { width: 13px; height: 13px; opacity: 0.75; }

.side-mini {
  position: absolute; inset: 0 auto 0 0; width: 92px;
  display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 22px;
  opacity: 0; pointer-events: none; transition: opacity 0.4s;
  text-decoration: none;
}
.side-mini img {
  width: 54px; height: 54px; border-radius: 50%; object-fit: cover; object-position: 50% 10%;
  box-shadow: 0 0 0 1px var(--line-2), 0 0 0 5px rgba(255, 255, 255, 0.04);
}
.side-mini span {
  writing-mode: vertical-rl; font-family: var(--serif); font-style: italic; font-size: 19px;
  color: var(--muted); letter-spacing: 0.04em;
}
body[data-view="slide"] .side-full { opacity: 0; pointer-events: none; transform: translateX(-30px); }
body[data-view="slide"] .side-mini { opacity: 1; pointer-events: auto; transition-delay: 0.25s; }

/* ───────── Stage ───────── */
.stage { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
  padding: 18px clamp(20px, 3.2vw, 48px) 0;
  min-height: 56px;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--faint); flex-wrap: wrap; }
.crumbs a { text-decoration: none; color: var(--muted); padding: 4px 2px; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here { color: var(--acc); }
.hint { font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
kbd {
  font-family: var(--mono); font-size: 11px; line-height: 1;
  padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel); color: var(--muted);
}

.views { position: relative; min-height: 0; }
.view {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: clamp(14px, 2.2vh, 28px) clamp(20px, 3.2vw, 48px) 20px;
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(0.985);
  transition: opacity 0.4s, transform 0.6s var(--ease), visibility 0s 0.4s;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.view.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: 0.08s, 0.08s, 0s; }
.view-inner { max-width: 1180px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }

.navbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 10px clamp(20px, 3.2vw, 48px) 16px;
}
.nav-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel);
  font-size: 13.5px; color: var(--ink); max-width: 100%;
  transition: background 0.25s, border-color 0.25s, opacity 0.25s;
}
.nav-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-btn:hover { background: var(--panel-2); border-color: rgba(var(--acc-rgb), 0.6); }
.nav-btn[disabled] { opacity: 0.25; pointer-events: none; }
.nav-btn.next { justify-self: end; background: rgba(var(--acc-rgb), 0.14); border-color: rgba(var(--acc-rgb), 0.45); }
.nav-btn.prev { justify-self: start; }
.nav-btn small { color: var(--faint); font-size: 12px; }
.progress { display: flex; align-items: center; gap: 12px; white-space: nowrap; color: var(--faint); font-size: 12px; font-family: var(--mono); }
.progress-track { width: clamp(80px, 14vw, 220px); height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--acc); border-radius: 3px; transition: width 0.5s var(--ease), background 0.5s; }

/* ───────── Orbs ───────── */
.orbs { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(18px, 3vw, 46px) clamp(20px, 3.4vw, 56px); }
.orbit {
  --d: clamp(96px, min(10.4vw, 13.6dvh), 160px);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  width: calc(var(--d) + 36px);
  text-decoration: none; text-align: center;
  animation: bob 7s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -1.37s);
  -webkit-tap-highlight-color: transparent;
}
.orbit.big { --d: clamp(150px, min(14.2vw, 30dvh), 236px); gap: 20px; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

.orb {
  position: relative; display: block; width: var(--d); aspect-ratio: 1; border-radius: 50%;
  isolation: isolate;
  transition: transform 0.6s var(--ease), box-shadow 0.6s;
  box-shadow:
    0 36px 50px -34px rgba(var(--acc-rgb), 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}
.orbit:hover .orb, .orbit:focus-visible .orb { transform: scale(1.07); box-shadow: 0 40px 70px -30px rgba(var(--acc-rgb), 0.9), 0 0 0 1px rgba(255, 255, 255, 0.16); }
.orbit:focus-visible { outline: none; }
.orbit:focus-visible .orb { outline: 2px solid var(--acc); outline-offset: 6px; }
.orb-media { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: #0c1122; }
.orb-media > img, .orb-media > video, .orb-media > svg {
  width: 100%; height: 100%; object-fit: cover; transform: scale(1.14);
  transition: transform 1.2s var(--ease);
}
.orbit:hover .orb-media > * { transform: scale(1.22); }
/* thick glass edge: blur what's behind the outer ring */
.orb-rim {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  -webkit-backdrop-filter: blur(5px) saturate(1.35) brightness(1.12);
  backdrop-filter: blur(5px) saturate(1.35) brightness(1.12);
  -webkit-mask: radial-gradient(circle closest-side, transparent 72%, #000 90%);
  mask: radial-gradient(circle closest-side, transparent 72%, #000 90%);
}
.orb-glass {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(ellipse 36% 20% at 31% 13%, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0) 72%),
    radial-gradient(ellipse 9% 6% at 74% 22%, rgba(255, 255, 255, 0.55), transparent 70%),
    radial-gradient(ellipse 56% 26% at 56% 97%, rgba(255, 255, 255, 0.3), transparent 72%),
    radial-gradient(circle closest-side, transparent 62%, rgba(190, 214, 255, 0.1) 80%, rgba(214, 228, 255, 0.34) 95%, rgba(255, 255, 255, 0.1) 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.38),
    inset 0 0 26px 4px rgba(196, 218, 255, 0.26),
    inset 0 -20px 34px -10px rgba(255, 255, 255, 0.26),
    inset 12px 22px 40px -22px rgba(255, 255, 255, 0.36),
    inset -18px -8px 40px -22px rgba(8, 12, 30, 0.75);
}
.orb-ring {
  position: absolute; inset: -9px; border-radius: 50%; pointer-events: none;
  border: 1.5px solid rgba(var(--acc-rgb), 0.85); opacity: 0;
}
.orbit.is-next .orb-ring { animation: ping 2.4s ease-out infinite; }
@keyframes ping { 0% { opacity: 0.9; transform: scale(0.96); } 80%, 100% { opacity: 0; transform: scale(1.16); } }

.orb-label { display: grid; gap: 3px; justify-items: center; }
.orb-label i {
  font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--acc);
  display: inline-flex; align-items: center; gap: 6px;
}
.orbit.is-seen .orb-label i::after { content: "✓"; color: var(--good); font-size: 11px; }
.orb-label b { font-weight: 500; font-size: 15px; line-height: 1.35; color: var(--ink); }
.orb-label small { font-size: 12.5px; color: var(--faint); line-height: 1.45; }
.orbit.big .orb-label b { font-family: var(--serif); font-size: clamp(24px, 2.3vw, 32px); font-weight: 400; line-height: 1.1; }
.orbit.big .orb-label small { font-size: 13.5px; color: var(--muted); }
.orbit.big { width: calc(var(--d) + 44px); }
.home .orbs { flex-wrap: nowrap; gap: clamp(14px, 2.4vw, 44px); }

/* art inside non-photo orbs */
.orb-art { background: radial-gradient(circle at 50% 38%, rgba(var(--acc-rgb), 0.5), rgba(var(--acc-rgb), 0.12) 55%, #0a0f20 100%); }
.orb-art svg { stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.orb-art .a { stroke: var(--acc); }
.orb-art .af { fill: var(--acc); stroke: none; }
.orb-art .wf { fill: #fff; stroke: none; }
.orb-art .dim { opacity: 0.35; }
.orb-art text { fill: #fff; stroke: none; font-family: var(--serif); }

/* ───────── Home ───────── */
.home .view-inner { justify-content: center; gap: clamp(22px, 5vh, 56px); padding-bottom: 3vh; }
.home-head { text-align: center; display: grid; gap: 12px; justify-items: center; }
.home-head h2 { font-size: clamp(30px, min(3.6vw, 6.4dvh), 52px); font-weight: 600; line-height: 1.2; letter-spacing: 0.04em; }
.home-head h2 em { font-family: var(--serif); font-weight: 400; color: var(--acc); font-size: 1.12em; }
.home-head { gap: 8px; }
.home-sub { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: clamp(18px, 1.9vw, 26px); line-height: 1.25; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 4px; }
.tag {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px; line-height: 1.5;
  border: 1px solid rgba(var(--acc-rgb), 0.4); color: var(--acc); background: rgba(var(--acc-rgb), 0.08);
  white-space: nowrap;
}
.tag.plain { border-color: var(--line-2); color: var(--muted); background: var(--panel); }

/* ───────── Gallery ───────── */
.gallery .view-inner { justify-content: center; gap: clamp(12px, 2.6vh, 40px); }
.g-head { display: grid; gap: 8px; justify-items: center; text-align: center; }
.g-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, min(4.3vw, 7.4dvh), 64px); line-height: 1; letter-spacing: -0.01em; }
.g-head h2 em { color: var(--acc); }
.g-sub { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: clamp(16px, 1.6vw, 21px); max-width: 34em; line-height: 1.3; }
.g-lead { color: var(--ink); font-size: 16px; max-width: 40em; }
.gallery .orbs { max-width: 780px; margin: 0 auto; gap: clamp(10px, 2vh, 30px) clamp(20px, 3.4vw, 56px); }
.g-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ───────── Slides ───────── */
.slide .view-inner { gap: clamp(12px, 2vh, 22px); justify-content: center; padding-bottom: 2vh; }
.s-head { display: grid; gap: 8px; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; color: var(--acc); text-transform: uppercase; }
.s-head h2 { font-size: clamp(22px, min(2.3vw, 4.2dvh), 34px); font-weight: 600; line-height: 1.3; letter-spacing: 0.005em; max-width: 34em; text-wrap: balance; }
.s-head h2 em { font-style: normal; color: var(--acc); }
.lead { color: var(--muted); font-size: 15.5px; max-width: 54em; }
.lead b, .card b, .points b { color: var(--ink); font-weight: 600; }
.cols { display: grid; gap: clamp(16px, 2.2vw, 30px); align-items: start; }
.cols.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols.c-5-7 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.cols.c-7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.cols.c-4-8 { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
.cols.c-9-3 { grid-template-columns: minmax(0, 9fr) minmax(0, 3fr); }
.cols.center { align-items: center; }
.stack { display: grid; gap: 14px; align-content: start; }

.card { border: 1px solid var(--line); background: var(--panel); border-radius: 16px; padding: 16px 18px; }
.card h3 { font-size: 15.5px; font-weight: 600; margin-bottom: 4px; }
.card p { font-size: 14px; color: var(--muted); line-height: 1.65; }
.card.hot { border-color: rgba(var(--acc-rgb), 0.55); background: linear-gradient(160deg, rgba(var(--acc-rgb), 0.16), rgba(var(--acc-rgb), 0.04)); }
.card .label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--faint); text-transform: uppercase; display: block; margin-bottom: 6px; }
.card.hot .label { color: var(--acc); }

.points { display: grid; gap: 12px; }
.points li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; font-size: 14.5px; color: var(--muted); line-height: 1.65; }
.points li > i {
  font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--acc);
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(var(--acc-rgb), 0.5);
  display: grid; place-items: center; margin-top: 1px;
}
.points strong { display: block; color: var(--ink); font-weight: 600; font-size: 15.5px; }

.fig { display: grid; gap: 8px; }
.paper {
  background: #fff; border-radius: 14px; padding: 10px; overflow: hidden; cursor: zoom-in; border: 0; width: 100%;
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.9);
  transition: transform 0.4s var(--ease);
}
.paper:hover { transform: translateY(-2px); }
.paper img { width: 100%; height: auto; border-radius: 6px; }
.paper.tall img { max-height: 52dvh; width: auto; margin: 0 auto; }
.fig figcaption, .cap { font-size: 12.5px; color: var(--faint); line-height: 1.5; }

.vids { display: grid; gap: 12px; }
.vids.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vids.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vids.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vid { position: relative; border-radius: 14px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.vid video { width: 100%; aspect-ratio: 3 / 2; max-height: 29dvh; object-fit: cover; }
.vid figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 9px;
  font-size: 13px; line-height: 1.4; color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78));
}
.vid figcaption b { font-weight: 600; }
.vid .badge {
  position: absolute; top: 9px; left: 9px; font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2);
}
.vid.ours { border-color: rgba(var(--acc-rgb), 0.8); box-shadow: 0 0 0 1px rgba(var(--acc-rgb), 0.5), 0 20px 50px -28px rgba(var(--acc-rgb), 0.9); }
.vid.ours .badge { background: var(--acc); color: #1a1206; border-color: transparent; font-weight: 600; }
.vid.bad figcaption { color: #ffd0c8; }

.stats { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.stat { display: grid; gap: 0; }
.stat b { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, min(3.6vw, 6.2dvh), 52px); line-height: 1; color: var(--acc); letter-spacing: -0.01em; }
.stat b small { font-size: 0.45em; color: var(--muted); margin-left: 4px; font-family: var(--sans); }
.stat span { font-size: 13px; color: var(--muted); max-width: 17em; line-height: 1.5; margin-top: 6px; }

/* tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs.vertical { flex-direction: column; flex-wrap: nowrap; }
.tab {
  text-align: left; cursor: pointer; border: 1px solid var(--line); background: var(--panel);
  border-radius: 14px; padding: 11px 14px; display: grid; gap: 2px;
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.tab:hover { background: var(--panel-2); }
.tab[aria-selected="true"] { border-color: rgba(var(--acc-rgb), 0.7); background: linear-gradient(120deg, rgba(var(--acc-rgb), 0.2), rgba(var(--acc-rgb), 0.05)); }
.tab i { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--acc); }
.tab b { font-weight: 600; font-size: 15px; }
.tab small { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.tabs.row .tab { padding: 8px 16px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px; }
.panel { display: none; gap: 14px; align-content: start; }
.panel.is-on { display: grid; animation: fadeUp 0.5s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

/* comparison bars */
.bars { display: grid; gap: 7px; }
.bars h4 { margin: 0 0 2px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.bar { display: grid; grid-template-columns: 124px 1fr 52px; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.bar .track { height: 9px; border-radius: 9px; background: var(--line); overflow: hidden; }
.bar .fill { display: block; height: 100%; width: calc(var(--v) * 1%); border-radius: 9px; background: rgba(255, 255, 255, 0.34); transform-origin: left; animation: grow 0.9s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.bar b { font-family: var(--mono); font-weight: 500; font-size: 12.5px; color: var(--ink); text-align: right; }
.bar.ours { color: var(--ink); }
.bar.ours .fill { background: var(--acc); }
.bar.ours b { color: var(--acc); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 6px 14px; text-align: right; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl thead th { font-weight: 500; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line-2); }
.tbl tbody tr + tr td { border-top: 1px solid var(--line); }
.tbl td { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.tbl td:first-child { font-family: var(--sans); font-size: 14px; color: var(--ink); }
.tbl tr.ours td { background: rgba(var(--acc-rgb), 0.09); color: var(--ink); }
.tbl td.best { color: var(--acc); font-weight: 700; }
.tbl tr.ref td, .tbl tr.ref td:first-child { color: var(--faint); }
.tbl .note { display: inline-block; margin-left: 8px; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); font-family: var(--sans); vertical-align: 1px; }
.tbl .note.warn { border-color: rgba(255, 150, 130, 0.5); color: #ffb3a4; }
.tbl tr.group td { font-family: var(--sans); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding-top: 12px; padding-bottom: 4px; }

/* TW · eras */
.eras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.keys { display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.era-art { margin-top: 10px; height: 26px; display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12px; }
.era-art svg { height: 24px; width: auto; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.card.hot .era-art { color: var(--acc); }

/* bylines */
.byline { font-size: 14px; color: var(--muted); line-height: 1.7; }
.byline mark { background: none; color: var(--acc); font-weight: 600; }
.byline sup { font-size: 0.72em; }

/* SAE */
.formula { font-family: var(--serif); font-size: clamp(20px, 1.9vw, 27px); line-height: 1.3; word-spacing: 0.12em; }
.formula i { font-style: italic; }
.formula sub, .formula sup { font-size: 0.6em; font-style: normal; }
.frac { display: inline-grid; text-align: center; vertical-align: middle; margin-left: 4px; }
.frac > span { padding: 2px 8px; }
.frac > span + span { border-top: 1px solid currentColor; }
.t-s { color: #9fc0ff; }
.t-w { color: var(--acc); }
.mixer { display: grid; gap: 12px; }
.mixer-row { display: grid; grid-template-columns: 96px 1fr 44px; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
.mixer-row output { font-family: var(--mono); color: var(--ink); text-align: right; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--line-2); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--acc); border: 2px solid #0b0f1e; cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--acc); border: 2px solid #0b0f1e; cursor: pointer; }
input[type="range"].s::-webkit-slider-thumb { background: #9fc0ff; }
input[type="range"].s::-moz-range-thumb { background: #9fc0ff; }
.mixbar { height: 34px; border-radius: 10px; overflow: hidden; display: flex; font-size: 12.5px; font-family: var(--mono); border: 1px solid var(--line-2); }
.mixbar span { display: grid; place-items: center; white-space: nowrap; overflow: hidden; transition: flex-basis 0.3s var(--ease); color: #10131f; font-weight: 600; }
.mixbar .a { background: #d7b8ff; }
.mixbar .b { background: #a9d2ff; }
.diagram { width: 100%; height: auto; display: block; }
.diagram text { font-family: var(--sans); fill: var(--muted); font-size: 13px; }
.diagram .t-ink { fill: var(--ink); }
.diagram .t-acc { fill: var(--acc); font-weight: 600; }
.grid-demo { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 18px; align-items: center; max-width: 720px; margin: 0 auto; }
.cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.cells i { aspect-ratio: 1; border-radius: 4px; background: rgba(255, 255, 255, 0.06); border: 1px dashed rgba(255, 255, 255, 0.14); }
.cells i.a { background: #c9a8ff; border: 0; }
.cells i.b { background: #9fcbff; border: 0; }
.grid-demo .op { font-family: var(--serif); font-size: 26px; color: var(--muted); }
.grid-cap { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.grid-cap b { color: var(--ink); display: block; font-weight: 600; }

/* LEAFLET flow */
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; counter-reset: f; }
.flow li { position: relative; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 12px 14px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.flow li b { display: block; color: var(--ink); font-size: 14.5px; font-weight: 600; }
.flow li::before { counter-increment: f; content: "0" counter(f); font-family: var(--mono); font-size: 11px; color: var(--acc); display: block; margin-bottom: 4px; }
.flow li:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); color: var(--faint); z-index: 1; font-size: 13px; }
.flow li.hot { border-color: rgba(var(--acc-rgb), 0.55); background: rgba(var(--acc-rgb), 0.1); }

/* ───────── Lightbox ───────── */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 3vmin;
  background: rgba(3, 5, 12, 0.88); backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0s 0.3s; cursor: zoom-out;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.lightbox img { max-width: 100%; max-height: 92dvh; background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8); }

@media (min-width: 901px) and (max-height: 700px) {
  .side-full { gap: 12px; padding-top: 18px; padding-bottom: 14px; }
  .cv { gap: 6px; font-size: 13px; }
  .bio { font-size: 13.5px; line-height: 1.6; }
}
@media (min-width: 901px) and (max-height: 770px) {
  .g-sub, .orbit:not(.big) .orb-label small { display: none; }
  .points { gap: 8px; }
  .card { padding: 12px 16px; }
  .tbl th, .tbl td { padding: 4px 12px; }
  .stats { gap: 8px 22px; }
  .lead { font-size: 14.5px; }
}

/* ───────── Responsive ───────── */
@media (max-width: 1180px) {
  :root { --side-w: 290px; }
  .side-full { width: 290px; padding: 22px 20px 18px; }
}
@media (max-width: 900px) {
  body, body[data-view="slide"] { display: block; overflow: auto; --side-w: 100%; }
  .side { height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-full { width: 100%; height: auto; padding: 16px 18px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 16px; overflow: visible; }
  .side-top { flex: 1; min-width: 240px; }
  .portrait { width: 84px; aspect-ratio: 1; border-radius: 50%; }
  .bio, .cv { display: none; }
  .links { margin: 0; padding: 0; width: 100%; }
  body[data-view="slide"] .side-full { opacity: 1; pointer-events: auto; transform: none; }
  body[data-view="slide"] .portrait, body[data-view="slide"] .links { display: none; }
  body[data-view="slide"] .side h1 { margin-top: 2px; }
  .side-mini { display: none; }
  .stage { height: auto; min-height: 100dvh; display: block; }
  .views { position: static; }
  .view { position: static; display: none; overflow: visible; transform: none; }
  .view.is-active { display: block; }
  .navbar { position: sticky; bottom: 0; background: rgba(5, 7, 15, 0.9); backdrop-filter: blur(10px); border-top: 1px solid var(--line); z-index: 5; }
  .hint { display: none; }
  .cols.c2, .cols.c-5-7, .cols.c-7-5, .cols.c-4-8, .cols.c-9-3 { grid-template-columns: minmax(0, 1fr); }
  .eras, .flow { grid-template-columns: minmax(0, 1fr); }
  .flow li:not(:last-child)::after { display: none; }
  .vids.n3, .vids.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs.vertical { flex-direction: row; flex-wrap: wrap; }
  .tabs.vertical .tab small { display: none; }
  .progress-track { display: none; }
  .nav-btn small { display: none; }
  .orbit { --d: 118px; }
  .orbit.big { --d: 150px; }
  .home .orbs { flex-wrap: wrap; }
  .paper.tall img { max-height: none; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
