/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #000;
  color: #e8e8e8;
  font-family: 'Inter', 'Helvetica Neue', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: 'Times New Roman', 'Source Serif Pro', 'Songti SC', 'Noto Serif SC', serif;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin: 0;
}

a { color: inherit; text-decoration: none; }
button {
  font-family: inherit;
  background: none;
  color: inherit;
  border: none;
  cursor: pointer;
  padding: 0;
}

:root {
  --accent: #cfa86a;
  --accent-soft: rgba(207, 168, 106, 0.5);
  --hairline: rgba(255, 255, 255, 0.1);
  --hairline-strong: rgba(255, 255, 255, 0.2);
  --muted: #888;
  --surface: #0a0a0a;
  /* Keep in sync with FADE_IN / SCATTER / SCATTER_STAGGER in js/about.js. */
  --seq-fade-in: 900ms;
  --seq-scatter: 1100ms;
  --seq-scatter-stagger: 420ms;
}

/* ===== Nav ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2.5rem;
  z-index: 10;
}
.page-home .nav { mix-blend-mode: difference; }
.brand {
  font-family: 'Times New Roman', serif;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  color: #f5f5f5;
  transition: color 0.2s ease;
}
a.brand:hover { color: var(--accent); }
.lang-toggle {
  font-size: 0.875rem;
  letter-spacing: 0.15em;
  padding: 0.4rem 0.5rem;
  transition: color 0.2s ease;
}
.lang-toggle:hover { color: var(--accent); }

/* ===== Hero ===== */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 1;
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4.5rem;
  padding: 0 2rem;
  text-align: center;
}
.hero-title {
  font-size: clamp(1.875rem, 4.4vw, 4rem);
  line-height: 1.2;
  color: #f5f5f5;
  max-width: 1100px;
  margin: 0;
  /* Safety net for legibility on bright video frames since the dark overlay
     was removed to honor the original video colors. */
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.6), 0 1px 4px rgba(0, 0, 0, 0.55);
}
/* Colour-only accent, same as .seq-body strong: the weight has to stay 400 or
   the accented words would also thicken against the rest of the line. */
.hero-title strong {
  color: var(--accent);
  font-weight: inherit;
}

/* ===== Hero arrow ===== */
.hero-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 6.5rem;
  height: 4rem;
  color: rgba(200, 200, 200, 0.9);
  transition: color 0.25s ease, transform 0.25s ease;
  cursor: pointer;
}
.hero-arrow:hover {
  color: var(--accent);
  transform: translateX(8px);
}
.hero-arrow-icon {
  display: block;
  width: 5.25rem;
  height: auto;
  animation: arrow-nudge 2.6s ease-in-out infinite;
  /* No filter on this element — `filter: drop-shadow` combined with
     `animation` forces the SVG to re-rasterize every frame and steals
     GPU compositor cycles from the hero video. */
}
.hero-arrow:hover .hero-arrow-icon { animation: none; }
@keyframes arrow-nudge {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(6px); }
}

/* ===== About page layout ===== */
.page-about {
  background: #000;
  /* A single fixed viewport, not a scrolling document. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.page-about .nav {
  border-bottom: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.about {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-areas: "stage";
  place-items: center;
  padding: 6.5rem 2rem 7.5rem;
}
.seq,
.products {
  grid-area: stage;
  width: 100%;
}
body.seq-done .about {
  padding: 5.25rem 2rem 7.5rem;
}


/* ===== Sequence stage =====
   One line holds the stage at a time. The stage keeps a fixed height so the
   optical centre never moves between a one-line step and a three-line one. */
.seq {
  display: grid;
  place-items: center;
}
.seq-stage {
  width: min(760px, 100%);
  min-height: 46vh;
  display: grid;
  place-items: center;
}
.seq-step {
  max-width: 760px;
  text-align: center;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--seq-fade-in) ease, transform var(--seq-fade-in) ease;
}
.seq-step.is-in {
  opacity: 1;
  transform: none;
  transition: opacity var(--seq-fade-in) cubic-bezier(0.22, 0.61, 0.36, 1),
              transform var(--seq-fade-in) cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ===== Leaf scatter (exit) =====
   about.js splits the line into one .seq-ch per character and hands each a
   random drift vector + delay, so the line breaks up and blows away rather
   than dimming as a block. .is-in stays on during the exit — the characters
   carry the opacity, otherwise the block would double-fade.
   .seq-wd keeps a Latin word glued together while it rests; without it,
   inline-block letters would let words break mid-word. */
.seq-ch {
  display: inline-block;
  will-change: transform, opacity;
}
.seq-wd {
  display: inline-block;
  white-space: nowrap;
}
.seq-step.is-scatter .seq-ch {
  animation: seq-leaf var(--seq-scatter) cubic-bezier(0.36, 0.03, 0.7, 0.96) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes seq-leaf {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
  22% {
    /* the small lift a leaf catches before it lets go */
    opacity: 0.92;
    transform: translate3d(calc(var(--dx) * 0.16), calc(var(--dy) * -0.09), 0)
               rotate(calc(var(--rot) * 0.2)) scale(1.03);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--rot)) scale(0.82);
  }
}

/* Same palette as the retired Q&A: gold marker, near-white heading,
   soft-grey body, gold only on the load-bearing phrase. */
.seq-num {
  display: block;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  margin-bottom: 1.75rem;
}
.seq-title {
  font-family: 'Times New Roman', 'Source Serif Pro', 'Songti SC', 'Noto Serif SC', serif;
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  font-weight: 400;
  color: #f5f5f5;
  line-height: 1.3;
  margin: 0 0 1.75rem 0;
}
.seq-body {
  font-size: clamp(1.0625rem, 1.55vw, 1.35rem);
  line-height: 1.9;
  color: #d8d8d8;
  margin: 0;
}
.seq-body strong {
  color: var(--accent);
  font-weight: 600;
}

/* The pivot question and the closing line carry the weight alone — no
   number, no heading, sized up so they read as a beat rather than a point. */
.seq-step--pivot .seq-body,
.seq-step--finale .seq-body {
  font-family: 'Times New Roman', 'Source Serif Pro', 'Songti SC', 'Noto Serif SC', serif;
  color: #f5f5f5;
  line-height: 1.45;
}
.seq-step--pivot .seq-body {
  font-size: clamp(1.75rem, 3.4vw, 2.75rem);
}
.seq-step--finale .seq-body {
  font-size: clamp(2rem, 4.2vw, 3.25rem);
}

/* ===== Sequence HUD ===== */
.seq-hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 4.4rem;
  z-index: 4;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.75rem;
}
.seq-dots {
  display: flex;
  gap: 0.55rem;
  transition: opacity 0.6s ease;
}
.seq-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.4s ease, transform 0.4s ease;
}
.seq-dot.is-past { background: rgba(255, 255, 255, 0.3); }
.seq-dot.is-current {
  background: var(--accent);
  transform: scale(1.4);
}
.seq-ctl {
  transition: color 0.2s ease;
}
.seq-replay {
  display: none;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  padding: 0.55rem 1.1rem;
  color: rgba(255, 255, 255, 0.45);
}
.seq-replay:hover { color: var(--accent); }
body.seq-done .seq-replay { display: inline-block; }
/* display:none, not opacity:0 — an invisible-but-laid-out dot row would sit
   inside the flex box and push the replay control off centre. */
body.seq-done .seq-dots { display: none; }

/* ===== Utilities ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Products section ===== */
.products {
  max-width: 920px;
  margin: 0 auto;
  max-height: 100%;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1s ease, transform 1s ease;
}
.products.is-in {
  opacity: 1;
  transform: none;
}
.products[hidden] { display: none; }
.products {
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}
.products::-webkit-scrollbar { width: 4px; }
.products::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 2px;
}
.products::-webkit-scrollbar-track { background: transparent; }
.section-header {
  margin-bottom: 1rem;
}
/* The heading is the whole header now — the lede below it was folded into
   the title, so the header's own 1rem is the only gap down to the grid. */
.section-header h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  color: #f5f5f5;
  margin-bottom: 0;
}
.products-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 720px) {
  .products-grid { grid-template-columns: 1fr 1fr; }
}
.product-card {
  display: block;
  padding: 1.6rem 1.75rem;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
}
.product-card:hover {
  border-color: var(--accent-soft);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.04);
}
.product-card h3 {
  font-size: 1.3rem;
  color: #f5f5f5;
  margin-bottom: 0.4rem;
}
.product-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ===== Products inside the yield card =====
   Each entry is independently clickable, so the card itself is no longer a
   link — it is a plain container holding two targets. */
.product-group + .product-group {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--hairline);
}
.product-link {
  display: block;
  margin: 0 -0.7rem;
  padding: 0.4rem 0.7rem;
  border-radius: 2px;
  transition: background 0.2s ease;
}
.product-link:hover,
.product-link:focus-visible {
  background: rgba(255, 255, 255, 0.05);
}
.product-link-name {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}
.product-link:hover .product-link-name { color: #e6c58c; }
.product-link-desc {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.55;
}
.product-link-cta {
  display: block;
  margin-top: 0.45rem;
  color: var(--accent);
  font-size: 0.8125rem;
  opacity: 0.72;
}

/* ===== Link Cortex page ===== */
.page-cortex { background: #000; }
.page-cortex .nav {
  border-bottom: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
/* Wider than the reading column on purpose: prose stays at 820px, but the
   captures are 1306px of dense product UI and every pixel lost to scaling
   costs legibility. Editorial rule — narrow text, wide figures. */
.cortex {
  max-width: 1360px;
  margin: 0 auto;
  padding: 9rem 2.5rem 5rem;
}
.cortex-head {
  max-width: 820px;
  margin-bottom: 6rem;
}
.cortex-title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  color: #f5f5f5;
  line-height: 1.2;
  margin: 0 0 1.75rem 0;
}
.cortex-lede {
  margin: 0;
  font-size: clamp(1rem, 1.35vw, 1.1875rem);
  line-height: 1.95;
  color: #d8d8d8;
}
/* Same accent treatment the manifesto lines use for their load-bearing phrase. */
.cortex-lede strong {
  color: var(--accent);
  font-weight: 600;
}
/* ----- The deck -------------------------------------------------------- */
/* Four captures stacked like windows on a desk. No caption, no counter: the
   peeking top edges are the affordance and the hairline ticks are the only
   chrome. Depth arrives as --depth (0 = front), written by js/cortex.js. */
.deck {
  --deck-z-step: -108px;   /* how far each card sits back in the scene */
  --deck-y-step: -1.05rem; /* how much of each card's top edge peeks out */
  margin: 0;
}

/* Until the script arms it, and forever if the script never runs, the deck is
   a plain column of all four captures. A screenshot is never hidden behind
   JavaScript. */
.deck-stage {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  outline: none;
}
.deck-rail { display: none; }

.deck.is-live {
  /* Room above for the three peeking edges, and below for the ticks. */
  padding-top: 3.75rem;
}
.deck.is-live .deck-stage {
  position: relative;
  display: block;
  aspect-ratio: 1306 / 853;
  perspective: 1700px;
  perspective-origin: 50% 0%;
  transform-style: preserve-3d;
  cursor: pointer;
  touch-action: pan-y;
}
.deck.is-live.is-dragging .deck-stage { cursor: grabbing; }

/* A light mat around every capture. All four are light-themed UI, and butting
   white straight against pure black reads as glare rather than an image. */
.deck-card {
  margin: 0;
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
}
.deck-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1px;
}
.deck.is-live .deck-card {
  position: absolute;
  inset: 0;
  transform-origin: 50% 0%;
  will-change: transform, filter;
  /* Expo-out. The long tail is what makes the swap read as weight rather
     than as a jump. */
  transition:
    transform 780ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 780ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 400ms ease;
  transform:
    translate3d(0, calc(var(--depth, 0) * var(--deck-y-step)),
                calc(var(--depth, 0) * var(--deck-z-step)));
  /* Receding cards go quiet instead of gaining a shadow — one generator for
     depth, not two. */
  filter: brightness(calc(1 - var(--depth, 0) * 0.14));
}
.deck.is-live .deck-card img {
  height: 100%;
  object-fit: contain;
}
.deck.is-live .deck-stage:hover .deck-card.is-front,
.deck.is-live .deck-stage:focus-visible .deck-card.is-front {
  border-color: var(--hairline-strong);
}
.deck.is-live .deck-stage:focus-visible .deck-card.is-front {
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* Ticks, not numbers. One is gold — the only colour the deck spends. */
.deck.is-live .deck-rail {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 2.75rem;
}
.deck-tick {
  width: 2.25rem;
  height: 2px;
  border-radius: 1px;
  background: var(--hairline-strong);
  transition: background 0.45s ease, transform 0.45s ease;
}
.deck-tick:hover { background: #6d6d6d; }
.deck-tick.is-active {
  background: var(--accent);
  transform: scaleY(1.5);
}
.cortex-soon {
  margin: 5.5rem 0 0 0;
  text-align: center;
  color: var(--accent);
  font-family: 'Times New Roman', 'Source Serif Pro', 'Songti SC', 'Noto Serif SC', serif;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: 0.1em;
}

/* ===== Footer ===== */
.page-about .foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  border-top: none;
  padding: 1.15rem 1.5rem;
  font-size: 0.75rem;
  opacity: 0.55;
  /* One row, not a stack. The deployed build injects the ICP filing block
     into this footer (it does not exist in the LAN build), which made the
     footer ~30px taller in production only and collided with the replay
     control. Laying copyright and filing side by side keeps the served
     footer the same height as the local one. */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.3rem 1.25rem;
}
/* Beats the injected `.foot .beian` rule on specificity, whatever the order. */
.page-about .foot .beian {
  margin-top: 0;
}
.foot {
  padding: 2.5rem 3rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-align: center;
}

/* ===== Mobile (≤720px) ===== */
@media (max-width: 720px) {
  .about { padding: 5.5rem 1.5rem 6.5rem; }
  .seq-stage { min-height: 52vh; }
  .seq-num { letter-spacing: 0.28em; margin-bottom: 1.25rem; }
  .seq-title { margin-bottom: 1.25rem; }
  .seq-body { line-height: 1.85; }
  .seq-hud { bottom: 3.5rem; gap: 1.25rem; }
  .cortex { padding: 6.5rem 1.25rem 3.5rem; }
  .cortex-head { margin-bottom: 3rem; }
  /* Shallower stack: at phone width a 108px recession eats most of the
     capture, and the peeking edges only need to hint that there are more. */
  .deck {
    --deck-z-step: -46px;
    --deck-y-step: -0.55rem;
  }
  .deck.is-live { padding-top: 2rem; }
  .deck.is-live .deck-rail { margin-top: 1.75rem; }
  .deck-tick { width: 1.75rem; }
  .cortex-soon { margin-top: 3.5rem; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .hero-arrow, .product-card, .lang-toggle, .brand { transition: none; }
  .hero-arrow-icon { animation: none; }
  .seq-step {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .seq-step.is-scatter .seq-ch {
    animation: none;
    opacity: 0;
  }
  /* cortex.js bails out before arming the deck under reduced motion, so this
     only has to guarantee the column fallback never animates. */
  .deck-card, .deck-tick { transition: none; }
  html { scroll-behavior: auto; }
}

/* Static (reduced-motion) fallback: the whole argument at once, scrollable. */
body.seq-static,
body.seq-static.page-about {
  height: auto;
  overflow: auto;
}
body.seq-static .about {
  position: static;
  display: block;
  max-width: 880px;
  margin: 0 auto;
  padding: 9rem 2.5rem 6rem;
}
body.seq-static .seq-stage {
  min-height: 0;
  display: block;
  width: 100%;
}
body.seq-static .seq-step {
  text-align: left;
  margin-bottom: 4.5rem;
}
body.seq-static .products {
  opacity: 1;
  transform: none;
  transition: none;
  margin-top: 2rem;
  border-top: 1px solid var(--hairline);
  padding-top: 4rem;
}
body.seq-static .seq-hud { display: none; }
body.seq-static.page-about .foot {
  position: static;
  opacity: 1;
}

/* ===== ICP / 公安网备 filing footer (server bundle only) ===== */
.beian {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.beian a { color: inherit; transition: color 0.2s ease; }
.beian a:hover { color: #bbb; }
.hero .beian {
  position: absolute;
  bottom: 1.25rem;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 0 1rem;
  color: rgba(255, 255, 255, 0.45);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
.hero .beian a:hover { color: rgba(255, 255, 255, 0.8); }
.foot .beian { margin-top: 0.6rem; }
