/* =========================================================================
   AI Fire — scroll-driven video-background site
   ========================================================================= */

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif;

  --bg: #05060a;

  /* Text tones (cool at the top of the page → warm near the CTA) */
  --cool-strong: #eef4ff;
  --cool-soft:   #a8bbdd;
  --warm-strong: #fff3e4;
  --warm-soft:   #e9c39a;

  /* Accent is interpolated cool → warm by JS; this is the cool default. */
  --accent: 141, 186, 255;         /* pale blue  */
  --accent-warm: 255, 157, 92;     /* soft amber */

  /* Scroll length is set from JS to keep the scrub speed consistent. */
  --scroll-len: 680vh;
}

html { background: var(--bg); scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--cool-strong);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }

.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;
}

.skip-link {
  position: fixed; top: -60px; left: 16px; z-index: 40;
  background: rgba(var(--accent), 0.95); color: #04121f;
  padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: 14px;
  text-decoration: none; transition: top .2s ease;
}
.skip-link:focus { top: 16px; }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; background: radial-gradient(120% 120% at 50% 45%, #0a0d16 0%, #04050a 70%);
  transition: opacity .7s ease, visibility .7s ease;
}
.loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader__ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
  border-top-color: rgba(var(--accent), 0.9);
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 26px rgba(var(--accent), 0.25);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader__label {
  margin: 0; font-size: 14px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--cool-soft);
}
.loader__dots::after { content: ""; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots {
  0% { content: ""; } 25% { content: "."; } 50% { content: ".."; }
  75% { content: "..."; } 100% { content: ""; }
}

/* ---------- Stage (pinned) + spacer (scroll length) ---------- */
.stage {
  position: fixed; inset: 0; z-index: 1;
  overflow: hidden;
}
.spacer { height: var(--scroll-len); width: 100%; }

/* ---------- Background video ---------- */
.bg {
  position: absolute; inset: 0; z-index: 0;
  background: #04050a center/cover no-repeat;
  background-image: url("../assets/ember-core-poster.jpg");
}
.bg__video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 50%;
  /* subtle scale so cover cropping never shows edges during layout shifts */
  transform: scale(1.02);
}

/* Legibility scrim: dark on the left (where text lives), clear over the
   central sphere on the right; plus a gentle top+bottom fade. */
.bg__scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg,
      rgba(3,5,10,0.88) 0%,
      rgba(3,5,10,0.72) 28%,
      rgba(3,5,10,0.40) 48%,
      rgba(3,5,10,0.00) 66%),
    linear-gradient(180deg,
      rgba(3,5,10,0.55) 0%,
      rgba(3,5,10,0.00) 22%,
      rgba(3,5,10,0.00) 72%,
      rgba(3,5,10,0.55) 100%);
}

/* Warm overlay whose opacity is raised by JS toward the CTA. */
.bg__warm {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0;
  background:
    radial-gradient(70% 60% at 60% 55%, rgba(255,120,40,0.20) 0%, rgba(255,90,30,0.05) 45%, rgba(0,0,0,0) 70%),
    linear-gradient(0deg, rgba(60,20,5,0.35) 0%, rgba(0,0,0,0) 55%);
  transition: opacity .2s linear;
}

/* ---------- Navigation ---------- */
.nav {
  position: absolute; top: 0; left: 0; right: 0; z-index: 4;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
  padding: clamp(16px, 2.4vw, 26px) clamp(18px, 4vw, 48px);
  padding-top: max(clamp(16px, 2.4vw, 26px), env(safe-area-inset-top));
}
.nav__brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--cool-strong); text-decoration: none;
  font-weight: 700; letter-spacing: 0.02em; font-size: clamp(17px, 2vw, 20px);
}
.nav__flame { color: rgb(var(--accent)); display: inline-flex; filter: drop-shadow(0 0 8px rgba(var(--accent),0.6)); }
.nav__name { text-shadow: 0 1px 18px rgba(0,0,0,0.5); }

.nav__links {
  display: flex; align-items: center; gap: clamp(18px, 3vw, 40px);
  margin: 0 auto;
}
.nav__links a {
  color: var(--cool-soft); text-decoration: none;
  font-size: 15px; letter-spacing: 0.01em;
  position: relative; padding: 6px 0;
  transition: color .25s ease;
  text-shadow: 0 1px 16px rgba(0,0,0,0.5);
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px;
  background: rgb(var(--accent)); transition: right .25s ease;
}
.nav__links a:hover, .nav__links a:focus-visible { color: var(--cool-strong); }
.nav__links a:hover::after, .nav__links a:focus-visible::after { right: 0; }

/* ---------- Buttons ---------- */
.btn {
  --btn-accent: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-weight: 600; font-size: 15px; letter-spacing: 0.01em;
  border-radius: 999px; cursor: pointer; text-decoration: none;
  border: 1px solid transparent; white-space: nowrap;
  transition: transform .2s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease;
  min-height: 44px; padding: 0 22px;
}
.btn:active { transform: translateY(1px); }

.btn--ghost {
  background: rgba(255,255,255,0.04);
  border-color: rgba(var(--btn-accent), 0.5);
  color: var(--cool-strong);
  backdrop-filter: blur(6px);
}
.btn--ghost:hover, .btn--ghost:focus-visible {
  border-color: rgba(var(--btn-accent), 0.9);
  box-shadow: 0 0 22px rgba(var(--btn-accent), 0.25);
}

.btn--primary {
  background: linear-gradient(180deg, rgba(255,183,110,1) 0%, rgba(255,138,64,1) 100%);
  color: #2a0f00; font-weight: 700;
  box-shadow: 0 10px 34px rgba(255,120,40,0.34), inset 0 1px 0 rgba(255,255,255,0.4);
  padding: 0 26px;
}
.btn--primary:hover, .btn--primary:focus-visible {
  box-shadow: 0 14px 44px rgba(255,120,40,0.5), inset 0 1px 0 rgba(255,255,255,0.5);
  transform: translateY(-1px);
}

/* ---------- Panels ---------- */
.panels {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
}
.panel {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: flex-start;
  opacity: 0; will-change: opacity, transform;
}
.panel__inner {
  max-width: 560px;
  margin-left: clamp(20px, 8vw, 120px);
  margin-right: 20px;
  padding: 90px 0;
}

/* Text tones per section */
.panel[data-tone="cool"] { color: var(--cool-strong); }
.panel[data-tone="mid"]  { color: #f4f2ee; }
.panel[data-tone="warm"] { color: var(--warm-strong); }

.eyebrow {
  margin: 0 0 18px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.42em; text-transform: uppercase;
  color: rgb(var(--accent));
  text-shadow: 0 0 20px rgba(var(--accent), 0.5);
}

.opening-line {
  margin: 0; font-size: clamp(1.35rem, 3.4vw, 2.4rem); font-weight: 500;
  line-height: 1.28; letter-spacing: -0.01em; color: var(--cool-soft);
  text-shadow: 0 2px 30px rgba(0,0,0,0.55);
}

.headline {
  margin: 0; font-weight: 600;
  font-size: clamp(2.6rem, 8.2vw, 5.4rem); line-height: 1.02;
  letter-spacing: -0.03em;
  text-shadow: 0 4px 40px rgba(0,0,0,0.6);
}
.lede {
  margin: 26px 0 0; max-width: 30ch;
  font-size: clamp(1.05rem, 1.7vw, 1.3rem); line-height: 1.55;
  color: var(--cool-soft);
  text-shadow: 0 2px 24px rgba(0,0,0,0.55);
}

.section-title {
  margin: 0 0 34px; font-weight: 600;
  font-size: clamp(1.8rem, 4.4vw, 3rem); line-height: 1.08; letter-spacing: -0.02em;
  text-shadow: 0 3px 30px rgba(0,0,0,0.6);
}

/* Single column so all four points stay in the clean left area, clear of the
   central sphere. */
.value-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr; gap: 18px;
  max-width: 380px;
}
.value-item { position: relative; padding-left: 20px; }
.value-item__mark {
  position: absolute; left: 0; top: 9px; width: 8px; height: 8px; border-radius: 50%;
  background: rgb(var(--accent));
  box-shadow: 0 0 14px rgba(var(--accent), 0.8);
}
.value-item h3 {
  margin: 0 0 6px; font-size: clamp(1.05rem, 1.7vw, 1.22rem); font-weight: 600;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 20px rgba(0,0,0,0.55);
}
.value-item p {
  margin: 0; font-size: 0.98rem; line-height: 1.5; color: #c7c1b6;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}

.cta-headline {
  margin: 0; font-weight: 600;
  font-size: clamp(2.2rem, 6.4vw, 4.2rem); line-height: 1.04; letter-spacing: -0.03em;
  text-shadow: 0 4px 40px rgba(0,0,0,0.6);
}
.cta-text {
  margin: 22px 0 30px; max-width: 34ch;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem); line-height: 1.5; color: var(--warm-soft);
  text-shadow: 0 2px 24px rgba(0,0,0,0.55);
}

/* ---------- Signup form ---------- */
.signup {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px;
  align-items: center; max-width: 520px;
}
.signup__input {
  min-height: 52px; padding: 0 18px; border-radius: 999px;
  background: rgba(10,12,18,0.6); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff; font-family: inherit; font-size: 16px; /* 16px avoids iOS zoom */
  transition: border-color .2s ease, box-shadow .2s ease;
}
.signup__input::placeholder { color: rgba(233,195,154,0.6); }
.signup__input:focus {
  outline: none; border-color: rgba(255,157,92,0.9);
  box-shadow: 0 0 0 4px rgba(255,157,92,0.18);
}
.signup__btn { min-height: 52px; }
.signup__note {
  grid-column: 1 / -1; margin: 4px 2px 0; font-size: 13px; color: var(--warm-soft);
  opacity: 0.85; text-shadow: 0 1px 14px rgba(0,0,0,0.5);
}
.signup.is-success .signup__note { color: #8ff0b0; opacity: 1; }
.signup.is-error   .signup__input { border-color: #ff7a7a; box-shadow: 0 0 0 4px rgba(255,80,80,0.16); }

/* ---------- Scroll rail + cue ---------- */
.rail {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 3;
  background: rgba(255,255,255,0.06);
}
.rail__fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, rgba(var(--accent),0.9), rgba(255,157,92,0.95));
  box-shadow: 0 0 16px rgba(var(--accent), 0.5);
}

.cue {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--cool-soft); transition: opacity .5s ease;
}
.cue.is-hidden { opacity: 0; }
.cue__text { font-size: 12px; letter-spacing: 0.32em; text-transform: uppercase; }
.cue__line {
  width: 1px; height: 34px; background: linear-gradient(rgba(var(--accent),0.9), rgba(var(--accent),0));
  animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue {
  0%, 100% { transform: scaleY(0.5); transform-origin: top; opacity: 0.5; }
  50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
}

/* =========================================================================
   Responsive — mobile keeps the sphere centred and moves text to the base
   ========================================================================= */
@media (max-width: 760px) {
  .nav__links { display: none; }
  .nav { justify-content: space-between; }

  .bg__scrim {
    background:
      linear-gradient(180deg,
        rgba(3,5,10,0.55) 0%,
        rgba(3,5,10,0.00) 20%,
        rgba(3,5,10,0.00) 40%,
        rgba(3,5,10,0.78) 82%,
        rgba(3,5,10,0.92) 100%);
  }

  .panel { align-items: flex-end; justify-content: center; }
  .panel__inner {
    margin: 0; padding: 0 22px calc(64px + env(safe-area-inset-bottom));
    max-width: 640px; width: 100%; text-align: left;
  }

  .opening-line { font-size: clamp(1.3rem, 6vw, 1.9rem); }
  .headline { font-size: clamp(2.6rem, 13vw, 4rem); }
  .lede { max-width: none; }

  /* Bottom-anchored on mobile: keep the four labels, drop the descriptions so
     the list stays clear of the sphere. */
  .value-grid { grid-template-columns: 1fr; gap: 16px; max-width: none; }
  .value-item p { display: none; }

  .cta-text { max-width: none; }
  .signup { grid-template-columns: 1fr; }
  .signup__btn { width: 100%; }

  .cue { display: none; }                  /* avoids overlapping bottom-anchored text */
}

/* Short landscape phones: pin text to the bottom too and shrink */
@media (max-height: 560px) and (orientation: landscape) {
  .panel__inner { padding: 70px 0 40px; margin-left: clamp(16px, 6vw, 60px); }
  .headline { font-size: clamp(2rem, 7vw, 3rem); }
  .value-grid { gap: 12px 24px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .loader__ring { animation-duration: 2s; }
  .cue__line { animation: none; }
  .bg__video { transform: none; }
}
