/* =====================================================================
   NOCTIS — marketing site
   Design system: precision (audiophile) x warmth (album art, night)
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* brand */
  --brand: #E74856;
  --brand-2: #3E7288;
  --brand-3: #FCC4CC;
  --accent: var(--brand);          /* live-swappable in Themes section */

  /* dark theme (default) */
  --bg: #09090B;
  --bg-2: #0C0C0F;
  --elev: #141416;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #F4F4F6;
  --text-muted: #A6A6AE;
  --text-faint: #6E6E77;
  --on-accent: #FFFFFF;

  --glow-red: rgba(231, 72, 86, 0.50);
  --glow-teal: rgba(62, 114, 136, 0.42);
  --glow-pink: rgba(252, 196, 204, 0.30);
  --shadow-card: 0 30px 60px -30px rgba(0, 0, 0, 0.8), 0 10px 30px -20px rgba(0, 0, 0, 0.6);
  --shadow-window: 0 60px 120px -40px rgba(0, 0, 0, 0.85), 0 30px 60px -30px rgba(0, 0, 0, 0.6);
  --noise-opacity: 0.035;

  /* type */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* fluid scale */
  --step--1: clamp(0.82rem, 0.8rem + 0.1vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.4rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3rem);
  --step-4:  clamp(2.6rem, 1.9rem + 3.4vw, 4.5rem);
  --step-5:  clamp(3.2rem, 2rem + 5.4vw, 6.5rem);

  /* spacing / layout */
  --container: 1200px;
  --container-wide: 1340px;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --section-y: clamp(3.25rem, 6vw, 6rem);

  /* radii */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 34px;
  --r-pill: 999px;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur: 0.4s;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #FAF9F7;
  --bg-2: #F3F1EC;
  --elev: #FFFFFF;
  --surface: rgba(20, 20, 22, 0.025);
  --surface-2: rgba(20, 20, 22, 0.05);
  --border: rgba(20, 20, 22, 0.10);
  --border-strong: rgba(20, 20, 22, 0.18);
  --text: #16161A;
  --text-muted: #55555E;
  --text-faint: #86868F;
  --brand: #D3384A;               /* deepened for AA on paper */
  --accent: #D3384A;
  --glow-red: rgba(231, 72, 86, 0.20);
  --glow-teal: rgba(62, 114, 136, 0.16);
  --glow-pink: rgba(252, 196, 204, 0.5);
  --shadow-card: 0 24px 50px -30px rgba(24, 20, 20, 0.4), 0 8px 24px -16px rgba(24, 20, 20, 0.18);
  --shadow-window: 0 50px 100px -40px rgba(24, 20, 20, 0.35), 0 20px 50px -30px rgba(24, 20, 20, 0.22);
  --noise-opacity: 0.02;
  color-scheme: light;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color 0.5s var(--ease-out), color 0.5s var(--ease-out);
}

img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* page-wide noise + vignette for depth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- Typography helpers ---------- */
.display {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.018em;
}
.display em { font-style: italic; font-weight: 560; color: var(--accent); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}
.lede { color: var(--text-muted); font-size: var(--step-1); max-width: 42ch; }
.mono { font-family: var(--font-mono); }

/* ---------- Layout ---------- */
.container {
  width: min(100% - var(--gutter) * 2, var(--container));
  margin-inline: auto;
}
.container--wide { max-width: var(--container-wide); width: min(100% - var(--gutter) * 2, var(--container-wide)); }
.section { position: relative; padding-block: var(--section-y); z-index: 2; }
.section__head { max-width: 62ch; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section__title { font-size: var(--step-4); margin-top: 0.6rem; }
.section__lede { margin-top: 1.2rem; color: var(--text-muted); font-size: var(--step-1); max-width: 52ch; }

/* ---------- Ambient glow ---------- */
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.75;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}
.glow--red { background: radial-gradient(circle, var(--glow-red), transparent 68%); }
.glow--teal { background: radial-gradient(circle, var(--glow-teal), transparent 68%); }
.glow--pink { background: radial-gradient(circle, var(--glow-pink), transparent 68%); }
@media (prefers-reduced-motion: no-preference) {
  .glow--drift { animation: drift 22s var(--ease-in-out) infinite alternate; }
  .glow--drift-2 { animation: drift2 28s var(--ease-in-out) infinite alternate; }
}
@keyframes drift { to { transform: translate3d(6%, -8%, 0) scale(1.15); } }
@keyframes drift2 { to { transform: translate3d(-8%, 6%, 0) scale(1.1); } }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0.9em 1.5em;
  min-height: 48px;
  border-radius: var(--r-pill);
  font-weight: 560;
  font-size: var(--step-0);
  letter-spacing: -0.01em;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--border);
  transition: transform 0.25s var(--ease-out), background-color 0.25s var(--ease-out),
              border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), color 0.25s;
  will-change: transform;
}
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.99); }
.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 10px 30px -12px var(--glow-red), 0 2px 0 rgba(255, 255, 255, 0.12) inset;
}
.btn--primary:hover { box-shadow: 0 18px 46px -14px var(--glow-red), 0 2px 0 rgba(255, 255, 255, 0.16) inset; }
.btn--ghost { --btn-bg: transparent; }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn--lg { padding: 1.05em 1.9em; min-height: 56px; font-size: var(--step-1); }
.btn--block { width: 100%; }

/* ---------- Nav ---------- */
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 200;
  background: var(--accent); color: var(--on-accent);
  padding: 0.7em 1.2em; border-radius: var(--r-sm);
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: 68px;
  display: flex; align-items: center;
  transition: background-color 0.35s var(--ease-out), border-color 0.35s, backdrop-filter 0.35s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom-color: var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; }
.brand__mark { width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 4px 14px -4px var(--glow-red); }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.01em; }
.nav__links { display: flex; align-items: center; gap: 0.35rem; }
.nav__link {
  padding: 0.5em 0.85em; border-radius: var(--r-pill);
  color: var(--text-muted); font-size: var(--step--1); font-weight: 500;
  transition: color 0.2s, background-color 0.2s;
}
.nav__link:hover { color: var(--text); background: var(--surface); }
.nav__actions { display: flex; align-items: center; gap: 0.6rem; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border); color: var(--text-muted);
  transition: color 0.2s, background-color 0.2s, border-color 0.2s, transform 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .moon { display: block; }
[data-theme="light"] .theme-toggle .sun { display: none; }
.theme-toggle.spin svg { animation: toggleSwap 0.4s var(--ease-out); }
@keyframes toggleSwap { from { transform: translateY(35%) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
/* ---------- Mobile menu ---------- */
.nav__menu-btn { display: none; }
.nav__menu-btn .nav__burger-close { display: none; }
.nav.menu-open .nav__menu-btn .nav__burger { display: none; }
.nav.menu-open .nav__menu-btn .nav__burger-close { display: block; }
.nav__menu {
  position: absolute; top: calc(100% + 0.4rem); left: 0.75rem; right: 0.75rem;
  display: none;
  padding: 0.9rem;
  background: color-mix(in srgb, var(--elev) 92%, transparent);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  opacity: 0; transform: translateY(-8px);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out), visibility 0.25s;
}
.nav__menu-links { display: grid; }
.nav__menu-links a {
  padding: 0.8em 0.9em; border-radius: 12px;
  font-weight: 500; color: var(--text);
}
.nav__menu-links a:hover { background: var(--surface); }
.nav__menu-actions { display: flex; gap: 0.6rem; margin-top: 0.7rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.nav__menu-actions .btn { flex: 1; white-space: nowrap; padding-inline: 1em; }
@media (max-width: 860px) {
  .nav__links, .nav__discord, .nav__github { display: none; }
  .nav__menu-btn { display: inline-grid; }
  .nav__inner { position: relative; }
  .nav__inner .brand { position: absolute; left: 50%; transform: translateX(-50%); }
  .nav__menu { display: block; visibility: hidden; pointer-events: none; }
  .nav.menu-open .nav__menu { visibility: visible; pointer-events: auto; opacity: 1; transform: translateY(0); }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: 8.5rem; padding-bottom: clamp(3rem, 6vw, 6rem); overflow: clip; }
.hero__glows { position: absolute; inset: 0; z-index: 0; }
.hero__glows .glow--red { width: 46vw; height: 46vw; top: -10%; left: 46%; }
.hero__glows .glow--teal { width: 40vw; height: 40vw; top: 18%; left: -6%; }
.hero__glows .glow--pink { width: 26vw; height: 26vw; top: 44%; left: 62%; opacity: 0.5; }
.hero__inner { position: relative; z-index: 4; text-align: center; display: flex; flex-direction: column; align-items: center; }
.hero__title { font-size: var(--step-5); max-width: 15ch; margin: 1.4rem 0 0; font-weight: 640; }
.hero__lede { margin-top: 1.5rem; font-size: var(--step-1); color: var(--text-muted); max-width: 54ch; text-wrap: balance; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center; margin-top: 2.2rem; }

.hero__window {
  position: relative; z-index: 2; margin-top: clamp(3rem, 6vw, 5rem);
  width: min(100%, 1120px); margin-inline: auto;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-window);
  overflow: hidden;
  will-change: transform;
  background: var(--elev);
}
.hero__window::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: inherit;
}
.hero__window img { width: 100%; }

/* ---------- Marquee ---------- */
.marquee { position: relative; z-index: 2; padding-block: clamp(2rem, 5vw, 3.5rem); overflow: hidden; }
.marquee__label {
  text-align: center; font-family: var(--font-mono); font-size: var(--step--1);
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 1.6rem;
}
.marquee__track { display: flex; width: max-content; will-change: transform; animation: marquee var(--marquee-dur, 40s) linear infinite; }
@keyframes marquee { to { transform: translate3d(-50%, 0, 0); } }
.marquee__item {
  width: clamp(112px, 13vw, 168px); aspect-ratio: 1; border-radius: var(--r-md);
  overflow: hidden; border: 1px solid var(--border);
  box-shadow: 0 16px 30px -20px rgba(0, 0, 0, 0.7);
  flex: none; margin-right: 1.1rem;
}
.marquee__item img { width: 100%; height: 100%; object-fit: cover; }
.marquee::before, .marquee::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 14%; z-index: 3; pointer-events: none;
}
.marquee::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.marquee::after { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }

/* ---------- Manifesto ---------- */
.manifesto { text-align: center; padding-block: clamp(2.25rem, 4vw, 3.5rem); }
.manifesto__text {
  font-family: var(--font-display); font-optical-sizing: auto; font-weight: 560;
  font-size: var(--step-4); line-height: 1.16; letter-spacing: -0.018em;
  max-width: 20ch; margin-inline: auto; text-wrap: balance;
}
.manifesto__text em { font-style: italic; color: var(--accent); }
.manifesto__sub { margin-top: 2rem; color: var(--text-muted); max-width: 52ch; margin-inline: auto; text-wrap: balance; }
.reveal-word { display: inline-block; }

/* ---------- Feature showcase (pinned) ---------- */
.showcase { position: relative; }
@media (min-width: 901px) { .showcase { height: 250vh; } }
/* trim the dead air between the pinned showcase and the next section */
.showcase + .section { padding-top: clamp(1.5rem, 3vw, 2.75rem); }
.showcase__viewport {
  position: sticky; top: 0; min-height: 100vh;
  display: flex; align-items: center;
  padding-block: 3vh;
}
.showcase__grid {
  display: grid; grid-template-columns: 0.9fr 1.4fr; align-items: center;
  gap: clamp(2rem, 4vw, 4rem);
}
.showcase__copy { position: relative; }
.showcase__index {
  font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.2em;
  color: var(--text-faint); margin-bottom: 1.4rem;
}
.showcase__index b { color: var(--accent); font-weight: 500; }
.showcase__steps { display: grid; }
.showcase__step {
  grid-area: 1 / 1; opacity: 0; transform: translateY(14px);
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
  pointer-events: none;
}
.showcase__step.is-active { opacity: 1; transform: none; pointer-events: auto; }
.showcase__step h3 { font-family: var(--font-display); font-weight: 600; font-size: var(--step-3); line-height: 1.08; letter-spacing: -0.018em; }
.showcase__step p { margin-top: 1.1rem; color: var(--text-muted); max-width: 40ch; }
.showcase__step .tag { display: inline-block; margin-top: 1.4rem; font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.08em; color: var(--accent); }

.showcase__stage { position: relative; aspect-ratio: 2560 / 1380; }
.showcase__shot {
  position: absolute; inset: 0; border-radius: var(--r-lg);
  overflow: hidden; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-window);
  opacity: 0; transform: scale(1.03);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.showcase__shot.is-active { opacity: 1; transform: none; }
.showcase__shot img { width: 100%; height: 100%; object-fit: cover; }
.showcase__progress { position: absolute; left: 0; bottom: -2.4rem; display: flex; gap: 8px; }
.showcase__dot { width: 34px; height: 3px; border-radius: 2px; background: var(--border-strong); overflow: hidden; }
.showcase__dot span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s linear; }
.showcase__dot.is-active span { width: 100%; }

@media (max-width: 900px) {
  .showcase__viewport { display: none; }
  .showcase__steps--mobile { display: grid; gap: clamp(3.5rem, 10vw, 6rem); }
  .showcase__block { display: grid; gap: 1.4rem; }
  .showcase__block h3 { font-family: var(--font-display); font-weight: 600; font-size: var(--step-3); line-height: 1.08; }
  .showcase__block p { color: var(--text-muted); }
  .showcase__block .tag { font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.08em; color: var(--accent); }
  .showcase__block .frame { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border-strong); box-shadow: var(--shadow-card); }
}
@media (min-width: 901px) { .showcase__steps--mobile { display: none; } }

/* ---------- Audio quality ---------- */
.audio__grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.formats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 2rem 0 2.6rem; }
.format {
  font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.02em;
  padding: 0.5em 0.85em; border-radius: var(--r-pill);
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface);
}
.format.is-lossless { color: var(--text); border-color: var(--border-strong); }
.specs { display: grid; gap: 1.4rem; }
.spec { display: flex; gap: 1rem; }
.spec__icon {
  flex: none; width: 44px; height: 44px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}
.spec__icon svg { width: 22px; height: 22px; }
.spec h3 { font-size: var(--step-0); font-weight: 600; }
.spec p { color: var(--text-muted); font-size: var(--step--1); margin-top: 0.2rem; }

.audio__shot { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border-strong); box-shadow: var(--shadow-window); }

@media (max-width: 900px) {
  .audio__grid { grid-template-columns: 1fr; }
}

/* ---------- Themes ---------- */
.themes__grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.themes__shot { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border-strong); box-shadow: var(--shadow-window); }
.picker { margin-top: 2rem; }
.picker__label { font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.swatches { display: flex; gap: 0.7rem; margin-top: 0.9rem; }
/* Selection ring sits outside the color dot with a fixed gap (padding + content-box
   clip), so nothing scales or shifts when a swatch becomes active. */
.swatch {
  width: 40px; height: 40px; border-radius: 50%; position: relative;
  border: 2px solid transparent; padding: 3px;
  background-clip: content-box;
  transition: border-color 0.2s;
}
.swatch:hover { border-color: var(--border-strong); }
.swatch.is-active { border-color: var(--text); }
/* live preview card (mini now-playing, mirrors the app) */
.preview {
  margin-top: 2.2rem; max-width: 360px;
  background: var(--elev); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1rem; box-shadow: var(--shadow-card);
}
.preview__row { display: flex; align-items: center; gap: 0.9rem; }
.preview__art {
  width: 56px; height: 56px; border-radius: 12px; flex: none; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #000));
}
.preview__art img { width: 100%; height: 100%; object-fit: cover; }
.preview__meta { min-width: 0; }
.preview__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview__artist { color: var(--accent); font-size: var(--step--1); font-weight: 500; }
.preview__bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 1rem; overflow: hidden; }
.preview__bar span { display: block; height: 100%; width: 46%; background: var(--accent); border-radius: 2px; }
.preview__controls { display: flex; align-items: center; justify-content: center; gap: 1.4rem; margin-top: 0.9rem; color: var(--text-muted); }
.preview__controls .play { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--on-accent); }
.preview__controls svg { width: 18px; height: 18px; }
.preview__controls .play svg { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .themes__grid { grid-template-columns: 1fr; }
  .themes__shot { order: -1; }
}

/* ---------- Integrations ---------- */
.integrations__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.integration {
  padding: 1.5rem; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); transition: border-color 0.25s, background-color 0.25s, transform 0.25s var(--ease-out);
}
.integration:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-3px); }
.integration h3 { font-size: var(--step-0); font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.integration h3 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.integration p { color: var(--text-muted); font-size: var(--step--1); margin-top: 0.4rem; }
@media (max-width: 900px) { .integrations__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .integrations__grid { grid-template-columns: 1fr; } }

/* ---------- Download ---------- */
.download { position: relative; }
.download__glows .glow--red { width: 40vw; height: 40vw; left: 55%; top: 0; }
.download__glows .glow--teal { width: 34vw; height: 34vw; left: 2%; top: 30%; }
.platforms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.platform {
  padding: 1.8rem; border-radius: var(--r-lg); border: 1px solid var(--border);
  background: var(--surface); display: flex; flex-direction: column; gap: 0.4rem;
  transition: border-color 0.25s, transform 0.25s var(--ease-out), box-shadow 0.25s;
}
.platform:hover { border-color: var(--border-strong); transform: translateY(-4px); box-shadow: var(--shadow-card); }
.platform__icon { width: 34px; height: 34px; color: var(--text); margin-bottom: 0.7rem; }
.platform h3 { font-size: var(--step-1); font-weight: 600; }
.platform__req { color: var(--text-faint); font-size: var(--step--1); font-family: var(--font-mono); }
.platform .btn { margin-top: 1.1rem; }

.cmd__copy { color: var(--text-muted); display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; flex: none; transition: color 0.2s, background-color 0.2s; }
.cmd__copy:hover { color: var(--text); background: var(--surface-2); }
.cmd__copy svg { width: 16px; height: 16px; }
.cmd__copy .check { display: none; color: var(--brand-2); }
.cmd__copy.is-copied .clip { display: none; }
.cmd__copy.is-copied .check { display: block; }
@media (max-width: 820px) { .platforms { grid-template-columns: 1fr; } }

/* ---------- Package manager dropdown (hero) ---------- */
.pkg { position: relative; }
.pkg__trigger svg { width: 1em; height: 1em; transition: transform 0.25s var(--ease-out); }
.pkg:hover .pkg__trigger svg, .pkg:focus-within .pkg__trigger svg, .pkg.is-open .pkg__trigger svg { transform: rotate(180deg); }
/* invisible bridge so the menu doesn't close while the cursor crosses the gap */
.pkg::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 14px; }
.pkg__menu {
  position: absolute; top: calc(100% + 10px); left: 50%; z-index: 60;
  transform: translateX(-50%) translateY(8px);
  min-width: 340px; padding: 0.45rem;
  background: var(--elev); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-card);
  opacity: 0; visibility: hidden;
  transition: opacity 0.22s var(--ease-out), transform 0.22s var(--ease-out), visibility 0.22s;
  text-align: left;
}
.pkg:hover .pkg__menu, .pkg:focus-within .pkg__menu, .pkg.is-open .pkg__menu {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
.pkg__item {
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
  padding: 0.6rem 0.5rem 0.6rem 0.8rem; border-radius: 10px;
  transition: background-color 0.15s;
}
.pkg__item:hover { background: var(--surface-2); }
.pkg__item + .pkg__item { margin-top: 2px; }
.pkg__name {
  display: block; font-family: var(--font-mono); font-size: 0.68rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint);
}
.pkg__info code {
  display: block; margin-top: 2px;
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.55;
  color: var(--text); white-space: nowrap;
}
@media (max-width: 480px) {
  .pkg__menu { min-width: min(92vw, 340px); }
  .pkg__info code { font-size: 0.72rem; }
}

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding-block: clamp(3rem, 6vw, 5rem) 2.5rem; position: relative; z-index: 2; }
.footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2.5rem; }
.footer__brand { max-width: 30ch; }
.footer__brand p { color: var(--text-muted); font-size: var(--step--1); margin-top: 1rem; }
.footer__cols { display: flex; gap: clamp(2rem, 5vw, 5rem); flex-wrap: wrap; }
.footer__col h5 { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 1rem; }
.footer__col a { display: block; color: var(--text-muted); padding: 0.32rem 0; font-size: var(--step--1); transition: color 0.2s; }
.footer__col a:hover { color: var(--text); }
.footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--border); color: var(--text-faint); font-size: var(--step--1); }
.footer__bottom a { color: var(--text-muted); }
.footer__bottom a:hover { color: var(--text); }

/* ---------- Mini-player download dock ---------- */
.dock {
  /* Centered with auto margins, not translateX(-50%): a half-pixel horizontal
     transform makes the round art re-rasterize (visibly reshape) when the
     slide-in transition ends. Only translateY animates. */
  position: fixed; left: 0; right: 0; bottom: 1.1rem; z-index: 90;
  margin-inline: auto;
  transform: translateY(160%);
  will-change: transform;
  width: min(100% - 2rem, 480px);
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 0.7rem 0.6rem 1rem;
  background: color-mix(in srgb, var(--elev) 82%, transparent);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-card);
  transition: transform 0.5s var(--ease-out), opacity 0.4s;
  opacity: 0;
}
.dock.is-visible { transform: translateY(0); opacity: 1; }
.dock__art { width: 42px; height: 42px; border-radius: 50%; flex: none; box-shadow: 0 4px 12px -4px var(--glow-red); }
.dock__meta { min-width: 0; flex: 1; }
.dock__release {
  display: inline-flex; align-items: center; gap: 0.6em;
  color: var(--text-muted);
  font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.02em;
  white-space: nowrap;
}
.dock__release b { font-weight: 600; color: var(--text); }
.dock .btn { flex: none; padding: 0.6em 1.2em; min-height: 38px; font-size: var(--step--1); }
@media (max-width: 620px) {
  .dock { gap: 0.6rem; padding-left: 0.75rem; }
  .dock__meta { display: none; }
  .dock__art { width: 36px; height: 36px; }
  .dock .btn { flex: 1; }
}

/* ---------- Discord ---------- */
.btn--discord {
  --btn-bg: #5865F2;
  --btn-fg: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 10px 30px -12px rgba(88, 101, 242, 0.55), 0 2px 0 rgba(255, 255, 255, 0.14) inset;
}
.btn--discord:hover { --btn-bg: #4752C4; box-shadow: 0 18px 46px -14px rgba(88, 101, 242, 0.6), 0 2px 0 rgba(255, 255, 255, 0.16) inset; }
.nav__discord { min-height: 42px; padding: 0.5em 1.1em; font-size: var(--step--1); }
@media (max-width: 620px) {
  .nav__discord-label { display: none; }
  .nav__discord { width: 42px; height: 42px; padding: 0; border-radius: 50%; }
}

/* ---------- Live release badge + download counter ---------- */
:root { --ok: #22C55E; }
[data-theme="light"] { --ok: #15803D; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; position: relative; }
@media (prefers-reduced-motion: no-preference) {
  .pulse-dot::after {
    content: ""; position: absolute; inset: -4px; border-radius: 50%;
    border: 1px solid var(--ok);
    animation: pulse 2.4s var(--ease-out) infinite;
  }
}
@keyframes pulse { from { transform: scale(0.5); opacity: 0.9; } to { transform: scale(1.7); opacity: 0; } }
.hero__badge {
  display: inline-flex; align-items: center; gap: 0.6em;
  padding: 0.5em 1.1em; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--elev) 60%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.02em;
  color: var(--text-muted);
  transition: border-color 0.25s, background-color 0.25s;
}
.hero__badge:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.hero__badge b { font-weight: 600; color: var(--text); }
.hero__badge-sep { color: var(--text-faint); }
.hero__downloads {
  margin-top: 1.5rem; display: inline-flex; align-items: center; gap: 0.6em;
  font-family: var(--font-mono); font-size: var(--step--1); color: var(--text-muted);
}
.hero__downloads b { color: var(--brand); font-weight: 600; display: inline-block; }
.hero__downloads b.bump { animation: countBump 0.6s var(--ease-out); }
@keyframes countBump { 30% { transform: scale(1.22); } }

/* ---------- Download community + platform alt links ---------- */
.platform__alt {
  margin-top: 0.65rem; font-size: var(--step--1); color: var(--text-faint);
  text-decoration: underline dotted; text-underline-offset: 3px; transition: color 0.2s;
}
.platform__alt:hover { color: var(--text); }
.download__community {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  display: flex; flex-direction: column; align-items: center; gap: 1.2rem; text-align: center;
}
.download__community-note { color: var(--text-muted); max-width: 44ch; }

/* ---------- Footer extras ---------- */
.footer__social { display: flex; gap: 0.6rem; margin-top: 1.2rem; }
.footer__yours { font-family: var(--font-display); font-style: italic; color: var(--text-muted); }

/* ---------- Theme cross-fade fallback (browsers without View Transitions) ---------- */
html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
  transition: background-color 0.5s var(--ease-out), color 0.4s var(--ease-out),
              border-color 0.5s var(--ease-out), fill 0.4s, stroke 0.4s,
              box-shadow 0.5s var(--ease-out) !important;
}

/* ---------- Reveal (GSAP-driven) base state ---------- */
[data-reveal] { opacity: 0; transform: translateY(24px); }
.no-motion [data-reveal] { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .glow { animation: none !important; }
}
