/*
 * Phones (and portrait tablets): the same film, stacked for a tall, narrow screen. The bold words sit at the
 * top, the device is the hero of the middle, the segmented control and the round's dots sit at the bottom.
 * Landscape phones ("compact") keep the desktop's side by side, with fewer words. Nothing here applies to
 * desktop: every rule is scoped to html[data-mode], which main.js and an inline script in index.html set
 * from the same media queries. The film's heights come from JS (--film-h: the large viewport, --film-sh: the
 * small one) so the browser's bar coming and going never moves anything.
 */
.chips { display: none; }

html[data-mode="phone"], html[data-mode="compact"] {
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html[data-mode="phone"] {
  --gut: clamp(16px, 4.2vw, 40px);
  --nav-h: calc(54px + var(--safe-t));
  /* the round's dots sit just above the small viewport's bottom edge, so they never move with the bar */
  --rail-top: calc(var(--film-sh, 100svh) - 52px - var(--safe-b));
}
html[data-mode="phone"] body, html[data-mode="compact"] body { -webkit-tap-highlight-color: transparent; }
html[data-mode="phone"] .stage, html[data-mode="compact"] .stage { bottom: auto; height: var(--film-h, 100lvh); }

/* ——— the nav: the studio's mark, the app, the session's clock, the App Store ——— */
html[data-mode="phone"] .nav {
  height: var(--nav-h); padding: var(--safe-t) calc(var(--gut) + var(--safe-r)) 0 calc(var(--gut) + var(--safe-l));
  grid-template-columns: 1fr auto 1fr; column-gap: 8px;
}
html[data-mode="phone"] .nav-l { gap: 11px; }
html[data-mode="phone"] .nav-mark { font-size: 0; gap: 0; opacity: 0.86; }
html[data-mode="phone"] .nav-logo { width: 18px; height: 18px; }
html[data-mode="phone"] .nav-app { padding-left: 11px; gap: 7px; font-size: 16.5px; }
html[data-mode="phone"] .nav-app img { width: 24px; height: 24px; border-radius: 6px; }
html[data-mode="phone"] .nav-clock { min-height: 32px; padding: 6px 11px 6px 8px; gap: 6px; font-size: 14.5px; }
html[data-mode="phone"] .nav-clock svg { width: 17px; height: 17px; }
html[data-mode="phone"] .nc-name { display: none; }
html[data-mode="phone"] .nc-time { min-width: 2.9em; opacity: 0.9; }
html[data-mode="phone"] .nav-get { border-radius: 7px; }
html[data-mode="phone"] .nav-get img { height: 32px; }

/* ——— the round along the bottom ——— */
html[data-mode="phone"] .rail { top: var(--rail-top); bottom: auto; padding: 4px 6px; gap: 2px; }
html[data-mode="phone"] .rail-dot { width: 34px; height: 40px; }
html[data-mode="phone"] .rail-tip { display: none; }

/* ——— a chapter's words: who it's for, the statement, two chips; the control at the bottom ——— */
html[data-mode="phone"] .ch {
  top: calc(var(--nav-h) + 8px); bottom: auto; left: calc(var(--gut) + var(--safe-l)); right: calc(var(--gut) + var(--safe-r)); width: auto;
  height: calc(var(--rail-top) - var(--nav-h) - 8px - 10px); display: block;
}
html[data-mode="phone"] .ch[data-side="right"] { left: calc(var(--gut) + var(--safe-l)); right: calc(var(--gut) + var(--safe-r)); }
html[data-mode="phone"] .ch-head { gap: 9px; }
html[data-mode="phone"] .ch-dot { width: 18px; height: 18px; box-shadow: inset 0 0 0 1.6px var(--acc); }
html[data-mode="phone"] .ch-dot.is-cup { box-shadow: none; }
html[data-mode="phone"] .ch-dot.is-cup svg { width: 100%; height: 100%; }
html[data-mode="phone"] .ch-head b { display: none; }
html[data-mode="phone"] .ch-head span { font-size: clamp(13.5px, 3.5vw, 19px); font-weight: 620; color: var(--ink-2); letter-spacing: -0.005em; }
html[data-mode="phone"] .ch-stmts { margin-top: clamp(8px, calc(var(--film-sh, 100svh) * 0.012), 14px); }
html[data-mode="phone"] .stmt h2 {
  font-size: clamp(30px, 8.6vw, 60px); font-stretch: 118%; line-height: 1; letter-spacing: -0.034em; margin-bottom: 0;
}
html[data-mode="phone"] .stmt h2 .w { padding: 0.05em 0 0.1em; margin: -0.05em 0 -0.1em; }
html[data-mode="phone"] .stmt ul { display: none; }

html[data-mode="phone"] .chips { display: block; position: relative; height: 32px; margin-top: clamp(10px, calc(var(--film-sh, 100svh) * 0.016), 16px); }
.chip { position: absolute; left: 0; top: 0; height: 100%; visibility: hidden; transform-origin: 0 50%; will-change: transform, opacity; overflow: hidden; border-radius: 999px; }
.chip-bg {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-radius: 999px;
  background: color-mix(in oklab, var(--acc) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--acc) 30%, transparent);
}
.words[data-tone="light"] .chip-bg { background: rgba(21, 18, 10, 0.085); box-shadow: inset 0 0 0 1px rgba(21, 18, 10, 0.12); }
.chip-in {
  position: absolute; left: 0; top: 0; height: 100%; display: inline-flex; align-items: center; gap: 6px; padding: 0 13px 0 9px;
  white-space: nowrap; font-size: 14px; font-weight: 660; letter-spacing: -0.005em; color: var(--ink); visibility: hidden;
}
.chip-ic { flex: none; width: 18px; height: 18px; display: grid; place-items: center; color: var(--acc-ink, var(--acc)); }
.chip-ic .i { width: 100%; height: 100%; }
.chip-st { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 3px color-mix(in oklab, var(--acc) 30%, transparent); }
.chip-st.is-now { background: #30d158; box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.3); }

html[data-mode="phone"] .seg {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: max-content;
  --sh: 38px; --sp: clamp(11px, 3vw, 20px); --segf: clamp(13px, 3.5vw, 17px);
}
html[data-mode="phone"] .ch-get { display: none; }

/* ——— the hero ——— */
html[data-mode="phone"] .hero-words { left: calc(var(--gut) + var(--safe-l)); right: calc(var(--gut) + var(--safe-r)); width: auto; top: calc(var(--nav-h) + 12px); }
html[data-mode="phone"] .hero-h1 { font-size: clamp(38px, 10.8vw, 76px); line-height: 0.95; letter-spacing: -0.04em; max-width: 11em; }
html[data-mode="phone"] .hero-sub { margin-top: 14px; font-size: clamp(15px, 4vw, 21px); line-height: 1.4; max-width: 24em; }
html[data-mode="phone"] .hero-sub .sub-more { display: none; }
html[data-mode="phone"] .hero-ex { position: absolute; left: 0; right: 0; margin-top: 0; font-size: clamp(14.5px, 3.9vw, 20px); gap: 3px; min-height: 0; }
html[data-mode="phone"] .hero-get {
  position: fixed; left: 0; right: 0; top: calc(var(--rail-top) - 22px); margin: 0; justify-content: center; gap: 12px;
}
html[data-mode="phone"] .hero-get .badge img { height: 46px; }
html[data-mode="phone"] .hero-cue { display: none; }

/* the devices (and what leaves their glass) fade out under the words and above the controls instead of
   passing behind them: main.js sets each layer's mask from where the words end, frame by frame */

/* the nav's badge waits for the hero's to fly up into it */
html[data-mode="phone"] .nav-get { opacity: 0; }
html[data-mode="phone"] .hero-get .badge { transform-origin: 0 0; will-change: transform; }

/* ——— the close: the badge back from the nav, and the footer ——— */
.close-get { display: none; }
html[data-mode="phone"] .close-get { display: block; position: fixed; left: 0; top: 0; z-index: 7; transform-origin: 0 0; visibility: hidden; will-change: transform; }
html[data-mode="phone"] .close-get img { height: 52px; width: auto; }
html[data-mode="phone"] .foot {
  top: calc(var(--film-sh, 100svh) - 104px - var(--safe-b)); bottom: auto; left: calc(var(--gut) + var(--safe-l)); right: calc(var(--gut) + var(--safe-r));
  flex-direction: column; justify-content: flex-start; gap: 7px; padding-top: 14px; font-size: 12px; text-align: center;
}
html[data-mode="phone"] .foot nav { justify-content: center; gap: 4px 14px; font-size: 13px; }
html[data-mode="phone"] .foot nav a:last-child { flex-basis: 100%; text-align: center; }

/* ——— landscape phones: the desktop's side by side, kept to the statement and its chips ——— */
html[data-mode="compact"] .nav { height: calc(46px + var(--safe-t)); padding: var(--safe-t) calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l)); }
html[data-mode="compact"] .nav-mark { font-size: 0; gap: 0; }
html[data-mode="compact"] .nav-app { font-size: 15px; padding-left: 10px; }
html[data-mode="compact"] .nav-app img { width: 22px; height: 22px; }
html[data-mode="compact"] .nav-clock { min-height: 30px; padding: 5px 11px 5px 8px; font-size: 13.5px; }
html[data-mode="compact"] .nav-get img { height: 30px; }
html[data-mode="compact"] .rail { bottom: calc(4px + var(--safe-b)); }
html[data-mode="compact"] .rail-tip { display: none; }
html[data-mode="compact"] .ch {
  top: calc(50px + var(--safe-t)); bottom: calc(52px + var(--safe-b)); left: calc(max(20px, 4vw) + var(--safe-l)); width: clamp(260px, 40vw, 440px); gap: 10px;
}
html[data-mode="compact"] .ch[data-side="right"] { left: auto; right: calc(max(20px, 4vw) + var(--safe-r)); }
html[data-mode="compact"] .ch-head b { display: none; }
html[data-mode="compact"] .ch-head span { font-size: 13px; }
html[data-mode="compact"] .ch-dot { width: 18px; height: 18px; }
html[data-mode="compact"] .stmt h2 { font-size: clamp(22px, min(3.4vw, 7.4vh), 34px); margin-bottom: 0; }
html[data-mode="compact"] .stmt ul { display: none; }
html[data-mode="compact"] .chips { display: block; position: relative; height: 30px; width: 100%; }
html[data-mode="compact"] .chip-in { font-size: 13px; }
html[data-mode="compact"] .seg { --sh: 32px; --sp: 10px; --segf: 12.5px; }
html[data-mode="compact"] .ch-get { display: none; }
html[data-mode="compact"] .hero-words { left: calc(max(20px, 4vw) + var(--safe-l)); top: calc(62px + var(--safe-t)); width: 46vw; }
html[data-mode="compact"] .hero-h1 { font-size: clamp(28px, min(4.6vw, 9.6vh), 44px); }
html[data-mode="compact"] .hero-sub { margin-top: 10px; font-size: 13.5px; }
html[data-mode="compact"] .hero-sub .sub-more { display: none; }
html[data-mode="compact"] .hero-get { margin-top: 12px; }
html[data-mode="compact"] .hero-get .badge img { height: 38px; }
html[data-mode="compact"] .hero-ex { margin-top: 10px; font-size: 13px; gap: 1px; min-height: 0; }
html[data-mode="compact"] .hero-cue { display: none; }
html[data-mode="compact"] .foot { left: 20px; right: 20px; bottom: 10px; gap: 12px; font-size: 11.5px; }

/* ——— portrait tablets: the same stack, its chrome and controls sized for the larger screen ——— */
@media (min-width: 600px) {
  html[data-mode="phone"] { --nav-h: calc(76px + var(--safe-t)); --rail-top: calc(var(--film-sh, 100svh) - 70px - var(--safe-b)); }
  html[data-mode="phone"] .nav-logo { width: 22px; height: 22px; }
  html[data-mode="phone"] .nav-app { font-size: 21px; gap: 10px; padding-left: 14px; }
  html[data-mode="phone"] .nav-app img { width: 32px; height: 32px; border-radius: 8px; }
  html[data-mode="phone"] .nav-clock { min-height: 42px; padding: 8px 15px 8px 11px; gap: 9px; font-size: 18px; }
  html[data-mode="phone"] .nav-clock svg { width: 21px; height: 21px; }
  html[data-mode="phone"] .nc-name { display: inline; }
  html[data-mode="phone"] .nav-get img { height: 42px; }
  html[data-mode="phone"] .rail { padding: 6px 10px; gap: 6px; transform: translateX(-50%) scale(1.3); transform-origin: 50% 0; }
  html[data-mode="phone"] .ch-dot { width: 24px; height: 24px; }
  html[data-mode="phone"] .ch-head span { font-size: 18px; }
  html[data-mode="phone"] .chips { height: 42px; }
  html[data-mode="phone"] .chip-in { font-size: 18px; gap: 8px; padding: 0 17px 0 12px; }
  html[data-mode="phone"] .chip-ic { width: 23px; height: 23px; }
  html[data-mode="phone"] .seg { --sh: 50px; --sp: 22px; --segf: 18px; }
  html[data-mode="phone"] .hero-get .badge img { height: 58px; }
  html[data-mode="phone"] .hero-get small { font-size: 16px; }
  html[data-mode="phone"] .close-get img { height: 64px; }
  html[data-mode="phone"] .foot { font-size: 14px; top: calc(var(--film-sh, 100svh) - 120px - var(--safe-b)); }
  html[data-mode="phone"] .foot nav { font-size: 15px; }
}
