/* ============================================================
   page.css — the one-poster page.
   Joi's formula in Mental's design code: one sentence, one lit
   object (the real app, on film), one button. All animation is
   transform/opacity/filter. No SVG blur filters anywhere.
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  /* iOS: body-level clip alone does not stop sideways touch panning */
  overflow-x: clip;
  /* iOS: don't let Safari's text autosizing inflate past our clamp()s */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip; /* not `hidden` — that would break position:sticky */
}

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

a { color: inherit; text-decoration: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Entrance: tiny staggered fades, then stillness ---------- */
.enter {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s var(--ease-soft), transform 0.9s var(--ease-soft);
}
.enter.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .enter { transition: opacity 0.3s ease; transform: none; }
  .h1-orb { animation: none !important; }
}

/* ---------- Nav — liquid muted glass, reveals on scroll-up ---------- */
.nav {
  position: sticky;
  top: 14px;
  z-index: 40;
  width: min(92%, 720px);
  margin: 14px auto 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px;
  padding: 12px 12px 12px 20px;
  border-radius: var(--r-pill);
  background: rgba(16, 16, 18, 0.55);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),   /* glass top light  */
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),        /* glass under-edge */
    0 12px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0.45s var(--ease-soft), opacity 0.45s var(--ease-soft);
}
.nav.tucked {
  transform: translateY(-160%);
  opacity: 0;
  pointer-events: none;
}
.nav .brand { display: flex; align-items: center; gap: 5px; flex: none; }
.nav .brand-mark {
  width: 28px; height: 29px;
  display: block;
}
.nav .brand-name {
  color: var(--text-2);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.2px;
}
.nav .links { display: flex; gap: 30px; margin-left: auto; }
.nav .links a {
  color: var(--text-2);
  font-size: var(--t-nav);
  transition: color 0.25s ease;
}
.nav .links a:hover { color: var(--text); }
/* mobile: logo + pill only — the links live in the footer anyway */
@media (max-width: 640px) {
  .nav { gap: 12px; padding: 8px 8px 8px 16px; }
  .nav .links { display: none; }
}

/* The one pill — Liquid Glass button: white, dark label (#1A1A1A) */
.pill {
  display: inline-flex; align-items: center; gap: 10px;
  white-space: nowrap;
  background: #fff;
  color: var(--btn-label);
  font-size: 19px; font-weight: 700;
  line-height: 1;
  padding: 18px 32px;
  border-radius: var(--r-pill);
  transition: transform 0.3s var(--ease-soft), background 0.3s ease;
}
.pill:hover { transform: scale(1.02); background: #ececec; }
.pill:active { transform: scale(0.97); }
.pill svg { display: block; width: 16px; height: 19px; }
/* the nav pill keeps its compact size (unchanged paddings) */
.nav .pill { font-size: 16px; padding: 13px 22px; gap: 8px; }
.nav .pill svg { width: 13px; height: 16px; }
/* very narrow (SE zoom modes, Slide Over, page-zoom): mark only, compact pill */
@media (max-width: 379px) {
  .nav .brand-name { display: none; }
  .nav .pill { font-size: 14px; padding: 11px 16px; }
  .nav .pill svg { width: 12px; height: 14px; }
}

/* ---------- Poster ---------- */
.poster {
  text-align: center;
  padding: clamp(64px, 10vh, 128px) var(--s-screen-pad) 0;
}
.overline {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
h1 {
  max-width: 13ch;
  margin: 20px auto 0;
  font-size: var(--t-display);
  font-weight: 600;                 /* Joi's 599 — between semibold and bold */
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--text);
}
/* The inline orb — Mental's pictogram, set into the type; the neutral
   sphere (AppColors.sphereNeutral): pure white core, white halo. */
.h1-orb {
  display: inline-block;
  width: 0.62em; height: 0.62em;
  border-radius: 50%;
  background: #fff;
  vertical-align: baseline;
  margin: 0 0.04em 0 0.02em;
  transform: translateY(0.06em);
  box-shadow: 0 0 0.02em #fff, 0 0 0.05em #fff, 0 0 0.16em #fff,
              0 0 0.32em rgba(255, 255, 255, 0.6),
              0 0 0.55em rgba(255, 255, 255, 0.35),
              0 0 0.96em rgba(255, 255, 255, 0.2);
  animation: orbbreathe 6s ease-in-out infinite;
}
@keyframes orbbreathe {
  0%, 100% { transform: translateY(0.06em) scale(0.97); }
  50% { transform: translateY(0.06em) scale(1.04); }
}

.cta-row { margin-top: clamp(72px, 12vh, 130px); }
.cta-note {
  color: var(--text-3);
  font-size: var(--t-micro);
  margin-top: 12px;
}

/* ---------- The tableau — the real app, scrubbed by scroll ---------- */
/* JS adds .scrub when motion is allowed: the section grows tall and the
   stage pins while scroll drives the film. Fallback: static, plays on tap. */
.tableau {
  position: relative;
  padding: clamp(110px, 18vh, 220px) 20px 0;
}
.tableau .stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
}
/* pin length keeps the approved pacing; end-frame rest halved */
.tableau.scrub {
  height: 360vh;
  padding: 0 20px;
  margin-top: clamp(110px, 18vh, 220px); /* hero → phone breathing room */
}
.tableau.scrub .stage {
  position: sticky;
  top: 0;
  height: 100svh;
}

/* iPhone 17 Pro — Apple's official product bezel (used as is), the video
   sits in the measured glass cutout: 1206×2622 inside a 1350×2760 frame
   → insets 5.333% (x) / 2.5% (y). The opaque island in the art lands
   exactly over the island in the recording. */
.device {
  position: relative;
  /* the original filter created a stacking context; without one the manifesto
     paints through the phone — keep the device above following sections */
  z-index: 1;
  /* fits width AND the pinned 100svh stage */
  width: min(440px, 90vw, calc((100svh - 48px) * 1350 / 2760));
  max-width: 100%; /* never bleed into the stage gutter (tall-narrow viewports) */
  aspect-ratio: 1350 / 2760;
  -webkit-tap-highlight-color: transparent;
}
/* Device shadows, split by platform budget: desktop affords the true
   drop-shadow contour; iOS Safari CLIPS large filtered layers (bezel at 3×
   DPR + 80px shadow radii exceeds its filter region — the "phone cut in
   places" bug), so phones get a cheap box-shadow on the rounded outline. */
@media (min-width: 521px) {
  .device {
    filter:
      drop-shadow(0 0 70px rgba(255, 255, 255, 0.05))   /* screen light spill */
      drop-shadow(0 30px 80px rgba(0, 0, 0, 0.85));
  }
}
@media (max-width: 520px) {
  .device {
    border-radius: 14% / 6.9%; /* ≈ the bezel corner; only the shadow sees it */
    box-shadow:
      0 0 70px rgba(255, 255, 255, 0.05),
      0 30px 80px rgba(0, 0, 0, 0.85);
  }
}
.device:focus-visible {
  outline: 1.5px solid rgba(255, 255, 255, 0.6);
  outline-offset: 4px;
}
.device video,
.device .film {
  position: absolute;
  left: 5.333%;
  top: 2.5%;
  /* replaced elements keep intrinsic size with auto — size explicitly */
  width: 89.334%;   /* 100 − 2×5.333 */
  height: 95%;      /* 100 − 2×2.5   */
  object-fit: cover;
  display: block;
  background: #000;
}
/* the WebCodecs canvas (js/scrubber.js) — hidden until its first real frame,
   the <video> poster covers the load */
.device .film { display: none; }
.device .film.on { display: block; }
.device .bezel {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.device { cursor: default; }
.tableau:not(.scrub) .device { cursor: pointer; } /* tap-to-play fallback */

/* ---------- Manifesto — three statements, one stage, blur-swap ---------- */
/* JS adds .scrub when motion is allowed; without it, statements stack. */
.manifesto { padding: clamp(96px, 14vh, 160px) var(--s-screen-pad); }
.manifesto .stage { max-width: 780px; margin: 0 auto; }
.statement {
  font-size: clamp(28px, 4.2vw, 52px);
  font-weight: 550;
  letter-spacing: -0.015em;
  line-height: 1.28;
  color: var(--text);
}
.statement + .statement { margin-top: var(--s-checkin); }
.statement .dim { color: var(--text-2); }

.manifesto.scrub { height: 340vh; padding: 0 var(--s-screen-pad); }
.manifesto.scrub .stage {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  align-items: center;
}
.manifesto.scrub .statement {
  grid-area: 1 / 1;                 /* all three share the stage */
  margin: 0;
  opacity: 0;
  filter: blur(14px);
  transform: translateY(14px);
  will-change: opacity, filter, transform;
}

/* ---------- Closer — the identical pill, centered in its own room ---------- */
.closer {
  min-height: 46svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 var(--s-screen-pad);
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 0 var(--s-screen-pad) 72px;
}
footer .wordmark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.2px;
  color: var(--text);
}
footer .wordmark-mark { width: 34px; height: 35px; display: block; }
footer nav {
  display: flex; flex-wrap: wrap; gap: 10px 26px;
  justify-content: center;
  margin-top: 28px;
}
footer nav a { color: var(--text-2); font-size: 14px; transition: color 0.25s ease; }
footer nav a:hover { color: var(--text); }
.signoff {
  margin-top: 36px;
  color: var(--text-3);
  font-size: var(--t-micro);
}
