/* OniFit website. Colors and fonts come from the app design system (design/bbfit-tokens.css). */

@font-face {
  font-family: 'Boldonse';
  src: url('/fonts/Boldonse-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --ground: #0a0c0b;
  --surface: #131714;
  --surface-raised: #1c211d;
  --line: #2a312b;
  --ink: #f2f5ee;
  --ink-muted: #a6aea1;
  --volt: #c8f135;
  --on-volt: #0a0c0b;
  --gold: #ffc83d;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1160px;
  --font-sans: -apple-system, 'SF Pro Display', 'SF Pro Text', system-ui, 'Segoe UI', Roboto, sans-serif;
  --font-brand: 'Boldonse', 'SF Pro Display', system-ui, sans-serif;
  /* Elastic motion, as in the app. */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 17px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-muted); }
.small { font-size: 14px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--volt); color: var(--on-volt); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--volt); outline-offset: 3px; }

/* Header and footer */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 24px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--ground) 80%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.top nav { display: flex; gap: 24px; margin-left: auto; }
.top nav a { text-decoration: none; color: var(--ink-muted); font-weight: 500; }
.top nav a:hover { color: var(--ink); }
.lang { display: flex; gap: 2px; }
.lang a { padding: 6px 8px; border-radius: 8px; color: var(--ink-muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.lang a:hover { color: var(--ink); }
.lang a[aria-current] { color: var(--volt); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 22px/1 var(--font-brand); }
.brand .logo { width: 36px; height: auto; }
.brand .logo path { fill: var(--volt); }
@media (max-width: 760px) { .top { gap: 8px; } .top nav { display: none; } .lang { margin-left: auto; } .top .button { white-space: nowrap; } }

.foot {
  display: grid; gap: 24px; grid-template-columns: 1fr 2fr;
  max-width: var(--max); margin: 96px auto 0; padding: 48px var(--gutter);
  border-top: 1px solid var(--line);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 12px 24px; align-content: start; }
.foot nav a { color: var(--ink-muted); text-decoration: none; }
.foot nav a:hover { color: var(--ink); }
.foot > p { grid-column: 1 / -1; margin: 0; }
@media (max-width: 760px) { .foot { grid-template-columns: 1fr; } }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: 999px;
  background: var(--volt); color: var(--on-volt);
  font-weight: 700; text-decoration: none;
  transition: background-color 0.15s, transform 0.1s;
}
.button:hover { background: color-mix(in srgb, var(--volt) 82%, white); }
.button:active { transform: scale(0.98); }
.button.small { min-height: 40px; padding: 0 18px; font-size: 15px; }
.button.ghost { background: var(--surface-raised); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.button.ghost:hover { background: color-mix(in srgb, var(--surface-raised) 88%, white); }
.store { display: flex; flex-wrap: wrap; gap: 12px; }
.store .button { min-width: 210px; }
.store .button span { display: grid; text-align: left; line-height: 1.15; }
.store .button small { font-weight: 500; font-size: 12px; opacity: 0.75; }
/* Store buttons: on hover, the label rolls down like a slot-machine reel and the store name comes in from above. */
.store .slot { overflow: hidden; align-items: center; }
.store .slot > span { grid-area: 1 / 1; transition: transform 0.38s cubic-bezier(0.3, 1.35, 0.5, 1); }
.store .slot-alt { font-size: 18px; transform: translateY(-200%); }
.store .button:hover .slot > span:first-child,
.store .button:focus-visible .slot > span:first-child { transform: translateY(130%); }
.store .button:hover .slot-alt,
.store .button:focus-visible .slot-alt { transform: none; transition-delay: 0.04s; }

/* Sections */
.section { max-width: var(--max); margin: 0 auto; padding: clamp(112px, 14vw, 168px) var(--gutter) 0; }
/* Boldonse has tall glyphs: below a line height of about 1.35, the lines touch. */
.section > h2, .section-head h2 {
  font-size: clamp(34px, 5vw, 64px); font-weight: 700; line-height: 1.04; letter-spacing: -0.035em;
  max-width: 15ch; margin-bottom: 0.4em; text-wrap: balance;
}
/* The second part of a title is muted: one accent color per screen is enough. */
.section > h2 .volt, .section-head h2 .volt { color: var(--ink-muted); }
.lead-title { font: clamp(30px, 5vw, 56px)/1.35 var(--font-brand); }
.lead { font-size: clamp(18px, 2.2vw, 21px); color: var(--ink-muted); max-width: 640px; }
.volt { color: var(--volt); }

/* Hero: image when it exists, a volt glow otherwise. */
.hero {
  position: relative; isolation: isolate;
  min-height: min(88vh, 860px);
  display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 48px;
  max-width: var(--max); margin: 0 auto; padding: 72px var(--gutter) 48px;
}
.hero::before {
  content: ''; position: absolute; inset: 0 calc(50% - 50vw); z-index: -1;
  background:
    linear-gradient(90deg, var(--ground) 30%, color-mix(in srgb, var(--ground) 40%, transparent) 70%, var(--ground)),
    linear-gradient(0deg, var(--ground), transparent 35%),
    url('/img/hero.webp') right center / cover no-repeat,
    radial-gradient(60% 70% at 78% 45%, color-mix(in srgb, var(--volt) 22%, transparent), transparent 70%);
}
.hero h1 { font: clamp(40px, 7.4vw, 84px)/1.35 var(--font-brand); margin-bottom: 24px; }
.hero .lead { margin-bottom: 32px; }
.hero .note { margin-top: 16px; font-size: 14px; color: var(--ink-muted); }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 48px; } }

/* Phone frame around an app screenshot. */
.phone {
  justify-self: center;
  width: min(300px, 72vw); aspect-ratio: 9 / 19.5;
  border-radius: 46px; padding: 12px;
  background: linear-gradient(145deg, #2b312c, #0e110f);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.8s var(--spring);
}
.phone:hover { transform: translateY(-8px); }
.phone .screen {
  width: 100%; height: 100%; border-radius: 36px; overflow: hidden;
  background: radial-gradient(80% 50% at 50% 30%, color-mix(in srgb, var(--volt) 18%, var(--surface)), var(--ground));
  display: grid; place-items: center;
}
/* Phone with a real screenshot of the app (npm run site:screens). */
/* The frame is a thin black bezel with a metal edge, an island and a side button. Its height follows the screenshot. */
.phone:has(> img.screen) {
  position: relative; aspect-ratio: auto; padding: 9px; border-radius: 54px;
  background: #030403;
  box-shadow: 0 0 0 2px #3b423c, 0 0 0 3px #161a17, 0 40px 90px rgba(0, 0, 0, 0.55);
}
/* The island, in the top margin of the screen. */
.phone:has(> img.screen)::before {
  content: ""; position: absolute; top: 19px; left: 50%; transform: translateX(-50%);
  width: 30%; height: 24px; border-radius: 12px; background: #000;
}
/* The side button. */
.phone:has(> img.screen)::after {
  content: ""; position: absolute; right: -5px; top: 26%; width: 3px; height: 64px;
  border-radius: 0 2px 2px 0; background: #3b423c;
}
/* The screenshot uses the full width and touches the bottom of the screen. A screenshot of the web app has no status */
/* bar: a top margin (13.5 % of the width) holds the island and has the background color of the app. */
.phone img.screen {
  display: block; box-sizing: border-box; width: 100%; height: auto;
  padding-top: 13.5%; border-radius: 46px; background: var(--ground);
}
/* A screenshot of an iPhone (class real) keeps the height of its status bar: no margin. Paint the status bar in the */
/* background color before you publish it: the frame shows only its own island. */
.phone img.screen.real { padding-top: 0; }

/* Screens section: two phones side by side, the second one lower. The text is under each phone. */
.shots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 48px; margin-top: 64px; }
.shot { margin: 0; display: grid; gap: 32px; justify-items: center; align-content: start; }
.shot:nth-child(2) { margin-top: 96px; }
.shot .phone.small { width: min(270px, 70vw); }
.shot figcaption { width: min(270px, 70vw); }
.shot h3 { font-size: 19px; font-weight: 650; margin-bottom: 6px; }
.shot p { color: var(--ink-muted); margin: 0; font-size: 16px; }
@media (max-width: 760px) { .shots { grid-template-columns: 1fr; gap: 72px; } .shot:nth-child(2) { margin-top: 0; } }
.phone .screen .logo { width: 40%; }
.phone .screen .logo path { fill: var(--volt); }

/* Steps: three columns under a thin line, no boxes. */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-top: 56px; counter-reset: step; }
.step { border-top: 1px solid var(--line); padding-top: 24px; }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  display: block; margin-bottom: 28px;
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--volt);
}
.step h3 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.step p { color: var(--ink-muted); margin: 0; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; gap: 32px; } }

/* Features: the title stays on the left while the list scrolls on the right. */
#features { display: grid; grid-template-columns: 5fr 7fr; gap: 0 64px; align-items: start; }
#features > h2 { position: sticky; top: 120px; }
.features { display: grid; }
.feature {
  display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: center;
  padding: 28px 0; border-top: 1px solid var(--line);
}
.feature:last-child { border-bottom: 1px solid var(--line); }
/* The frame stays still; on hover, the picture zooms a little inside it. */
.feature .art { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-md); overflow: hidden; }
.feature .art::before {
  content: ""; position: absolute; inset: 0;
  background: var(--art, none) center / cover, radial-gradient(70% 90% at 30% 20%, color-mix(in srgb, var(--volt) 16%, var(--surface-raised)), var(--surface-raised));
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.feature:hover .art::before { transform: scale(1.06); }
/* Feature images (website/img), see docs/WEBSITE.md. */
.art-recovery { --art: url('/img/recovery.webp'); }
.art-loads { --art: url('/img/loads.webp'); }
.art-midset { --art: url('/img/midset.webp'); }
.art-gym { --art: url('/img/gym.webp'); }
.art-knees { --art: url('/img/knees.webp'); }
.art-records { --art: url('/img/records.webp'); }
.feature h3 { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; }
.feature p { color: var(--ink-muted); margin: 0; }
@media (max-width: 960px) {
  #features { grid-template-columns: 1fr; }
  #features > h2 { position: static; }
}
@media (max-width: 560px) {
  .feature { grid-template-columns: 96px 1fr; gap: 18px; align-items: start; padding: 22px 0; }
  .feature .art { aspect-ratio: 1; border-radius: 12px; }
  .feature h3 { font-size: 18px; }
  .feature p { font-size: 15px; }
}

/* Wide image band with a quote, from edge to edge. */
.band {
  position: relative; isolation: isolate; overflow: hidden;
  margin-top: clamp(112px, 14vw, 168px);
  min-height: min(78vh, 680px); display: grid; align-items: end;
  padding: 64px max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
}
.band::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(0deg, var(--ground), rgba(10, 12, 11, 0.55) 45%, rgba(10, 12, 11, 0.15) 75%, var(--ground)),
    url('/img/band.webp') center / cover,
    radial-gradient(60% 80% at 70% 30%, color-mix(in srgb, var(--gold) 20%, transparent), var(--surface));
}
.band p { font-size: clamp(28px, 4.4vw, 56px); font-weight: 700; line-height: 1.08; letter-spacing: -0.035em; max-width: 18ch; margin: 0; text-wrap: balance; }
.band p .volt { color: var(--volt); }
@media (max-width: 860px) { .band { min-height: 440px; padding-bottom: 40px; } }

/* Values */
.values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-top: 40px; }
.value { border-top: 1px solid var(--line); padding-top: 20px; }
.value h3 { font-size: 19px; font-weight: 650; }
.value p { color: var(--ink-muted); margin: 0; }
@media (max-width: 760px) { .values { grid-template-columns: 1fr; gap: 28px; } }

/* Last call: a volt block with dark text. */
.cta {
  background: var(--volt); color: var(--on-volt);
  border-radius: var(--radius-xl); padding: clamp(40px, 7vw, 88px);
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px 48px; align-items: end;
}
.cta .lead-title { margin: 0; max-width: 12ch; grid-row: span 2; }
.cta .lead { color: color-mix(in srgb, var(--on-volt) 72%, var(--volt)); margin: 0 0 24px; }
.cta .store { margin: 0; }
.cta .button { background: var(--on-volt); color: var(--ink); }
.cta .button.ghost { background: transparent; color: var(--on-volt); border-color: color-mix(in srgb, var(--on-volt) 35%, transparent); }
.cta :focus-visible { outline-color: var(--on-volt); }
@media (max-width: 860px) { .cta { grid-template-columns: 1fr; } }

/* Elements rise into view while the page scrolls. CSS only: the security policy blocks scripts. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .step, .shot, .feature, .value, .band p, .cta {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
  }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(48px); }
  to { opacity: 1; transform: none; }
}

/* Legal and help pages */
.prose { max-width: 760px; margin: 0 auto; padding: 64px var(--gutter) 0; }
.prose h1 { font: clamp(30px, 5vw, 44px)/1.4 var(--font-brand); margin-bottom: 8px; }
.prose h2 { font-size: 24px; margin-top: 48px; }
.prose h3 { font-size: 19px; margin-top: 28px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { color: var(--ink-muted); font-weight: 600; }
.prose .updated { color: var(--ink-muted); font-size: 15px; }
.prose .callout { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--volt); border-radius: var(--radius-md); padding: 16px 20px; margin: 24px 0; }
.prose details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 4px 20px; margin: 12px 0; }
.prose summary { cursor: pointer; font-weight: 600; padding: 14px 0; }
.prose details p { color: var(--ink-muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* Opening of the home page (build-site.mjs, gate()). Only on the home page, with scroll-driven animations and without
   reduced motion: elsewhere the gate stays hidden and the page is the plain site. During the first screen of scroll,
   the site stays in place (it moves up as fast as the page scrolls, over a spacer of one screen), fades in from
   nothing and comes a little closer, and the gate grows around it until the opening fills the screen.
   website/gate.js then removes the gate (class "entered" on <html>): scrolling back up stops at the top of the site.
   Without the script, the page stops at the top of the site once (scroll snap) before the gate closes again. */
.gate, .gate-space, .gate-end { display: none; }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .gate {
      display: block; position: fixed; inset: 0; z-index: 50; pointer-events: none;
      animation: gate-out linear both; animation-timeline: scroll(root); animation-range: 0 100vh;
    }
    .gate svg { position: absolute; inset: 0; width: 100%; height: 100%; }
    @media (max-aspect-ratio: 1/1) { .gate svg { left: -35%; width: 170%; } }
    .gate-zoom {
      transform-box: view-box; transform-origin: 237px 238px;
      animation: gate-zoom cubic-bezier(0.6, 0, 0.95, 0.5) both; animation-timeline: scroll(root); animation-range: 0 100vh;
    }
    .gate-cue {
      position: absolute; left: 0; right: 0; bottom: max(28px, env(safe-area-inset-bottom)); margin: 0;
      text-align: center; color: var(--ink-muted); font-weight: 500; letter-spacing: 0.02em;
      animation: gate-cue linear both; animation-timeline: scroll(root); animation-range: 0 100vh;
    }
    .gate-space { display: block; height: 100vh; }
    html:has(.gate-end) { scroll-snap-type: y proximity; }
    .gate-end { display: block; height: 1px; margin-top: -1px; scroll-snap-align: start; scroll-snap-stop: always; }
    /* Only the site that follows the gate: the other pages have no gate. */
    .gate-end ~ .site {
      transform-origin: 50% 50vh;
      animation: site-in linear both; animation-timeline: scroll(root); animation-range: 0 100vh;
    }
    /* After the gate (gate.js). */
    html.entered { scroll-snap-type: none; }
    .entered .gate, .entered .gate-space, .entered .gate-end { display: none; }
    .entered .gate-end ~ .site { animation: none; }
  }
}
@keyframes gate-zoom { from { transform: scale(1); } to { transform: scale(32); } }
@keyframes gate-out { 0%, 82% { opacity: 1; visibility: visible; } 99% { opacity: 0; } 100% { opacity: 0; visibility: hidden; } }
@keyframes gate-cue { from { opacity: 1; } 12% { opacity: 0; } to { opacity: 0; } }
/* The translation cancels the scroll (linear: -20vh at 80 %). The zoom ends at 80 %, before the gate fades out: the
   sticky header then sits exactly at the top of the screen. */
@keyframes site-in {
  from { opacity: 0; transform: translateY(-100vh) scale(1.12); }
  35% { opacity: 1; }
  80% { transform: translateY(-20vh) scale(1); }
  to { opacity: 1; transform: none; }
}
  23.333% { opacity: 1; }
  66.667% { transform: translateY(-50vh) scale(1); }
  to { opacity: 1; transform: none; }
}
  35% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
