/* =====================================================================
   SYS://ORBIT — style prototype (phase 1)
   Visual language: deep space + signal interference + render-style switching
   Modes (html[data-mode]): deep | blueprint | signal | halftone
   ===================================================================== */

/* ---------- 1. tokens ---------- */
:root {
  --f-display: "Chakra Petch", "Noto Sans TC", system-ui, sans-serif;
  --f-stencil: "Big Shoulders Stencil Display", "Chakra Petch", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --f-serif: "Noto Serif TC", "Songti TC", serif;
  --f-body: "Noto Sans TC", "Chakra Petch", system-ui, sans-serif;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 48px);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-snap: cubic-bezier(.7, 0, .2, 1);

  /* deep (default) */
  --bg: #04060f;
  --bg-2: #0a1030;
  --panel: rgba(7, 11, 32, .74);
  --panel-solid: #0b112f;
  --line: rgba(150, 170, 255, .16);
  --line-strong: rgba(170, 190, 255, .38);
  --text: #e6ebff;
  --text-dim: #8a95c4;
  --accent: #4a66ff;
  --accent-2: #8a6bff;
  --hl: #a9d8ff;
  --ice: #dfe8ff;
  --emblem: rgba(235, 240, 255, .92);
  --code-bg: rgba(4, 8, 26, .85);
  --ca-r: rgba(255, 50, 90, .75);
  --ca-c: rgba(40, 235, 255, .75);
  --scan-a: .20;
  --grain-a: .07;
  --grid-a: 0;
  --sigil: #9ec2ff;
  color-scheme: dark;
}

html[data-mode="blueprint"] {
  --bg: #eceef4;
  --bg-2: #dfe3ee;
  --panel: rgba(250, 251, 255, .82);
  --panel-solid: #f6f7fb;
  --line: rgba(31, 59, 255, .22);
  --line-strong: rgba(31, 59, 255, .55);
  --text: #0b1766;
  --text-dim: #4b58a6;
  --accent: #1f3bff;
  --accent-2: #1f3bff;
  --hl: #1f3bff;
  --ice: #1f3bff;
  --emblem: rgba(31, 59, 255, .92);
  --code-bg: rgba(31, 59, 255, .06);
  --ca-r: rgba(255, 60, 90, .55);
  --ca-c: rgba(0, 170, 255, .55);
  --scan-a: .05;
  --grain-a: .05;
  --grid-a: 1;
  --sigil: #1f3bff;
  color-scheme: light;
}

html[data-mode="signal"] {
  --bg: #021214;
  --bg-2: #062628;
  --panel: rgba(3, 32, 34, .7);
  --panel-solid: #04282a;
  --line: rgba(80, 240, 220, .18);
  --line-strong: rgba(90, 250, 230, .45);
  --text: #cafff5;
  --text-dim: #5fb2a7;
  --accent: #35e0cc;
  --accent-2: #e24bd2;
  --hl: #8affee;
  --ice: #b9fff4;
  --emblem: rgba(140, 255, 236, .9);
  --code-bg: rgba(1, 20, 22, .88);
  --scan-a: .30;
  --grain-a: .09;
  --grid-a: 0;
  --sigil: #5ff5df;
}

html[data-mode="halftone"] {
  --bg: #050505;
  --bg-2: #141414;
  --panel: rgba(16, 16, 16, .76);
  --panel-solid: #121212;
  --line: rgba(255, 255, 255, .16);
  --line-strong: rgba(255, 255, 255, .45);
  --text: #f3f3f3;
  --text-dim: #8d8d8d;
  --accent: #ffffff;
  --accent-2: #3f5cff;
  --hl: #ffffff;
  --ice: #ffffff;
  --emblem: rgba(255, 255, 255, .92);
  --code-bg: rgba(0, 0, 0, .85);
  --scan-a: .24;
  --grain-a: .10;
  --grid-a: 0;
  --sigil: #ffffff;
}

/* ---------- 2. base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); transition: background-color .25s linear; }
body {
  margin: 0;
  min-height: 100vh;
  background: transparent;   /* html paints the colour; the fixed 3D canvas sits behind body */
  color: var(--text);
  font-family: var(--f-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: color .25s linear;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: var(--bg); }
.mono { font-family: var(--f-mono); letter-spacing: .04em; }
.serif { font-family: var(--f-serif); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 1px dashed var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- 3. fixed background & overlays ---------- */
#cosmos, .bg-fallback, #glitch-layer, .fx-scan, .fx-grain, .fx-vignette, .fx-grid {
  position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
#cosmos { z-index: -3; display: block; }
.bg-fallback {
  z-index: -4;
  background:
    radial-gradient(ellipse at 70% 30%, rgba(74, 102, 255, .25), transparent 55%),
    radial-gradient(ellipse at 20% 80%, rgba(138, 107, 255, .15), transparent 50%),
    var(--bg);
}
.fx-grid {
  z-index: -2;
  opacity: var(--grid-a);
  transition: opacity .3s;
  background-image:
    linear-gradient(rgba(31, 59, 255, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 59, 255, .10) 1px, transparent 1px),
    linear-gradient(rgba(31, 59, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 59, 255, .05) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
#glitch-layer { z-index: 60; }
.fx-scan {
  z-index: 50;
  opacity: var(--scan-a);
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .9) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(to right, rgba(255, 255, 255, .10) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
html[data-mode="blueprint"] .fx-scan { mix-blend-mode: normal; }
.fx-grain {
  z-index: 51;
  inset: -60%;
  width: 220%;
  height: 220%;
  opacity: var(--grain-a);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain .7s steps(6) infinite;
}
.fx-vignette {
  z-index: 49;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%);
}
html[data-mode="blueprint"] .fx-vignette { background: radial-gradient(ellipse at center, transparent 60%, rgba(31, 59, 255, .10) 100%); }
body.no-scan .fx-scan, body.no-grain .fx-grain { display: none; }
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-6%, 4%); } 40% { transform: translate(5%, -7%); }
  60% { transform: translate(-3%, 8%); } 80% { transform: translate(7%, 2%); } 100% { transform: translate(0, 0); }
}

/* switching: chromatic text split + jitter while the glitch layer runs */
body.is-switching main, body.is-switching .topbar { animation: jitter .28s steps(3) 2; }
body.is-switching h1, body.is-switching h2, body.is-switching h3, body.is-switching .btn, body.is-switching .stat b {
  text-shadow: 3px 0 var(--ca-r), -3px 0 var(--ca-c);
}
@keyframes jitter {
  0% { transform: translate(0, 0); } 33% { transform: translate(-4px, 1px); } 66% { transform: translate(3px, -1px); } 100% { transform: translate(0, 0); }
}

/* ---------- 4. top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s;
}
.topbar.is-scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-display); font-weight: 600; letter-spacing: .18em; font-size: 14px; }
.brand svg { width: 30px; height: 30px; color: var(--accent); }
.brand .brand-name b { color: var(--accent); font-weight: 600; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { text-decoration: none; font-size: 14px; letter-spacing: .12em; color: var(--text-dim); position: relative; padding: 4px 0; transition: color .2s; }
.nav a .n { font-family: var(--f-mono); font-size: 10px; color: var(--accent); margin-right: 6px; vertical-align: 2px; }
.nav a:hover { color: var(--text); }
.nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: var(--accent); transition: right .3s var(--ease-out); }
.nav a:hover::after { right: 0; }

.mode-switch { display: flex; border: 1px solid var(--line-strong); }
.mode-switch button {
  appearance: none; border: 0; background: transparent; color: var(--text-dim);
  font: 500 12px/1 var(--f-display); letter-spacing: .14em; padding: 8px 11px; cursor: pointer; position: relative;
  transition: color .2s, background .2s;
}
.mode-switch button + button { border-left: 1px solid var(--line); }
.mode-switch button:hover { color: var(--text); }
.mode-switch button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
html[data-mode="halftone"] .mode-switch button[aria-pressed="true"] { color: #000; }
.readout { font-size: 11px; color: var(--text-dim); display: flex; gap: 14px; white-space: nowrap; }
.readout b { color: var(--hl); font-weight: 400; }
.menu-btn { display: none; }

/* ---------- 5. layout ---------- */
main { position: relative; z-index: 1; overflow-x: clip; }
.section { position: relative; padding: clamp(80px, 12vh, 140px) var(--gutter); }
.wrap { max-width: var(--wrap); margin: 0 auto; position: relative; }

.sec-head { display: grid; grid-template-columns: auto auto 1fr auto; align-items: end; gap: 6px 18px; margin-bottom: clamp(36px, 6vh, 64px); position: relative; }
.sec-index { font-size: 12px; color: var(--accent); align-self: start; padding-top: 10px; }
.sec-title { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: clamp(34px, 4.6vw, 64px); line-height: 1; letter-spacing: .14em; text-transform: uppercase; }
.sec-title-zh { grid-column: 2; font-family: var(--f-serif); font-size: 15px; letter-spacing: .55em; color: var(--text-dim); }
.sec-rule { grid-column: 3; grid-row: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); align-self: center; position: relative; }
.sec-rule::before { content: ""; position: absolute; left: 0; top: -3px; width: 7px; height: 7px; border: 1px solid var(--accent); transform: rotate(45deg); }
.sec-coord { grid-column: 4; grid-row: 1; font-size: 11px; color: var(--text-dim); align-self: center; }

/* HUD panel with corner brackets */
.hud { position: relative; border: 1px solid var(--line); background: var(--panel); }
.hud::before, .hud::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1px solid var(--accent); pointer-events: none; z-index: 2; }
.hud::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.hud::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.tag { display: inline-flex; align-items: center; gap: 6px; font: 500 11px/1 var(--f-mono); letter-spacing: .08em; color: var(--hl); border: 1px solid var(--line); padding: 5px 8px; text-transform: uppercase; white-space: nowrap; }
.tag::before { content: ""; width: 4px; height: 4px; background: var(--accent); }

.btn {
  --cut: 10px;
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 13px/1 var(--f-display); letter-spacing: .2em; text-transform: uppercase; text-decoration: none;
  padding: 15px 22px; color: var(--text);
  border: 1px solid var(--line-strong);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  position: relative; overflow: hidden; transition: color .25s, border-color .25s; cursor: pointer; background: transparent;
}
.btn::before { content: ""; position: absolute; inset: 0; background: var(--accent); transform: translateX(-101%); transition: transform .35s var(--ease-out); z-index: -1; }
.btn:hover { color: var(--bg); border-color: var(--accent); }
.btn:hover::before { transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-primary::before { background: var(--ice); }
html[data-mode="halftone"] .btn-primary, html[data-mode="halftone"] .btn:hover { color: #000; }
.btn .arrow { font-family: var(--f-mono); }

/* ---------- 6. hero ---------- */
.hero {
  position: relative; min-height: 100vh; padding: 120px var(--gutter) 120px;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 24px;
  max-width: 1500px; margin: 0 auto;
}
.hero::before {
  /* text protection. The hero is max 1500px and centred, so the layer starts at the
     window's left edge (50% - 50vw), not the hero's, or wide screens show a seam there. */
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(50% - 50vw); right: 40%; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--bg) 78%, transparent) 0%, color-mix(in srgb, var(--bg) 78%, transparent) 28%, color-mix(in srgb, var(--bg) 45%, transparent) 64%, transparent 100%);
}
.hero-text { position: relative; }
.kicker { font-size: 12px; color: var(--accent); margin: 0 0 22px; letter-spacing: .2em; }
.hero-name {
  margin: 0; font-family: var(--f-display); font-weight: 600; text-transform: uppercase;
  font-size: clamp(46px, 7vw, 108px); line-height: .95; letter-spacing: .05em; position: relative;
}
.hero-name-zh { margin: 14px 0 0; font-family: var(--f-serif); font-size: clamp(18px, 2vw, 24px); letter-spacing: .6em; color: var(--text-dim); }
.hero-role { margin: 28px 0 0; font-size: 13px; letter-spacing: .28em; color: var(--hl); display: flex; align-items: center; gap: 12px; }
.hero-role::before { content: ""; width: 36px; height: 1px; background: var(--accent); }
.hero-lead { margin: 22px 0 0; max-width: 34em; color: var(--text-dim); font-weight: 300; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 38px; }

.hero-space { min-height: 40vh; }

/* HUD trackers that follow objects in the 3D scene */
.trackers { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.tracker { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .5s; color: var(--line-strong); will-change: transform; }
.tracker.is-on { opacity: 1; }
.tk-reticle { position: absolute; width: 120px; height: 120px; left: -60px; top: -60px; animation: spin 40s linear infinite; overflow: visible; }
.tracker[data-track="planet"] .tk-reticle { width: 190px; height: 190px; left: -95px; top: -95px; animation-duration: 70s; }
.tracker[data-track="field"] .tk-reticle { width: 150px; height: 150px; left: -75px; top: -75px; animation-direction: reverse; }
.tk-label { position: absolute; left: 74px; top: -92px; font-size: 10px; line-height: 1.8; color: var(--text-dim); white-space: nowrap; letter-spacing: .14em; padding-left: 10px; border-left: 1px solid var(--accent); }
.tracker[data-track="planet"] .tk-label { left: 104px; top: -120px; }
.tk-label b { color: var(--hl); font-weight: 400; }
.tk-label i { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.subtitle {
  position: absolute; left: 0; right: 0; bottom: 64px; margin: 0; text-align: center;
  font-family: var(--f-serif); font-weight: 600; font-size: clamp(14px, 1.4vw, 18px); letter-spacing: .32em;
  color: #fff; text-shadow: 0 0 12px rgba(0, 0, 0, .9), 0 0 2px rgba(0, 0, 0, .9);
  transition: opacity .35s, filter .35s;
}
html[data-mode="blueprint"] .subtitle { color: var(--text); text-shadow: 0 0 10px rgba(255, 255, 255, .9); }
.subtitle.is-out { opacity: 0; filter: blur(4px); }
.scroll-hint { position: absolute; left: var(--gutter); bottom: 28px; font-size: 10px; color: var(--text-dim); letter-spacing: .3em; }
.scroll-hint::after { content: ""; display: inline-block; width: 60px; height: 1px; margin-left: 12px; vertical-align: middle; background: linear-gradient(90deg, var(--accent), transparent); animation: hint 2.4s var(--ease-snap) infinite; transform-origin: left; }
@keyframes hint { 0% { transform: scaleX(0); } 50% { transform: scaleX(1); } 100% { transform: scaleX(1); opacity: 0; } }

/* glitch text copies (used on .hero-name during bursts) */
.glitch-text { position: relative; }
.glitch-text::before, .glitch-text::after {
  content: attr(data-text); position: absolute; inset: 0; opacity: 0; pointer-events: none;
}
.is-burst .glitch-text::before { opacity: .85; color: var(--ca-c); transform: translate(-5px, 0); clip-path: inset(10% 0 55% 0); animation: gl1 .3s steps(2) infinite; }
.is-burst .glitch-text::after { opacity: .85; color: var(--ca-r); transform: translate(5px, 0); clip-path: inset(58% 0 8% 0); animation: gl2 .3s steps(2) infinite; }
@keyframes gl1 { 0% { clip-path: inset(10% 0 55% 0); } 50% { clip-path: inset(40% 0 30% 0); } 100% { clip-path: inset(70% 0 5% 0); } }
@keyframes gl2 { 0% { clip-path: inset(58% 0 8% 0); } 50% { clip-path: inset(5% 0 80% 0); } 100% { clip-path: inset(30% 0 45% 0); } }

/* ---------- 7. reveal: domino tile flip (drawn by tile-flip.js on a canvas inside the element) ---------- */
[data-reveal] { position: relative; }
.tile-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
.js [data-reveal]:not(.is-shown) > :not(.tile-fx):not(.const-tip) { opacity: 0; }

/* ---------- 8. profile ---------- */
.profile-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.fx-frame { position: relative; margin: 0; overflow: hidden; background: var(--panel-solid); }
.fx-frame .fx-img { width: 100%; height: 100%; object-fit: cover; }
.fx-frame canvas.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fx-frame.has-canvas .fx-img { visibility: hidden; }
.fx-frame figcaption { position: absolute; left: 12px; bottom: 10px; z-index: 3; font-size: 10px; letter-spacing: .2em; color: #fff; mix-blend-mode: difference; }
.profile-photo { aspect-ratio: 5 / 6; }
.profile-photo .ticks { position: absolute; inset: 10px; z-index: 3; pointer-events: none; border: 1px solid rgba(255, 255, 255, .12); }
.quote { font-size: clamp(20px, 2.2vw, 28px); line-height: 1.6; letter-spacing: .12em; margin: 0 0 22px; }
.profile-body p { color: var(--text-dim); font-weight: 300; }
.spec { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 28px 0; border-top: 1px solid var(--line); }
.spec div { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.spec div:nth-child(odd) { padding-right: 18px; border-right: 1px solid var(--line); }
.spec div:nth-child(even) { padding-left: 18px; }
.spec dt { color: var(--text-dim); }
.spec dd { margin: 0; color: var(--text); text-align: right; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px 14px 14px; }
.stat b { display: block; font-family: var(--f-display); font-weight: 500; font-size: clamp(30px, 3.4vw, 44px); line-height: 1; color: var(--ice); letter-spacing: .02em; }
.stat b sup { font-size: .45em; color: var(--accent); margin-left: 2px; }
.stat > span { display: block; margin-top: 8px; font-size: 12px; color: var(--text-dim); letter-spacing: .08em; }

/* ---------- 9. timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 150px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(var(--accent), var(--line) 30%, var(--line) 80%, transparent); }
.tl-item { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 0 44px; padding: 0 0 52px; position: relative; }
.tl-when { font-size: 12px; color: var(--hl); padding-top: 4px; text-align: right; padding-right: 28px; }
.tl-when small { display: block; color: var(--text-dim); font-size: 10px; letter-spacing: .2em; }
.tl-node { position: absolute; left: 150px; top: 8px; width: 13px; height: 13px; transform: translateX(-50%); border: 1px solid var(--accent); border-radius: 50%; background: var(--bg); }
.tl-node::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.tl-body h3 { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: 22px; letter-spacing: .06em; }
.tl-org { margin: 4px 0 12px; font-size: 13px; color: var(--text-dim); letter-spacing: .1em; }
.tl-body ul { margin: 0 0 14px; padding: 0; list-style: none; color: var(--text-dim); font-weight: 300; }
.tl-body li { padding-left: 18px; position: relative; }
.tl-body li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 10. constellation ---------- */
.constellation { position: relative; height: clamp(420px, 60vh, 560px); }
.constellation canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.constellation .const-tip { position: absolute; z-index: 3; pointer-events: none; min-width: 180px; max-width: 260px; padding: 12px 14px; font-size: 13px; opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
.constellation .const-tip.is-on { opacity: 1; transform: none; }
.const-tip b { display: block; font-family: var(--f-display); font-weight: 600; letter-spacing: .08em; }
.const-tip .lv { display: flex; gap: 3px; margin: 8px 0 6px; }
.const-tip .lv i { width: 16px; height: 4px; background: var(--line); }
.const-tip .lv i.on { background: var(--accent); }
.const-tip p { margin: 0; color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.skill-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.skill-group h3 { margin: 0 0 10px; font-family: var(--f-serif); font-weight: 600; font-size: 15px; letter-spacing: .3em; color: var(--text); }
.skill-group h3 small { display: block; font-family: var(--f-mono); font-weight: 400; font-size: 10px; letter-spacing: .2em; color: var(--accent); }

.constellation { cursor: grab; touch-action: pan-y; user-select: none; }
.constellation:active { cursor: grabbing; }
.const-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.node-label {
  position: absolute; left: 0; top: 0; pointer-events: auto; appearance: none; background: none; border: 0; padding: 2px 4px;
  font: 500 11.5px/1.2 var(--f-mono); letter-spacing: .04em; color: var(--text); white-space: nowrap; cursor: pointer;
  transition: opacity .2s, color .2s; text-shadow: 0 0 6px var(--bg), 0 0 2px var(--bg);
}
.node-label.is-act { color: var(--hl); }
.node-label.is-act::before { content: "▸ "; color: var(--accent); }
.group-label { position: absolute; left: 0; top: 0; font-family: var(--f-serif); font-weight: 600; font-size: 20px; letter-spacing: .4em; color: var(--text); text-align: center; pointer-events: none; transition: opacity .3s; text-shadow: 0 0 10px var(--bg); white-space: nowrap; }
.group-label small { display: block; font: 400 10px/1.6 var(--f-mono); letter-spacing: .3em; color: var(--accent); }
.const-hint { position: absolute; right: 14px; bottom: 10px; margin: 0; font-size: 10px; color: var(--text-dim); letter-spacing: .2em; z-index: 3; }
.const-tip .grp { display: block; font-size: 10px; color: var(--accent); letter-spacing: .14em; margin-top: 2px; }

/* ---------- 11. archive cards ---------- */
.filters { display: flex; gap: 8px; margin: -24px 0 28px; flex-wrap: wrap; }
.filters button { appearance: none; background: none; border: 1px solid var(--line); color: var(--text-dim); font: 500 12px/1 var(--f-display); letter-spacing: .16em; padding: 9px 14px; cursor: pointer; }
.filters button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.card { display: flex; flex-direction: column; text-decoration: none; transition: transform .35s var(--ease-out), border-color .25s; }
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.card .fx-frame { aspect-ratio: 16 / 10; }
.card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-meta { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-dim); }
.card-meta .kind { color: var(--accent); }
.card h3 { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: 19px; line-height: 1.4; letter-spacing: .04em; }
.card p { margin: 0; font-size: 14px; color: var(--text-dim); font-weight: 300; flex: 1; }
.card.is-hidden { display: none; }
.card-code { aspect-ratio: 16 / 10; overflow: hidden; background: var(--code-bg); padding: 14px 16px; font: 11px/1.7 var(--f-mono); color: var(--text-dim); position: relative; }
.card-code .k { color: var(--accent-2); }
.card-code .s { color: var(--hl); }
.card-code .c { opacity: .55; }
.card-code mark { background: var(--accent); color: var(--bg); padding: 0 2px; }

/* ---------- 12. featured log (article sample) ---------- */
.log { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(24px, 4vw, 56px); }
.log-article { padding: clamp(22px, 3vw, 40px); }
.log-article h3 { margin: 0 0 6px; font-family: var(--f-display); font-weight: 500; font-size: clamp(22px, 2.4vw, 30px); letter-spacing: .04em; line-height: 1.35; }
.log-article .meta { font-size: 11px; color: var(--text-dim); margin-bottom: 22px; display: flex; gap: 16px; flex-wrap: wrap; }
.log-article p { color: var(--text-dim); font-weight: 300; }
.log-article h4 { font-family: var(--f-serif); font-weight: 600; font-size: 17px; letter-spacing: .2em; margin: 30px 0 8px; color: var(--text); }
.log-article h4::before { content: "// "; font-family: var(--f-mono); color: var(--accent); letter-spacing: 0; }
pre.code { margin: 18px 0; padding: 16px 18px; background: var(--code-bg); border-left: 2px solid var(--accent); overflow-x: auto; font: 12.5px/1.75 var(--f-mono); color: var(--text); }
pre.code .k { color: var(--accent-2); } pre.code .s { color: var(--hl); } pre.code .c { color: var(--text-dim); }
.callout { border: 1px solid var(--line); border-left: 2px solid var(--accent-2); padding: 12px 16px; font-size: 14px; color: var(--text-dim); margin: 18px 0; }
.callout b { color: var(--text); font-family: var(--f-mono); font-weight: 600; letter-spacing: .1em; margin-right: 8px; }
.log-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.log-article { min-width: 0; }
.log-side .hud { padding: 18px; }
.log-side h4 { margin: 0 0 12px; font: 500 12px/1 var(--f-mono); letter-spacing: .2em; color: var(--accent); }
.toc { list-style: none; margin: 0; padding: 0; counter-reset: t; font-size: 14px; }
.toc li { counter-increment: t; padding: 7px 0; border-bottom: 1px dashed var(--line); color: var(--text-dim); }
.toc li::before { content: counter(t, decimal-leading-zero) "  "; font-family: var(--f-mono); color: var(--accent); font-size: 11px; }
.code-rain { height: 190px; overflow: hidden; font: 10.5px/1.5 var(--f-mono); color: var(--text-dim); white-space: pre; position: relative; }
.code-rain .blk { background: var(--accent); color: var(--bg); }
.code-rain .blk2 { background: var(--accent-2); color: var(--bg); }

/* ---------- 13. contact / footer ---------- */
.uplink { text-align: center; padding-bottom: 40px; }
.uplink-big { font-family: var(--f-stencil); font-weight: 900; font-size: clamp(64px, 13vw, 210px); line-height: .85; letter-spacing: .01em; margin: 0; text-transform: uppercase; color: var(--emblem); }
.uplink-zh { font-family: var(--f-serif); letter-spacing: .8em; color: var(--text-dim); margin: 20px 0 40px; }
.links { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 28px var(--gutter) 34px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-dim); position: relative; z-index: 1; }

/* ---------- 14. style lab ---------- */
.lab { position: fixed; left: 16px; bottom: 16px; z-index: 70; width: 280px; font-size: 12px; background: var(--panel-solid); }
.lab summary { list-style: none; cursor: pointer; padding: 10px 14px; font: 600 11px/1 var(--f-mono); letter-spacing: .2em; color: var(--accent); display: flex; justify-content: space-between; }
.lab summary::-webkit-details-marker { display: none; }
.lab[open] summary { border-bottom: 1px solid var(--line); }
.lab .lab-body { padding: 12px 14px 14px; display: grid; gap: 10px; }
.lab label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-dim); }
.lab input[type="range"] { width: 120px; accent-color: var(--accent); }
.lab input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.lab .drop { border: 1px dashed var(--line-strong); padding: 12px; text-align: center; color: var(--text-dim); cursor: pointer; line-height: 1.5; }
.lab .drop.is-over { border-color: var(--accent); color: var(--text); }
.lab .lab-note { color: var(--text-dim); font-size: 11px; line-height: 1.6; margin: 0; }
.lab .btn { padding: 10px 14px; font-size: 11px; justify-content: center; }

/* ---------- 15. responsive ---------- */
@media (max-width: 1100px) {
  .readout { display: none; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .nav { display: none; }
  .mode-switch { margin-left: auto; }
  .hero { grid-template-columns: 1fr; padding-top: 96px; min-height: auto; padding-bottom: 150px; }
  .hero-space { order: -1; min-height: 34vh; }
  .hero::before { inset: 30vh 0 0 0; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 70%, transparent) 30%); }
  .profile-grid, .log { grid-template-columns: minmax(0, 1fr); }
  .profile-photo { max-width: 420px; }
  .sec-head { grid-template-columns: auto 1fr; }
  .sec-rule, .sec-coord { display: none; }
  .timeline::before { left: 7px; }
  .tl-item { grid-template-columns: 1fr; padding-left: 34px; }
  .tl-node { left: 7px; }
  .tl-when { text-align: left; padding: 0 0 6px; }
  .tl-when small { display: inline; margin-left: 8px; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .brand .brand-name { display: none; }
  .mode-switch button { padding: 8px 8px; letter-spacing: .06em; }
  .cards, .skill-groups { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec { grid-template-columns: 1fr; }
  .spec div:nth-child(odd) { padding-right: 0; border-right: 0; }
  .spec div:nth-child(even) { padding-left: 0; }
  .subtitle { letter-spacing: .14em; bottom: 70px; padding: 0 16px; }
  .lab { left: 8px; right: 8px; width: auto; bottom: 8px; }
  .sec-title { letter-spacing: .08em; }
}

/* ---------- 16. reduced motion ---------- */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
html.reduce-motion .fx-grain { animation: none; }
