/* Founder's Jarvis
   Porcelain ground, one dark object, periwinkle signal.
   Depth: Three.js hero (3d.js) + CSS 3D per-section transitions + card tilt. */

:root {
  --ground: #F4F2ED;
  --ground-2: #EAE7DF;
  --card: #FBFAF7;
  --ink: #14171B;
  --ink-2: #4E555D;
  --muted: #656C74;   /* 4.63:1 on --ground; #767D85 was 3.72 and failed AA */
  --line: #DCD8CF;
  --hair: #E8E5DD;
  --accent: #3D4AE0;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(61, 74, 224, .09);

  --wrap: 74rem;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0E1014;
    --ground-2: #14171C;
    --card: #171B21;
    --ink: #F2F1EC;
    --ink-2: #B9BFC6;
    --muted: #868D95;
    --line: #272C33;
    --hair: #1E232A;
    --accent: #93A0FF;
    --accent-ink: #0E1014;
    --accent-soft: rgba(147, 160, 255, .12);
  }
}
:root[data-theme="dark"] {
  --ground: #0E1014;
  --ground-2: #14171C;
  --card: #171B21;
  --ink: #F2F1EC;
  --ink-2: #B9BFC6;
  --muted: #868D95;
  --line: #272C33;
  --hair: #1E232A;
  --accent: #93A0FF;
  --accent-ink: #0E1014;
  --accent-soft: rgba(147, 160, 255, .12);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* .btn sets display, which ties with the UA's [hidden] rule and wins on order.
   Without this, every launch-only button shows while MODE is "waitlist". */
[hidden] { display: none !important; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* soft animated background canvas, Lesson 1 item 7 */
.bg-3d { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; opacity: 0; transition: opacity 1.2s ease; }
.bg-3d.on { opacity: 1; }

h1, h2, h3 { font-family: var(--sans); font-weight: 600; letter-spacing: -0.03em; line-height: 1.02; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 5.6vw, 5rem); font-weight: 700; letter-spacing: -0.04em; }
h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
h3 { font-size: 1.25rem; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--accent); }
img, svg, canvas { display: block; max-width: 100%; }

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

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 1.75rem; }
.wrap.narrow { max-width: 48rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.row.gap { gap: 1.5rem; justify-content: flex-start; }
.wrap-row { flex-wrap: wrap; }

.eyebrow {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.eyebrow .lower { text-transform: none; }
.lede { font-size: clamp(1.125rem, 1.5vw, 1.3125rem); color: var(--ink-2); max-width: 26em; }
.fine { font-size: 0.9375rem; color: var(--muted); }
.aside { margin-top: 3rem; color: var(--muted); max-width: 40em; }
a.quiet { color: var(--muted); text-decoration: none; font-size: 0.9375rem; }
a.quiet:hover { color: var(--ink); }

.btn {
  display: inline-block; font-family: var(--sans); font-weight: 600; font-size: 1rem;
  color: var(--accent-ink); background: var(--accent); border: 1px solid transparent;
  border-radius: 999px; padding: 0.85rem 1.6rem; text-decoration: none; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 6px var(--accent-soft); }
.btn-sm { font-size: 0.9375rem; padding: 0.55rem 1.1rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

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

.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 60; backdrop-filter: blur(14px); background: color-mix(in srgb, var(--ground) 80%, transparent); }
.site-head .row { padding-block: 1.1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand .pip { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
@media (max-width: 680px) { .hide-sm { display: none; } }

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

.hero { padding-block: clamp(2.5rem, 5vw, 5rem) clamp(3rem, 6vw, 6rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.hero-copy { display: grid; gap: 1.75rem; justify-items: start; }
.hero-copy h1 { margin-top: 0.5rem; }

.stage-col { display: grid; gap: 2.25rem; }
.stage { position: relative; aspect-ratio: 4 / 5; min-height: 26rem; }

/* the step rail: the phone narrates itself, this says it in words too */
ol.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.5rem; justify-content: center; }
ol.steps li {
  flex: 1 1 0; min-width: 0; display: grid; gap: 0.3rem; align-content: start;
  padding-top: 0.7rem; border-top: 2px solid var(--line);
  font-size: 0.9375rem; color: var(--muted);
  transition: color .45s ease, border-color .45s ease;
}
ol.steps .n { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.12em; color: var(--muted); transition: color .45s ease; }
ol.steps[data-step="0"] li:nth-child(1),
ol.steps[data-step="1"] li:nth-child(2),
ol.steps[data-step="2"] li:nth-child(3) { color: var(--ink); border-top-color: var(--accent); }
ol.steps[data-step="0"] li:nth-child(1) .n,
ol.steps[data-step="1"] li:nth-child(2) .n,
ol.steps[data-step="2"] li:nth-child(3) .n { color: var(--accent); }
.stage canvas, .stage .fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .fallback { display: grid; place-items: center; transition: opacity .6s ease; }
.stage .fallback svg { height: 92%; width: auto; filter: drop-shadow(0 30px 50px rgba(20,23,27,.25)); }
.stage.live .fallback { opacity: 0; pointer-events: none; }
/* fade the bottom so the shadow plane does not end on a hard canvas edge */
.stage canvas {
  opacity: 0; transition: opacity .6s ease; touch-action: pan-y;
  mask-image: linear-gradient(to bottom, #000 80%, transparent 99%);
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 99%);
}
.stage.live canvas { opacity: 1; }
.hint {
  position: absolute; left: 50%; bottom: 0.75rem; transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-2); opacity: 0; transition: opacity .5s ease; pointer-events: none; white-space: nowrap;
}
.stage.live .hint { opacity: 1; }
.stage.touched .hint { opacity: 0; }

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

.band { padding-block: clamp(3.5rem, 7vw, 7rem); }
.band .eyebrow { margin-bottom: 2.5rem; }

ol.four { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 4vw, 4rem) clamp(2rem, 5vw, 5rem); }
ol.four li { display: grid; gap: 0.6rem; align-content: start; }
ol.four .n { font-family: var(--mono); font-size: 0.8125rem; color: var(--accent); }
ol.four p { color: var(--ink-2); max-width: 24em; }

.statement { padding-block: clamp(4rem, 9vw, 9rem); }
.statement p { font-size: clamp(1.75rem, 4.2vw, 3.25rem); font-weight: 600; letter-spacing: -0.035em; line-height: 1.12; max-width: 20em; text-wrap: balance; }
.statement em { font-style: normal; color: var(--accent); }

.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.card .tilt-in { padding: clamp(1.75rem, 3vw, 2.5rem); display: grid; gap: 0.7rem; }
.card p { color: var(--ink-2); }

.prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.price { display: grid; gap: 0.6rem; justify-items: start; align-content: start; padding-top: 2rem; border-top: 2px solid var(--ink); }
.amount { font-size: clamp(3.5rem, 8vw, 5.5rem); font-weight: 700; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.price .btn { margin-top: 0.75rem; }

.faq { max-width: 48rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; padding-block: 1.25rem; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--accent); }
.faq details[open] summary::after { content: "\2013"; }
.faq p { color: var(--ink-2); padding-bottom: 1.25rem; max-width: 44em; }

.strip { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 2.5rem; align-items: center; background: var(--ground-2); border-radius: 6px; padding: clamp(2rem, 4vw, 3rem); }
.strip p { color: var(--ink-2); margin-top: 0.5rem; max-width: 36em; }

.site-foot { border-top: 1px solid var(--line); padding-block: 2.5rem 3.5rem; display: grid; gap: 1.25rem; }

/* ----------------------------------------------------- forms and prose */

.form { display: grid; gap: 1.25rem; max-width: 34rem; margin-top: 2.5rem; }
.field { display: grid; gap: 0.45rem; }
.field label { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  font-family: inherit; font-size: 1rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 0.75rem 0.85rem; width: 100%;
}
.field textarea { min-height: 7rem; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--accent); }
.form-status { font-size: 0.9375rem; margin-top: 1rem; }
.form-status[data-state="ok"] { color: var(--accent); }
.hp { position: absolute; left: -9999px; }
.prose { max-width: 42rem; display: grid; gap: 1.25rem; }
.prose h2 { margin-top: 1.5rem; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 1.25rem; display: grid; gap: 0.5rem; }
.review-flag { border: 1px dashed var(--accent); border-radius: 4px; padding: 1rem 1.25rem; font-size: 0.9375rem; color: var(--muted); }
.plain-list { display: grid; gap: 1.25rem; margin: 0; padding: 0; list-style: none; }
.plain-list li { display: grid; grid-template-columns: 1.5rem minmax(0,1fr); gap: 0.75rem; color: var(--ink-2); }
.plain-list li::before { content: "\2014"; color: var(--accent); font-family: var(--mono); }

/* ======================================================================
   LESSON 1 · per-section scroll-linked 3D transitions
   JS writes --p (0 to 1) per element. Default 1 so nothing is ever
   invisible without JS; .has-3d (added by JS) is what sets the start.
   ====================================================================== */

[data-3d] { --p: 1; opacity: calc(var(--p) * 1.25 - .25); will-change: transform, opacity; }
.has-3d [data-3d] { --p: 0; }

[data-3d="rise"] {
  transform: perspective(1400px) rotateX(calc((1 - var(--p)) * 16deg)) translateY(calc((1 - var(--p)) * 64px)) scale(calc(.955 + var(--p) * .045));
}
[data-3d="lift"] {
  transform: perspective(1400px) translate3d(0, calc((1 - var(--p)) * 48px), calc((var(--p) - 1) * 140px)) rotateX(calc((1 - var(--p)) * 12deg));
}
[data-3d="hinge-left"] {
  transform-origin: left center;
  transform: perspective(1400px) rotateY(calc((1 - var(--p)) * -26deg)) translateX(calc((1 - var(--p)) * -40px));
}
[data-3d="hinge-right"] {
  transform-origin: right center;
  transform: perspective(1400px) rotateY(calc((1 - var(--p)) * 26deg)) translateX(calc((1 - var(--p)) * 40px));
}
[data-3d="foot"] {
  transform-origin: center bottom;
  transform: perspective(1400px) rotateX(calc((1 - var(--p)) * 38deg)) translateY(calc((1 - var(--p)) * 14%));
}

/* ======================================================================
   LESSON 1 · Aceternity-style card tilt. JS writes --px --py --mx --my.
   Transforms live on .tilt-in so they never fight the data-3d transform.
   ====================================================================== */

@media (hover: hover) {
  .tilt { perspective: 900px; }
  .tilt .tilt-in {
    transform: rotateY(calc(var(--px, 0) * 6deg)) rotateX(calc(var(--py, 0) * -6deg)) translateZ(var(--lift, 0px));
    transition: transform .9s cubic-bezier(.22,.61,.36,1);
    position: relative;
  }
  .tilt.moving .tilt-in { transition-duration: .18s; }
  .tilt .tilt-in::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(22rem circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 60%);
    opacity: var(--glare, 0); transition: opacity .3s ease;
  }
}

/* ------------------------------------------------------------- narrow */

@media (max-width: 920px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .stage-col { order: -1; max-width: 26rem; margin-inline: auto; margin-bottom: 1.5rem; width: 100%; }
  .three, .prices, .strip { grid-template-columns: minmax(0, 1fr); }
  ol.four { grid-template-columns: minmax(0, 1fr); }
  /* hinged full-width elements overflow a narrow viewport, so fall back to rise */
  [data-3d="hinge-left"], [data-3d="hinge-right"] {
    transform-origin: center;
    transform: perspective(1400px) rotateX(calc((1 - var(--p)) * 16deg)) translateY(calc((1 - var(--p)) * 64px)) scale(calc(.955 + var(--p) * .045));
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-3d] { --p: 1 !important; transform: none !important; }
  .btn, .tilt .tilt-in { transition: none; }
  .bg-3d { display: none; }
}
