/* ================================================================
   PRISM — style.css
   Light studio theme: warm gray canvas, ink type, one violet accent.
   ================================================================ */

:root {
  --bg: #ECEAE6;
  --ink: #14120F;
  --ink-60: rgba(20, 18, 15, 0.64);
  --ink-30: rgba(20, 18, 15, 0.34);
  --ink-12: rgba(20, 18, 15, 0.12);
  --accent: #6C4CFF;
  --accent-soft: rgba(108, 76, 255, 0.14);
  --font-display: "Sora", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  /* The violet glow lives on the .ambience layer so it can lerp per preset. */
  background-image:
    radial-gradient(900px 700px at 12% 88%, rgba(214, 189, 138, 0.20), rgba(214, 189, 138, 0) 62%),
    linear-gradient(180deg, #F1EFEB 0%, #ECEAE6 45%, #E4E0D9 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fine procedural grain over everything except the cursor. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)'/%3E%3C/svg%3E");
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.chip:focus-visible {
  border-radius: 999px;
}

/* ----------------------------------------------------------------
   Lenis smooth-scroll compatibility
   ---------------------------------------------------------------- */

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

/* ----------------------------------------------------------------
   Ambience layer (per-preset glow, painted from JS) + fixed scene
   ---------------------------------------------------------------- */

.ambience {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.scene {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.scene canvas {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.scene canvas.is-grabbing {
  cursor: grabbing;
}

/* ----------------------------------------------------------------
   Top bar
   ---------------------------------------------------------------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 4.5vw, 60px);
  pointer-events: none;
}

.brand {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.18em;
}

.brand-mark {
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(20, 18, 15, 0.18);
}

.nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 30px);
}

.nav a {
  color: var(--ink-60);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.25s ease;
}

.nav a:hover {
  color: var(--ink);
}

.nav a.cta {
  color: #fff;
  background: var(--ink);
  padding: 9px 18px;
  border-radius: 999px;
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.nav a.cta:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(108, 76, 255, 0.3);
}

/* ----------------------------------------------------------------
   Scroll story: four viewport-height sections in a left column
   ---------------------------------------------------------------- */

.story {
  position: relative;
  z-index: 10;
  pointer-events: none;
}

.sec {
  position: relative;
  min-height: 100vh;
  max-width: min(660px, 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(18px, 2.6vh, 28px);
  padding: 120px clamp(20px, 4.5vw, 60px) 110px;
  pointer-events: none;
}

.sec a,
.sec button {
  pointer-events: auto;
}

.hl-2 {
  font-size: clamp(34px, 4.8vw, 62px);
}

/* Scroll-triggered reveals (non-hero sections). --d staggers per element. */
[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s ease var(--d, 0s),
    transform 0.9s cubic-bezier(0.19, 0.9, 0.22, 1) var(--d, 0s);
  will-change: opacity, transform;
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Hero scroll cue */
.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-30);
}

.cue-line {
  position: relative;
  width: 1.5px;
  height: 38px;
  background: var(--ink-12);
  overflow: hidden;
}

.cue-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateY(-100%);
  animation: cue-drop 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes cue-drop {
  45% {
    transform: translateY(0);
  }
  90%,
  100% {
    transform: translateY(100%);
  }
}

/* Macro stats */
.stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(24px, 4vw, 54px);
  border-top: 1px solid var(--ink-12);
  padding-top: 22px;
  max-width: 520px;
}

.stats li {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-key {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-30);
}

/* CTA row */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.btn-primary,
.btn-ghost {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
  padding: 15px 30px;
  border-radius: 999px;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease,
    transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-primary {
  color: #fff;
  background: var(--ink);
}

.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(108, 76, 255, 0.35);
}

.btn-ghost {
  color: var(--ink);
  border: 1px solid var(--ink-12);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-ghost:hover {
  border-color: var(--ink-30);
  transform: translateY(-2px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hl {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(46px, 7.4vw, 92px);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.hl em {
  font-style: normal;
  color: var(--accent);
}

.hl .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.line-in {
  display: inline-block;
  transform: translateY(115%);
  transition: transform 1s cubic-bezier(0.19, 0.9, 0.22, 1);
  will-change: transform;
}

.copy {
  max-width: 47ch;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink-60);
}

/* ----------------------------------------------------------------
   Preset chips
   ---------------------------------------------------------------- */

.presets {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.presets-label {
  display: flex;
  justify-content: space-between;
  max-width: 440px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-30);
}

.presets-label em {
  font-style: normal;
  letter-spacing: 0.12em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--ink-12);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease,
    transform 0.25s ease, box-shadow 0.25s ease;
}

.chip:hover {
  border-color: var(--ink-30);
  transform: translateY(-2px);
}

.chip:active {
  transform: translateY(0) scale(0.98);
}

.chip-index {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--ink-30);
  transition: color 0.25s ease;
}

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 12px 28px rgba(108, 76, 255, 0.35);
}

.chip.is-active .chip-index {
  color: rgba(255, 255, 255, 0.6);
}

/* ----------------------------------------------------------------
   Spec sheet
   ---------------------------------------------------------------- */

.spec {
  max-width: 440px;
  border-top: 1px solid var(--ink-12);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spec-head {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-30);
}

.spec-name {
  color: var(--accent);
  animation: fade-slide 0.45s ease;
}

.spec-blurb {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-60);
  min-height: 40px;
  animation: fade-slide 0.45s ease;
}

@keyframes fade-slide {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.spec-rows {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.spec-rows li {
  display: grid;
  grid-template-columns: 96px 1fr 44px;
  align-items: center;
  gap: 14px;
}

.spec-key {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.spec-bar {
  position: relative;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-12);
  overflow: hidden;
}

.spec-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.spec-val {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-60);
  text-align: right;
}

/* ----------------------------------------------------------------
   Footer
   ---------------------------------------------------------------- */

.foot {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(20px, 4.5vw, 60px);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-30);
  pointer-events: none;
}

/* ----------------------------------------------------------------
   Intro reveal (driven by .is-ready on the site wrapper)
   ---------------------------------------------------------------- */

.sec-hero .eyebrow,
.sec-hero .copy,
.sec-hero .scroll-cue {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.19, 0.9, 0.22, 1);
}

.topbar,
.foot {
  opacity: 0;
  transition: opacity 0.9s ease;
}

.is-ready .sec-hero .eyebrow {
  opacity: 1;
  transform: none;
  transition-delay: 0.1s;
}

.is-ready .hl .line:nth-child(1) .line-in {
  transform: translateY(0);
  transition-delay: 0.16s;
}

.is-ready .hl .line:nth-child(2) .line-in {
  transform: translateY(0);
  transition-delay: 0.28s;
}

.is-ready .sec-hero .copy {
  opacity: 1;
  transform: none;
  transition-delay: 0.4s;
}

.is-ready .sec-hero .scroll-cue {
  opacity: 1;
  transform: none;
  transition-delay: 0.56s;
}

.is-ready .topbar {
  opacity: 1;
  transition-delay: 0.55s;
}

.is-ready .foot {
  opacity: 1;
  transition-delay: 0.78s;
}

/* ----------------------------------------------------------------
   Loader
   ---------------------------------------------------------------- */

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: opacity 0.65s ease 0.05s, visibility 0s linear 0.75s;
}

#loader.done {
  opacity: 0;
  visibility: hidden;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loader-mark path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: draw 1.1s cubic-bezier(0.6, 0, 0.3, 1) forwards 0.1s;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.loader-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5em;
  padding-left: 0.5em;
  color: var(--ink);
}

.loader-line {
  width: 148px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-12);
  overflow: hidden;
}

.loader-line span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  animation: loadline 1s cubic-bezier(0.65, 0, 0.25, 1) forwards 0.2s;
}

@keyframes loadline {
  to {
    width: 100%;
  }
}

/* ----------------------------------------------------------------
   Custom cursor
   ---------------------------------------------------------------- */

.cursor-off,
.cursor-off * {
  cursor: none !important;
}

.cursor-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}

.cursor-dot {
  position: fixed;
  top: -4px;
  left: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-100px, -100px);
}

.cursor-ring {
  position: fixed;
  top: -17px;
  left: -17px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(108, 76, 255, 0.55);
  transform: translate(-100px, -100px);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1),
    width 0.25s ease, height 0.25s ease, top 0.25s ease, left 0.25s ease,
    border-color 0.25s ease, background 0.25s ease;
}

.cursor-ring.is-hover {
  width: 52px;
  height: 52px;
  top: -26px;
  left: -26px;
  border-color: var(--ink-30);
  background: rgba(108, 76, 255, 0.08);
}

.cursor-ring.is-down {
  width: 24px;
  height: 24px;
  top: -12px;
  left: -12px;
  border-color: var(--accent);
}

/* ----------------------------------------------------------------
   Fallbacks
   ---------------------------------------------------------------- */

.boot-fallback,
.scene-fallback {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
}

.fallback-card {
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 30px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--ink-12);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(20, 18, 15, 0.12);
}

.fallback-card strong {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: -0.01em;
}

.fallback-card p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-60);
}

.fallback-card code {
  font-size: 11px;
  color: var(--accent);
  word-break: break-word;
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */

@media (max-width: 900px) {
  .sec {
    min-height: 100svh;
    justify-content: flex-end;
    padding-top: 42vh;
    padding-bottom: 96px;
  }

  .stats {
    gap: 22px;
  }

  .nav a:not(.cta) {
    display: none;
  }

  .foot-hint {
    display: none;
  }

  .spec-blurb {
    min-height: 0;
  }
}

@media (pointer: coarse) {
  .presets-label em {
    display: none;
  }
}

/* ----------------------------------------------------------------
   Reduced motion: collapse all decorative animation
   ---------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }

  .cue-line::after {
    animation: none;
    transform: translateY(0);
  }
}
