/* ============================================================
   AirPods Pro — Flagship scroll experience
   Traditional Chinese (zh-Hant) premium marketing site
   ============================================================ */

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

html { -webkit-text-size-adjust: 100%; }

:root {
  /* type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "PingFang TC", "Noto Sans TC", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* dark theme (default) */
  --bg: #060607;
  --bg-elevated: #101012;
  --scene-bg: #060607;
  --text: #f5f5f7;
  --text-dim: #a1a1a6;
  --text-faint: #6e6e73;
  --hairline: rgba(255,255,255,0.10);
  --hairline-strong: rgba(255,255,255,0.18);
  --card: rgba(255,255,255,0.035);
  --card-hover: rgba(255,255,255,0.06);
  --nav-bg: rgba(12,12,14,0.62);
  --accent: #2997ff;
  --accent-2: #a15ff5;
  --accent-3: #ff617e;
  --grad: linear-gradient(100deg, #2997ff 0%, #a15ff5 52%, #ff8c6b 100%);
  --shadow-color: rgba(0,0,0,0.55);
  --glow: rgba(41,151,255,0.35);
}

:root[data-theme="light"] {
  --bg: #fbfbfd;
  --bg-elevated: #ffffff;
  --scene-bg: #f2f2f4;
  --text: #1d1d1f;
  --text-dim: #515154;
  --text-faint: #86868b;
  --hairline: rgba(0,0,0,0.10);
  --hairline-strong: rgba(0,0,0,0.16);
  --card: rgba(0,0,0,0.02);
  --card-hover: rgba(0,0,0,0.045);
  --nav-bg: rgba(250,250,252,0.68);
  --shadow-color: rgba(0,0,0,0.14);
  --glow: rgba(41,151,255,0.22);
}

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.5;
  letter-spacing: 0.005em;
  transition: background-color 0.6s ease, color 0.6s ease;
}

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: #fff; }

/* ============================================================
   Loader
   ============================================================ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  transition: opacity 0.9s ease, visibility 0.9s ease;
}
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-mark {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transform: translateY(8px);
  animation: loaderIn 0.9s cubic-bezier(.16,1,.3,1) 0.1s forwards;
}
.loader-bar {
  width: min(240px, 60vw);
  height: 2px;
  background: var(--hairline);
  border-radius: 2px;
  overflow: hidden;
}
.loader-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--grad);
  border-radius: 2px;
}
.loader-pct {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
@keyframes loaderIn { to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   WebGL canvas
   ============================================================ */
#webgl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.3s ease;
}
#webgl.ready { opacity: 1; }
body.no-webgl #webgl { display: none; }

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(22px, 4vw);
  background: transparent;
  backdrop-filter: saturate(180%) blur(0px);
  -webkit-backdrop-filter: saturate(180%) blur(0px);
  border-bottom: 1px solid transparent;
  transform: translateY(0);
  transition: transform 0.5s cubic-bezier(.16,1,.3,1),
              background-color 0.4s ease, backdrop-filter 0.4s ease,
              border-color 0.4s ease;
}
.nav.scrolled {
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.nav.hidden { transform: translateY(-100%); }

.nav-brand {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.nav-brand b { font-weight: 600; }

.nav-links {
  display: flex;
  gap: clamp(18px, 2.4vw, 34px);
  align-items: center;
}
.nav-links a {
  font-size: 13px;
  color: var(--text-dim);
  position: relative;
  transition: color 0.25s ease;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -5px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(.16,1,.3,1);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { transform: scaleX(1); }

.nav-right { display: flex; align-items: center; gap: 16px; }

.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}
.theme-toggle:hover { background: var(--card-hover); transform: scale(1.06); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.buy-pill {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  padding: 7px 16px;
  border-radius: 980px;
  border: none;
  transition: transform 0.25s cubic-bezier(.16,1,.3,1), background-color 0.25s ease;
  will-change: transform;
}
.buy-pill:hover { background: #0f86ff; }

.nav-toggle { display: none; }

/* ============================================================
   Progress rail
   ============================================================ */
.progress-rail {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  height: 140px;
  width: 2px;
  background: var(--hairline);
  border-radius: 2px;
  z-index: 150;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.progress-rail.visible { opacity: 1; }
.progress-dot {
  position: absolute;
  left: 50%;
  top: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, 0);
  box-shadow: 0 0 12px var(--glow);
  will-change: transform;
}

/* ============================================================
   Custom cursor
   ============================================================ */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 30px; height: 30px;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.28s ease, height 0.28s ease, background-color 0.28s ease,
              border-color 0.28s ease, opacity 0.3s ease;
  opacity: 0;
  mix-blend-mode: difference;
}
.cursor.active { opacity: 1; }
.cursor.hover {
  width: 54px; height: 54px;
  background: rgba(255,255,255,0.08);
  border-color: transparent;
}
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ============================================================
   Cinema — pinned 3D stage
   ============================================================ */
.cinema {
  position: relative;
  height: 640vh;   /* tall scroll stage; ScrollTrigger scrubs across acts */
  z-index: 2;
}
.cinema-viewport {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.act {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 max(24px, 7vw);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}
.act[data-align="center"] { align-items: center; text-align: center; }
.act[data-align="left"]    { align-items: flex-start; text-align: left; }
.act[data-align="right"]   { align-items: flex-end; text-align: right; }

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.act-title {
  font-size: clamp(38px, 8.2vw, 116px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0;
}
.act-title.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.act-sub {
  font-size: clamp(17px, 2.1vw, 26px);
  color: var(--text-dim);
  margin-top: 22px;
  max-width: 30ch;
  font-weight: 400;
}
.act[data-align="center"] .act-sub { margin-left: auto; margin-right: auto; }
.act-body {
  font-size: clamp(15px, 1.5vw, 19px);
  color: var(--text-dim);
  max-width: 34ch;
  margin-top: 20px;
  line-height: 1.55;
}

.scroll-hint {
  position: absolute;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.scroll-hint .line {
  width: 1px; height: 40px;
  background: linear-gradient(var(--text-faint), transparent);
  overflow: hidden;
  position: relative;
}
.scroll-hint .line::after {
  content: "";
  position: absolute;
  top: -40px; left: 0;
  width: 1px; height: 40px;
  background: linear-gradient(transparent, var(--accent));
  animation: scrollLine 1.9s ease-in-out infinite;
}
@keyframes scrollLine {
  0% { transform: translateY(0); }
  100% { transform: translateY(80px); }
}

/* Split-text char reveal */
.split { display: inline-block; }
.split .word { display: inline-block; white-space: nowrap; }
.split .char {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.split .char > span {
  display: inline-block;
  transform: translateY(112%);
  transition: transform 0.9s cubic-bezier(.16,1,.3,1);
  transition-delay: calc(var(--i) * 0.028s);
}
.split.is-visible .char > span { transform: translateY(0); }

/* Feature callouts (act 5) */
.callouts {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.callout {
  position: absolute;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.16,1,.3,1);
}
.callout.show { opacity: 1; transform: translateY(0); }
.callout .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(41,151,255,0.16), 0 0 16px var(--glow);
}
.callout .leader {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  top: 4px;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.7s cubic-bezier(.16,1,.3,1) 0.1s;
}
.callout.show .leader { transform: scaleX(1); }
.callout .label {
  position: absolute;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.callout .label small {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 400;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* ============================================================
   Content sections (post-cinema)
   ============================================================ */
.content { position: relative; z-index: 2; background: var(--bg); }

.section { padding: clamp(90px, 13vw, 190px) max(24px, 7vw); }

.section-head { max-width: 900px; margin: 0 auto 68px; text-align: center; }
.section-head .eyebrow { color: var(--accent); }
.section-head h2 {
  font-size: clamp(30px, 5vw, 58px);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.04;
  margin: 0;
}
.section-head p {
  color: var(--text-dim);
  font-size: clamp(16px, 1.8vw, 20px);
  margin-top: 20px;
}

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity 1s cubic-bezier(.16,1,.3,1), transform 1s cubic-bezier(.16,1,.3,1); }
.reveal.in { opacity: 1; transform: none; }

/* feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
}
.feature-card {
  position: relative;
  padding: 38px 32px 44px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--hairline);
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(.16,1,.3,1), background-color 0.4s ease, border-color 0.4s ease;
  isolation: isolate;
}
.feature-card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: 24px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.45s ease;
  z-index: -1;
}
.feature-card:hover { transform: translateY(-8px); background: var(--card-hover); }
.feature-card:hover::before { opacity: 1; }
.feature-card .fc-icon {
  width: 46px; height: 46px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: rgba(41,151,255,0.12);
  color: var(--accent);
  margin-bottom: 26px;
}
.feature-card .fc-icon svg { width: 24px; height: 24px; }
.feature-card h3 { font-size: 21px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.01em; }
.feature-card p { color: var(--text-dim); font-size: 15px; margin: 0; line-height: 1.6; }
.feature-card .fc-metric {
  margin-top: 26px;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.03em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.feature-card .fc-metric span { font-size: 15px; color: var(--text-faint); -webkit-text-fill-color: var(--text-faint); margin-left: 6px; }

/* pull-quote / spec highlight */
.highlight {
  text-align: center;
  max-width: 1000px;
  margin: 0 auto;
}
.highlight .big {
  font-size: clamp(34px, 6.4vw, 92px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0;
}
.highlight .big em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.highlight p { color: var(--text-dim); font-size: clamp(17px, 2vw, 22px); margin-top: 34px; }

.stat-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(30px, 7vw, 90px);
  margin-top: 76px;
}
.stat { text-align: center; }
.stat .num {
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}
.stat .lbl { color: var(--text-faint); font-size: 14px; margin-top: 12px; letter-spacing: 0.02em; }

/* specs table */
.specs { max-width: 900px; margin: 0 auto; }
.specs-table { border-top: 1px solid var(--hairline); }
.spec-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 26px 8px;
  border-bottom: 1px solid var(--hairline);
  align-items: baseline;
}
.spec-row dt { color: var(--text-faint); font-size: 14px; letter-spacing: 0.02em; }
.spec-row dd { margin: 0; font-size: clamp(15px, 1.6vw, 18px); color: var(--text); line-height: 1.55; }
.spec-row dd b { font-weight: 600; }

/* CTA */
.cta {
  position: relative;
  text-align: center;
  padding: clamp(110px, 16vw, 220px) max(24px, 7vw);
  overflow: hidden;
}
.cta::before {
  content: "";
  position: absolute;
  left: 50%; top: 42%;
  width: min(900px, 120vw); height: min(900px, 120vw);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--glow) 0%, transparent 62%);
  opacity: 0.85;
  z-index: 0;
  pointer-events: none;
}
.cta > * { position: relative; z-index: 1; }
.cta h2 {
  font-size: clamp(34px, 6.6vw, 96px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.0;
  margin: 0 0 26px;
}
.cta h2 em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cta p { color: var(--text-dim); font-size: clamp(16px, 1.9vw, 21px); margin: 0 auto 46px; max-width: 40ch; }
.cta-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn {
  position: relative;
  font-size: 16px;
  font-weight: 500;
  padding: 15px 34px;
  border-radius: 980px;
  border: 1px solid transparent;
  transition: transform 0.3s cubic-bezier(.16,1,.3,1), background-color 0.3s ease, color 0.3s ease;
  will-change: transform;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0f86ff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--hairline-strong); }
.btn-ghost:hover { background: var(--card-hover); }
.magnetic { display: inline-block; }
.magnetic .btn-inner { display: inline-block; will-change: transform; }
.price-note { margin-top: 26px; color: var(--text-faint); font-size: 13px; }

/* footer */
.footer {
  position: relative;
  z-index: 2;
  background: var(--bg);
  border-top: 1px solid var(--hairline);
  padding: 70px max(24px, 7vw) 46px;
  color: var(--text-faint);
  font-size: 12px;
}
.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 40px;
  max-width: 1180px;
  margin: 0 auto 48px;
}
.footer-col h4 { color: var(--text); font-size: 13px; margin: 0 0 16px; font-weight: 600; }
.footer-col a { display: block; color: var(--text-faint); margin-bottom: 11px; transition: color 0.25s ease; }
.footer-col a:hover { color: var(--text); }
.footer-legal {
  max-width: 1180px;
  margin: 0 auto;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
  line-height: 1.7;
}

/* ============================================================
   Fallback (no WebGL)
   ============================================================ */
.fallback-hero {
  display: none;
  position: relative;
  min-height: 100vh;
  z-index: 2;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 8vw;
  background:
    radial-gradient(80% 60% at 50% 30%, rgba(41,151,255,0.18), transparent 70%),
    var(--bg);
}
body.no-webgl .cinema { display: none; }
body.no-webgl .fallback-hero { display: flex; }
body.no-webgl #loader { display: none; }
.fallback-hero .eyebrow { color: var(--accent); }
.fallback-hero h1 {
  font-size: clamp(44px, 10vw, 120px);
  font-weight: 600;
  letter-spacing: -0.035em;
  margin: 0;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fallback-hero p { color: var(--text-dim); font-size: clamp(18px, 2.4vw, 26px); margin-top: 22px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 820px) {
  .nav-links { display: none; }
  .cinema { height: 560vh; }
  .act-sub { max-width: 24ch; }
  .spec-row { grid-template-columns: 1fr; gap: 8px; }
  .spec-row dt { font-size: 12px; }
  .progress-rail { right: 12px; height: 100px; }
  .callout .label { font-size: 12px; }
}

@media (max-width: 500px) {
  .nav { padding: 0 16px; }
  .buy-pill { padding: 6px 13px; font-size: 12px; }
  .act { padding: 0 24px; }
  .callouts { display: none; } /* leader lines don't frame well on very small screens */
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .scroll-hint .line::after { animation: none; }
  .split .char > span { transition-duration: 0.4s; transition-delay: 0s; }
  .reveal { transition-duration: 0.4s; }
}
