/* Kung Fu Niu Niu marketing site.
 * Mobile-first: the primary target is a 390px Android screen, not a desktop browser.
 */

@import url("tokens.css");

/* ---------- reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  /* Two soft lamps behind the content, echoing the podium lighting in the brand art. */
  background-image:
    radial-gradient(1100px 620px at 50% -6%, rgba(140, 60, 180, 0.42), transparent 62%),
    radial-gradient(760px 520px at 92% 34%, rgba(160, 50, 210, 0.2), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--ink) 78%);
  background-attachment: fixed;
}

img, video, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); }
button { font: inherit; color: inherit; }

/* text-wrap: balance evens out short headings so a line never ends on one orphan word or
 * character — which Chinese headlines are especially prone to. */
h1, h2, h3, h4 { line-height: var(--lh-head); margin: 0 0 0.5em; font-weight: 700; text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 5.2vw, 2.75rem); font-weight: 900; }
h2 { font-size: clamp(1.35rem, 4.2vw, 2rem); }
h3 { font-size: clamp(1.1rem, 3.2vw, 1.35rem); }
p { margin: 0 0 1em; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

.shell { width: var(--shell); margin-inline: auto; }
.shell-narrow { width: var(--shell-narrow); margin-inline: auto; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- shared bits ---------- */

.gold-text {
  background: var(--grad-gold);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 0.6em;
}

.lede { color: var(--muted); font-size: 1.05rem; }

/* Cloud-scrollwork divider — the 祥云 motif from the brand art, as a section rule. */
.divider {
  width: 100%; height: 26px; margin: 8px 0 0;
  opacity: 0.75;
  color: var(--gold-deep);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.85em 1.6em; min-height: 48px;   /* 48px = comfortable thumb target */
  border: 0; border-radius: 999px;
  font-weight: 700; cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.99); }

.btn-gold {
  background: var(--grad-gold); color: #2b1600;
  box-shadow: 0 10px 26px rgba(230, 180, 70, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.btn-gold:hover { color: #2b1600; box-shadow: 0 14px 34px rgba(230, 180, 70, 0.42), inset 0 1px 0 rgba(255,255,255,.65); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 0, 22, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner {
  display: flex; align-items: center; gap: 12px;
  min-height: 62px;
}
.brand-lockup { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-lockup img { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); }
.brand-name { font-weight: 900; font-size: 1.02rem; letter-spacing: 0.02em; }

.site-nav { display: none; gap: 4px; }
.site-nav a {
  padding: 8px 14px; border-radius: 999px;
  color: var(--muted); font-size: 0.92rem; font-weight: 700;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.site-nav a:hover { color: var(--text); background: rgba(255,255,255,.06); }
.site-nav a[aria-current="page"] { color: var(--gold); background: var(--surface-3); }

.lang-switch { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.lang-switch button {
  min-width: 38px; padding: 5px 8px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font-size: 0.78rem; font-weight: 700; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.lang-switch button[aria-pressed="true"] { background: var(--grad-gold); color: #2b1600; }

@media (min-width: 860px) { .site-nav { display: flex; } }

/* Mobile nav row under the header, so the three pages are always one tap away. */
.mobile-nav {
  display: flex; gap: 6px; padding: 8px 0 10px;
  overflow-x: auto; scrollbar-width: none;
}
.mobile-nav::-webkit-scrollbar { display: none; }
.mobile-nav a {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 0.85rem; font-weight: 700; white-space: nowrap;
}
.mobile-nav a[aria-current="page"] { background: var(--surface-3); color: var(--gold); border-color: var(--gold-deep); }
@media (min-width: 860px) { .mobile-nav { display: none; } }

/* ---------- hero ---------- */

.hero { padding: 32px 0 16px; }
.hero-grid { display: grid; gap: 24px; align-items: center; }

/* On desktop the hero carries the brand, so it gets real presence — but via padding, not
 * min-height. A tall container with centred content just parks dead bands above and below
 * the copy, which reads as a layout accident rather than breathing room.
 *
 * The 1.1fr copy column is deliberate: at a narrower ratio the zh headline wraps with a
 * single orphaned character on line two, which looks broken. */
@media (min-width: 900px) {
  .hero { padding: 56px 0 48px; }
  /* The key art is near-square (2016x2126), so its column is capped rather than given a
   * fraction: a 1:1 asset in a ~500px fraction column renders ~525px tall and swallows
   * the fold. A fixed 420px column keeps the mascot prominent but subordinate to the
   * headline and the CTA, which are what the page is actually for. */
  .hero-grid { grid-template-columns: 1fr 420px; gap: 56px; }
}

.hero h1 { margin-bottom: 0.35em; }
.hero .lede { max-width: 46ch; }

.hero-art {
  position: relative;
  width: min(100%, 420px);
  margin-inline: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow), 0 0 70px rgba(160, 50, 210, 0.34);
  overflow: hidden;
}
.hero-art img { display: block; width: 100%; height: auto; }
/* Warm rim on the lower edge so the art seats into the page instead of floating as a
 * pasted rectangle — the source art already fades to dark at its own edges. */
.hero-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 -60px 70px -50px rgba(13, 6, 22, 0.95),
              inset 0 0 0 1px rgba(230, 180, 70, 0.14);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* Referral UID copy widget */
.uid-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 18px; padding: 12px 14px;
  background: var(--grad-surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.uid-label { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.uid-value {
  font-family: var(--font-mono); font-size: 1.15rem; font-weight: 700;
  letter-spacing: 0.08em; color: var(--gold);
}
.copy-btn {
  margin-left: auto; padding: 8px 16px; min-height: 40px;
  border: 1px solid var(--gold-deep); border-radius: 999px;
  background: rgba(230, 180, 70, 0.1); color: var(--gold);
  font-size: 0.85rem; font-weight: 700; cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.copy-btn:hover { background: rgba(230, 180, 70, 0.2); }
.copy-btn[data-state="done"] { background: rgba(62, 207, 142, 0.16); border-color: var(--jade); color: var(--jade); }

/* ---------- sections ---------- */

.section { padding: 40px 0; scroll-margin-top: 130px; }
.section-head { margin-bottom: 22px; }
.section-num {
  display: inline-block; margin-right: 10px;
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700;
  color: var(--gold-deep);
}

.card {
  background: var(--grad-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.grid { display: grid; gap: 16px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 700px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* Jump nav (scrollspy) */
.jump-nav {
  position: sticky; top: 62px; z-index: 40;
  display: flex; gap: 6px; padding: 10px 0;
  overflow-x: auto; scrollbar-width: none;
  background: rgba(11, 0, 22, 0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.jump-nav::-webkit-scrollbar { display: none; }
.jump-nav a {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 0.84rem; font-weight: 700; white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.jump-nav a.is-active { background: var(--grad-gold); color: #2b1600; border-color: transparent; }

/* Step blocks — image and text alternate sides on wide screens. */
.step { display: grid; gap: 18px; align-items: center; margin-bottom: 30px; }
@media (min-width: 820px) {
  /* Narrow media column: the screenshot is a phone, not a hero image. */
  .step { grid-template-columns: 300px 1fr; gap: 40px; }
  /* Alternate sides down the page, matching the reference layout. */
  .step:nth-of-type(even) { grid-template-columns: 1fr 300px; }
  .step:nth-of-type(even) .step-media { order: 2; }
}
/* Tutorial screenshots are full phone screens at 9:19.5. Left to fill the grid column
 * they render over 1000px tall against a two-line caption, which leaves the row mostly
 * empty. Cap them at a believable phone width and centre them in the column instead. */
.step-media {
  width: min(100%, 268px);
  margin-inline: auto;
  border-radius: var(--r-md); border: 1px solid var(--line);
  overflow: hidden; box-shadow: var(--shadow-sm); background: var(--surface);
}
.step-media img { display: block; width: 100%; height: auto; }
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-bottom: 10px;
  border-radius: 50%; background: var(--grad-gold); color: #2b1600;
  font-weight: 900; font-size: 0.95rem;
}

/* Plain bulleted list used inside cards — gold markers, comfortable leading for zh. */
.clean-list { list-style: none; margin: 12px 0 0; padding: 0; }
.clean-list li {
  position: relative; padding-left: 18px; margin-bottom: 0.45em;
  color: var(--muted); font-size: 0.93rem;
}
.clean-list li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--gold-deep);
}

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { position: relative; padding-left: 30px; margin-bottom: 0.6em; }
.checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--jade); font-weight: 900;
}

/* Notes and warnings */
.note {
  border-left: 3px solid var(--gold); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(230, 180, 70, 0.08); padding: 12px 16px; margin: 16px 0;
}
.note.warn { border-left-color: var(--cinnabar); background: rgba(242, 122, 106, 0.09); }
/* Extra air above a note that closes a section rather than interrupting one. */
.note.is-spaced { margin-top: 26px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; background: var(--surface); }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th { background: var(--surface-3); font-weight: 700; color: var(--gold-light); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
td.mult { color: var(--gold); font-size: 1.05rem; }

/* ---------- posters (benefits) ---------- */

/* The reward posters carry their own headline, tables and figures baked into the artwork.
 * They are the content, not a backdrop for it — so they render at full size and full
 * opacity, with the caption BELOW rather than overlaid. An earlier version used them as a
 * background behind a dark scrim, which buried the payout tables they exist to show. */
.poster-wall { display: grid; gap: 22px; }
@media (min-width: 800px)  { .poster-wall { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1240px) { .poster-wall { grid-template-columns: repeat(3, 1fr); } }

.poster {
  display: flex; flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--grad-surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.poster:hover { transform: translateY(-3px); border-color: var(--gold-deep); box-shadow: var(--shadow); }

.poster-media { display: block; background: var(--ink); }
.poster-media img { width: 100%; height: auto; display: block; }

/* Landscape posters (喝水 / TNG 限额) run the full width of the wall. */
.poster.is-wide { grid-column: 1 / -1; margin-top: 22px; }

.poster-caption {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line-soft);
}
.poster-caption h2, .poster-caption h3 {
  margin: 0; font-size: 1.02rem; color: var(--gold-light);
}
.poster-caption p { margin: 6px 0 0; width: 100%; color: var(--muted); font-size: 0.9rem; line-height: 1.6; }

.poster-tag {
  padding: 3px 10px; border-radius: 999px;
  background: var(--crimson-soft); border: 1px solid rgba(217, 43, 63, 0.4);
  color: #ff9aa4; font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.poster-tag.gold { background: rgba(230,180,70,.12); border-color: var(--gold-deep); color: var(--gold-light); }

/* Tapping a poster opens the full-resolution image — the small print in the payout
 * tables is genuinely hard to read at grid size on a phone. */
.poster-media[href]:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }

/* ---------- sticky mobile CTA ---------- */

.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(11, 0, 22, 0.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.sticky-cta .uid-mini { font-size: 0.75rem; color: var(--muted); line-height: 1.3; }
.sticky-cta .uid-mini strong { display: block; font-family: var(--font-mono); color: var(--gold); font-size: 0.95rem; }
.sticky-cta .btn { flex: 1; padding: 0.7em 1.1em; min-height: 44px; }
@media (min-width: 860px) { .sticky-cta { display: none; } }

/* Pages reserve room so the bar never covers the last section. */
body.has-sticky-cta { padding-bottom: calc(var(--cta-h) + env(safe-area-inset-bottom)); }
@media (min-width: 860px) { body.has-sticky-cta { padding-bottom: 0; } }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 40px; padding: 34px 0 40px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted); font-size: 0.9rem;
}
.footer-grid { display: grid; gap: 20px; }
/* The footer lockup sits above the tagline; the header one is a bare link and
   must not inherit this. */
.site-footer .brand-lockup { margin-bottom: 10px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-grid h4 { color: var(--text); font-size: 0.95rem; margin-bottom: 0.6em; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 0.45em; }
.legal { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line-soft); font-size: 0.82rem; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--cta-h) + 20px); z-index: 90;
  transform: translate(-50%, 14px);
  padding: 10px 20px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--gold-deep); color: var(--text);
  font-size: 0.9rem; font-weight: 700;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- ambient background orbs ---------- */

/* Two large, soft, FIXED radial pools that sit behind everything and stay put while the
 * page scrolls. They are what stops a long dark page reading as a flat void — the content
 * drifts past a stable light source instead of over dead black. Injected by site.js
 * because they are purely decorative. */
.ambient {
  position: fixed;
  width: 560px; height: 560px;
  border-radius: 50%;
  opacity: 0.16;
  pointer-events: none;
  /* Behind all content but still in front of the body background. Using a negative
   * z-index here — rather than lifting the content above the orbs — is deliberate: the
   * earlier version set `position: relative` on the header and sticky CTA to raise them,
   * which silently overrode `sticky` and `fixed` and broke both. */
  z-index: -1;
}
.ambient-one {
  top: 6vh; left: -240px;
  background: radial-gradient(circle, var(--violet-neon) 0%, rgba(160, 50, 210, 0) 68%);
}
.ambient-two {
  bottom: 12vh; right: -280px;
  background: radial-gradient(circle, var(--gold) 0%, rgba(230, 180, 70, 0) 68%);
}
/* ---------- scroll progress ---------- */

.page-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}
.page-progress span {
  display: block; height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: var(--grad-gold);
  will-change: transform;
}

/* ---------- reveal on scroll ---------- */

/* Scoped to .js (set by js/head.js before first paint) so that without scripting the
 * content is simply visible. Hiding it unconditionally would mean a single JS failure
 * silently blanks whole sections of the page.
 *
 * 0.68s with a long, late-settling curve on the transform and a plain ease on opacity:
 * the element finishes fading in well before it finishes moving, which is what makes the
 * motion read as fluid rather than as a snap. Matched to the reference site's feel. */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.68s ease, transform 0.68s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .ambient { display: none; }
}
