/* Tokens, type, controls, the nav, and the hero: copy beside a 3D desk scene. */
/* Archivo v25, self-hosted and preloaded in index.html. Trimmed to the axes the page uses (weight 400-800,
   width 100-125%) and to Latin-1 plus common punctuation; re-subset before adding other scripts. */
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 400 800; font-stretch: 100% 125%; font-display: swap;
  src: url(../fonts/archivo-v25-sub.woff2) format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2010-2027, U+2030-203A, U+20AC, U+2122, U+2212;
}
/* Inline SVG icons from the sprite in index.html; sized by the surrounding font-size like an icon font */
.ico { width: 1em; height: 1em; flex: none; fill: currentColor; }

@property --rx { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
@property --ry { syntax: "<angle>"; inherits: true; initial-value: 0deg; }

:root {
  --ground: #f3f3f1;      /* page */
  --tone: #e7e6e2;        /* second surface */
  --raised: #fbfbf9;      /* cards */
  --paper: #fbfaf7;       /* always light: drawings multiply onto it in both themes */
  --ink: #1f1c19;         /* graphite */
  --ink-soft: #5e5750;
  --line: rgba(31, 28, 25, .12);
  --dark: #24201c;
  --on-dark: #f3f3f1;
  --accent: #f07f23;      /* AR Draw orange, from the app icon */
  --accent-hover: #f58f3c;
  --accent-deep: #8f4410;
  --shadow: 32, 22, 12;   /* warm shadow tint, used as rgba(var(--shadow), a) */
  --glass: rgba(251, 251, 249, .72);

  --step-small: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --step-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-lead: clamp(1.125rem, 1.02rem + 0.5vw, 1.4rem);
  --step-head: clamp(2.1rem, 1.3rem + 3.4vw, 4.25rem);
  --step-display: clamp(2.6rem, 1.1rem + 5.6vw, 6rem);

  --margin: clamp(16px, 4vw, 56px);
  --max: 1320px;
  /* One shape system: surfaces 28px, inner media 18px, every control a pill. */
  --r-surface: 28px;
  --r-media: 18px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #14110f;
    --tone: #221e1a;
    --raised: #1b1815;
    --ink: #f1efea;
    --ink-soft: #b3aba2;
    --line: rgba(241, 239, 234, .12);
    --dark: #0d0b0a;
    --shadow: 0, 0, 0;
    --glass: rgba(27, 24, 21, .72);
    --accent-deep: #ffb27a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0; background: var(--ground); color: var(--ink); overflow-x: clip;
  font: 400 var(--step-body)/1.55 "Archivo", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .2em; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, ul, ol { margin: 0; }
h1, h2 { font-weight: 650; font-stretch: 112%; letter-spacing: -0.035em; line-height: 1; text-wrap: balance; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: #1f1c19; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* The one download button: an accent pill with the Apple mark in a dark disc and a one-line
   App Store label. A light sweep crosses it now and then. */
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: flex-start; gap: 12px;
  min-height: 54px; min-width: min(100%, 320px); padding: 0 28px 0 7px; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(180deg, #f8963f, #f07f23 55%, #e8711a); color: #1f1c19; text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -3px 0 rgba(143, 68, 16, .35),
    0 0 0 1px rgba(143, 68, 16, .25), 0 14px 32px -10px rgba(240, 127, 35, .75);
  transition: transform .35s var(--spring), box-shadow .35s var(--ease), filter .2s;
}
.btn__mark {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  background: #1f1c19; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform .45s var(--spring);
}
.btn__mark svg { width: 19px; height: 19px; margin-top: -2px; fill: #fff; } /* the Apple mark sits optically high */
.btn__label { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.005em; }
.btn__label b { font-weight: 800; font-stretch: 108%; }
.btn::after { /* light sweep */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%);
  transform: translateX(-120%); animation: sweep 4.5s var(--ease) infinite 1.5s;
}
@keyframes sweep { 0% { transform: translateX(-120%); } 30%, 100% { transform: translateX(120%); } }
.btn:hover {
  transform: translateY(-3px); filter: saturate(1.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -3px 0 rgba(143, 68, 16, .35),
    0 0 0 1px rgba(143, 68, 16, .25), 0 22px 40px -12px rgba(240, 127, 35, .9), 0 0 0 6px rgba(240, 127, 35, .18);
}
.btn:hover .btn__mark { transform: rotate(-10deg) scale(1.06); }
.btn:active { transform: translateY(1px) scale(.97); box-shadow: inset 0 2px 6px rgba(143, 68, 16, .4), 0 6px 14px -8px rgba(240, 127, 35, .7); }

/* Round icon button (shelf arrows) */
.round {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--raised); font-size: 18px;
  transition: transform .3s var(--spring), background-color .2s;
}
.round:hover { transform: translateY(-2px); }
.round:active { transform: scale(.92); }
.round:disabled { opacity: .35; cursor: default; transform: none; }

/* Range: solid track, round accent thumb (stage opacity). */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 44px; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--line); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 999px;
  background: var(--accent); border: 3px solid var(--raised); box-shadow: 0 2px 8px rgba(var(--shadow), .3);
  transition: transform .25s var(--spring);
}
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 999px; border: 3px solid var(--raised); background: var(--accent); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.2); }

/* ---- Nav: one floating glass pill, fixed so the chapter frames below can fill the screen ---- */
.nav {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 30; /* z scale: nav 30, dock 40 */
  width: min(var(--max), calc(100% - 2 * var(--margin))); overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 60px; padding: 0 10px 0 12px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 30px -18px rgba(var(--shadow), .5);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-stretch: 112%; text-decoration: none; font-size: 1.05rem; }
.wordmark img { border-radius: 10px; }
.nav__links { display: flex; gap: 4px; font-size: var(--step-small); }
.nav__links a { padding: 10px 14px; border-radius: 999px; text-decoration: none; transition: background-color .2s; }
.nav__links a:hover { background: var(--tone); }
.nav__chapter { display: none; align-items: baseline; gap: 8px; margin-right: auto; padding-left: 14px; border-left: 1px solid var(--line); font-size: var(--step-small); color: var(--ink-soft); }
.nav__chapter b { color: var(--accent); font-weight: 700; font-stretch: 112%; }
.nav__chapter.is-changing span, .nav__chapter.is-changing b { animation: chap-in .5s var(--ease); }
@keyframes chap-in { from { opacity: 0; transform: translateY(8px); } }
.nav__progress { position: absolute; left: 24px; right: 24px; bottom: 0; height: 2px; display: none; }
.nav__progress span { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.scrolly .nav__chapter { display: inline-flex; }
.scrolly .nav__progress { display: block; }


/* ---- Hero ---- */
.hero {
  width: min(var(--max), calc(100% - 2 * var(--margin))); margin: 0 auto;
  min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 7fr); align-items: center; gap: clamp(24px, 4vw, 64px);
  padding: 96px 0 clamp(24px, 4vw, 56px);
}
.hero__copy { display: grid; }
/* The lines swap in row 1, bottom-aligned; the download button holds row 2 for the whole chapter */
.beat { grid-area: 1 / 1; align-self: end; }
.hero__cta { grid-row: 2; margin-top: 32px; }
.beat--1 { display: grid; gap: 28px; justify-items: start; }
.beat--2, .beat--3 { display: none; }
.scrolly .beat--2, .scrolly .beat--3 { display: block; opacity: 0; visibility: hidden; }
.beat-line { font-size: clamp(2.2rem, 0.9rem + 3.6vw, 4.5rem); font-weight: 650; font-stretch: 112%; letter-spacing: -0.035em; line-height: 1.04; text-wrap: balance; max-width: 12ch; padding-bottom: .08em; }
.beat-line em { font-style: italic; color: var(--accent); }
.hero h1 { font-size: clamp(2.5rem, 0.9rem + 4.3vw, 5.25rem); line-height: 1.04; padding-bottom: .06em; }
.hero h1 em { font-style: italic; color: var(--accent); }
.lead { font-size: var(--step-lead); color: var(--ink-soft); max-width: 34ch; line-height: 1.45; }

/* Headline words flip up into place on load (hierarchy: the promise lands first). */
.kinetic { perspective: 600px; }
.kinetic .w { display: inline-block; transform-origin: 50% 100%; }
.js .kinetic .w { opacity: .25; transform: translateY(.4em) rotateX(-75deg); animation: word-in .9s var(--ease) forwards; }
.js .kinetic .w:nth-child(2) { animation-delay: .07s; }
.js .kinetic .w:nth-child(3) { animation-delay: .14s; }
.js .kinetic .w:nth-child(4) { animation-delay: .21s; }
.js .kinetic .w:nth-child(5) { animation-delay: .32s; }
@keyframes word-in { to { opacity: 1; transform: none; } }

/* ---- Stage: the desk in 3D. Tilt layers: scroll (outer) and pointer (inner, --rx/--ry from JS). ---- */
.stage { display: grid; gap: 14px; min-width: 0; }
.stage__viewport {
  position: relative; aspect-ratio: 5 / 4; perspective: 1400px; perspective-origin: 50% 30%;
}
.scene {
  position: absolute; inset: 0; transform-style: preserve-3d;
  /* --base-x / --base-z: the resting tilt, flattened by the scroll story; --rx / --ry: pointer */
  transform: rotateX(calc(var(--base-x, 18deg) + var(--rx))) rotateY(var(--ry)) rotateZ(var(--base-z, -4deg));
  transition: transform .8s var(--ease);
  animation: scene-in 1.4s var(--ease) backwards .15s;
}
.stage__viewport.is-tracking .scene, .scrolly .scene { transition-duration: .25s; }
@keyframes scene-in { from { opacity: 0; transform: rotateX(48deg) rotateZ(-14deg) translateY(40px) scale(.9); } }

.desk {
  position: absolute; inset: 0; border-radius: var(--r-surface); overflow: hidden; background: #b9a58a;
  transform-style: preserve-3d;
  box-shadow: 0 50px 80px -30px rgba(var(--shadow), .55), 0 12px 24px -12px rgba(var(--shadow), .35);
}
.stage__paper { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage__sheet {
  position: absolute; left: 50%; top: 47%; width: 62%; aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(-1.5deg);
  mix-blend-mode: multiply; /* the sheet is its own stacking context, so blend the whole group with the paper */
}
.stage__art { position: absolute; inset: 0; transition: transform .6s var(--spring); }
.stage__sheet img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  transition: opacity 1.2s ease, transform .9s var(--ease), filter .9s var(--ease);
}
/* --reveal: how much of the line drawing is traced (0-1); --fade: scroll fade on top of the visitor's slider (--user-op) */
.stage__pencil { opacity: .85; clip-path: inset(0 0 calc((1 - var(--reveal, 1)) * 100%) 0); }
.stage__picture { opacity: calc(var(--user-op, .45) * var(--fade, 1)); }
.scrolly .stage { --reveal: .35; }
.stage__edge {
  position: absolute; left: 4%; right: 4%; top: calc(var(--reveal, 1) * 100%); height: 3px; border-radius: 3px;
  background: #f07f23; opacity: var(--edge, 0); pointer-events: none;
}
.scrolly .stage { --edge: 1; }
.stage.is-swapping .stage__picture, .stage.is-swapping .stage__pencil {
  opacity: 0 !important; transform: scale(1.06); filter: blur(6px); transition-duration: .5s;
}

/* The phone's view: a glass frame floating above the sheet, with a scan line sweeping it. */
.lens {
  position: absolute; left: 31%; top: 6%; width: 38%; height: 86%;
  border-radius: 34px; border: 2px solid rgba(255, 255, 255, .8);
  background: linear-gradient(135deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .04) 45%, rgba(255, 255, 255, .14));
  box-shadow: inset 0 0 0 6px rgba(31, 28, 25, .55), 0 40px 60px -20px rgba(var(--shadow), .45);
  transform: translateZ(var(--lens-z, 120px)); overflow: hidden; pointer-events: none;
  animation: hover-z 6s ease-in-out infinite;
}
.lens__island { position: absolute; top: 14px; left: 50%; width: 30%; height: 14px; border-radius: 999px; background: rgba(31, 28, 25, .85); transform: translateX(-50%); }
.lens__scan {
  position: absolute; left: 6px; right: 6px; top: 0; height: 22%;
  background: linear-gradient(to bottom, transparent, rgba(240, 127, 35, .28) 85%, rgba(240, 127, 35, .9));
  animation: scan 3.6s var(--ease) infinite;
}
@keyframes scan { from { transform: translateY(-30%); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { transform: translateY(420%); opacity: 0; } }
@keyframes hover-z { 50% { translate: 0 -8px; } }

/* Other picture sets drifting at different depths around the desk. */
.floater {
  position: absolute; width: 22%; aspect-ratio: 1; object-fit: contain; padding: 8px;
  background: var(--paper); border-radius: var(--r-media);
  box-shadow: 0 24px 40px -18px rgba(var(--shadow), .5); pointer-events: none;
  animation: float 7s ease-in-out infinite;
}
/* --py: scroll parallax, larger for the nearer cards */
.floater--a { left: -6%; top: 8%; --z: 90px; transform: translateZ(var(--z)) translateY(var(--py, 0px)) rotate(-8deg); }
.floater--b { right: 1%; top: 38%; --z: 170px; transform: translateZ(var(--z)) translateY(var(--py, 0px)) rotate(7deg); animation-delay: -2.5s; width: 18%; }
.floater--c { left: 8%; bottom: -8%; --z: 60px; transform: translateZ(var(--z)) translateY(var(--py, 0px)) rotate(4deg); animation-delay: -4.5s; width: 17%; }
@keyframes float { 50% { translate: 0 -12px; } }

/* Toolbar under the scene: a glass pill with the app's own tools. */
.stage__bar {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 8px 10px 8px 22px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px -24px rgba(var(--shadow), .6); font-size: 15px;
}
.stage__name { font-weight: 650; min-width: 5.5em; }
.stage__tools { display: flex; gap: 6px; }
.stage__tools button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 0; border-radius: 999px; background: var(--tone);
  transition: background-color .2s, transform .3s var(--spring);
}
.stage__tools button .ico { font-size: 18px; }
.stage__tools button:hover { transform: translateY(-2px); }
.stage__tools button:active { transform: scale(.92); }
.stage__tools button[aria-pressed=true] { background: var(--accent); color: #1f1c19; }
.stage__opacity { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--ink-soft); }
.stage__opacity .ico { font-size: 20px; }
.stage__opacity input { width: clamp(110px, 12vw, 200px); }

/* ---- Entrances: parts rise in with a slight 3D tip. Visible without JS. ---- */
.js .reveal {
  opacity: 0; transform: perspective(800px) translateY(28px) rotateX(12deg);
  transition: opacity .8s var(--ease), transform .9s var(--ease);
}
.js .reveal.is-in { opacity: 1; transform: none; }
/* The hero is on screen at load: it rises in from CSS right away instead of waiting for the deferred scripts,
   and starts faintly visible (like the headline words) so the first frame already shows the text. */
.js .hero .reveal { animation: hero-rise .9s var(--ease) .15s both; }
@keyframes hero-rise { from { opacity: .25; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---- Dock: the download button pinned to the bottom on phones ---- */
.dock { display: none; }

@media (max-width: 900px) {
  .nav__links { display: none; }
  .hero { grid-template-columns: 1fr; align-content: center; gap: 22px; padding: 84px 0 24px; }
  .beat--1 { gap: 18px; }
  .hero h1 { font-size: clamp(2.3rem, 10.5vw, 4rem); }
  .lead { font-size: 1.0625rem; }
  /* one-column layouts: the download button is the dock pinned to the bottom, not a hero button */
  .hero__cta { display: none; }
  .dock { display: block; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40; }
  /* keep frame content clear of the dock (54px + 12px gap) */
  .hero { padding-bottom: 84px; }
  .dock .btn { width: 100%; justify-content: center; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -3px 0 rgba(143, 68, 16, .35), 0 0 0 1px rgba(143, 68, 16, .25), 0 18px 40px -12px rgba(var(--shadow), .6); }
  .beat-line { font-size: clamp(2.1rem, 9.5vw, 3.4rem); }
  .stage__viewport { aspect-ratio: 1 / .88; margin: 0 4%; }
  .lens { left: 28%; width: 44%; border-radius: 26px; }
  .floater--a { left: -6%; }
  .floater--b { right: -2%; }
}
@media (max-width: 640px) {
  .nav { height: 56px; }
  /* Toolbar in one row: icon tools and the slider, so the whole hero fits one phone screen */
  .stage__bar { min-height: 56px; padding: 6px 14px 6px 6px; gap: 8px; }
  .stage__name { display: none; }
  .stage__tools button { width: 44px; padding: 0; justify-content: center; }
  .stage__tools button span { display: none; }
  .stage__opacity { flex: 1; }
  .stage__opacity input { flex: 1; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js .reveal, .js .kinetic .w { opacity: 1; transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .nav, .stage__bar { background: var(--raised); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
