/* ═══ 星鏈數遊 — 星軌・電影感 (Celestial Cinema, Variant C) ═══
   Design constitution: DESIGN.md — gold <2% area, cyan = live signals only,
   single obsidian canvas, square corners, expensive-machinery motion. */
:root {
  --bg: #05070D;
  --surface: #0B1220;
  --text: #EDF1F7;
  --muted: #8A94A8;
  --cyan: #3FD8FF;
  --gold: #C9A86A;
  --gold-line: rgba(201, 168, 106, .30);
  --line: rgba(138, 148, 168, .16);
  --serif: "Noto Serif TC", serif;
  --sans: "Noto Sans TC", "PingFang TC", sans-serif;
  --latin: "Marcellus", serif;
  --mono: "IBM Plex Mono", monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* film grain — kills plastic gradients */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
b { font-weight: 500; }
h2 { font-family: var(--serif); font-weight: 900; font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: .04em; line-height: 1.3; }

.eyebrow { font-family: var(--latin); letter-spacing: .55em; font-size: .76rem; color: var(--gold); text-indent: .55em; }

/* ═══ scroll progress hairline ═══ */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 1px; z-index: 70; background: transparent; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--cyan)); }

/* ═══ Nav ═══ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  transition: background .4s var(--ease), border-color .4s var(--ease), padding .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled { background: rgba(5, 7, 13, .82); backdrop-filter: blur(14px); border-bottom-color: var(--gold-line); }
.nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 26px 32px;
  display: flex; align-items: center; justify-content: center; gap: 56px;
  transition: padding .4s var(--ease);
}
.nav.scrolled .nav-inner { padding: 15px 32px; }
.nav-links { display: flex; gap: 48px; font-size: .88rem; letter-spacing: .18em; color: var(--muted); font-weight: 400; }
.nav-links a { position: relative; padding: 4px 0; transition: color .25s; }
.nav-links a:hover { color: var(--text); }
.nav-links a::after {
  content: ""; position: absolute; left: 50%; bottom: -2px; width: 0; height: 1px;
  background: var(--gold); transition: width .3s var(--ease), left .3s var(--ease);
}
.nav-links a:hover::after { width: 100%; left: 0; }
.gold-link { color: var(--gold) !important; }
.nav-brand { display: flex; align-items: center; }
/* alpha-cutout color logo: brightness lift keeps navy text legible on obsidian */
.brand-logo, .footer-logo {
  filter: brightness(1.75) saturate(.92);
}
.brand-logo { height: 58px; width: auto; transition: height .4s var(--ease); }
.nav.scrolled .brand-logo { height: 44px; }
.footer-logo { height: 74px; width: auto; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 10px; margin-left: auto; }
.nav-toggle span { display: block; width: 22px; height: 1.5px; background: var(--text); margin: 6px 0; transition: .3s var(--ease); }
.nav-mobile { display: none; }

/* ═══ Hero ═══ */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; overflow: hidden; padding: 90px 24px 70px;
  background:
    radial-gradient(1100px 700px at 50% 118%, rgba(63, 216, 255, .09), transparent 60%),
    radial-gradient(900px 500px at 50% -22%, rgba(201, 168, 106, .06), transparent 65%);
}
#starfield { position: absolute; inset: 0; width: 100%; height: 100%; }
.rings {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(140vw, 1100px); aspect-ratio: 1; opacity: .92; pointer-events: none;
}
.ring-g { transform-origin: 500px 500px; }
.r1 { transform: rotate(-14deg); animation: precess 90s linear infinite; }
.r2 { transform: rotate(-14deg); animation: precess 140s linear infinite reverse; }
.r3 { transform: rotate(-14deg); animation: precess 70s linear infinite; }
@keyframes precess {
  from { transform: rotate(-14deg) rotateZ(0deg); }
  to   { transform: rotate(-14deg) rotateZ(360deg); }
}

.hero-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
h1 {
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(3rem, 9.5vw, 5.6rem);
  letter-spacing: .22em; text-indent: .22em; line-height: 1.18;
  margin-top: 30px;
  text-shadow: 0 0 70px rgba(63, 216, 255, .25);
}
h1 .ch { display: inline-block; }
.hero-sub { margin-top: 26px; font-size: clamp(.98rem, 2vw, 1.18rem); letter-spacing: .3em; text-indent: .3em; color: var(--muted); }
.hero-sub b { color: var(--text); }
.h-divider { display: flex; align-items: center; gap: 18px; margin: 38px 0 0; }
.h-divider .l { width: 110px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line)); }
.h-divider .r { width: 110px; height: 1px; background: linear-gradient(90deg, var(--gold-line), transparent); }
.h-divider .d { width: 5px; height: 5px; transform: rotate(45deg); background: var(--gold); }
.hero-actions { margin-top: 40px; display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }

.btn-gold {
  position: relative; padding: 17px 44px;
  border: 1px solid var(--gold); color: var(--gold);
  letter-spacing: .2em; text-indent: .2em; font-size: .92rem; font-weight: 400;
  background: linear-gradient(135deg, rgba(201, 168, 106, .14), transparent);
  transition: background .35s var(--ease), color .35s var(--ease), box-shadow .35s var(--ease);
  overflow: hidden;
}
.btn-gold::before { /* one-shot specular glint, retriggered on hover */
  content: ""; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(237, 227, 204, .25), transparent);
  transform: skewX(-20deg);
}
.btn-gold:hover { background: linear-gradient(135deg, rgba(201, 168, 106, .28), rgba(201, 168, 106, .08)); color: #EDE3CC; box-shadow: 0 0 30px rgba(201, 168, 106, .15); }
.btn-gold:hover::before { animation: glint .9s var(--ease); }
@keyframes glint { to { left: 130%; } }
.btn-quiet { padding: 17px 28px; color: var(--muted); letter-spacing: .16em; font-size: .92rem; transition: color .3s; }
.btn-quiet:hover { color: var(--cyan); }
.btn-lg { font-size: 1rem; padding: 19px 52px; }

.ticker {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 2;
  border-top: 1px solid var(--gold-line);
  padding: 13px 20px;
  font-family: var(--mono); font-size: .64rem; letter-spacing: .16em; color: var(--muted);
  display: flex; justify-content: center; gap: clamp(22px, 5vw, 62px); flex-wrap: wrap;
  background: rgba(5, 7, 13, .5);
}
.ticker b { color: var(--cyan); font-weight: 400; }
.ticker .ok { color: var(--cyan); }
.sim { font-style: normal; color: var(--gold); border: 1px solid var(--gold-line); padding: 0 5px; font-size: .56rem; letter-spacing: .12em; margin-left: 6px; }

/* ═══ ACT rules ═══ */
.act-rule {
  max-width: 1280px; margin: 0 auto; padding: 88px 32px 34px;
  display: flex; align-items: center; gap: 26px;
}
.act-rule .n { font-family: var(--latin); color: var(--gold); letter-spacing: .32em; font-size: .8rem; white-space: nowrap; }
.act-rule .l { flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-line), transparent); }

/* ═══ Service panels ═══ */
.panel, .process, .contact { scroll-margin-top: 96px; }
.panel { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.panel-inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: 60px; align-items: center; }
.panel.alt .panel-inner { grid-template-columns: .85fr 1.15fr; }
.panel-copy { position: relative; padding-top: 26px; }
.roman {
  position: absolute; top: -34px; left: -8px; z-index: -1;
  font-family: var(--latin); font-size: 6rem; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px var(--gold-line);
}
.panel-copy .en { display: block; font-family: var(--latin); letter-spacing: .36em; font-size: .68rem; color: var(--gold); margin: 10px 0 22px; }
.panel-copy > p { color: var(--muted); max-width: 36em; }
.craft { list-style: none; margin: 22px 0; }
.craft li {
  padding: 10px 0 10px 20px; border-left: 1px solid var(--gold-line);
  color: var(--muted); font-size: .92rem; margin-bottom: 8px;
}
.craft li b { color: var(--gold); font-weight: 500; margin-right: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.tags span {
  font-size: .8rem; padding: 7px 16px; color: var(--muted); font-weight: 400;
  border: 1px solid var(--line); transition: border-color .3s, color .3s;
}
.tags span:hover { border-color: var(--cyan); color: var(--cyan); }

.panel-visual { display: flex; justify-content: center; }

/* game demo block — playable key art 星鏈遠征 */
.game-demo {
  position: relative; width: min(100%, 440px);
  border: 1px solid var(--gold-line); background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  cursor: crosshair; user-select: none;
  --px: 0; --py: 0;
}
.gd-title {
  position: absolute; top: 18px; left: 0; right: 0; z-index: 3;
  text-align: center; pointer-events: none;
}
.gd-title .zh {
  display: block; font-family: var(--serif); font-weight: 900;
  font-size: 1.5rem; letter-spacing: .4em; text-indent: .4em;
  background: linear-gradient(100deg, #EDE3CC, var(--gold) 60%, #8A6F42);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 10px rgba(201, 168, 106, .3));
}
.gd-title .en { display: block; font-family: var(--latin); font-size: .56rem; letter-spacing: .5em; text-indent: .5em; color: var(--muted); margin-top: 4px; }
.gd-scene { display: block; width: 100%; }
.gd-l1 { transform: translate(calc(var(--px) * -4px), calc(var(--py) * -3px)); }
.gd-l2 { transform: translate(calc(var(--px) * -9px), calc(var(--py) * -6px)); }
.gd-ship {
  transform: translate(calc(var(--px) * 16px), calc(var(--py) * 22px)) rotate(calc(var(--py) * 4deg));
  transform-origin: 96px 152px;
  transition: transform .25s var(--ease);
}
.gd-planet { animation: gdDrift 14s ease-in-out infinite alternate; }
@keyframes gdDrift { from { transform: translateY(0); } to { transform: translateY(8px); } }
.gd-ast { animation: gdDrift 9s ease-in-out infinite alternate; }
.gd-ast.a2 { animation-duration: 12s; animation-delay: 2s; }
.gd-flame { transform-origin: 38px 152px; animation: gdFlame .18s linear infinite alternate; }
@keyframes gdFlame { from { transform: scaleX(.75); opacity: .8; } to { transform: scaleX(1.15); opacity: 1; } }
.gd-lamp { animation: gdLamp 1.6s ease-in-out infinite; }
@keyframes gdLamp { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.gd-hud {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 16px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: .62rem; letter-spacing: .14em; color: var(--muted);
}
.gd-hud b { color: var(--cyan); font-weight: 400; }
#gdScore.blink { animation: gdBlink 1.2s step-end infinite; }
@keyframes gdBlink { 50% { opacity: .25; } }
#gdScore.scored { color: var(--gold); animation: none; }
.game-demo.shake { animation: gdShake .18s linear; }
@keyframes gdShake {
  25% { transform: translate(2px, -1px); }
  50% { transform: translate(-2px, 1px); }
  75% { transform: translate(1px, 1px); }
}
#gdLaser.fire { animation: gdFire .22s var(--ease) forwards; }
@keyframes gdFire { 0% { opacity: 1; } 100% { opacity: 0; } }
#gdBoom { --bx: 0px; --by: 0px; }
#gdBoom.hit { animation: gdHit .5s var(--ease) forwards; }
@keyframes gdHit {
  0% { opacity: 1; transform: translate(var(--bx), var(--by)) scale(.3); }
  70% { opacity: 1; transform: translate(var(--bx), var(--by)) scale(1.15); }
  100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(1.5); }
}

/* quant demo console */
.quant-demo {
  width: min(100%, 430px); background: var(--surface);
  border: 1px solid var(--gold-line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  font-family: var(--mono);
  --mx: 50%; --my: 50%;
  position: relative;
}
.quant-demo::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(240px circle at var(--mx) var(--my), rgba(63, 216, 255, .07), transparent 65%);
  opacity: 0; transition: opacity .4s;
}
.quant-demo:hover::before { opacity: 1; }
.qd-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  font-size: .62rem; letter-spacing: .2em; color: var(--gold);
}
.qd-row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 18px 0; font-size: .72rem; color: var(--muted); }
.qd-row b { color: var(--text); font-weight: 400; font-size: .95rem; }
.qd-row b.c { color: var(--cyan); }
.qd-chart { width: 100%; height: 88px; margin-top: 12px; display: block; }
.qd-log { padding: 12px 18px 16px; font-size: .62rem; line-height: 2; color: var(--muted); border-top: 1px solid var(--line); }
.qd-log .ok { color: var(--cyan); font-weight: 400; }

/* ═══ Creed ═══ */
.creed { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.creed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--gold-line); border: 1px solid var(--gold-line); }
.creed-item { background: var(--bg); padding: 44px 36px; transition: background .4s var(--ease); }
.creed-item:hover { background: var(--surface); }
.cnum { font-family: var(--latin); font-size: 1.5rem; color: var(--gold); display: block; margin-bottom: 16px; }
.creed-item h3 { font-family: var(--serif); font-weight: 900; font-size: 1.18rem; margin-bottom: 12px; letter-spacing: .06em; }
.creed-item p { color: var(--muted); font-size: .9rem; }

/* ═══ Process ═══ */
.process { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; }
.steps li { position: relative; padding-top: 22px; border-top: 1px solid var(--line); transition: border-color .4s; }
.steps li:hover { border-top-color: var(--gold); }
.snum { font-family: var(--mono); font-size: .72rem; color: var(--gold); letter-spacing: .2em; }
.steps h3 { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; margin: 10px 0 8px; letter-spacing: .05em; }
.steps p { color: var(--muted); font-size: .86rem; }

.faq { margin-top: 64px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 22px 8px;
  font-weight: 400; font-size: .98rem; letter-spacing: .04em;
  display: flex; justify-content: space-between; align-items: center;
  transition: color .3s;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--latin); color: var(--gold); font-size: 1.2rem; transition: transform .3s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--gold); }
.faq p { padding: 0 8px 24px; color: var(--muted); font-size: .9rem; max-width: 52em; }

/* ═══ Contact ═══ */
.contact { padding: 130px 32px 120px; text-align: center; position: relative;
  background: radial-gradient(800px 420px at 50% 100%, rgba(201, 168, 106, .05), transparent 65%);
}
.contact .serif { font-size: clamp(2rem, 5vw, 3rem); margin: 20px 0 14px; }
.contact-lead { color: var(--muted); margin-bottom: 44px; }
.contact .btn-gold { display: inline-block; }
.promise { margin-top: 26px; font-family: var(--mono); font-size: .7rem; letter-spacing: .14em; color: var(--muted); }

/* ═══ Footer ═══ */
.footer { border-top: 1px solid var(--gold-line); padding: 40px 32px; }
.footer-inner { max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; }
.footer-copy { font-size: .78rem; color: var(--muted); font-family: var(--mono); }

/* ═══ Reveal & choreography (progressive enhancement) ═══ */
.js .reveal { opacity: 0; transform: translateY(20px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.js .reveal.visible { opacity: 1; transform: none; }
.js .d1 { transition-delay: .08s; }
.js .d2 { transition-delay: .16s; }
.js .d3 { transition-delay: .24s; }

.js .chor { opacity: 0; transform: translateY(16px); animation: rise .8s var(--ease) forwards; }
.js .c1 { animation-delay: .15s; }
.js .c2 { animation-delay: .3s; }
.js .c3 { animation-delay: .65s; }
.js .c4 { animation-delay: .85s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.js h1 .ch { opacity: 0; transform: translateY(.35em); animation: chRise .7s var(--ease) forwards; }
@keyframes chRise { to { opacity: 1; transform: none; } }

/* chart self-draw */
.js #chartLine { stroke-dasharray: 800; stroke-dashoffset: 800; }
.js .visible #chartLine, .js .quant-demo.drawn #chartLine { animation: draw 1.6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ring-g, .btn-gold::before { animation: none !important; }
  .js .reveal, .js .chor, .js h1 .ch { animation: none !important; transition: opacity .2s !important; opacity: 1 !important; transform: none !important; }
  .js #chartLine { stroke-dashoffset: 0 !important; }
  #starfield { display: none; }
}

/* ═══ RWD ═══ */
@media (max-width: 980px) {
  .panel-inner, .panel.alt .panel-inner { grid-template-columns: 1fr; gap: 40px; }
  .panel.alt .panel-visual { order: 2; }
  .creed-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; gap: 34px 26px; }
}
@media (max-width: 760px) {
  .nav-inner { justify-content: space-between; gap: 0; padding: 18px 22px; }
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
  .nav-mobile {
    display: none; flex-direction: column; background: rgba(5, 7, 13, .96);
    border-bottom: 1px solid var(--gold-line); backdrop-filter: blur(14px);
  }
  .nav-mobile.open { display: flex; }
  .nav-mobile a { padding: 16px 24px; text-align: center; letter-spacing: .2em; color: var(--muted); border-top: 1px solid var(--line); }
  .nav-mobile a:active { color: var(--gold); }
  h1 { letter-spacing: .14em; text-indent: .14em; }
  .hero-sub { letter-spacing: .14em; text-indent: .14em; }
  .ticker { gap: 16px; font-size: .58rem; }
  .tk-wide { display: none; }
  .act-rule { padding: 64px 22px 26px; }
  .panel, .creed, .process { padding: 0 22px; }
  .steps { grid-template-columns: 1fr; }
  .roman { font-size: 4.4rem; top: -26px; }
  .contact { padding: 96px 22px 88px; }
  .gd-hud { font-size: .56rem; letter-spacing: .08em; gap: 10px; }
  .gd-title .zh { font-size: 1.25rem; }
}
@media (max-width: 420px) {
  .gd-hud span:first-child .sim { display: none; }
}
