/* FORGE site: page layouts. Shared pieces are in forge.css.
   The 3D scenes read custom properties that forge.js updates from the
   pointer and from scroll; with no script they rest at the values here. */

/* ---- Home: hero ---------------------------------------------------- */

.hero {
  --rx: 4deg; --ry: -8deg; --scroll: 0;
  position: relative; min-height: min(880px, 100svh);
  padding-block: clamp(40px, 6vw, 72px) 40px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); align-items: center; gap: 32px;
}
.hero-copy { display: grid; gap: 28px; justify-items: start; position: relative; z-index: 2; }
.hero-title { --fs: clamp(68px, 10.4vw, 168px); line-height: 0.86; }
.js .hero-title { animation: rise var(--slow) var(--ease-out) both; }
.js .hero-copy > :not(.hero-title) { animation: rise var(--slow) var(--ease-out) 120ms both; }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } }

.platforms { display: flex; flex-wrap: wrap; gap: 8px 28px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--faint); }

.scene { position: relative; height: clamp(460px, 56vw, 700px); perspective: 1600px; }
.scene-stage {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry)) translateY(calc(var(--scroll) * -60px)) scale(calc(1 - var(--scroll) * 0.12));
  transition: transform 260ms ease-out;
}
.scene .phone, .scene .watch { position: absolute; }
.p-main { width: 43%; left: 28.5%; top: 2%; border-color: var(--line-accent); transform: translateZ(80px); box-shadow: 0 40px 120px #000; animation: float-a 6s ease-in-out infinite; }
.p-left { width: 33%; left: 2%; top: 17%; transform: translateX(calc(var(--scroll) * -70px)) translateZ(-120px) rotateY(24deg); animation: float-b 7s ease-in-out infinite; }
.p-right { width: 33%; right: 0; top: 14%; transform: translateX(calc(var(--scroll) * 70px)) translateZ(-80px) rotateY(-24deg); animation: float-b 8s ease-in-out infinite; }
.p-watch { width: 19%; left: 10%; bottom: 4%; transform: translateZ(160px) rotateY(14deg); animation: float-a 5s ease-in-out infinite; }
/* `translate` is animated on its own so it adds to each device's transform. */
@keyframes float-a { 50% { translate: 0 -14px; } }
@keyframes float-b { 0%, 100% { translate: 0 -8px; } 50% { translate: 0 10px; } }

.ring { position: absolute; left: 50%; top: 56%; aspect-ratio: 1; border-radius: 50%; translate: -50% -50%; }
.ring-a { width: 92%; border: 1px solid var(--line-strong); animation: spin 40s linear infinite; }
.ring-b { width: 62%; border: 1px dashed var(--line-accent); animation: spin 26s linear infinite reverse; }
.ring-c { width: min(400px, 90%); top: 50%; border: 1px solid var(--line-strong); }
@keyframes spin { from { transform: rotateX(72deg) rotateZ(0); } to { transform: rotateX(72deg) rotateZ(360deg); } }

.scene-hint { position: absolute; right: 0; bottom: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--faint); }
@media (hover: none) { .scene-hint { display: none; } }

/* ---- Home: marquee ------------------------------------------------- */

.marquee { overflow: hidden; padding: 22px 0; border-block: 1px solid var(--line); }
.marquee-track {
  display: flex; gap: 56px; width: max-content; white-space: nowrap;
  font-family: var(--font-display); font-size: calc(40px * var(--display-scale)); letter-spacing: 0.05em; color: var(--line-accent);
  animation: slide 40s linear infinite;
}
.marquee-track .hot { color: var(--accent); }
@keyframes slide { to { transform: translateX(-50%); } }

/* ---- Home: pinned phone and chapters ------------------------------- */

.flow { padding-block: var(--section) 40px; }
.flow > h2 { max-width: 14ch; margin-bottom: clamp(40px, 6vw, 72px); }
.flow-grid { --progress: 0; display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); }
.flow-stick { position: sticky; top: 112px; align-self: start; display: flex; gap: 20px; perspective: 1400px; }
.rail { position: relative; width: 2px; background: var(--line); }
.rail span { position: absolute; inset: 0 0 auto; height: calc(var(--progress) * 100%); background: var(--accent); }
.flow-phone { position: relative; width: min(320px, 100%); aspect-ratio: 480 / 1043; border-color: var(--line-accent); padding: 8px; transform: rotateY(calc((var(--progress) - 0.5) * -14deg)); }
.flow-phone img {
  position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: cover;
  opacity: 0; transform: translateY(24px) scale(0.96);
  transition: opacity 500ms var(--ease-out), transform 700ms var(--ease-out);
}
.flow-phone img.is-on { opacity: 1; transform: none; }

.chapter { min-height: 68vh; padding: 24px 0 72px; border-top: 1px solid var(--line); display: grid; gap: 18px; align-content: start; transition: border-color var(--fast); }
.chapter.is-active { border-top-color: var(--line-accent); }
.chapter.is-active > .tag { color: var(--accent); }
.chapter p { max-width: 56ch; font-size: 18px; color: var(--muted); }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; max-width: 580px; margin-top: 8px; }
.points li { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); font-size: 15px; }
.chapter-shot { display: none; }

@media (max-width: 900px) {
  .flow-grid { grid-template-columns: minmax(0, 1fr); }
  .flow-stick { display: none; }
  .chapter { min-height: 0; }
  .chapter-shot { display: block; width: min(260px, 70%); margin: 16px auto 0; }
}

/* ---- Home: watch band, library, languages -------------------------- */

.band { border-top: 1px solid var(--line); background: var(--surface); }
.band-row { padding-block: var(--section); display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: center; gap: clamp(32px, 6vw, 64px); }
.band-art { position: relative; min-height: 420px; display: grid; place-items: center; perspective: 1200px; }
.band-art .watch { width: min(240px, 60%); }
.tilt { transform: rotateY(-22deg) rotateX(8deg); animation: float-a 6s ease-in-out infinite; }
.band-copy { display: grid; gap: 20px; }

.library { padding-block: var(--section); }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.ex-card {
  --mx: 50%; --my: 50%;
  position: relative; min-height: 190px; padding: 22px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface);
  display: grid; gap: 10px; align-content: space-between; overflow: hidden;
  transition: border-color var(--fast), transform var(--fast) var(--ease-out);
}
.ex-card:hover { border-color: var(--line-accent); transform: translateY(-4px); color: var(--text); }
/* A soft light that follows the pointer across the card. */
.ex-card::before { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity var(--fast); background: radial-gradient(240px circle at var(--mx) var(--my), #d7ff641f, transparent 70%); }
.ex-card:hover::before { opacity: 1; }
.ex-card > * { position: relative; }
.ex-top { display: flex; justify-content: space-between; gap: 12px; }
.ex-card forge-figure { width: 100%; aspect-ratio: 5 / 4; }
.ex-name { font-size: 22px; font-weight: 600; line-height: 1.15; }
.ex-muscles { font-size: 14px; color: var(--muted); }
.ex-card[hidden] { display: none; }

.langs { border-block: 1px solid var(--line); }
.langs-row { padding-block: 72px; display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); align-items: center; gap: 40px; }
.langs h2.display { --fs: 56px; }
@media (max-width: 760px) { .langs-row { grid-template-columns: minmax(0, 1fr); } }

/* ---- Features ------------------------------------------------------ */

.layers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 20px; padding-bottom: var(--section); }
.layer { border: 1px solid var(--line); border-radius: 32px; background: var(--surface); padding: clamp(28px, 4vw, 48px) clamp(28px, 4vw, 48px) 0; display: grid; gap: 28px; overflow: hidden; }
.layer-copy { display: grid; gap: 16px; align-content: start; justify-items: start; }
.layer h2.display { --fs: clamp(40px, 4vw, 56px); }
.layer p { color: var(--muted); }
.layer-art { --tilt: 0; perspective: 1200px; display: grid; justify-items: center; }
.layer-art .phone { width: min(260px, 80%); margin-bottom: -38%; transform: rotateY(calc(var(--tilt) * 18deg)) rotateX(calc(var(--tilt) * -6deg)); transition: transform 200ms ease-out; }
.layer-art .watch { width: min(200px, 60%); margin-bottom: 40px; transform: rotateY(calc(var(--tilt) * 24deg)); transition: transform 200ms ease-out; }
.layer-wide { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: center; border-color: var(--line-accent); }
.layer-wide h2.display { --fs: clamp(44px, 5.4vw, 76px); }
.layer-wide .layer-art .phone { margin-bottom: -20%; }
.layer-accent { background: var(--accent); color: var(--ground); border-color: var(--accent); }
.layer-accent p, .layer-accent .tag { color: var(--ground); }
.layer-accent .phone { border-color: var(--ground); }

/* ---- Pro ----------------------------------------------------------- */

.plans { display: grid; gap: 40px; justify-items: center; }
.billing { margin: 0; padding: 6px; border: 1px solid var(--line-strong); border-radius: 32px; display: flex; gap: 6px; }
.billing input { position: absolute; opacity: 0; }
.billing label { cursor: pointer; display: inline-flex; align-items: center; min-height: 48px; padding: 0 24px; border-radius: 24px; font-size: 15px; font-weight: 700; }
.billing input:checked + label { background: var(--accent); color: var(--ground); }
.billing input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 3px; }

.plan-grid { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 20px; }
.plan { border: 1px solid var(--line); border-radius: 32px; background: var(--surface); padding: clamp(28px, 4vw, 40px); display: grid; gap: 24px; align-content: start; }
.plan h2.display { --fs: 48px; }
.plan-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; color: var(--muted); }
.price .display { --fs: clamp(64px, 8vw, 96px); color: var(--text); }
.ticks { display: grid; gap: 14px; }
.ticks li { display: grid; grid-template-columns: 16px 1fr; gap: 12px; }
.ticks li::before { content: '+'; color: var(--accent); font-family: var(--font-mono); }
.plan .btn { margin-top: auto; }
.plan-pro { background: var(--accent); color: var(--ground); border-color: var(--accent); }
.plan-pro .price, .plan-pro .price .display, .plan-pro .ticks li::before { color: var(--ground); }
.badge { padding: 8px 14px; border-radius: 18px; background: var(--ground); color: var(--accent); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; }
.note { font-size: 13px; line-height: 1.5; }
.price-month { display: none; }
.plans:has(#bill-month:checked) .price-year { display: none; }
.plans:has(#bill-month:checked) .price-month { display: flex; }

.compare { padding-top: var(--section); display: grid; gap: 32px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 24px; }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 16px; }
th, td { padding: 18px 24px; text-align: center; }
th:first-child { text-align: left; font-weight: 500; }
thead th { background: var(--surface); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--faint); }
tbody tr { border-top: 1px solid var(--line); }
.is-pro { color: var(--accent); }
.is-off { color: var(--faint); }

/* ---- Exercise library and exercise page ---------------------------- */

.library-head { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); align-items: end; }
.search { display: grid; gap: 8px; }
.search label, .count { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--faint); }
.search input { width: 100%; height: 56px; padding: 0 20px; border: 1px solid var(--line-accent); border-radius: 28px; background: var(--surface); font-size: 16px; }
.search input::placeholder { color: var(--faint); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.chip-btn { cursor: pointer; min-height: 48px; padding: 0 20px; border: 1px solid var(--line-strong); border-radius: 24px; background: transparent; font-size: 15px; font-weight: 600; }
.chip-btn[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.count { padding: 24px 0; text-transform: uppercase; }
.empty { padding: 48px 0; color: var(--muted); }

.exercise { padding-bottom: var(--section); }
.exercise-head { padding-block: 48px 64px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: center; gap: clamp(32px, 5vw, 56px); }
.exercise-head > div { display: grid; gap: 24px; }
.exercise-title { --fs: clamp(60px, 9vw, 152px); line-height: 0.86; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.facts > div { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.facts dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--faint); }
.facts dd { margin-top: 6px; font-weight: 600; }
.figure-stage { position: relative; aspect-ratio: 1; max-height: 560px; border: 1px solid var(--line-strong); border-radius: 32px; background: var(--surface); overflow: hidden; }
.figure-stage figcaption { position: absolute; inset: 24px 24px auto; display: flex; justify-content: space-between; gap: 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--faint); }
.figure-stage forge-figure { width: 100%; height: 100%; }

.exercise-body { padding-top: 64px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: clamp(32px, 5vw, 64px); }
.exercise-main { display: grid; gap: 72px; align-content: start; }
.exercise-main h2.display { --fs: 56px; margin-bottom: 24px; }
.steps { counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 22px 0; border-top: 1px solid var(--line); }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(step, decimal-leading-zero); font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--accent); }
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.notes li { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); font-size: 16px; }
.exercise-side { display: grid; gap: 20px; align-content: start; }
.side-card { padding: 28px; border: 1px solid var(--line); border-radius: 28px; display: grid; gap: 14px; }
.side-app { border-color: var(--line-accent); background: var(--raised); }
.side-app h2.display { --fs: 40px; }
.side-app p { font-size: 15px; color: var(--muted); }
.phone.crop { padding: 0; border-width: 1px; border-radius: 20px; max-height: 380px; overflow: hidden; }
.phone.crop img { border-radius: 0; object-fit: cover; object-position: top; }
.row-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; font-weight: 600; border-bottom: 1px solid var(--line); }
.side-card .chips > a { min-height: 40px; padding: 0 14px; font-size: 14px; }
@media (max-width: 900px) { .exercise-body { grid-template-columns: minmax(0, 1fr); } }
