/* "One iPhone. That's all." — over-the-air chapter (refraction/parts/home-ota.php, js/ota.js):
   install Zag Store from Safari, then open it and discover apps.
   Default: a static, readable section (reduced motion, short screens, no JavaScript).
   html.ota-live: the film, played inside the hero's pinned timeline. */

/* Static ---------------------------------------------------------------- */
.ota { padding: clamp(96px, 12vw, 160px) var(--gutter); }
.ota__stage {
  --ph-h: 560px;
  --ph-w: calc(var(--ph-h) * 9 / 19.4);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: clamp(48px, 8vw, 120px);
  row-gap: 56px;
  max-width: 1240px;
  margin: 0 auto;
}
.ota__copy { grid-column: 1; display: grid; gap: 16px; justify-items: start; align-content: start; }
.ota__vis { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
.ota-title { font-size: clamp(2.3rem, 4.3vw, 4.5rem); font-weight: 700; line-height: 0.96; letter-spacing: -0.052em; text-wrap: balance; }
.ota-lede { max-width: 36ch; color: var(--text-secondary); font-size: clamp(16px, 1.25vw, 18.5px); line-height: 1.55; text-wrap: pretty; }
.ota-fine { max-width: 44ch; color: var(--text-tertiary); font-size: 13.5px; line-height: 1.55; }
.ota-final { font-size: clamp(1.25rem, 1.9vw, 1.75rem); font-weight: 650; letter-spacing: -0.03em; }
.ota__type, .ota__props, .ota-ribbon, .ota-signal, .ota-light, .ota-phone__rim { display: none; }
.ota-scr--lock, .ota-scr--home, .ota-scr--app { display: none; } /* static: the installer page */

/* The real Zag Store app icon; its dark variant follows the site's appearance. */
.ota-zag { position: relative; display: block; overflow: hidden; border-radius: 22.5%; }
.ota-zag img { display: block; width: 100%; height: 100%; }
.ota-zag__dark { display: none !important; }
:root[data-theme="dark"] .ota-zag__light { display: none !important; }
:root[data-theme="dark"] .ota-zag__dark { display: block !important; }

/* Phone (shared) */
.ota-phone { display: grid; justify-items: center; gap: 14px; margin: 0; }
.ota-phone__body {
  width: var(--ph-w);
  height: var(--ph-h);
  padding: calc(var(--ph-w) * 0.035);
  border-radius: calc(var(--ph-w) * 0.17);
  background: var(--device-frame);
  box-shadow: inset 0 0 0 1px var(--device-edge), inset 0 0 0 4px var(--device-frame), var(--device-shadow);
}
.ota-phone__screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: calc(var(--ph-w) * 0.14);
  container-type: size;
  background:
    radial-gradient(90% 55% at 20% 0%, hsl(var(--app-hue) 75% 62% / 0.55), transparent 72%),
    radial-gradient(90% 60% at 95% 75%, hsl(calc(var(--app-hue) + 50) 75% 60% / 0.36), transparent 72%),
    var(--app-bg);
  color: var(--app-text);
}
.ota-phone__status { position: absolute; left: 0; right: 0; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; height: 12cqw; padding: 0 9cqw; font-size: 4cqw; font-weight: 650; }
.ota-phone__island { position: absolute; left: 50%; top: 3.2cqw; width: 30cqw; height: 8.4cqw; margin-left: -15cqw; border-radius: 99px; background: #000; }
.ota-phone__net { position: relative; width: 5cqw; height: 5cqw; }
.ota-phone__net .ota-glyph { position: absolute; inset: 0; width: 100%; height: 100%; }
.ota-phone__net .ota-glyph--bars { opacity: 0; }
.ota-phone__caption { color: var(--text-tertiary); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; }

.ota-glyph { overflow: visible; }
.ota-glyph--wifi path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.ota-glyph--wifi circle, .ota-glyph--bars rect { fill: currentColor; }

.ota-scr { position: absolute; inset: 0; }
.ota-lock__time { position: absolute; left: 0; right: 0; top: 20%; text-align: center; font-size: 21cqw; font-weight: 600; letter-spacing: -0.04em; }
.ota-lock__date { position: absolute; left: 0; right: 0; top: 16%; text-align: center; font-size: 4cqw; font-weight: 600; opacity: 0.8; }
.ota-scr--safari { background: var(--app-bg); }
/* Mirrors /install/: certificate, profile, password, "Sign Zag Store", then "Install Zag Store". */
.ota-safari__page { position: absolute; left: 0; right: 0; top: 15%; display: grid; justify-items: center; gap: 2.6cqw; padding: 0 8cqw; text-align: center; }
.ota-safari__icon { width: 21cqw; height: 21cqw; margin-bottom: 1cqw; box-shadow: 0 2cqw 6cqw rgb(40 60 200 / 0.3); }
.ota-safari__page strong { font-size: 6.2cqw; letter-spacing: -0.02em; }
.ota-safari__sub { max-width: 58cqw; color: var(--app-muted); font-size: 3.3cqw; line-height: 1.4; }
.ota-safari__fields { display: grid; gap: 1.8cqw; width: 100%; margin-top: 2cqw; text-align: left; }
.ota-safari__field { display: flex; align-items: center; gap: 2cqw; height: 9cqw; padding: 0 3cqw; border-radius: 2.6cqw; background: var(--app-surface); box-shadow: 0 0 0 1px var(--app-separator); font-size: 3.3cqw; font-weight: 550; }
.ota-safari__field em { margin-left: auto; color: var(--app-muted); font-style: normal; letter-spacing: 0.1em; }
.ota-check { flex: none; width: 3.8cqw; height: 3.8cqw; fill: none; stroke: #16a34a; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ota-safari__btn { position: relative; display: grid; place-items: center; width: 100%; height: 11cqw; margin-top: 2.4cqw; overflow: hidden; border-radius: 3cqw; background: #326cf4; color: #fff; font-size: 3.9cqw; font-weight: 700; }
.ota-safari__label { position: relative; z-index: 1; grid-area: 1 / 1; }
.ota-safari__label--install { position: absolute; inset: 0; display: grid; place-items: center; background: #16834a; opacity: 0; }
.ota-safari__fill { position: absolute; inset: 0; background: rgb(255 255 255 / 0.28); transform-origin: 0 50%; transform: scaleX(0); }
.ota-safari__bar { position: absolute; left: 5cqw; right: 5cqw; bottom: 6cqw; display: grid; place-items: center; height: 11cqw; border-radius: 99px; background: var(--app-surface); box-shadow: 0 0 0 1px var(--app-separator); font-size: 3.8cqw; }
.ota-home__grid { position: absolute; left: 6cqw; right: 6cqw; top: 17cqw; display: grid; grid-template-columns: repeat(4, 1fr); row-gap: 6cqw; justify-items: center; }
.ota-home__app { display: grid; justify-items: center; gap: 1.2cqw; }
.ota-home__app .tile { --tile: 15.6cqw; box-shadow: none; }
.ota-home__app small { font-size: 2.7cqw; font-weight: 550; white-space: nowrap; }
.ota-home__slot { position: relative; display: block; width: 15.6cqw; height: 15.6cqw; }
.ota-home__zag { width: 100%; height: 100%; }

/* Zag Store, opened: a simplified Discover screen with real catalogue icons. */
.ota-scr--app { background: var(--app-bg); }
.ota-app__head { position: absolute; left: 7cqw; top: 15cqw; display: flex; align-items: center; gap: 2cqw; color: var(--app-muted); font-size: 3.4cqw; font-weight: 650; }
.ota-app__mark { width: 6.5cqw; height: 6.5cqw; }
.ota-app__title { position: absolute; left: 7cqw; top: 23cqw; font-size: 9.5cqw; letter-spacing: -0.03em; }
.ota-app__search { position: absolute; left: 7cqw; right: 7cqw; top: 37cqw; display: flex; align-items: center; height: 9.5cqw; padding: 0 4cqw; border-radius: 3cqw; background: var(--app-surface); box-shadow: 0 0 0 1px var(--app-separator); color: var(--app-muted); font-size: 3.4cqw; }
.ota-app__grid { position: absolute; left: 7cqw; right: 7cqw; top: 54cqw; display: grid; grid-template-columns: repeat(3, 1fr); row-gap: 6cqw; justify-items: center; }
.ota-app__item { display: grid; justify-items: center; gap: 1.6cqw; width: 100%; min-width: 0; }
.ota-app__item .tile { --tile: 18cqw; box-shadow: none; }
.ota-app__item small { max-width: 100%; overflow: hidden; font-size: 2.9cqw; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.ota-home__ring { position: absolute; inset: 22%; width: 56%; height: 56%; transform: rotate(-90deg); fill: none; stroke: #fff; stroke-width: 4; stroke-dasharray: 1 1; stroke-dashoffset: 0; opacity: 0; }

@media (max-width: 799px) {
  .ota__stage { --ph-h: 480px; grid-template-columns: 1fr; text-align: center; }
  .ota__copy { justify-items: center; }
  .ota__vis { grid-column: 1; grid-row: auto; justify-self: center; }
}

/* Live film ------------------------------------------------------------- */
/* Lives inside the pinned .intro, above the hero and below Discover. */
html.ota-live .ota { position: absolute; inset: 0; z-index: 1; padding: 0; pointer-events: none; }
html.ota-live .ota__stage {
  --vcx: 66%;
  --vcy: 52%;
  --ph-h: min(70svh, 640px);
  position: absolute;
  inset: 0;
  display: block;
  max-width: none;
  overflow: hidden;
}
html.ota-live .ota__copy {
  position: absolute;
  left: var(--gutter);
  top: 0;
  bottom: 0;
  z-index: 6;
  width: min(36vw, 500px);
  align-content: center;
  gap: 20px;
  opacity: 0;
}
/* ONE [phone] DEVICE. — the words sit either side of the phone (desktop) or above and below it (phones). */
html.ota-live .ota__type {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: 0;
  height: 0;
  margin: 0;
  font-size: clamp(4.5rem, 8.5vw, 9.5rem);
  font-weight: 800;
  line-height: 0.84;
  letter-spacing: -0.065em;
  text-transform: uppercase;
  white-space: nowrap;
  background: linear-gradient(100deg, var(--line-2), var(--line-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  will-change: transform, opacity;
}
html.ota-live .ota__type span {
  position: absolute;
  top: -0.42em;
  padding: 0.04em 0.06em 0.1em; /* room for the gradient's glyph overhang */
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
}
html.ota-live .ota__type span:first-child { right: calc(var(--ph-w) * 0.66); }
html.ota-live .ota__type span:last-child { left: calc(var(--ph-w) * 0.66); }
@media (min-width: 800px) {
  html.ota-live .ota__copy[data-scene="2"] { top: auto; bottom: 8svh; align-content: end; }
}
html.ota-live .ota__vis { position: absolute; left: var(--vcx); top: var(--vcy); z-index: 3; width: 0; height: 0; }
html.ota-live .ota__vis > .ota__type { display: block; }
html.ota-live .ota-phone { position: absolute; left: calc(var(--ph-w) / -2); top: calc(var(--ph-h) / -2); z-index: 3; display: block; opacity: 0; }
html.ota-live .ota-phone__caption { position: absolute; left: 0; right: 0; top: calc(100% + 12px); text-align: center; }
html.ota-live .ota-scr--lock, html.ota-live .ota-scr--home, html.ota-live .ota-scr--app { display: block; }
html.ota-live .ota-scr--safari, html.ota-live .ota-scr--home, html.ota-live .ota-scr--app { opacity: 0; }

/* The bridge from the hero: the splitting Z's light becomes the halo the phone stands in. */
html.ota-live .ota-light {
  --s: calc(var(--ph-h) * 1.5);
  display: block;
  position: absolute;
  left: calc(var(--s) / -2);
  top: calc(var(--s) / -2);
  z-index: 0;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(closest-side, hsl(195 100% 62% / 0.5), hsl(232 95% 62% / 0.32) 42%, hsl(300 90% 62% / 0.16) 68%, transparent);
  opacity: 0;
  will-change: transform, opacity;
  pointer-events: none;
}
:root[data-theme="light"].ota-live .ota-light { background: radial-gradient(closest-side, hsl(195 100% 60% / 0.34), hsl(232 95% 62% / 0.2) 42%, hsl(300 90% 62% / 0.1) 68%, transparent); }
/* The phone catches that light along its edge. */
html.ota-live .ota-phone__rim {
  display: block;
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--ph-w) * 0.17 + 1px);
  box-shadow: 0 0 0 1.5px hsl(192 100% 74% / 0.9), 0 0 26px 3px hsl(222 100% 64% / 0.55), 0 0 80px 12px hsl(296 90% 62% / 0.3);
  opacity: 0;
  will-change: opacity;
  pointer-events: none;
}

/* Scene 1 props, sized from the phone */
html.ota-live .ota__props { display: block; position: absolute; left: 0; top: 0; }
html.ota-live .ota-laptop {
  --lw: calc(var(--ph-h) * 0.82);
  position: absolute;
  left: calc(var(--ph-w) * 0.5 + var(--lw) * 0.02);
  top: calc(var(--ph-h) * -0.12);
  width: var(--lw);
  opacity: 0;
}
.ota-laptop__lid { display: block; height: calc(var(--lw) * 0.62); padding: calc(var(--lw) * 0.025); border-radius: calc(var(--lw) * 0.03) calc(var(--lw) * 0.03) 4px 4px; background: var(--device-frame); box-shadow: inset 0 0 0 1px var(--device-edge), var(--device-shadow); }
.ota-laptop__screen { display: grid; align-content: center; gap: 7%; height: 100%; padding: 0 16%; border-radius: 4px; background: linear-gradient(160deg, hsl(var(--app-hue) 45% 30% / 0.55), var(--app-bg)); }
.ota-laptop__screen span { display: block; height: 6%; border-radius: 99px; background: var(--app-separator); }
.ota-laptop__screen span:nth-child(2) { width: 70%; }
.ota-laptop__screen span:nth-child(3) { width: 45%; }
.ota-laptop__base { display: block; width: 116%; height: calc(var(--lw) * 0.035); margin-left: -8%; border-radius: 0 0 10px 10px; background: var(--device-frame); box-shadow: inset 0 0 0 1px var(--device-edge); }
html.ota-live .ota-tablet {
  --tw: calc(var(--ph-h) * 0.44);
  position: absolute;
  left: calc(var(--ph-w) * -0.5 - var(--tw) * 0.9);
  top: calc(var(--ph-h) * -0.3);
  width: var(--tw);
  height: calc(var(--tw) * 1.36);
  padding: calc(var(--tw) * 0.045);
  border-radius: calc(var(--tw) * 0.08);
  background: var(--device-frame);
  box-shadow: inset 0 0 0 1px var(--device-edge), var(--device-shadow);
  opacity: 0;
}
.ota-tablet__screen { display: block; height: 100%; border-radius: calc(var(--tw) * 0.05); background: linear-gradient(200deg, hsl(calc(var(--app-hue) + 40) 45% 32% / 0.5), var(--app-bg)); }
html.ota-live .ota-cable {
  position: absolute;
  left: -6px;
  top: calc(var(--ph-h) * 0.3);
  width: calc(var(--ph-w) * 0.5 + var(--ph-h) * 0.3);
  height: calc(var(--ph-h) * 0.3);
  overflow: visible;
  fill: none;
  stroke: var(--text-tertiary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  vector-effect: non-scaling-stroke;
}

/* Scene 3: signal and data ribbon */
html.ota-live .ota-signal {
  display: block;
  position: absolute;
  left: calc(var(--ph-w) * -0.5 - 120px);
  top: calc(var(--ph-h) * -0.38);
  width: 64px;
  height: 64px;
  color: var(--text-primary);
  opacity: 0;
}
html.ota-live .ota-signal .ota-glyph { position: absolute; inset: 0; width: 100%; height: 100%; }
html.ota-live .ota-signal .ota-glyph--bars rect { transform-box: fill-box; transform-origin: 50% 100%; }
html.ota-live .ota-ribbon {
  display: block;
  position: absolute;
  right: calc(var(--ph-w) * -0.1);
  top: calc(var(--ph-h) * -0.28);
  z-index: 2;
  width: min(48vw, 640px);
  height: calc(var(--ph-h) * 0.5);
  overflow: visible;
  fill: none;
  stroke: url(#ota-ribbon-g);
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0;
}
html.ota-live .ota-ribbon path { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
html.ota-live .ota-ribbon path + path { stroke-width: 7; stroke-dasharray: 0.1 0.9; opacity: 0.55; }

html.ota-live .ota-phone { will-change: transform, opacity; }

@media (max-width: 799px) {
  html.ota-live .ota__stage {
    --copy-top: calc(env(safe-area-inset-top) + 82px);
    --vis-top: calc(var(--copy-top) + 236px);
    --vis-h: calc(100svh - var(--vis-top) - env(safe-area-inset-bottom) - 28px);
    --vcx: 50%;
    --vcy: calc(var(--vis-top) + var(--vis-h) / 2);
    --ph-h: min(calc(var(--vis-h) - 36px), 500px);
  }
  html.ota-live .ota__copy { left: var(--gutter); right: var(--gutter); top: var(--copy-top); bottom: auto; width: auto; align-content: start; justify-items: center; gap: 12px; text-align: center; }
  html.ota-live .ota-title { font-size: clamp(1.9rem, 8.4vw, 2.5rem); }
  html.ota-live .ota-lede { font-size: 15px; }
  html.ota-live .ota-fine { font-size: 12px; }
  html.ota-live .ota-final { font-size: 1.1rem; }
  html.ota-live .ota__type { font-size: clamp(3.4rem, 17vw, 5.5rem); }
  html.ota-live .ota__type span { left: auto; right: auto; transform: translateX(-50%); }
  html.ota-live .ota__type span:first-child { top: calc(var(--ph-h) * -0.4 - 0.95em); right: auto; }
  html.ota-live .ota__type span:last-child { top: calc(var(--ph-h) * 0.4 + 0.02em); left: auto; }
  html.ota-live .ota-signal { left: calc(var(--ph-w) * -0.5 - 64px); width: 44px; height: 44px; }
  html.ota-live .ota-ribbon { width: 60vw; }
}
@media (max-width: 799px) and (max-height: 780px) {
  html.ota-live .ota-fine { display: none; }
}
