/* Vireta home page: the pinned scroll story (opening, 01 equipment, 02 plan) and the finale.
   Loaded after style.css and home.css. Dark only. No inline styles anywhere (CSP): story.js writes
   with the CSSOM only. Class prefixes: s-* story, fp/fan/finale = finale.
   Without JS, or with reduced motion, the stage is not shown: the stacked .story__static version is
   (nothing is hidden). The finale is an ordinary section whose final look is its default look. */

:root {
  --hdr: 56px; /* the sticky site header */
  --sg: clamp(20px, 5vw, 80px);
}
@media (min-width: 768px) {
  :root {
    --hdr: 64px;
  }
}

/* ---------- shared bits ---------- */
.s-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font: 700 0.875rem / 1 var(--display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--volt);
}
.s-eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: currentColor;
}
.s-eyebrow--c {
  justify-content: center;
}
.s-eyebrow--c::after {
  content: '';
  width: 24px;
  height: 1px;
  background: currentColor;
}
.s-lede {
  margin: 0;
  max-width: 30ch;
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem);
  line-height: 1.45;
  color: var(--muted);
}
:lang(is) .s-lede {
  max-width: 32ch;
}
.s-note {
  margin: 0;
  max-width: 40ch;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--faint);
}
.s-note b {
  color: var(--muted);
  font-weight: 600;
}

/* phone frame (story phone and finale phones) */
.s-phone,
.fp {
  position: relative;
  width: var(--pw);
  aspect-ratio: 780 / 1688;
  border-radius: calc(var(--pw) * 0.13);
  background: var(--night-deep);
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--rule),
    0 0 0 calc(var(--pw) * 0.022) var(--night-deep),
    0 0 0 calc(var(--pw) * 0.022 + 1px) var(--rule);
  backface-visibility: hidden;
}
.s-phone img,
.fp img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  max-width: none;
}
.s-phone picture,
.fp picture {
  display: contents;
}
.s-phone::after,
.fp::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.1),
    transparent 28%,
    transparent 70%,
    rgba(212, 245, 60, 0.07)
  );
}

/* ---------- static version (default) ---------- */
.story__stage {
  display: none;
}
.story__static {
  width: min(100% - 2 * var(--gutter), 1200px);
  margin: 0 auto;
  padding: clamp(24px, 6vw, 72px) 0 clamp(8px, 3vw, 40px);
}
.s-st {
  display: grid;
  gap: 36px;
  align-items: center;
  padding: clamp(40px, 6vw, 72px) 0;
  border-top: 1px solid var(--rule);
}
.s-st:first-child {
  border-top: 0;
}
.s-st__t {
  display: grid;
  gap: 18px;
  justify-items: start;
}
.s-st__h {
  margin: 0;
  font-size: clamp(3rem, 1.6rem + 6vw, 6.5rem);
  line-height: 0.9;
}
:lang(is) .s-st__h {
  font-size: clamp(2.75rem, 1.6rem + 5vw, 5.5rem);
}
.s-st__m {
  display: flex;
  justify-content: center;
}
.s-phone--static {
  --pw: min(300px, 70vw);
  margin: 8px;
  border-radius: 40px;
  box-shadow:
    0 0 0 1px var(--rule),
    0 0 0 7px var(--night-deep),
    0 0 0 8px var(--rule),
    0 40px 80px -30px rgba(0, 0, 0, 0.85),
    0 0 90px -20px var(--volt-glow);
}
.s-st__chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  max-width: 460px;
}
.s-st__chips li,
.s-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--rule);
  background: rgba(30, 30, 27, 0.92);
  font: 600 0.9375rem / 1 var(--body);
  color: var(--text);
  white-space: nowrap;
}
.s-st__chips li::before,
.s-chip::before {
  content: '';
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--control);
}
.s-st__chips li.is-on,
.s-chip.is-on {
  border-color: var(--text);
  box-shadow:
    0 0 0 1px var(--text),
    0 0 40px -6px var(--volt-line);
}
.s-st__chips li.is-on::before,
.s-chip.is-on::before {
  background: var(--volt)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.5l2.6 2.6L11 4.6' fill='none' stroke='%231a1a17' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 100% no-repeat;
  border-color: var(--volt);
}
.s-st__days {
  display: grid;
  gap: 14px;
  align-content: start;
  width: 100%;
  max-width: 420px;
  justify-self: center;
}

/* a day of the plan (real data from the app's builder) */
.s-day {
  padding: 16px 18px 18px;
  border-radius: 18px;
  background: rgba(30, 30, 27, 0.94);
  border: 1px solid var(--rule);
  box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.8);
}
.s-day__h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 2px;
  font-family: var(--display);
  text-transform: uppercase;
}
.s-day__h b {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  line-height: 1;
}
.s-day__h span {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--volt);
}
.s-day__t {
  margin: 0 0 8px;
  font: 700 1.125rem / 1.15 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.s-day__l {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--muted);
}
.s-day__l li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-top: 1px solid rgba(52, 51, 46, 0.8);
}
.s-day__l i {
  font-style: normal;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.s-day__s {
  display: none;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--muted);
}

@media (min-width: 860px) {
  .s-st {
    grid-template-columns: 1.15fr 1fr;
  }
}

/* ---------- chapter rail (desktop, a link list: works without JS) ---------- */
.s-rail {
  display: none;
}
@media (min-width: 1100px) {
  .s-rail {
    position: fixed;
    right: 10px;
    top: 50%;
    translate: 0 -50%;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    transition: opacity 240ms var(--ease-out);
  }
  .s-rail.is-off {
    opacity: 0;
    pointer-events: none;
  }
  .s-rail a {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    min-height: 32px;
    font: 700 0.8125rem / 1 var(--display);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--faint);
    transition: color 240ms var(--ease-out);
  }
  .s-rail a::after {
    content: '';
    order: 2;
    width: 10px;
    height: 1px;
    background: currentColor;
    transition: width 320ms var(--ease-out);
  }
  .s-rail span {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition:
      max-width 320ms var(--ease-out),
      opacity 240ms var(--ease-out);
  }
  .s-rail a.is-on {
    color: var(--volt);
  }
  .s-rail a.is-on::after {
    width: 22px;
  }
  .s-rail a.is-on span,
  .s-rail:hover span,
  .s-rail a:focus-visible span {
    max-width: 130px;
    opacity: 1;
  }
}

/* ---------- the finale (a normal section; its default look is the final frame) ---------- */
.finale {
  position: relative;
  overflow: clip;
  padding: clamp(72px, 10vw, 140px) 0 clamp(64px, 8vw, 112px);
  background: radial-gradient(
    ellipse 60% 45% at 50% 55%,
    rgba(212, 245, 60, 0.07),
    transparent 70%
  );
}
.finale__in {
  width: min(100% - 2 * var(--gutter), 1440px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.finale__h {
  margin: 20px 0 0;
  font-size: clamp(3rem, 1rem + 6.2vw, 8rem);
  line-height: 0.9;
}
:lang(is) .finale__h {
  font-size: clamp(2.75rem, 1rem + 5.4vw, 7rem);
}
.finale__h span {
  display: block;
}
@media (min-width: 900px) {
  .finale__h span {
    display: inline;
  }
}
/* the "coming soon" sticker under the finale headline */
.finale__soon {
  margin-top: clamp(18px, 2.4vw, 32px);
}
.sticker {
  position: relative;
  display: inline-block;
  padding: 0.55em 1.2em 0.5em;
  border-radius: 14px;
  background: var(--volt);
  color: var(--on-accent);
  font: 800 clamp(1.125rem, 0.9rem + 1vw, 1.75rem) / 1 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-4deg);
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.4),
    0 14px 34px var(--volt-glow);
}
.sticker::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1.5px dashed rgba(26, 26, 23, 0.45);
  border-radius: 10px;
  pointer-events: none;
}
@keyframes sticker-slap {
  from {
    transform: rotate(-13deg) scale(1.3);
  }
  60% {
    transform: rotate(-2deg) scale(0.97);
  }
  to {
    transform: rotate(-4deg) scale(1);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .js .finale__soon.is-in .sticker {
    animation: sticker-slap 620ms var(--ease-out) 250ms both;
  }
}
.fan {
  --fpw: min(calc((100vw - 2 * var(--gutter)) / 3.1), 150px);
  --wm: calc((100vw - 2 * var(--gutter)) / 2.8);
  position: relative;
  width: 100%;
  height: calc(var(--fpw) * 3.6);
  margin-top: clamp(20px, 3vw, 48px);
  perspective: 1500px;
  perspective-origin: 50% 40%;
}
@media (min-width: 760px) {
  .fan {
    --fpw: clamp(120px, 12.4vw, 250px);
    --wm: calc(var(--fpw) * 2.45);
    height: calc(var(--fpw) * 2.65);
  }
}
.fan__wm {
  position: absolute;
  left: 50%;
  top: 20%;
  translate: -50% -52%;
  font: 800 var(--wm) / 0.8 var(--display);
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.fan__wm span {
  display: block;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(243, 239, 230, 0.28);
}
.fan__wm i {
  --w: 1;
  position: absolute;
  inset: 0;
  font-style: normal;
  color: transparent;
  -webkit-text-stroke: 2px var(--volt);
  filter: drop-shadow(0 0 18px rgba(212, 245, 60, 0.45));
  /* the reveal wipe is wider than the box so the glow is not cut into a rectangle */
  clip-path: inset(-90px calc((1 - var(--w)) * 100% - 90px * var(--w)) -90px -90px);
}
.fan__ph {
  position: absolute;
  inset: 27% 0 0;
}
@media (min-width: 760px) {
  .fan__wm {
    top: 50%;
  }
  .fan__ph {
    inset: 0;
  }
}
.fp {
  --k: 1;
  --pw: var(--fpw);
  position: absolute;
  left: 50%;
  top: 50%;
  margin: calc(var(--fpw) * -1.082) 0 0 calc(var(--fpw) / -2);
  transform: translate3d(
      calc(var(--x) * var(--fpw) * var(--k)),
      calc((var(--y) * var(--k) + (1 - var(--k)) * 0.3) * var(--fpw)),
      0
    )
    rotateY(calc(var(--ry) * var(--k) * 1deg)) rotate(calc(var(--rz) * var(--k) * 1deg))
    scale(calc(0.45 + (var(--s) - 0.45) * var(--k)));
  opacity: min(1, calc(var(--k) * 2.6));
  will-change: transform, opacity;
}
.fp[data-fp='0'] {
  --x: -1.86;
  --y: 0.16;
  --ry: 26;
  --rz: -5;
  --s: 0.84;
  z-index: 1;
}
.fp[data-fp='1'] {
  --x: -0.98;
  --y: 0.07;
  --ry: 17;
  --rz: -3;
  --s: 0.94;
  z-index: 2;
}
.fp[data-fp='2'] {
  --x: 0;
  --y: -0.02;
  --ry: 0;
  --rz: 0;
  --s: 1.1;
  z-index: 3;
}
.fp[data-fp='3'] {
  --x: 0.98;
  --y: 0.07;
  --ry: -17;
  --rz: 3;
  --s: 0.94;
  z-index: 2;
}
.fp[data-fp='4'] {
  --x: 1.86;
  --y: 0.16;
  --ry: -26;
  --rz: 5;
  --s: 0.84;
  z-index: 1;
}
/* phones: the five overlap more on a narrow screen */
@media (max-width: 759px) {
  .fp[data-fp='0'] {
    --x: -1.26;
    --ry: 22;
    --s: 0.8;
  }
  .fp[data-fp='1'] {
    --x: -0.66;
    --ry: 14;
  }
  .fp[data-fp='3'] {
    --x: 0.66;
    --ry: -14;
  }
  .fp[data-fp='4'] {
    --x: 1.26;
    --ry: -22;
    --s: 0.8;
  }
}
@media (min-width: 760px) {
  .fp[data-fp='0'] {
    --x: -2.12;
  }
  .fp[data-fp='1'] {
    --x: -1.1;
  }
  .fp[data-fp='3'] {
    --x: 1.1;
  }
  .fp[data-fp='4'] {
    --x: 2.12;
  }
}
.finale__foot {
  display: grid;
  gap: 16px;
  justify-items: center;
  margin-top: clamp(8px, 2vw, 24px);
}
.finale__lede {
  margin: 0;
  text-wrap: balance;
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem);
  line-height: 1.4;
  color: var(--text);
}
.finale .cta {
  justify-content: center;
  margin: 8px 0 0;
}
.finale .note {
  max-width: 44ch;
}

/* ---------- the pinned stage (JS + motion allowed) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js .story {
    --len: 3;
    position: relative;
    height: calc((var(--len) + 1) * (100vh - var(--hdr)));
    height: calc((var(--len) + 1) * (100svh - var(--hdr)));
  }
  html.js .story__static {
    display: none;
  }
  html.js .story__stage {
    display: block;
    position: sticky;
    top: var(--hdr);
    height: calc(100vh - var(--hdr));
    height: calc(100svh - var(--hdr));
    overflow: hidden;
    contain: layout paint;
    background: var(--night);
    --pw: 300px; /* phone width, set by JS */
    --cw: 300px; /* day card width, set by JS */
  }

  .s-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
      radial-gradient(ellipse 70% 50% at 50% 110%, rgba(212, 245, 60, 0.05), transparent 70%),
      var(--night);
  }
  .s-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url(/img/grain.png) 0 0 / 128px 128px;
    opacity: 0.05;
    mix-blend-mode: overlay;
  }
  .s-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 120vmax;
    height: 120vmax;
    margin: -60vmax 0 0 -60vmax;
    background: radial-gradient(
      closest-side,
      rgba(212, 245, 60, 0.2),
      rgba(212, 245, 60, 0.07) 45%,
      transparent 100%
    );
    will-change: transform;
  }

  .s-layer {
    position: absolute;
    inset: 0;
    perspective: 1500px;
    perspective-origin: 50% 45%;
    z-index: 2;
  }
  .s-layer > * {
    position: absolute;
    left: 50%;
    top: 50%;
  }
  .s-phone {
    z-index: 1;
    margin: calc(var(--pw) * -1.0821) 0 0 calc(var(--pw) / -2);
    opacity: 0;
    will-change: transform, opacity;
  }
  .s-phone img {
    opacity: 0;
    will-change: opacity, transform;
  }
  .s-phone img[data-scr='0'] {
    opacity: 1;
  }

  /* chips */
  .s-chip {
    z-index: 2;
    translate: -50% -50%;
    opacity: 0;
    will-change: transform, opacity;
    box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.8);
  }
  .s-chip::before {
    transition:
      background-color 200ms var(--ease-out),
      border-color 200ms var(--ease-out);
  }

  /* day cards: absolutely placed by JS, above the phone, below the copy */
  .s-days {
    display: contents;
  }
  .s-days .s-day {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 4;
    width: var(--cw);
    translate: -50% -50%;
    opacity: 0;
    will-change: transform, opacity;
  }
  .story.is-compact .s-day__l {
    display: none;
  }
  .story.is-compact .s-day__s {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .story.is-tiny .s-day__l,
  .story.is-tiny .s-day__s {
    display: none;
  }
  .story.is-tiny .s-day__t {
    margin-bottom: 0;
  }

  /* ---- copy ---- */
  .s-copy {
    position: absolute;
    left: var(--sg);
    top: 50%;
    translate: 0 -50%;
    width: max-content;
    max-width: min(46vw, 680px);
    visibility: hidden;
    pointer-events: none;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .s-copy.is-live {
    visibility: visible;
  }
  .s-copy--hero {
    max-width: min(66vw, 980px);
  }
  .s-hl {
    margin: 0;
    font-size: clamp(3.5rem, 1.6rem + 4.6vw, 6.75rem);
    line-height: 0.88;
    text-shadow: 0 2px 40px rgba(18, 18, 16, 0.6);
  }
  :lang(is) .s-hl {
    font-size: clamp(3.25rem, 1.4rem + 4.2vw, 6.25rem);
  }
  .s-copy--hero .s-hl {
    font-size: clamp(3.75rem, 1.6rem + 6.6vw, 9rem);
  }
  :lang(is) .s-copy--hero .s-hl {
    font-size: clamp(3.5rem, 1.4rem + 6vw, 8rem);
  }
  .s-ln {
    display: block;
    overflow: hidden;
    padding: 0.04em 0 0.06em;
    margin: -0.04em 0 -0.06em;
  }
  .s-ln > span {
    display: block;
    white-space: nowrap;
    will-change: transform;
  }
  .s-fx {
    will-change: transform, opacity;
  }
  .s-ghost {
    position: absolute;
    left: -0.06em;
    top: 50%;
    translate: 0 -62%;
    z-index: -1;
    font: 800 min(36vw, 62vh) / 0.8 var(--display);
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(243, 239, 230, 0.07);
    pointer-events: none;
    will-change: transform, opacity;
  }

  /* ---- hud ---- */
  .s-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 6;
  }
  .s-hair {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: rgba(243, 239, 230, 0.06);
  }
  .s-hair i {
    position: absolute;
    inset: 0;
    background: var(--volt);
    transform: scaleX(0);
    transform-origin: 0 50%;
    box-shadow: 0 0 14px var(--volt-line);
    will-change: transform;
  }
  .s-cue {
    position: absolute;
    left: var(--sg);
    bottom: clamp(18px, 4vh, 40px);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font: 700 0.8125rem / 1 var(--display);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--faint);
  }
  .s-cue i {
    width: 1px;
    height: 36px;
    background: linear-gradient(var(--volt), transparent);
    animation: s-cue 1.8s var(--ease-out) infinite;
    transform-origin: 50% 0;
  }
  @keyframes s-cue {
    0% {
      transform: scaleY(0);
    }
    55% {
      transform: scaleY(1);
    }
    100% {
      transform: scaleY(1);
      opacity: 0;
    }
  }

  /* ---- phone-sized stage (portrait, or narrower than 760): JS adds .is-m ---- */
  .story.is-m .s-copy {
    left: var(--sg);
    right: var(--sg);
    top: 22px;
    translate: none;
    width: auto;
    max-width: none;
    gap: 14px;
  }
  .story.is-m .s-hl {
    font-size: clamp(2.6rem, 12.6vw, 5rem);
  }
  .story.is-m .s-copy--hero .s-hl {
    font-size: clamp(3rem, 15vw, 5.75rem);
  }
  :lang(is) .story.is-m .s-hl {
    font-size: clamp(2.5rem, 11.6vw, 4.5rem);
  }
  :lang(is) .story.is-m .s-copy--hero .s-hl {
    font-size: clamp(2.75rem, 13.4vw, 5rem);
  }
  .story.is-m .s-lede {
    font-size: 1rem;
    max-width: 34ch;
  }
  .story.is-m .s-note {
    font-size: 0.875rem;
    line-height: 1.45;
    max-width: none;
  }
  .story.is-m .s-ghost {
    left: auto;
    right: -0.04em;
    top: 0;
    translate: 0 -8%;
    font-size: 58vw;
  }
  .story.is-m .s-chip {
    font-size: 0.8125rem;
    padding: 9px 12px 9px 10px;
    gap: 8px;
  }
  .story.is-m .s-chip::before {
    width: 14px;
    height: 14px;
  }
  .story.is-m .s-cue {
    display: none;
  }
  .story.is-m .s-day {
    padding: 11px 14px 12px;
    border-radius: 14px;
  }
  .story.is-m .s-day__h b {
    font-size: 1.25rem;
  }
  .story.is-m .s-day__t {
    font-size: 1rem;
    margin-bottom: 4px;
  }
  .story.is-m .s-day__s {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
    -webkit-line-clamp: unset;
  }
  .story.is-m .s-day__l {
    display: none;
  }
  .story.is-m.is-tiny .s-day__s {
    display: none;
  }
}

/* chapters reached from the rail or the skip link stop below the sticky header */
#workout,
#progress,
#finale,
#s-eq,
#s-plan {
  scroll-margin-top: calc(var(--hdr) + 12px);
}
.sticker .ios {
  text-transform: none;
}
