/* =========================================================
   吴一凡作品集 v2 · Digital Twin Atelier
   设计系统：深海军蓝 / 象牙 / 朱橙；直角；系统字体；零图片
   ========================================================= */

:root {
  --bg: #060a12;
  --bg-2: #0a111c;
  --surface: #0c1420;
  --ink: #f2ebdd;
  --muted: #93a1b0;
  --faint: #8b98a7;
  --line: rgba(242, 235, 221, 0.14);
  --line-strong: rgba(242, 235, 221, 0.26);
  --focus: #ff6b40;
  --accent: #e85c33;
  --accent-dim: rgba(232, 92, 51, 0.18);
  --accent-ink: #160703;
  --ok: #7fae8a;

  --serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", "Consolas", monospace;

  --pad: clamp(20px, 4vw, 72px);
  --max: 1440px;
  --topbar-h: 72px;
  --footer-h: 52px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(900px 620px at 74% 26%, rgba(232, 92, 51, 0.075), transparent 62%),
    radial-gradient(720px 520px at 88% 82%, rgba(147, 161, 176, 0.045), transparent 64%),
    radial-gradient(1100px 700px at 8% -8%, rgba(242, 235, 221, 0.035), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
html[data-render-tier="pending"] body { cursor: progress; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img, canvas { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--accent-ink); }

.skip-link {
  position: fixed;
  top: -100px;
  left: var(--pad);
  z-index: 100;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 11px/1 var(--mono);
  letter-spacing: 0.12em;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.042;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

/* ---------- top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(18px) saturate(135%);
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1;
}
.brand-text {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  letter-spacing: 0.1em;
  line-height: 1.25;
}
.brand-text small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
}
.topbar-meta {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 32px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--faint);
  text-transform: uppercase;
}
.meta-clock { color: var(--muted); font-variant-numeric: tabular-nums; }
.meta-sim { color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: calc(100dvh - var(--footer-h));
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 36px) var(--pad) calc(var(--footer-h) + 48px);
  display: flex;
  align-items: center;
}
.hero-copy {
  position: relative;
  z-index: 5;
  width: min(660px, 48vw);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 26px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
}
.eyebrow-rule { width: 26px; height: 1px; background: var(--accent); }

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(42px, 4.35vw, 74px);
  line-height: 1.14;
  letter-spacing: -0.01em;
}
.hero h1 span { display: block; }
.hero-sub {
  max-width: 33em;
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.95;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-top: 36px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: #f06a3e; border-color: #f06a3e; color: var(--accent-ink); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-glyph { font-size: 10px; letter-spacing: 0; }
.link-underline {
  position: relative;
  padding: 4px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.link-underline::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.link-underline:hover { color: var(--ink); }
.link-underline:hover::after { transform: scaleX(1); }

.hero-stats {
  display: flex;
  gap: clamp(26px, 3.4vw, 52px);
  margin: 56px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  width: min(100%, 480px);
}
.hero-stats div { display: flex; flex-direction: column; gap: 2px; }
.hero-stats dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--faint);
}
.hero-stats dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.2;
}

/* ---------- stage ---------- */
.hero-stage {
  position: absolute;
  inset: 0 0 0 32%;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.9s ease 0.15s;
}
body[data-ready] .hero-stage { opacity: 1; }
.stage-glow {
  position: absolute;
  left: 42%;
  top: 30%;
  width: 54%;
  height: 58%;
  transform: translate(-30%, -10%);
  background: radial-gradient(closest-side, rgba(232, 92, 51, 0.13), rgba(232, 92, 51, 0.035) 55%, transparent 74%);
  filter: blur(24px);
  pointer-events: none;
}
#hand-canvas, #poster-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
#hand-canvas { touch-action: none; cursor: grab; }
#hand-canvas:focus-visible { outline-offset: -3px; }
#hand-canvas:active { cursor: grabbing; }
#poster-canvas { cursor: default; }
.stage-scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    var(--bg) 0%,
    rgba(6, 10, 18, 0.94) 10%,
    rgba(6, 10, 18, 0.62) 28%,
    rgba(6, 10, 18, 0.12) 50%,
    transparent 66%
  );
}

.callout-layer, .callout-lines {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.callout {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 172px;
  opacity: 0;
  transform: translate3d(-999px, -999px, 0);
  transition: opacity 0.4s ease;
  will-change: transform;
  text-shadow: 0 1px 8px rgba(6, 10, 18, 0.95);
}
.callout.visible { opacity: 1; }
.callout-num {
  padding-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.callout-copy { display: flex; flex-direction: column; line-height: 1.4; }
.callout-copy b {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.callout-copy em {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.callout-lines path { fill: none; stroke: rgba(242, 235, 221, 0.32); stroke-width: 1; }
.callout-lines circle { fill: var(--accent); }

.stage-titleblock {
  position: absolute;
  right: clamp(16px, 3vw, 42px);
  bottom: calc(var(--footer-h) + 20px);
  z-index: 4;
  width: 292px;
  padding: 12px 14px 13px;
  border-top: 1px solid var(--line-strong);
  background: rgba(6, 10, 18, 0.58);
  backdrop-filter: blur(10px);
}
.tb-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.tb-rows { display: grid; gap: 3px; margin: 8px 0 0; }
.tb-rows div { display: flex; justify-content: space-between; gap: 12px; }
.tb-rows dt, .tb-rows dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.tb-rows dt { color: var(--faint); }
.tb-rows dd { color: var(--muted); }
.tb-rows dd.accent { color: var(--accent); }

.stage-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--footer-h) + 10px);
  z-index: 4;
  margin: 0;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--faint);
  white-space: nowrap;
  text-shadow: 0 1px 6px var(--bg);
}
.stage-badge {
  position: absolute;
  right: clamp(16px, 3vw, 42px);
  top: calc(var(--topbar-h) + 14px);
  z-index: 4;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-shadow: 0 1px 6px var(--bg);
}
.fallback-note {
  position: absolute;
  left: clamp(16px, 3vw, 42px);
  top: calc(var(--topbar-h) + 16px);
  z-index: 4;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.stage-noscript {
  position: absolute;
  left: 16%;
  top: 40%;
  z-index: 5;
  max-width: 360px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(6, 10, 18, 0.9);
  font-size: 13px;
  color: var(--muted);
}
.stage-noscript strong { display: block; margin-bottom: 6px; color: var(--ink); font-weight: 500; }

/* ---------- stats (only with ?stats=1) ---------- */
.stats {
  position: fixed;
  left: var(--pad);
  bottom: calc(var(--footer-h) + 10px);
  z-index: 55;
  display: flex;
  gap: 14px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 18, 0.82);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--faint);
  pointer-events: none;
}
.stats b { color: var(--ink); font-weight: 400; }
.stats-tier { color: var(--accent); }

/* ---------- footer ---------- */
.footer {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--footer-h);
  padding: 14px var(--pad);
  border-top: 1px solid var(--line);
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--faint);
  text-transform: uppercase;
}

/* ---------- entry motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { opacity: 0; transform: translateY(12px); animation: rise 0.7s var(--ease) forwards; }
  .hero-copy > *:nth-child(1) { animation-delay: 0.08s; }
  .hero-copy > *:nth-child(2) { animation-delay: 0.16s; }
  .hero-copy > *:nth-child(3) { animation-delay: 0.24s; }
  .hero-copy > *:nth-child(4) { animation-delay: 0.32s; }
  .hero-copy > *:nth-child(5) { animation-delay: 0.4s; }
}
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .hero-copy { width: min(600px, 54vw); }
  .hero h1 { font-size: clamp(40px, 4.8vw, 60px); }
  .meta-coord { display: none; }
}

@media (max-width: 900px) {
  :root { --topbar-h: 62px; }
  .topbar-meta { gap: 0; }
  .brand-text small { display: none; }
  .meta-sim { display: none; }
  .stats { display: none; }
  .hero {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-width: none;
    padding: calc(var(--topbar-h) + 38px) var(--pad) 0;
  }
  .hero-copy { display: contents; }
  .hero-copy > .eyebrow { order: 1; }
  .hero-copy > h1 { order: 2; }
  .hero-copy > .hero-sub { order: 3; }
  .hero-actions { order: 4; margin-top: 24px; }
  .hero-stage { order: 5; }
  .hero-stats { order: 6; margin-top: 28px; }
  .hero h1 { font-size: clamp(38px, 9.4vw, 54px); }
  .hero-sub { margin-top: 22px; font-size: 15px; line-height: 1.85; }
  .hero-stats { width: 100%; }
  .hero-stage {
    position: relative;
    inset: auto;
    width: calc(100% + var(--pad) * 2);
    margin: 22px calc(var(--pad) * -1) 0;
    height: min(42vh, 360px);
    min-height: 300px;
    opacity: 1;
  }
  .stage-scrim { display: none; }
  .stage-titleblock {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    padding: 8px 16px 9px;
    border-top: 1px solid var(--line-strong);
    background: rgba(6, 10, 18, 0.84);
  }
  .tb-head { padding-bottom: 5px; font-size: 11px; }
  .tb-rows {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 16px;
    margin-top: 5px;
  }
  .tb-rows dt, .tb-rows dd { font-size: 11px; }
  .stage-hint { display: none; }
  .stage-badge { display: none; }
  .fallback-note { left: 16px; top: 12px; }

  .callout { width: 150px; }
  .callout[data-priority="2"] { display: none; }
  .footer {
    position: static;
    height: auto;
    margin-top: 30px;
    padding: 16px var(--pad) 20px;
    font-size: 11px;
    letter-spacing: 0.05em;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

@media (max-width: 420px) {
  .brand-text { font-size: 13px; }
  .brand-text small { font-size: 11px; }
  .topbar-meta { font-size: 11px; letter-spacing: 0.06em; }
  .hero-stats { gap: 22px; }
  .hero-stats dd { font-size: 19px; }
  .stage-titleblock { width: calc(100% - 32px); }
}

@media (max-height: 760px) and (min-width: 901px) {
  .hero { padding-top: calc(var(--topbar-h) + 18px); padding-bottom: calc(var(--footer-h) + 24px); }
  .hero h1 { font-size: clamp(40px, 3.7vw, 60px); }
  .hero-sub { margin-top: 20px; font-size: 14.5px; }
  .hero-actions { margin-top: 26px; }
  .hero-stats { margin-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
  .hero-copy > * { opacity: 1; transform: none; }
  .hero-stage { opacity: 1; }
}
