/* ═══════════════════════════════════════════════════════════════
   RUSA — tokens copied verbatim from the design system.
   No colour appears on this site that is not declared here.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --paper:        #FBF8F3;
  --card:         #FFFFFF;
  --paper-raised: #FDFCFA;
  --sand:         #EDE4D4;
  --sand-deep:    #E4DCCE;
  --locked:       #F3ECDE;

  --trail-ahead:  #DED4C0;
  --trail-dash:   #C6B79C;

  --ink:         #2D2420;
  --ink-soft:    #4A4038;
  --stone-dark:  #6A6058;
  --stone:       #8A8070;
  --stone-light: #B0A898;
  --stone-pale:  #C4B8A8;
  --hairline:    #F5F2EE;

  --primary:       #22C55E;
  --primary-dark:  #1B9E4B;
  --primary-soft:  #BBEBCC;
  --primary-faint: #DCFCE7;
  --on-primary:    #FBF8F3;
  --on-workout:    #FBF8F3;

  /* Workout markers — each type owns exactly one colour. */
  --w-recovery:  #3D6B57;
  --w-easy:      #2E7D45;
  --w-intervals: #8A5A22;
  --w-threshold: #8C3B2E;
  --w-long:      #2C5061;
  --w-miniboss:  #4A3566;
  --w-boss:      #3B2A52;

  --danger:      #B5533C;
  --danger-text: #8C3B2E;
  --warning:      #C08A3E;
  --warning-text: #7A5320;
  --warning-bg:   #F6EAD2;
  --gold:         #E0B44C;

  /* Scrims — the same veils the app puts behind sheets and overlays. */
  --veil: rgba(251,248,243,0.88);

  --font: 'Familjen Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing and radii, from theme/layout.ts. Naming them once is what
     stops them drifting — the reason they were extracted in the app. */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   12px;
  --space-lg:   16px;
  --space-xl:   20px;
  --space-xxl:  24px;
  --space-xxxl: 32px;

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-xxl:  28px;
  --radius-pill: 99px;

  /* Rank tiers — one earthy progression, Jogger through Dasher. */
  --rank-1: #7A9B6E;
  --rank-2: #4E7C8A;
  --rank-3: #C08A3E;
  --rank-4: #B5533C;
  --rank-5: #6B4E7D;

  /* Type scale, from theme/typography.ts. The page adds one step above
     the app's largest — a phone never needs a 62px headline. */
  --text-micro:   10px;
  --text-label:   11px;
  --text-caption: 12px;
  --text-small:   13px;
  --text-body:    14px;
  --text-body-lg: 15px;
  --text-heading: 17px;
  --text-title:   20px;
  --text-title-lg: 22px;

  /* Letterspacing for the small ALL-CAPS labels, and for the wordmark. */
  --track-label:    1.6px;
  --track-wordmark: 4px;

  --shadow-card:  0 2px 8px rgba(0,0,0,0.06);
  --shadow-float: 0 4px 8px rgba(0,0,0,0.14);

  --wrap: 1040px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--font);
  font-weight: 400;
  font-size: var(--text-heading);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--primary-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }

:focus-visible {
  outline: 2.5px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--space-xxl);
}

/* ── Icons ──────────────────────────────────────────────────── */
/* The app's icon set, ported as an inline sprite: RUSA's own marks for
   the workouts and the logo, Lucide for interface chrome. Emoji were the
   thing that had to go — they render differently per platform, so the
   brand literally looked different depending on the device. */
.sprite { display: none; }

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

/* ── Utility type role: the app's signature label ───────────── */
.eyebrow {
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--stone-light);
  margin: 0 0 14px;
}

h1, h2, h3 { color: var(--ink); font-weight: 700; margin: 0 0 16px; }

h1 {
  font-size: clamp(38px, 7vw, 62px);
  line-height: 1.04;
  letter-spacing: -1.6px;
}

h2 {
  font-size: clamp(27px, 4vw, 36px);
  line-height: 1.14;
  letter-spacing: -0.8px;
}

h3 { font-size: var(--text-title); letter-spacing: -0.2px; margin-bottom: var(--space-sm); }

p { margin: 0 0 18px; }

.lede { font-size: clamp(17px, 2.2vw, 20px); color: var(--stone-dark); max-width: 54ch; }

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--veil);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--sand);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: var(--track-wordmark);
  font-size: var(--text-title);
}

.brand img { width: 32px; height: 32px; border-radius: var(--radius-sm); }

.header-spacer { flex: 1; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--space-lg) 30px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
}

.btn:active { transform: scale(0.97); }

.btn:disabled {
  background: var(--sand);
  color: var(--stone-pale);
  cursor: default;
}
.btn:disabled:active { transform: none; }

.btn--sm { font-size: var(--text-body); padding: 11px var(--space-xl); border-radius: var(--radius-lg); }

.btn--ghost {
  background: none;
  border: 1.5px solid var(--sand-deep);
  color: var(--stone-dark);
  font-weight: 500;
}

/* ── Sections ───────────────────────────────────────────────── */
section { padding: 82px 0; }
section + section { border-top: 1.5px solid var(--sand); }

.hero { padding: 74px 0 68px; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 48px;
  align-items: center;
}

.hero p.lede { margin-bottom: 28px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.hero-note {
  font-size: var(--text-small);
  color: var(--stone-light);
  margin: 18px 0 0;
}

/* ── The path: this site's signature element ────────────────── */
/* The logo is the path, so the page opens with the path itself
   drawing in, markers landing along it in workout-type colour. */
.trail { width: 100%; height: auto; overflow: visible; }

/* Every dimension below is the app's PathScreen value at 0.58 scale:
   path stroke 13, dashes 4/18, node borders 3 (4 on the next marker). */
.trail-line {
  fill: none;
  stroke: var(--trail-ahead);
  stroke-width: 7.5;
  stroke-linecap: round;
}

.trail-done {
  fill: none;
  stroke: var(--primary);
  stroke-width: 7.5;
  stroke-linecap: round;
}

/* The one segment still to unlock, dashed at the app's own rhythm —
   round caps on a 7.5 stroke every 12.7 turn it into a row of dots. */
.trail-frontier {
  fill: none;
  stroke: var(--trail-dash);
  stroke-width: 7.5;
  stroke-linecap: round;
  stroke-dasharray: 2.3 10.4;
}

/* Ahead of you: a cream disc waiting, not a hole in the path. */
.marker-ring { fill: var(--locked); stroke: var(--sand-deep); stroke-width: 1.75; }

/* A workout you have not reached still sits on top of the route, opaque:
   in the app a node blocks the trail behind it, so the path never reads as
   passing through a locked marker. Only the mark inside it is held back. */
.marker--locked .marker-icon--off { opacity: 0.73; }

/* The mark on a marker: light on a filled disc, held back on a locked one. */
.marker-icon        { fill: none; stroke-width: 2.67; stroke-linecap: round; stroke-linejoin: round; }
.marker-icon--on    { stroke: var(--on-workout); color: var(--on-workout); }
.marker-icon--off   { stroke: var(--stone-light); color: var(--stone-light); }

/* Green means ready everywhere in the app — the border, the completed
   trail — so the halo on the next workout says the same thing. */
.marker-halo { fill: var(--primary); opacity: 0.13; }

/* A challenge still ahead of you carries a second ring, in the border sand
   rather than a colour of its own — dashed or solid as the workout's plan
   data says. It is dropped once the workout is done, where the tick badge
   already tells the story. */
.challenge-ring { fill: none; stroke: var(--sand-deep); stroke-width: 1.75; }
.challenge-ring--dashed { stroke-dasharray: 5 4; }
.marker--locked .challenge-ring { opacity: 0.5; }

.done-badge circle { stroke: var(--paper); stroke-width: 1.45; }

/* Node labels: the title, then what the workout actually asks of you in
   its own colour. Locked ones fade back — they are not yours yet. */
.node-title {
  font-size: var(--text-small);
  font-weight: 700;
  fill: var(--stone);
}

.node-title--next { fill: var(--ink); }
.node-title--done { fill: var(--stone-pale); font-weight: 500; }

.node-sub {
  font-size: var(--text-label);
  font-weight: 700;
  fill: var(--stone);
}

.node-sub--done   { fill: var(--stone-pale); }
.node-sub--next   { fill: var(--w-threshold); }
.node-sub--locked { fill: var(--stone-light); }

.node-boss {
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.8px;
  fill: var(--stone);
}

.marker--locked .node-title,
.marker--locked .node-sub,
.marker--locked .node-boss { opacity: 0.45; }

/* Week rules: a quiet marker on the left, rule running right from it. The
   trail is allowed to cross them. */
.week-label {
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 2px;
  fill: var(--stone-pale);
}

.week-line { stroke: var(--sand-deep); stroke-width: 1.5; }

@media (prefers-reduced-motion: no-preference) {
  .trail-done {
    stroke-dasharray: var(--len);
    stroke-dashoffset: var(--len);
    animation: draw 2100ms cubic-bezier(0.4, 0, 0.2, 1) 180ms forwards;
  }
  /* The disc pops; the label just arrives with it, so the pop scales
     about the disc's own centre rather than the label's. */
  .marker { opacity: 0; animation: fade 420ms ease-out forwards; }
  .marker-node {
    animation: pop 420ms cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
    animation-delay: inherit;
  }
  .marker:nth-of-type(1) { animation-delay: 420ms; }
  .marker:nth-of-type(2) { animation-delay: 700ms; }
  .marker:nth-of-type(3) { animation-delay: 980ms; }
  .marker:nth-of-type(4) { animation-delay: 1260ms; }
  .marker:nth-of-type(5) { animation-delay: 1540ms; }
  .marker:nth-of-type(6) { animation-delay: 1820ms; }
  .marker:nth-of-type(7) { animation-delay: 2100ms; }
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes pop {
  from { transform: scale(0.55); }
  to   { transform: scale(1); }
}

.marker-node { transform-box: fill-box; transform-origin: center; }

/* ── The rank ladder ───────────────────────────────────────── */
/* The app's header pill, repeated once per tier: white on paper, ringed
   in the tier's own colour, so the ladder reads as one progression. */
.ranks {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xxl);
}

.rank-pill {
  background: var(--card);
  border: 2px solid;
  border-radius: var(--radius-pill);
  padding: 6px 13px;
  font-size: var(--text-small);
  font-weight: 700;
  color: var(--ink-soft);
}

.rank-pill span { color: var(--stone); }

/* ── Cards & grids ──────────────────────────────────────────── */
.grid { display: grid; gap: 18px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--card);
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-xl);
  padding: 26px;
  box-shadow: var(--shadow-card);
}

.card p:last-child { margin-bottom: 0; }

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 22px;
  margin-bottom: var(--space-lg);
  background: var(--primary-faint);
  color: var(--primary-dark);
}

/* ── Workout type list ──────────────────────────────────────── */
.types { display: flex; flex-direction: column; gap: 2px; }

.type-row {
  display: grid;
  grid-template-columns: 34px 1fr auto auto;
  gap: var(--space-lg);
  align-items: center;
  padding: 15px var(--space-xs);
  border-bottom: 1px solid var(--hairline);
}

.type-row:last-child { border-bottom: none; }

/* A miniature of the path marker: dark disc, light mark. Same discs the
   app draws along the route, so the legend and the path agree. */
.type-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 19px;
  color: var(--on-workout);
}

.type-name { font-weight: 700; color: var(--ink); font-size: 16px; }

.type-meta {
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--stone-light);
  white-space: nowrap;
}

.type-xp {
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary-dark);
  background: var(--primary-faint);
  border-radius: var(--radius-pill);
  padding: 3px 11px;
  white-space: nowrap;
}

/* ── Plan cards ─────────────────────────────────────────────── */
.plan-facts {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-lg);
}

.fact {
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--stone);
  background: var(--sand);
  border-radius: var(--radius-pill);
  padding: var(--space-xs) 11px;
}

/* ── Signup ─────────────────────────────────────────────────── */
.signup {
  background: var(--card);
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-xxl);
  padding: 44px;
  box-shadow: var(--shadow-card);
}

.signup-form { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }

.field {
  flex: 1 1 240px;
  font-family: var(--font);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-lg);
  padding: 15px 17px;
  transition: border-color 200ms ease;
}

.field::placeholder { color: var(--stone-pale); }
.field:hover { border-color: var(--sand-deep); }
.field:focus { outline: none; border-color: var(--primary-soft); background: var(--card); }

.consent {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: var(--text-small);
  color: var(--stone);
  line-height: 1.5;
}

.consent input {
  accent-color: var(--primary);
  width: 17px;
  height: 17px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.form-msg { font-size: var(--text-body); font-weight: 500; margin: 0; min-height: 21px; }
.form-msg[data-tone="ok"]   { color: var(--primary-dark); }
.form-msg[data-tone="err"]  { color: var(--danger-text); }
.form-msg[data-tone="info"] { color: var(--stone); }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1.5px solid var(--sand);
  padding: 40px 0 52px;
  font-size: var(--text-body);
  color: var(--stone-light);
}

.footer-links { display: flex; flex-wrap: wrap; gap: 22px; margin-bottom: 18px; }
.footer-links a { color: var(--stone-dark); text-decoration: none; font-weight: 500; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

/* ── Long-form document pages ───────────────────────────────── */
.doc { padding: 58px 0 82px; }
.doc .wrap { max-width: 760px; }
.doc h2 { font-size: var(--text-title-lg); margin-top: 42px; }
.doc h3 { font-size: var(--text-heading); margin-top: 26px; }
.doc ul { padding-left: 22px; margin: 0 0 18px; }
.doc li { margin-bottom: var(--space-sm); }
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 22px; }
.doc th, .doc td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--sand);
  font-size: var(--text-body-lg);
  vertical-align: top;
}
.doc th {
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--stone-light);
  border-bottom: 1.5px solid var(--sand-deep);
}
.updated { font-size: var(--text-small); color: var(--stone-light); margin-bottom: 30px; }

.callout {
  border-left: 4px solid var(--warning);
  background: var(--warning-bg);
  color: var(--warning-text);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  font-size: var(--text-body);
  margin: 0 0 24px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  section { padding: 62px 0; }
  .signup { padding: 30px 22px; border-radius: var(--radius-xxl); }
  .type-row { grid-template-columns: 34px 1fr auto; row-gap: var(--space-xs); }
  .type-meta { grid-column: 2 / -1; }
}

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