/* Velune launch page. Brand: black and white with white at 60/35/12/6 %, Inter 200–500, a serif italic for the
   headlines' second voice; the day is the app's clear blue. Motion: slow, eased, one breath every 5.6 s. */

:root {
  --ink: #000;
  --paper: #fff;
  --mist-82: rgba(255, 255, 255, .82);
  --mist-60: rgba(255, 255, 255, .6);
  --mist-35: rgba(255, 255, 255, .35);
  --line-12: rgba(255, 255, 255, .12);
  --veil-06: rgba(255, 255, 255, .06);
  --surface: rgba(0, 0, 0, .38);
  --ease: cubic-bezier(.45, 0, .55, 1);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --gutter: max(16px, env(safe-area-inset-left));
  --max: 1120px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--mist-82);
  font: 300 17px/1.6 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { color: var(--paper); margin: 0; font-weight: 200; letter-spacing: -.02em; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.005em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 1px solid var(--paper); outline-offset: 4px; border-radius: 4px; }

/* ── Sky ─────────────────────────────────────────────────────────────────────────────── */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
#sky { width: 100%; height: 100%; }
#stars { position: absolute; inset: 0; opacity: var(--stars, 1); transition: opacity .6s var(--ease); }
.sky .body { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; will-change: transform; transition: opacity .9s var(--ease); }

/* ── Loading screen ──────────────────────────────────────────────────────────────────── */
/* Only with JS (html.js-loading, set in <head>). If main.js never runs, CSS fades the mark in and the screen out. */
.loader { display: none; }
.js-loading .loader {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  position: fixed; inset: 0; z-index: 100; background: var(--ink);
  animation: loader-out .6s var(--ease) 3.2s forwards;
}
.loader-mark { width: 112px; height: 112px; animation: loader-in .9s var(--ease) .15s both; }
.loader-word { height: 13px; width: auto; animation: loader-in .9s var(--ease) .6s both; }
@keyframes loader-in { from { opacity: 0; } }
@keyframes loader-out { to { opacity: 0; visibility: hidden; } }

/* ── Bar ─────────────────────────────────────────────────────────────────────────────── */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0));
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand .wordmark { height: 13px; width: auto; }
.clock { display: flex; flex-direction: column; align-items: center; line-height: 1.15; font-variant-numeric: tabular-nums; }
#clock-time { color: var(--paper); font-weight: 200; font-size: 20px; letter-spacing: .02em; }
.clock-sub { font-size: 10px; letter-spacing: .25em; text-transform: uppercase; color: var(--mist-60); font-weight: 400; }
.pill {
  font: 500 13px/1 var(--sans); text-decoration: none; color: var(--paper);
  padding: 10px 14px; border: 1px solid var(--mist-35); border-radius: 999px;
  transition: background .45s var(--ease), border-color .45s var(--ease);
}
.pill:hover { background: var(--veil-06); border-color: var(--mist-60); }

/* ── Layout ──────────────────────────────────────────────────────────────────────────── */
main { position: relative; }
section { padding: 0 var(--gutter); }
.chapter {
  max-width: var(--max); margin: 0 auto; min-height: 92vh;
  display: grid; align-items: center; gap: clamp(32px, 6vw, 80px);
  padding-top: 14vh; padding-bottom: 14vh;
}
@media (min-width: 900px) { .chapter:not(.sky-chapter):not(.breathe):not(.beta) { grid-template-columns: 1fr 1.1fr; } }
.copy { max-width: 34rem; }
.copy.center { margin: 0 auto; text-align: center; }
.eyebrow { margin: 0 0 18px; font: 400 12px/1.4 var(--sans); letter-spacing: .25em; text-transform: uppercase; color: var(--mist-60); }
h1 { font-size: clamp(44px, 9vw, 104px); line-height: 1.02; }
h2 { font-size: clamp(32px, 5.4vw, 60px); line-height: 1.08; margin-bottom: 22px; }
h3 { font-size: 22px; font-weight: 300; margin-bottom: 8px; }
p { margin: 0 0 16px; }
.lead { font-size: clamp(18px, 2.1vw, 21px); max-width: 34rem; color: var(--mist-82); }
.fine { font-size: 13px; color: var(--mist-60); }

/* ── Hero ────────────────────────────────────────────────────────────────────────────── */
.hero {
  min-height: 100svh; max-width: var(--max); margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: 18vh; padding-bottom: 12vh; position: relative;
}
.hero h1 { margin-bottom: 28px; max-width: 12ch; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; margin: 18px 0 40px; }
.button {
  appearance: none; border: 0; cursor: pointer;
  font: 500 15px/1 var(--sans); color: var(--ink); background: var(--paper);
  padding: 16px 24px; border-radius: 999px; text-decoration: none;
  transition: transform .45s var(--ease), opacity .45s var(--ease), background .45s var(--ease);
}
.button:hover { transform: translateY(-1px); }
.button[disabled] { opacity: .45; cursor: default; transform: none; }
.button.ghost { background: transparent; color: var(--paper); border: 1px solid var(--mist-35); }
.button.ghost:hover { background: var(--veil-06); }
.link {
  appearance: none; background: none; border: 0; cursor: pointer; padding: 6px 0;
  font: 400 15px/1 var(--sans); color: var(--mist-82); text-decoration: none;
  border-bottom: 1px solid var(--mist-35); transition: color .45s var(--ease), border-color .45s var(--ease);
}
.link:hover { color: var(--paper); border-color: var(--paper); }
.sky-note { font-size: 14px; color: var(--mist-60); max-width: 30rem; }
.scroll-cue { position: absolute; left: 50%; bottom: 4vh; width: 1px; height: 56px; background: var(--line-12); overflow: hidden; }
.scroll-cue span { position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--paper); animation: cue 2.8s var(--ease) infinite; }
@keyframes cue { to { top: 100%; } }

/* ── Nightstand ──────────────────────────────────────────────────────────────────────── */
.stand { margin: 0; }
.stand svg { width: 100%; height: auto; overflow: visible; }
.stand .line path { fill: none; stroke: var(--mist-60); stroke-width: 1; stroke-linecap: round; }
.stand .phone rect { fill: none; stroke: var(--paper); stroke-width: 1; }
.stand .phone .screen { fill: rgba(255, 255, 255, .05); stroke: none; animation: glow 5.6s var(--ease) infinite; }
.stand .cable { fill: none; stroke: var(--mist-35); stroke-width: 1; }
.stand .trace circle { fill: var(--paper); }
.stand .mark { fill: var(--mist-60); font: 300 14px var(--sans); opacity: 0; transition: opacity .9s var(--ease), fill .9s var(--ease); }
.stand .mark.on { opacity: 1; fill: var(--paper); }
@keyframes glow { 50% { fill: rgba(255, 255, 255, .16); } }

/* ── The app in an iPhone (frame in CSS) ─────────────────────────────────────────────── */
.app .copy { align-self: center; }
.screen-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.screen-tabs button {
  appearance: none; cursor: pointer; font: 400 14px/1 var(--sans); color: var(--mist-60);
  background: transparent; padding: 9px 14px; border: 1px solid var(--line-12); border-radius: 999px;
  transition: color .45s var(--ease), border-color .45s var(--ease), background .45s var(--ease);
}
.screen-tabs button:hover { color: var(--paper); border-color: var(--mist-35); }
.screen-tabs button[aria-selected="true"] { color: var(--ink); background: var(--paper); border-color: var(--paper); }
.iphone { margin: 0; justify-self: center; width: min(74vw, 310px); }
.iphone-screen {
  position: relative; aspect-ratio: 780 / 1688; overflow: hidden; container-type: inline-size;
  border-radius: 13% / 6%; background: #05070c;
  box-shadow: 0 0 0 9px #0a0a0c, 0 0 0 10px rgba(255, 255, 255, .16), 0 40px 120px rgba(0, 0, 0, .55);
}
.iphone-screen img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; visibility: hidden; transition: opacity .9s var(--ease), visibility .9s; }
.iphone-screen img.is-on { opacity: 1; visibility: visible; }
.iphone-status {
  position: absolute; inset: 0 0 auto 0; height: 5.6%; padding: 0 8% 0 11%;
  display: flex; align-items: center; justify-content: space-between;
  font: 500 4.1cqw/1 var(--sans); color: var(--paper); font-variant-numeric: tabular-nums;
}
.iphone-status i { position: relative; width: 6.6cqw; height: 3.1cqw; border: 1px solid rgba(255, 255, 255, .5); border-radius: 1cqw; }
.iphone-status i::after { content: ""; position: absolute; inset: 1px 30% 1px 1px; background: var(--paper); border-radius: .6cqw; }
.iphone-island { position: absolute; top: 2.6%; left: 34%; width: 32%; height: 3.6%; border-radius: 999px; background: #000; }
.iphone figcaption { margin-top: 26px; text-align: center; }

/* ── Hypnogram ───────────────────────────────────────────────────────────────────────── */
.hypno { padding: clamp(18px, 3vw, 32px); border: 1px solid var(--line-12); border-radius: 24px; background: var(--surface); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.hypno svg { width: 100%; height: auto; overflow: visible; }
.hypno .grid line { stroke: var(--line-12); stroke-width: 1; }
.hypno .labels text, .hypno .hours text { fill: var(--mist-60); font: 400 12px var(--sans); }
.hypno-line { fill: none; stroke: var(--paper); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.result { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 18px 0 6px; color: var(--mist-60); opacity: 0; transform: translateY(6px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.result.on { opacity: 1; transform: none; }
.result b { color: var(--paper); font-weight: 300; font-variant-numeric: tabular-nums; }

/* ── Sky chapter ─────────────────────────────────────────────────────────────────────── */
.sky-chapter { min-height: 110vh; }

/* ── Breathe ─────────────────────────────────────────────────────────────────────────── */
.breathe { justify-items: center; }
.breath { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.orb { position: relative; width: min(64vw, 260px); aspect-ratio: 1; display: grid; place-items: center; }
.orb { width: min(80vw, 340px); }
.orb .halo {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  -webkit-mask-image: radial-gradient(circle, #000 52%, transparent 70%); mask-image: radial-gradient(circle, #000 52%, transparent 70%);
}
.orb .halo canvas { width: 100% !important; height: 100% !important; filter: grayscale(1) brightness(1.05) blur(.6px) drop-shadow(0 0 26px rgba(160, 195, 255, .4)); opacity: .82; }
.orb .ring { position: absolute; inset: 14%; border-radius: 50%; border: 1px solid var(--mist-35); opacity: .5; }
.no-halo .orb .halo { background: radial-gradient(circle, rgba(255, 255, 255, .85), rgba(190, 215, 255, .25) 38%, transparent 62%); }
.breath-word { min-height: 1.6em; margin: 0; font: 200 26px/1.3 var(--sans); color: var(--paper); text-align: center; }

/* ── Promises ────────────────────────────────────────────────────────────────────────── */
.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.promises li { padding: 24px; border: 1px solid var(--line-12); border-radius: 20px; background: var(--surface); }
.promises p { margin: 0; color: var(--mist-60); }

/* ── Survey ──────────────────────────────────────────────────────────────────────────── */
.beta { justify-items: center; }
.beta .copy h2, .beta .copy p { text-shadow: 0 1px 24px rgba(4, 22, 52, .45); }
.beta .eyebrow { color: var(--mist-82); }
.survey {
  width: 100%; max-width: 560px; position: relative;
  padding: clamp(22px, 4vw, 36px); border: 1px solid rgba(255, 255, 255, .22); border-radius: 28px;
  background: rgba(10, 34, 72, .62); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(5, 20, 50, .25);
}
.progress { height: 1px; background: var(--line-12); margin-bottom: 26px; }
.progress span { display: block; height: 100%; width: 0; background: var(--paper); transition: width .6s var(--ease); }
.step { border: 0; margin: 0; padding: 0; min-width: 0; display: none; }
.step.is-active { display: block; animation: rise .6s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
legend { padding: 0; margin-bottom: 18px; color: var(--paper); font: 200 clamp(24px, 3.6vw, 30px)/1.2 var(--sans); }
.hint { font-size: 14px; color: var(--mist-60); margin: -8px 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips label { position: relative; cursor: pointer; }
.chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chips span {
  display: inline-block; padding: 11px 16px; border-radius: 999px; font-size: 15px; color: var(--mist-82);
  border: 1px solid var(--mist-35); transition: background .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease);
}
.chips label:hover span { border-color: var(--mist-60); }
.chips input:checked + span { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.chips input:focus-visible + span { outline: 1px solid var(--paper); outline-offset: 3px; }
.field { display: block; margin-top: 16px; }
.field input {
  width: 100%; font: 300 17px/1.3 var(--sans); color: var(--paper);
  background: transparent; border: 0; border-bottom: 1px solid var(--mist-35); padding: 12px 2px; border-radius: 0;
}
.field input::placeholder { color: var(--mist-35); }
.field input:focus { outline: none; border-color: var(--paper); }
.consent { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; font-size: 14px; color: var(--mist-60); cursor: pointer; }
.consent input { flex: none; appearance: none; width: 20px; height: 20px; margin: 2px 0 0; border: 1px solid var(--mist-60); border-radius: 6px; display: grid; place-items: center; cursor: pointer; }
.consent input:checked { background: var(--paper); border-color: var(--paper); }
.consent input:checked::after { content: ""; width: 9px; height: 5px; border: 1.5px solid var(--ink); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.consent a { color: var(--paper); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.nav { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; }
.nav .link[hidden] { visibility: hidden; display: inline-block !important; } /* !important: the artifact viewer hides [hidden] with !important */
.form-error { min-height: 1.4em; margin: 16px 0 0; font-size: 14px; color: var(--paper); }
.done { text-align: center; padding: 10px 0; }
.done-mark { font: 400 44px/1 var(--serif); color: var(--paper); margin-bottom: 14px; }
.done h3 { font-size: 28px; font-weight: 200; }
.done p { color: var(--mist-82); }

/* ── Footer ──────────────────────────────────────────────────────────────────────────── */
.foot { max-width: 640px; margin: 0 auto; padding: 12vh var(--gutter) max(48px, env(safe-area-inset-bottom)); text-align: center; color: var(--mist-82); font-size: 14px; }
.foot img { margin: 0 auto 18px; }
.foot nav { margin: 10px 0 14px; }
.foot a { color: var(--paper); }

/* ── Phone ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .clock { display: none; }
  .hero { padding-top: 38svh; justify-content: flex-start; }
  .chapter { min-height: 0; padding-top: 12vh; padding-bottom: 12vh; }
  .sky-chapter { min-height: 80vh; }
  .stand .mark { font-size: 17px; }
  .hypno .labels text, .hypno .hours text { font-size: 15px; }
}

/* ── Calm motion for those who ask for it ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
  .scroll-cue { display: none; }
  .iphone-screen img { transition: none; }
}
