/* Towers Fitness — landing page
   Colours and faces are the app's own (Figma tokens: Brand_Main_Orange, Brand_Main_Purple; Passion One + Outfit).
   Every picture and clip is captured from the game, except the .real section: photos of real people training in Towers Fitness shirts. */

:root {
  --paper: #f6f3f7;
  --surface: #ebe5ee;
  --white: #ffffff;
  --ink: #1e122f;          /* Brand_Main_Purple */
  --muted: #5d5368;
  --orange: #e15449;       /* Brand_Main_Orange */
  --orange-soft: #ec8a82;
  --yellow: #fdbd74;       /* the second flame */
  --ember: #7d2f3a;        /* the maroon of the app's headers, flat */

  --font-display: "Passion One", "Arial Black", system-ui, sans-serif;
  --font-text: "Outfit", system-ui, sans-serif;

  --step-small: 0.875rem;
  --step-body: clamp(1.0625rem, 1rem + 0.15vw, 1.125rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --step-statement: clamp(1.5rem, 1rem + 1.4vw, 2.25rem);
  --step-head: clamp(2.75rem, 1rem + 4vw, 5rem);

  --max: 80rem;
  --margin: clamp(1.25rem, 5vw, 4.5rem);
  --gutter: clamp(1rem, 2vw, 1.75rem);
  --section: clamp(6.5rem, 11vw, 11rem);
  --radius: 1.25rem;

  --chamfer: polygon(0 0, 100% 0, 100% calc(100% - 0.6rem), calc(100% - 0.6rem) 100%, 0.6rem 100%, 0 calc(100% - 0.6rem));
  --merlon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 32'%3E%3Cpath d='M0 32V0h30l4 15h24l4-15h2v32z' fill='%23000'/%3E%3C/svg%3E");

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-text); font-size: var(--step-body); line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:target { scroll-margin-top: 5.5rem; }
::selection { background: var(--orange); color: var(--white); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { padding-inline: max(var(--margin), calc((100% - var(--max)) / 2)); }
p { max-width: 62ch; text-wrap: pretty; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; text-wrap: balance; }
.head { font-size: var(--step-head); line-height: 0.92; letter-spacing: -0.01em; }

/* ---------- controls ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 3.375rem; padding: 0 1.75rem 0.1rem; background: var(--orange); color: var(--white); font-size: 1.1875rem; font-weight: 700; text-decoration: none; white-space: nowrap; clip-path: var(--chamfer); transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease; }
.button:active { transform: scale(0.97); }
.button--small { min-height: 2.75rem; padding-inline: 1.25rem; font-size: var(--step-small); background: var(--ink); }
.button--paper { background: var(--paper); color: var(--ink); }
.link { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.22em; text-decoration-thickness: 0.08em; transition: text-decoration-color var(--t-hover) ease; }
.link-plain { font-weight: 600; text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 0.08em; }
@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--ink); }
  .button--small:hover { background: var(--orange); }
  .button--paper:hover { background: var(--yellow); }
  .link:hover { text-decoration-color: currentColor; }
  .link-plain:hover { color: var(--orange); }
}

/* the castle battlements: one band, above the combat field */
.merlons { height: 1.75rem; background-color: var(--ink); -webkit-mask: var(--merlon) left bottom / 3.5rem 1.75rem repeat-x; mask: var(--merlon) left bottom / 3.5rem 1.75rem repeat-x; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: 0; z-index: 20; background: var(--paper); }
.bar__inner { display: flex; align-items: center; gap: 2rem; min-height: 4.75rem; }
.bar__brand { display: block; width: 9.5rem; color: var(--ink); }
.bar__brand svg { width: 100%; height: auto; }
.bar__nav { display: flex; gap: 2rem; margin-left: auto; font-size: var(--step-small); font-weight: 600; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; min-height: calc(100svh - 4.75rem); padding-block: clamp(2.5rem, 5vw, 5rem); }
.hero__copy { display: grid; gap: 1.75rem; }
.hero h1 { max-width: 10ch; }
.hero__lede { font-size: var(--step-lead); line-height: 1.38; max-width: 34ch; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; }
.hero__fact { display: flex; align-items: center; gap: 0.85rem; margin-top: 0.5rem; font-size: var(--step-lead); font-weight: 600; }
.hero__fact img { width: 2.75rem; height: auto; }

.trailer { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--ink); }
.trailer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.trailer__play { position: absolute; inset: 0; display: block; width: 100%; color: var(--white); }
.trailer__poster { width: 100%; height: 100%; object-fit: cover; transition: transform 1200ms var(--ease-soft); }
.trailer__icon { position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 5.5rem; height: 5.5rem; margin: -2.75rem 0 0 -2.75rem; border-radius: 50%; background: var(--orange); transition: transform var(--t-hover) var(--ease-out); }
.trailer__icon svg { width: 2.4rem; height: 2.4rem; fill: var(--white); margin-left: 0.25rem; }
.trailer__label { position: absolute; left: 1.25rem; bottom: 1.25rem; padding: 0.45rem 0.9rem; border-radius: 2rem; background: var(--ink); font-weight: 600; font-size: var(--step-small); }
@media (hover: hover) and (pointer: fine) {
  .trailer__play:hover .trailer__icon { transform: scale(1.08); }
  .trailer__play:hover .trailer__poster { transform: scale(1.03); }
}

/* ---------- real workouts: photos of real people ---------- */
.real { padding-top: var(--section); }
.real__head { display: grid; grid-template-columns: 7fr 5fr; gap: var(--gutter); align-items: end; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.real__head p { font-size: var(--step-lead); line-height: 1.38; }
.real__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: clamp(15rem, 28vw, 26rem); gap: var(--gutter); }
.shot { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot figcaption { position: absolute; left: 1rem; bottom: 1rem; padding: 0.4rem 0.85rem; border-radius: 2rem; background: var(--ink); color: var(--paper); font-weight: 600; font-size: var(--step-small); }
.shot--ropes { grid-column: 1 / span 7; }
.shot--ropes img { object-position: 45% 50%; }
.shot--situp { grid-column: 8 / -1; }
.shot--situp img { object-position: 62% 55%; }
.shot--lunge { grid-column: 1 / span 5; }
.shot--lunge img { object-position: 50% 45%; }
.shot--dips { grid-column: 6 / -1; }
.shot--dips img { object-position: 55% 35%; }

/* ---------- your day becomes XP ---------- */
.xp { padding-block: var(--section); }
.xp__head { display: grid; grid-template-columns: 7fr 5fr; gap: var(--gutter); align-items: end; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.xp__head p { font-size: var(--step-lead); line-height: 1.38; }
.machine { position: relative; display: grid; grid-template-columns: 4fr 3fr 5fr; align-items: center; }
.machine__sources { position: relative; z-index: 1; display: grid; gap: 0.75rem; grid-column: 1; }
.machine__stats { position: relative; z-index: 1; grid-column: 3; display: grid; gap: 0.25rem; padding: 1.25rem 1.5rem; border-radius: var(--radius); background: var(--white); }
.machine__paths { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.machine__paths path { fill: none; stroke: var(--surface); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 9; transition: stroke 300ms ease; }
.machine__paths path.is-live { stroke: var(--orange); }
.machine__paths circle { fill: var(--orange); }
.machine__paths circle.is-gold { fill: var(--yellow); }

.source { display: grid; grid-template-columns: 3.25rem 1fr; grid-template-rows: auto auto; column-gap: 1rem; align-items: center; padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--white); transition: background-color 300ms ease, transform 400ms var(--ease-out), opacity 300ms ease; }
.source img { grid-row: 1 / 3; width: 3.25rem; height: 3.25rem; object-fit: contain; }
.source__label { font-size: var(--step-small); font-weight: 600; color: var(--muted); }
.source__value { font-size: var(--step-small); font-weight: 600; }
.source__value b { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; margin-right: 0.15rem; }
.source.is-active { background: var(--yellow); transform: translateX(0.5rem); }
.source.is-done { opacity: 0.55; }

.statrow { display: grid; grid-template-columns: 1.5rem 6.5rem 1fr 5.5rem; align-items: center; gap: 0.9rem; padding: 0.65rem 0; transition: transform 300ms var(--ease-out); }
.statrow img { width: 1.5rem; height: 1.5rem; }
.statrow__name { font-weight: 600; }
.statrow__bar { position: relative; height: 0.75rem; border-radius: 1rem; background: var(--surface); overflow: hidden; }
.statrow__bar span { position: absolute; inset: 0; border-radius: 1rem; background: var(--orange); transform-origin: left; transform: scaleX(var(--p, 1)); transition: transform 500ms var(--ease-out); }
.statrow--derived .statrow__bar span { background: var(--ember); }
.statrow__xp { justify-self: end; font-weight: 600; font-variant-numeric: tabular-nums; }
.statrow__xp b { font-family: var(--font-display); font-size: 1.35rem; color: var(--orange); }
.statrow.is-hit { transform: scale(1.03); }
.machine__note { margin-top: 1.5rem; margin-left: auto; max-width: 46ch; font-size: var(--step-small); color: var(--muted); text-align: right; }

/* ---------- how it works ---------- */
.steps { padding-bottom: var(--section); }
.steps h2 { margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.steps__list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gutter); }
.step { display: grid; align-content: start; gap: 0.85rem; padding: 1.75rem 1.75rem 2rem; border-radius: var(--radius); background: var(--white); }
.step__icon { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; margin-bottom: 0.5rem; border-radius: 50%; background: var(--paper); }
.step__icon img { width: 2.6rem; height: 2.6rem; object-fit: contain; }
.step h3 { font-size: 1.75rem; line-height: 1; }

/* ---------- combat (the live thing) ---------- */
.combat { position: relative; background: var(--paper); color: var(--paper); }
.combat .merlons--wall { height: 4rem; background-color: var(--field, var(--ink)); -webkit-mask-size: 8rem 4rem; mask-size: 8rem 4rem; transition: background-color 500ms ease; }
.combat__inner { overflow: hidden; background: var(--field, var(--ink)); transition: background-color 500ms ease; }
.combat[data-field="ember"] { --field: var(--ember); }
.combat__grid { display: grid; grid-template-columns: 5fr 7fr; align-items: center; gap: var(--gutter); min-height: 92svh; padding-block: clamp(3rem, 6vw, 5rem); }
.combat__copy { position: relative; z-index: 2; max-width: 34rem; display: grid; gap: 1.25rem; align-self: center; }
.combat__copy p { font-size: var(--step-body); }
.combat__try { color: var(--yellow); font-weight: 600; }

.duel { position: relative; font-size: clamp(0.75rem, 0.95vw, 1.05rem); display: grid; grid-template-columns: auto auto; align-items: center; justify-content: center; gap: 1.5em 2.5em; }
.duel__foe { display: grid; justify-items: center; gap: 1em; }
.duel__meter { display: grid; gap: 0.35em; }
.duel__name { font-weight: 700; font-size: 1.1em; }
.duel__hp { position: relative; display: block; width: 16em; height: 1.6rem; border-radius: 1em; background: var(--paper); overflow: hidden; }
.duel__hp-fill { position: absolute; inset: 0.25em; border-radius: 1em; background: var(--orange); transform-origin: left; transform: scaleX(var(--hp)); transition: transform 400ms var(--ease-out); }
.duel__hp-text { position: relative; display: block; text-align: center; font-weight: 700; font-size: max(0.8125rem, 0.85em); line-height: 1.6rem; color: var(--ink); }
.slime { position: relative; width: 18em; height: 18em; background-size: 700% 700%; background-repeat: no-repeat; }
.slime__still { width: 100%; height: 100%; }
.slime.is-live .slime__still { opacity: 0; }
.slime.is-hit { animation: shake 360ms var(--ease-out); }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-0.6em); } 45% { transform: translateX(0.5em); } 70% { transform: translateX(-0.25em); } }
.duel__pop { position: absolute; top: 4%; left: 50%; font-family: var(--font-display); font-size: 4.5em; line-height: 1; color: var(--yellow); transform: translate(-50%, 0); opacity: 0; pointer-events: none; }
.duel__pop.is-shown { animation: pop 900ms var(--ease-out) forwards; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 0.4em) scale(0.6); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -1em) scale(1); } }
.duel__arena { position: relative; display: grid; place-items: center; width: 26em; height: 26em; }
.duel__ring { position: absolute; width: 15em; height: 15em; border-radius: 50%; border: 0.6em solid var(--yellow); transform: scale(var(--ring, 1.7)); opacity: var(--ring-o, 0.9); pointer-events: none; }
.duel__attack { position: relative; display: grid; place-items: center; align-content: center; gap: 0.5em; width: 15em; height: 15em; border-radius: 50%; background: var(--orange); color: var(--white); font-family: var(--font-display); font-size: 1em; transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.duel__attack img { width: 3.6em; height: 3.6em; filter: brightness(0) invert(1); }
.duel__attack span { font-size: 3.2em; line-height: 1; }
.duel__attack:active { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) { .duel__attack:hover { background: #ea6458; } }
.duel__verdict { grid-column: 1 / -1; justify-self: center; min-height: 1em; font-family: var(--font-display); font-size: 3em; line-height: 1; color: var(--yellow); max-width: none; }

/* ---------- inside the game: cards ---------- */
.inside { padding-block: var(--section); }
.inside__head { display: grid; grid-template-columns: 7fr 5fr; gap: var(--gutter); align-items: end; margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }
.inside__head p { font-size: var(--step-lead); line-height: 1.38; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
.card { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--white); }
.card--wide { grid-column: span 2; }
.card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface); }
.card--wide .card__media { aspect-ratio: auto; flex: 1; min-height: 18rem; }
.card__media > img, .card__media > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card__media--yellow { background: var(--yellow); }
.card__media--orange { background: var(--orange); }
.card__media > .card__contain { inset: 8% 10%; width: 80%; height: 84%; object-fit: contain; }
.card__body { display: grid; gap: 0.5rem; padding: 1.5rem 1.75rem 1.75rem; }
.card__body h3 { font-size: 1.75rem; line-height: 1; }
.card__body p { color: var(--ink); }

/* the phone that holds an app screen */
.phone { position: absolute; left: 50%; top: 9%; width: 40%; aspect-ratio: 9 / 19.5; padding: 0.4rem; border-radius: 1.6rem; background: var(--ink); transform: translateX(-50%); }
.phone::before { content: ""; position: absolute; z-index: 1; left: 50%; top: 0.85rem; width: 32%; height: 0.75rem; margin-left: -16%; border-radius: 1rem; background: var(--ink); }
.phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 1.25rem; }

/* ---------- FAQ ---------- */
.faq { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); padding-bottom: var(--section); align-items: start; }
.faq__title { grid-column: 1 / span 4; position: sticky; top: 6rem; max-width: 7ch; }
.faq__list { grid-column: 5 / -1; display: grid; gap: 0.5rem; }
.faq details { background: var(--white); transition: background-color var(--t-hover) ease; }
.faq summary { position: relative; display: flex; align-items: center; min-height: 4.5rem; padding: 1rem 4rem 1rem 1.5rem; font-size: var(--step-lead); font-weight: 500; line-height: 1.25; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before, .faq summary::after { content: ""; position: absolute; right: 1.5rem; top: 50%; width: 1rem; height: 3px; margin-top: -1.5px; background: currentColor; transition: transform var(--t-hover) var(--ease-out); }
.faq summary::after { transform: rotate(90deg); }
.faq details[open] { background: var(--orange); color: var(--ink); }
.faq details[open] summary::after { transform: rotate(0deg); }
.faq details p { padding: 0 1.5rem 1.5rem; max-width: 52ch; }
@media (hover: hover) and (pointer: fine) { .faq details:not([open]):hover { background: var(--surface); } }

/* ---------- beta coupon ---------- */
.beta { padding-bottom: var(--section); }
.coupon { --notch: 3.5rem; position: relative; overflow: hidden; display: grid; grid-template-columns: 46fr 54fr; max-width: 74rem; margin-inline: auto; background: var(--orange); color: var(--ink); }
.coupon::before, .coupon::after { content: ""; position: absolute; left: calc(46% - var(--notch) / 2); width: var(--notch); height: var(--notch); border-radius: 50%; background: var(--paper); z-index: 1; }
.coupon::before { top: calc(var(--notch) * -0.5); }
.coupon::after { bottom: calc(var(--notch) * -0.5); }
.coupon__stub { display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: clamp(2rem, 4vw, 3.5rem); }
.coupon__title { font-size: var(--step-head); line-height: 0.92; text-transform: uppercase; color: var(--white); }
.coupon__stub p { font-size: var(--step-lead); line-height: 1.35; max-width: 24ch; }
.coupon__fields { display: grid; gap: 0.625rem; align-content: center; padding: clamp(2rem, 4vw, 3.5rem); border-left: 0.35rem dotted var(--paper); }
.field { display: block; width: 100%; min-height: 3.375rem; padding: 0.8rem 1rem; border: 0; border-radius: 0; background: var(--orange-soft); color: var(--ink); font-size: 1rem; appearance: none; -webkit-appearance: none; }
.field::placeholder { color: var(--ink); opacity: 0.75; }
select.field { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231e122f' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; background-size: 0.75rem; padding-right: 2.5rem; cursor: pointer; }
.field--date { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: text; }
.field--date span { opacity: 0.75; }
.field--date input { border: 0; background: transparent; color: var(--ink); font-size: 1rem; min-width: 0; }
.field:focus-visible, .field--date:focus-within { outline: 3px solid var(--ink); outline-offset: 0; }
.field[aria-invalid="true"] { outline: 3px solid var(--ink); }
.coupon__submit { min-height: 3.5rem; margin-top: 0.375rem; background: var(--ink); color: var(--white); font-weight: 700; font-size: var(--step-body); clip-path: var(--chamfer); transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease, color var(--t-hover) ease; }
.coupon__submit:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) { .coupon__submit:hover { background: var(--yellow); color: var(--ink); } }
.coupon__status { min-height: 1.5em; font-weight: 600; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.coupon__submit:disabled { opacity: 0.6; cursor: wait; }
.coupon.is-sent .coupon__fields > :not(.coupon__status) { display: none; }
.coupon.is-sent .coupon__status { font-family: var(--font-display); font-weight: 700; font-size: var(--step-statement); line-height: 1.1; }

/* ---------- footer ---------- */
.foot { background: var(--ink); color: var(--paper); padding-block: clamp(4rem, 8vw, 7rem) 2rem; }
.foot__mark { display: block; color: var(--paper); --flame: var(--orange); }
.foot__mark svg { width: 100%; height: auto; max-height: 34svh; }
.foot__cols { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); margin-top: 3.5rem; font-size: var(--step-small); }
.foot__cols ul { grid-column: span 2; display: grid; gap: 0.6rem; align-content: start; }
.foot__about { grid-column: 9 / -1; }
.foot__last small { font-size: inherit; }
.foot__last { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 4rem; font-size: var(--step-small); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-rise] { opacity: 0; transform: translateY(22px); animation: rise 800ms var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 90ms + 120ms); }
  .js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out); }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
  .js .step[data-reveal]:nth-child(2), .js .card[data-reveal]:nth-child(3n+2) { transition-delay: 80ms; }
  .js .step[data-reveal]:nth-child(3), .js .card[data-reveal]:nth-child(3n) { transition-delay: 160ms; }
  .js .step[data-reveal]:nth-child(4) { transition-delay: 240ms; }
  .js .shot[data-reveal]:nth-child(even) { transition-delay: 100ms; }
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- tablet ---------- */
/* ---------- the story: a closed tome that opens into a page-turning book ---------- */
.story {
  --story-ink: #3a2718;          /* page text, iron-gall brown */
  --story-gold: #c98a4b;         /* frames and rules */
  --story-night: #140c1e;        /* cover leather */
  --font-book: "EB Garamond", Georgia, "Times New Roman", serif;
  --font-engrave: "Cinzel", "Trajan Pro", Georgia, serif;
  position: relative; overflow: hidden; margin-bottom: var(--section);
  background: var(--ink);
  color: var(--paper);
}
.story__inner { display: grid; grid-template-columns: 6fr 6fr; align-items: center; gap: clamp(3rem, 6vw, 6rem); padding-block: clamp(5rem, 9vw, 8.5rem); }
.story__copy { display: grid; gap: 1.5rem; justify-items: start; }
.story__copy p { font-size: var(--step-lead); line-height: 1.38; max-width: 32ch; color: #e9e1ee; }
@media (hover: hover) and (pointer: fine) { .story__copy .button:hover { background: var(--yellow); color: var(--ink); } }

/* the closed tome (pure CSS 3D: cover, back, spine and page block) */
.tome { --w: clamp(14rem, 22vw, 19rem); --h: calc(var(--w) / 0.7); --t: calc(var(--w) * 0.13); justify-self: center; perspective: 1400px; padding: 1rem 2rem 3rem; }
.tome__body { position: relative; display: block; width: var(--w); height: var(--h); transform-style: preserve-3d; transform: rotateY(-30deg) rotateX(9deg) rotateZ(1deg); transition: transform 800ms var(--ease-out); }
.tome__cover, .tome__back { position: absolute; inset: 0; border-radius: 0.3rem 0.75rem 0.75rem 0.3rem; }
.tome__cover { transform: translateZ(calc(var(--t) / 2)); }
.tome__back { transform: translateZ(calc(var(--t) / -2)); background: var(--story-night); box-shadow: 2.5rem 3rem 4rem rgba(0, 0, 0, 0.55); }
.tome__spine { position: absolute; top: 0; left: calc(var(--t) / -2); width: var(--t); height: 100%; transform: rotateY(-90deg); background: linear-gradient(90deg, #0d0714, #2a1a3c 50%, #0d0714); border-radius: 0.3rem; }
.tome__edge { position: absolute; top: 1.2%; left: calc(var(--w) - var(--t) / 2 - 0.35rem); width: var(--t); height: 97.6%; transform: rotateY(90deg); background: repeating-linear-gradient(90deg, #f1e4c6 0 2px, #d5bf94 2px 3px); box-shadow: inset 0 0 1rem rgba(80, 50, 20, 0.35); }
@media (prefers-reduced-motion: no-preference) {
  .tome__body { animation: tome-float 6s ease-in-out infinite; }
  @keyframes tome-float { 50% { translate: 0 -0.6rem; } }
}
@media (hover: hover) and (pointer: fine) {
  .tome:hover .tome__body { transform: rotateY(-16deg) rotateX(5deg) rotateZ(0deg) scale(1.03); }
}

/* the cover art, shared by the tome and the book in the reader (sizes follow the cover's height) */
.cover { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 3%; padding: 12%; text-align: center; container-type: size; border-radius: inherit; color: var(--orange); background: radial-gradient(120% 75% at 50% 38%, #2d1b43 0%, #1a1028 58%, var(--story-night) 100%); box-shadow: inset 0.7rem 0 1rem -0.4rem rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.04); }
.cover::before, .cover::after { content: ""; position: absolute; pointer-events: none; }
.cover::before { inset: 4.5%; border: 2px solid var(--story-gold); border-radius: 0.2rem; opacity: 0.85; }
.cover::after { inset: 6.4%; border: 1px solid rgba(225, 84, 73, 0.55); }
.cover__corner { position: absolute; width: 7.5cqh; aspect-ratio: 1; background: var(--orange); -webkit-mask: url("assets/icons/tower.svg") center / contain no-repeat; mask: url("assets/icons/tower.svg") center / contain no-repeat; }
.cover__corner--tl { left: 9%; top: 6.5%; } .cover__corner--tr { right: 9%; top: 6.5%; }
.cover__corner--bl { left: 9%; bottom: 6.5%; } .cover__corner--br { right: 9%; bottom: 6.5%; }
.cover__eyebrow { font-family: var(--font-engrave); font-weight: 700; font-size: 2.3cqh; letter-spacing: 0.34em; margin-right: -0.34em; color: var(--yellow); text-transform: uppercase; }
.cover__title { font-family: var(--font-engrave); font-weight: 800; font-size: 11.5cqh; line-height: 0.95; text-shadow: 0 0.25cqh 0 #5a1c1a, 0 0 4cqh rgba(225, 84, 73, 0.45); }
.cover .tower { width: 15cqh; margin-top: 4cqh; color: #2b1b3e; --flame: var(--orange); filter: drop-shadow(0 0 2.5cqh rgba(225, 84, 73, 0.5)); }
.cover .tower path:first-child { stroke: var(--story-gold); stroke-width: 2.5; }

.ornament { position: relative; display: block; width: 62%; height: 1px; background: linear-gradient(90deg, transparent, var(--story-gold) 20% 80%, transparent); }
.ornament::before { content: ""; position: absolute; left: 50%; top: 50%; width: 0.55em; height: 0.55em; translate: -50% -50%; rotate: 45deg; background: var(--story-gold); box-shadow: 0 0 0 0.25em var(--story-night); }
.cover .ornament { font-size: 2cqh; width: 75%; }

/* ---------- the reader (a modal <dialog>) ---------- */
html.has-reader { overflow: hidden; }
.reader { --page-w: min(calc((100svh - 9.5rem) * 0.7), calc((100vw - 9rem) / 2), 31rem); --page-h: calc(var(--page-w) / 0.7);
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; background: transparent; color: var(--paper); font-family: var(--font-text); }
.reader[open] { display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; }
.reader::backdrop { background: radial-gradient(70% 60% at 50% 45%, rgba(52, 26, 58, 0.97), rgba(10, 6, 16, 0.99)); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.reader[open]::backdrop { animation: reader-fade 450ms ease both; }
@keyframes reader-fade { from { opacity: 0; } }

.reader__embers { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.reader__embers i { position: absolute; bottom: -1rem; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0.5rem 0.15rem rgba(225, 84, 73, 0.75); opacity: 0; animation: ember-rise var(--d) linear var(--delay) infinite; }
@keyframes ember-rise { 0% { transform: translate(0, 0); opacity: 0; } 12% { opacity: 0.9; } 100% { transform: translate(var(--dx), -105svh); opacity: 0; } }

.reader__close { position: absolute; top: 1.25rem; right: 1.25rem; z-index: 3; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: rgba(246, 243, 247, 0.08); transition: background-color var(--t-hover) ease; }
.reader__close svg, .reader__turn svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reader__nav { position: relative; z-index: 2; display: flex; align-items: center; gap: 1.5rem; padding: 0 1rem clamp(1.25rem, 3svh, 2rem); }
.reader__turn { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%; border: 1px solid rgba(201, 138, 75, 0.6); color: var(--paper); transition: background-color var(--t-hover) ease, opacity var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.reader__turn:active { transform: scale(0.94); }
.reader__turn:disabled { opacity: 0.25; cursor: default; }
.reader__count { min-width: 7.5rem; text-align: center; font-family: var(--font-engrave); font-weight: 700; font-size: var(--step-small); letter-spacing: 0.2em; text-transform: uppercase; color: #d9cbb3; }
@media (hover: hover) and (pointer: fine) {
  .reader__close:hover, .reader__turn:not(:disabled):hover { background: rgba(246, 243, 247, 0.16); }
}

.reader__stage { position: relative; z-index: 1; perspective: 2600px; opacity: 0; transform: translateY(4svh) scale(0.92); transition: opacity 600ms ease, transform 900ms var(--ease-out); }
.reader.is-shown .reader__stage { opacity: 1; transform: none; }

.book { position: relative; width: calc(var(--page-w) * 2); height: var(--page-h); transform-style: preserve-3d; cursor: pointer; transition: transform 1000ms cubic-bezier(0.45, 0.05, 0.25, 1); }
.book.is-closed { transform: translateX(calc(var(--page-w) * -0.5)); }
.book::after { content: ""; position: absolute; left: 4%; right: 4%; bottom: -5%; height: 8%; border-radius: 50%; background: rgba(0, 0, 0, 0.55); filter: blur(1.2rem); transform: translateZ(-2px); pointer-events: none; }
.book__source { display: none; }
.book__board { position: absolute; top: -1.2%; bottom: -1.2%; width: calc(50% + 1.2%); background: linear-gradient(90deg, #1b112a, var(--story-night)); transform: translateZ(-1px); transition: opacity 500ms ease 300ms; }
.book__board--left { left: -1.2%; border-radius: 0.75rem 0.2rem 0.2rem 0.75rem; }
.book__board--right { right: -1.2%; border-radius: 0.2rem 0.75rem 0.75rem 0.2rem; }
.book.is-closed .book__board { opacity: 0; transition-delay: 0ms; }
.book.no-anim, .book.no-anim .leaf, .book.no-anim .book__board { transition: none !important; }

.leaf { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; transform-origin: left center; transform-style: preserve-3d; transition: transform 1100ms cubic-bezier(0.45, 0.05, 0.25, 1); }
.leaf.is-flipped { transform: rotateY(-180deg); }
.leaf__face { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.leaf__face--back { transform: rotateY(180deg); }
.leaf__face::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent 60%); opacity: 0; }
.leaf__face--back::after { background: linear-gradient(270deg, rgba(0, 0, 0, 0.35), transparent 60%); }
.leaf.is-turning .leaf__face::after { animation: page-shade 1100ms ease-in-out; }
@keyframes page-shade { 50% { opacity: 1; } }

/* a page of the book: old paper; every size follows the page's height */
.page { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; container-type: size; padding: 8.5% 10% 6.5%; color: var(--story-ink); font-family: var(--font-book);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .24 0 0 0 0 .12 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(130% 95% at 50% 45%, #f8f0de 0%, #f0e3c6 62%, #e0cb9f 100%); }
.leaf__face--front .page { border-radius: 0 0.45rem 0.45rem 0; box-shadow: inset 2.2cqh 0 2.4cqh -1.6cqh rgba(90, 55, 20, 0.4), inset -1px 0 0 rgba(90, 55, 20, 0.2); }
.leaf__face--back .page { border-radius: 0.45rem 0 0 0.45rem; box-shadow: inset -2.2cqh 0 2.4cqh -1.6cqh rgba(90, 55, 20, 0.4), inset 1px 0 0 rgba(90, 55, 20, 0.2); }
.page__run { text-align: center; font-family: var(--font-engrave); font-weight: 700; font-size: 1.55cqh; letter-spacing: 0.32em; text-transform: uppercase; color: var(--ember); opacity: 0.75; }
.page__num { justify-self: center; font-family: var(--font-engrave); font-weight: 700; font-size: 1.9cqh; color: var(--ember); }
.page__num::before, .page__num::after { content: "·"; margin-inline: 0.6em; color: var(--story-gold); }
.page__text { display: grid; align-content: center; gap: 2.4cqh; }
.page__text p { max-width: none; font-size: 3.45cqh; line-height: 1.4; text-wrap: pretty; }
.page__text cite { font-style: italic; }
.page__text p::first-letter { float: left; margin: 0.4cqh 1.1cqh 0 0; padding: 0.6cqh 1.1cqh 0.2cqh; font-family: var(--font-engrave); font-weight: 800; font-size: 6.8cqh; line-height: 1; color: var(--orange); background: var(--ink); border: 0.5cqh double var(--story-gold); }

.page--title { grid-template-rows: none; place-content: center; justify-items: center; gap: 4%; text-align: center; }
.page__eyebrow { font-family: var(--font-engrave); font-weight: 700; font-size: 1.9cqh; letter-spacing: 0.34em; margin-right: -0.34em; text-transform: uppercase; color: var(--ember); }
.page__title { font-family: var(--font-engrave); font-weight: 800; font-size: 9cqh; line-height: 1; color: var(--orange); text-shadow: 0 0.3cqh 0 rgba(90, 28, 26, 0.35); }
.page--title .ornament { font-size: 1.8cqh; width: 55%; }
.page--title .ornament::before { box-shadow: 0 0 0 0.25em #f3e7cd; }
.page__byline { font-style: italic; font-size: 2.6cqh; }

.page--end .page__text { justify-items: center; text-align: center; gap: 4cqh; }
.page__text p.page__born { font-size: 4.4cqh; font-weight: 500; line-height: 1.2; }
.page__text p.page__born::first-letter { font-size: 8cqh; }
.page--end .tower { width: 13cqh; color: var(--ink); --flame: var(--orange); }
.page--end .button { font-size: 2.6cqh; min-height: 7cqh; padding-inline: 4cqh; }
@media (hover: hover) and (pointer: fine) { .page--end .button:hover { background: var(--ink); } }
.leaf.is-last .page--end .tower { animation: flame-glow 2.4s ease-in-out infinite; }
@keyframes flame-glow { 50% { filter: drop-shadow(0 0 2cqh rgba(225, 84, 73, 0.7)); } }

.page--cover { padding: 0; border-radius: 0.3rem 0.75rem 0.75rem 0.3rem; background: none; }
.page--endpaper { background: linear-gradient(90deg, #22163a, var(--story-night)); }

/* one page at a time on narrow screens: the turned page swings away to the left */
.book--single { width: var(--page-w); }
.book--single.is-closed { transform: none; }
.book--single .leaf { left: 0; width: 100%; }
.book--single .leaf.is-flipped { opacity: 0; transition: transform 1000ms cubic-bezier(0.45, 0.05, 0.25, 1), opacity 260ms ease 640ms; }
.book--single .book__board--left { display: none; }
.book--single .book__board--right { right: -2.4%; width: calc(100% + 2.4%); }

@media (max-width: 47.99em) {
  .story__inner { grid-template-columns: 1fr; gap: 1.5rem; padding-block: 4.5rem 3.5rem; }
  .story__copy { gap: 1.1rem; }
  .tome { --w: min(15rem, 62vw); padding-bottom: 2rem; }
  .reader { --page-w: min(calc(100vw - 2.5rem), calc((100svh - 9rem) * 0.7)); }
  .reader__close { top: 0.75rem; right: 0.75rem; }
  .reader__nav { gap: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .reader__stage, .book, .leaf, .book__board { transition-duration: 1ms !important; transition-delay: 0ms !important; }
  .reader__embers { display: none; }
  .leaf.is-turning .leaf__face::after { animation: none; }
}

@media (max-width: 64em) {
  .bar__nav { gap: 1.25rem; }
  .steps__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card--wide { grid-column: 1 / -1; }
  .card--wide .card__media { aspect-ratio: 16 / 9; flex: none; min-height: 0; }
  .machine { grid-template-columns: 1fr 1.2rem 1.4fr; }
  .duel { grid-template-columns: 1fr; justify-items: center; }
  .combat__grid { grid-template-columns: 1fr; min-height: 0; }
  .combat__copy { max-width: 40rem; }
}

/* ---------- phone ---------- */
@media (max-width: 52em) {
  .bar__nav { display: none; }
  .bar .button { margin-left: auto; }
}
@media (max-width: 47.99em) {
  .bar__inner { min-height: 4rem; }
  .bar__brand { width: 8rem; }
  .head { font-size: clamp(2.5rem, 11vw, 3.5rem); }

  .hero { grid-template-columns: 1fr; min-height: 0; padding-block: 2rem 4rem; gap: 2.5rem; }
  .hero__copy { gap: 1.25rem; }
  .hero__fact { font-size: 1.125rem; }
  .trailer__icon { width: 4.25rem; height: 4.25rem; margin: -2.125rem 0 0 -2.125rem; }

  .xp__head, .inside__head, .real__head { grid-template-columns: 1fr; gap: 1rem; }
  .real__grid { grid-template-columns: 1fr 1fr; grid-auto-rows: auto; gap: 0.75rem; }
  .shot--ropes, .shot--dips { grid-column: 1 / -1; aspect-ratio: 16 / 11; }
  .shot--situp, .shot--lunge { grid-column: auto; aspect-ratio: 4 / 5; }
  .shot figcaption { left: 0.65rem; bottom: 0.65rem; padding: 0.3rem 0.7rem; font-size: 0.8125rem; }
  .machine { grid-template-columns: 1fr; row-gap: 3.5rem; }
  .machine__sources { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .machine__stats { grid-column: 1; padding: 1rem 1.25rem; }
  .source { grid-template-columns: 1fr; row-gap: 0.25rem; padding: 0.9rem 1rem; }
  .source img { grid-row: auto; width: 2.5rem; height: 2.5rem; }
  .source.is-active { transform: translateY(-0.25rem); }
  .statrow { grid-template-columns: 1.25rem 5rem 1fr 4.5rem; gap: 0.6rem; }
  .machine__note { text-align: left; margin-left: 0; }

  .steps__list { grid-template-columns: 1fr; }

  .combat .merlons--wall { height: 2.5rem; -webkit-mask-size: 5rem 2.5rem; mask-size: 5rem 2.5rem; }
  .combat__grid { padding-block: 2.5rem 3rem; }
  .duel { font-size: 0.72rem; margin-top: 1rem; }

  .cards { grid-template-columns: 1fr; }

  .faq { grid-template-columns: 1fr; }
  .faq__title { grid-column: 1; position: static; max-width: none; margin-bottom: 1rem; }
  .faq__list { grid-column: 1; gap: 0.375rem; }
  .faq summary { min-height: 4rem; font-size: 1.125rem; padding: 0.9rem 3.5rem 0.9rem 1.25rem; }
  .faq details p { padding: 0 1.25rem 1.25rem; font-size: 1rem; }

  .coupon { grid-template-columns: 1fr; }
  .coupon::before, .coupon::after { left: calc(var(--notch) * -0.5); top: calc(13rem - var(--notch) / 2); }
  .coupon::after { left: auto; right: calc(var(--notch) * -0.5); bottom: auto; }
  .coupon__stub { min-height: 13rem; padding: 1.75rem 1.5rem; }
  .coupon__fields { border-left: 0; border-top: 0.35rem dotted var(--paper); padding: 1.75rem 1.5rem; }

  .foot__cols { grid-template-columns: 1fr 1fr; }
  .foot__cols ul { grid-column: span 1; }
  .foot__about { grid-column: 1 / -1; }
}
