/* Melda landing v4. Values from docs/HANDOFF.md; tokens from docs/fig-tokens.css.
   Two grounds: the film and download are dark (#0B0918), the app section is
   light (#FFF7F7). Hover accent #FF6565 on both. System stack: the app uses SF Pro. */

:root {
  --sc-canvas: #0B0918;
  --sc-surface: #16132A;
  --sc-ink: #FFF7F7;
  --sc-ink-soft: rgba(255, 247, 247, .7);
  --sc-accent: #FF6565;
  --sc-accent-ink: #331414;
  --sc-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Helvetica Neue", sans-serif;
  --sc-font-text: var(--sc-font-display);
  --sc-r-lg: 24px; --sc-r-pill: 1000px;
  --sc-shadow-color: 250 45% 6%;

  --gutter: clamp(20px, 6vw, 96px);
  --dark: #0B0918;
  --light: #FFF7F7;
  --ink-light: #331414;
}

html { scroll-behavior: smooth; }
body {
  background: var(--dark);
  color: var(--sc-ink);
  font-family: var(--sc-font-display);
  letter-spacing: 0;
  line-height: 1.45;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--sc-accent); }
::selection { background: var(--sc-accent); color: #fff; }
:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 3px; }

/* ------------------------------------------------------------------ nav */
.nav-scrim {
  position: fixed; inset: 0 0 auto 0; height: 150px; z-index: 49; pointer-events: none;
  background: linear-gradient(180deg, rgba(11,9,24,.55) 0%, rgba(11,9,24,.28) 45%, rgba(11,9,24,0) 100%);
}
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 56px);
  color: #FFF7F7;
  text-shadow: 0 1px 2px rgba(11,9,24,.45), 0 2px 14px rgba(11,9,24,.35);
  pointer-events: none;
}
.nav a { pointer-events: auto; }
.nav__mark { font-weight: 700; font-size: clamp(20px, 1.6vw, 24px); letter-spacing: -.03em; }
.nav__cta { font-size: clamp(13px, 1.05vw, 15px); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

/* ----------------------------------------------------------------- film */
.film { position: relative; height: calc(780vh + 100vh); background: var(--dark); }  /* the extra viewport holds the last frame while #download slides over it */
.film__stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: clip;
  background: var(--dark);
  isolation: isolate;
}
.film__media { position: absolute; inset: 0; }
.film__poster, .film__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.film__poster { object-fit: cover; object-position: 60% 50%; transition: opacity .6s ease; }
.film__canvas { opacity: 0; transition: opacity .6s ease; }
.film.is-painted .film__canvas { opacity: 1; }
.film.is-painted .film__poster { opacity: 0; }
.film__vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(11,9,24,.35) 0%, rgba(11,9,24,0) 30%, rgba(11,9,24,0) 60%, rgba(11,9,24,.6) 100%);
}

/* scrims: density only under the copy column; opacity follows the copy */
.scrim { position: absolute; inset: 0; pointer-events: none; opacity: 0; will-change: opacity; }
.scrim--lead  { background: radial-gradient(ellipse 60% 78% at 20% 50%, rgba(11,9,24,.5) 0%, rgba(11,9,24,.38) 30%, rgba(11,9,24,.18) 60%, rgba(11,9,24,.05) 85%, rgba(11,9,24,0) 100%); }
.scrim--trail { background: radial-gradient(ellipse 60% 78% at 80% 50%, rgba(11,9,24,.5) 0%, rgba(11,9,24,.38) 30%, rgba(11,9,24,.18) 60%, rgba(11,9,24,.05) 85%, rgba(11,9,24,0) 100%); }
.scrim--centre { background: radial-gradient(ellipse 70% 66% at 50% 46%, rgba(11,9,24,.5) 0%, rgba(11,9,24,.36) 35%, rgba(11,9,24,.14) 68%, rgba(11,9,24,0) 100%); }
@media (max-width: 700px) {
  .scrim--lead, .scrim--trail { background: linear-gradient(180deg, rgba(11,9,24,0) 22%, rgba(11,9,24,.18) 40%, rgba(11,9,24,.5) 62%, rgba(11,9,24,.72) 100%); }
  .scrim--centre { background: linear-gradient(180deg, rgba(11,9,24,.4) 0%, rgba(11,9,24,.6) 40%, rgba(11,9,24,.4) 100%); }
}

/* copy layers: film.js writes opacity and transform every frame it changes.
   No CSS transition on those two: the playhead is already lerped. */
.copy {
  position: absolute; pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}
.copy--title {
  inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 0 var(--gutter);
}
.copy--cap {
  top: 50%; left: 0; right: 0;
  translate: 0 -50%;
  padding: 0 var(--gutter);
  display: flex;
}
.copy--lead { justify-content: flex-start; }
.copy--trail { justify-content: flex-end; }
.cap { max-width: min(44vw, 560px); }
.cap--title { max-width: min(54vw, 680px); }
.copy--title-trail { align-items: flex-end; }
.copy--title-trail .cap--title { max-width: min(46vw, 620px); }
.cap--close { max-width: none; display: flex; flex-direction: column; align-items: center; }
.copy--msg {
  right: var(--gutter); top: 50%; translate: 0 -50%;
  max-width: 360px;
}
.copy--close {
  inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 0 24px;
}
.copy--close .film__actions { pointer-events: auto; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: #FFF7F7; background: rgba(11,9,24,.45);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: 7px 12px; border-radius: var(--sc-r-pill); margin-bottom: 18px;
}
.pill__dot { width: 8px; height: 8px; border-radius: 50%; display: block; }

.film__h1 {
  text-shadow: 0 2px 28px rgba(11,9,24,.55), 0 1px 3px rgba(11,9,24,.25);
  margin: 0; font-size: clamp(48px, 8vw, 128px); line-height: .92; letter-spacing: -.045em; font-weight: 700;
  text-wrap: balance; max-width: 12ch;
}
.film__lede {
  text-shadow: 0 1px 14px rgba(11,9,24,.6), 0 1px 2px rgba(11,9,24,.3);
  margin: 24px 0 0; font-size: clamp(17px, 1.5vw, 22px); line-height: 1.4;
  color: rgba(255,247,247,.8); max-width: 36ch; text-wrap: pretty;
}
.film__h2 {
  text-shadow: 0 2px 28px rgba(11,9,24,.55), 0 1px 3px rgba(11,9,24,.25);
  margin: 0; font-size: clamp(36px, 5.6vw, 88px); line-height: .94; letter-spacing: -.04em; font-weight: 700; text-wrap: balance;
}
.film__h2--close { font-size: clamp(40px, 6.5vw, 104px); letter-spacing: -.045em; max-width: 16ch; }
.film__body {
  text-shadow: 0 1px 14px rgba(11,9,24,.6), 0 1px 2px rgba(11,9,24,.3);
  margin: 18px 0 0; font-size: clamp(16px, 1.35vw, 20px); line-height: 1.45;
  color: rgba(255,247,247,.8); max-width: 38ch; text-wrap: pretty;
}
.film__actions { display: flex; gap: 10px; margin-top: 34px; flex-wrap: wrap; justify-content: center; }

.msg { display: flex; align-items: flex-end; gap: 10px; }
.msg__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: top; background: #FBEFD0; flex: none; }
.msg__bubble {
  margin: 0; background: #FFF7F7; color: var(--ink-light);
  padding: 13px 17px; border-radius: 24px 24px 24px 6px;
  font-size: 16px; line-height: 1.4; letter-spacing: -.3px;
  box-shadow: 0 8px 14px rgba(42,42,42,.2);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; padding: 14px 22px; border-radius: var(--sc-r-pill);
  white-space: nowrap; transition: transform 160ms var(--sc-ease-out), background-color 160ms, border-color 160ms;
}
.btn:active { transform: translateY(1px); }
.btn--fill { background: #FFF7F7; color: var(--ink-light); }
.btn--fill:hover { color: var(--ink-light); background: #fff; }
.btn--line { border: 1px solid rgba(255,247,247,.4); color: #FFF7F7; }
.btn--line:hover { color: #FFF7F7; border-color: rgba(255,247,247,.8); }

/* HUD */
.hud { position: absolute; z-index: 3; }
.hud--day {
  opacity: 0; will-change: opacity;
  left: var(--gutter); bottom: 28px;
  display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums;
}
.hud__label, .hud__of { font-size: 12px; color: rgba(255,247,247,.6); }
.hud__label { font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.hud__num { font-size: clamp(28px, 3vw, 44px); line-height: 1; font-weight: 700; letter-spacing: -.04em; min-width: 1.2em; }
.hud--beats { right: var(--gutter); bottom: 24px; display: flex; gap: 2px; align-items: center; }
.hud__bar {
  appearance: none; border: 0; margin: 0; cursor: pointer;
  padding: 8px 2px; background: transparent; /* 18px tap target around a 2px bar */
  width: 14px; transition: width .4s var(--sc-ease-out);
}
.hud__bar::before {
  content: ""; display: block; height: 2px; border-radius: 1px; background: #FFF7F7;
  opacity: .35; transition: opacity .4s;
}
.hud__bar.is-active { width: 32px; }
.hud__bar.is-active::before { opacity: 1; }
.hud__bar:focus-visible { outline-offset: 0; border-radius: 4px; }

/* phones: captions full width, anchored above the HUD */
@media (max-width: 700px) {
  .copy--cap { top: auto; bottom: 96px; translate: none; }
  .cap { max-width: 100%; }
  .cap--title, .copy--title-trail .cap--title { max-width: 100%; }
  .copy--title, .copy--title-trail { justify-content: flex-end; align-items: flex-start; padding-bottom: 96px; }
  /* the message sits above the copy on phones, never on top of it */
  .copy--msg { top: 104px; bottom: auto; translate: none; left: var(--gutter); right: var(--gutter); max-width: none; }
  .msg__bubble { font-size: 15px; }
  .film__h1 { font-size: clamp(44px, 13vw, 64px); }
  .film__h2 { font-size: clamp(34px, 10vw, 48px); }
  .film__h2--close { font-size: clamp(36px, 10.5vw, 52px); }
  .film__actions { flex-direction: column; align-items: center; }
}

/* ------------------------------------------------------------- download */
/* Slides up over the pinned night scene: negative top margin pulls it into the
   film's extra viewport, the gradient lets the scene show through at first. */
.dl {
  position: relative; z-index: 2;
  margin-top: -100vh; margin-top: -100svh;
  min-height: 100vh; min-height: 100svh;
  padding: clamp(160px, 26vh, 320px) var(--gutter) clamp(96px, 12vw, 180px);
  background: linear-gradient(180deg, rgba(11,9,24,0) 0%, rgba(11,9,24,.3) 26%, rgba(11,9,24,.8) 56%, var(--dark) 80%);
}
.dl__wrap {
  max-width: 820px; margin: 0 auto; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.dl__icon { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 32px; box-shadow: var(--sc-e2); }
.dl__h2 { margin: 0; font-size: clamp(44px, 7vw, 120px); line-height: .9; letter-spacing: -.05em; font-weight: 700; text-wrap: balance; }
.dl__p { margin: 22px 0 32px; font-size: 18px; line-height: 1.45; color: rgba(255,247,247,.7); max-width: 36ch; }
.dl__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.dl__actions .btn { padding: 15px 22px; }

/* The App Store badge: Apple's layout (black, hairline border, logo, two-line label). */
.appstore {
  display: inline-flex; align-items: center; gap: 10px;
  height: 60px; padding: 0 18px 0 14px;
  background: #000; color: #fff;
  border: 1px solid #A6A6A6; border-radius: 10px;
  text-decoration: none; line-height: 1;
  transition: transform 160ms var(--sc-ease-out), border-color 160ms;
}
.appstore:hover { color: #fff; border-color: #d0d0d0; }
.appstore:active { transform: translateY(1px); }
.appstore__logo { width: 30px; height: 30px; flex: none; }
.appstore__text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.appstore__small { font-size: 12px; font-weight: 400; letter-spacing: 0; }
.appstore__big { font-size: 25px; font-weight: 500; letter-spacing: -.01em; margin-top: -2px; }
.dl__top {
  display: inline-block; margin-top: 44px;
  font-size: 13px; font-weight: 500; letter-spacing: .02em;
  color: rgba(255,247,247,.45);
  text-decoration: underline; text-underline-offset: 5px; text-decoration-color: rgba(255,247,247,.25);
  transition: color 160ms, text-decoration-color 160ms;
}
.dl__top:hover { color: rgba(255,247,247,.85); text-decoration-color: rgba(255,247,247,.6); }

/* --------------------------------------------------------------- footer */
.foot {
  position: relative; z-index: 2; background: var(--dark); color: rgba(255,247,247,.6);
  border-top: 1px solid rgba(255,247,247,.12);
  padding: clamp(40px, 6vw, 72px) var(--gutter) 28px;
}
.foot__wrap {
  max-width: 1240px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap;
}
.foot__mark { font-weight: 700; font-size: clamp(20px, 1.6vw, 24px); letter-spacing: -.03em; color: #FFF7F7; }
.foot__line { margin: 10px 0 0; font-size: 15px; line-height: 1.45; color: rgba(255,247,247,.6); max-width: 32ch; }
.foot__links { display: flex; gap: clamp(18px, 2.4vw, 32px); font-size: 14px; font-weight: 500; }
.foot__links a { color: rgba(255,247,247,.7); }
.foot__links a:hover { color: #FFF7F7; }
.foot__copy {
  max-width: 1240px; margin: clamp(28px, 4vw, 48px) auto 0; padding-top: 20px;
  border-top: 1px solid rgba(255,247,247,.08);
  font-size: 12px; color: rgba(255,247,247,.4); letter-spacing: .01em;
}
@media (max-width: 700px) {
  .foot__wrap { flex-direction: column; align-items: flex-start; }
}

/* ---------------------------------------------------------------- legal */
.legal-body { background: var(--dark); }
.legal {
  max-width: 720px; margin: 0 auto;
  padding: clamp(120px, 16vh, 180px) var(--gutter) clamp(72px, 10vw, 120px);
  color: rgba(255,247,247,.82); font-size: 17px; line-height: 1.6;
}
.legal__title { margin: 0 0 40px; font-size: clamp(40px, 5.5vw, 72px); line-height: .96; letter-spacing: -.04em; font-weight: 700; color: #FFF7F7; }
.legal h2 { margin: 56px 0 14px; font-size: 26px; line-height: 1.15; letter-spacing: -.025em; font-weight: 700; color: #FFF7F7; }
.legal h3 { margin: 32px 0 10px; font-size: 19px; line-height: 1.25; letter-spacing: -.015em; font-weight: 600; color: #FFF7F7; }
.legal p { margin: 0 0 16px; text-wrap: pretty; }
.legal p:first-of-type { color: rgba(255,247,247,.55); font-size: 15px; }
.legal strong { color: #FFF7F7; font-weight: 600; }
.legal ul, .legal ol { margin: 0 0 18px; padding-left: 22px; }
.legal li { margin: 6px 0; }
.legal a { color: #FFF7F7; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,247,247,.35); }
.legal a:hover { color: var(--sc-accent); }
.legal-body .foot { margin-top: 0; }

/* ---------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .film__canvas, .film__poster, .hud__bar, .hud__bar::before, .btn { transition: none; }
}

/* The engine's worldflight rule hides [data-sc-copy] until it drives it. These
   blocks are driven by film.js through their parent, so restore them. */
.film [data-sc-copy] { opacity: 1; transform: none; transition: none; will-change: auto; }
