/* ==================================================================
   Run for the Mind - design system (loaded first on every page)
   Applied from the organiser's DESIGN.md (a photography-first athletic
   system): white canvas, one black ink, one soft grey surface, a single
   towering uppercase display tier (Bebas Neue, the file's named stand-in
   for the proprietary display face) and a quiet 12-16px interface tier
   (Inter). Pill buttons, square flat cards, no shadows, hairline
   dividers; colour comes from photography, red only for errors and
   placeholders. Token names from earlier versions are kept as aliases
   so every page stylesheet follows.
   ================================================================== */

@font-face { font-family: "Bebas Fallback"; src: local("Impact"), local("Haettenschweiler"), local("Arial Narrow"); size-adjust: 84%; }
@font-face { font-family: "Inter Fallback"; src: local("Arial"), local("Helvetica"); size-adjust: 107%; }

:root {
  color-scheme: light;

  /* DESIGN.md colours */
  --canvas: #ffffff;
  --soft-cloud: #f5f5f5;
  --ink: #111111;
  --charcoal: #39393b;
  --ash: #4b4b4d;
  --mute: #707072;
  --stone-inverse: #9e9ea0;
  --hairline: #cacacb;
  --hairline-soft: #e5e5e5;
  --sale: #d30005;
  --success: #007d48;
  --on-primary: #ffffff;

  /* Names the components use (kept from earlier versions of this system) */
  --paper: var(--canvas); --paper-2: var(--soft-cloud); --night: var(--soft-cloud); --void: var(--ink);
  --ink-2: var(--charcoal); --stone: var(--mute); --line: var(--hairline-soft);
  --gold: var(--ink); --gold-2: var(--charcoal); --champagne: var(--mute); --mood: var(--mute);
  --danger: var(--sale); --on-gold: var(--on-primary);
  --hair: var(--hairline-soft); --hair-hover: var(--hairline); --corner: transparent;
  --bg: var(--canvas); --bg-2: var(--soft-cloud); --bg-3: var(--soft-cloud); --bg-deep: var(--soft-cloud);
  --surface: var(--soft-cloud); --surface-2: var(--soft-cloud);
  --glass: var(--canvas); --glass-border: var(--hairline-soft); --glass-blur: 0px;
  --text: var(--ink); --text-2: var(--charcoal); --white: #ffffff;
  --accent: var(--ink); --accent-deep: var(--ink); --accent-2: var(--ink); --accent-2-hover: var(--charcoal);
  --line-strong: var(--hairline);
  --warn: var(--sale); --warn-bg: rgb(211 0 5 / .05);
  --error: var(--sale); --error-bg: rgb(211 0 5 / .05); --success-bg: rgb(0 125 72 / .07);
  --focus: var(--ink); --shadow: none; --glow: none;
  --navy: var(--ink); --green: var(--ink); --green-deep: var(--ink); --green-soft: var(--ink); --muted: var(--mute);

  /* Type */
  --font-display: "Bebas Neue", "Bebas Fallback", "Anton", Impact, "Arial Narrow", sans-serif;
  --font-body: "Inter", "Inter Fallback", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: var(--font-body);           /* older rules ask for a serif; the system has none */
  --fs-display: clamp(3rem, 8vw, 6rem);     /* 96px desktop, 64px tablet, 48px phone; line-height .9 */
  --fs-h1: 2rem;
  --fs-h2: 2rem;
  --fs-h3: 1.5rem;
  --fs-lede: 1rem;
  --fs-eyebrow: .875rem;
  --fs-micro: .75rem;

  /* Layout: 8px grid, 48px section rhythm, square containers, pill controls */
  --container: 1440px;
  --gutter: clamp(16px, 4.2vw, 80px);
  --header-h: 64px;
  --section: clamp(24px, 4vw, 48px);
  --radius: 0px;
  --radius-sm: 8px;
  --radius-pill: 30px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body { margin: 0; padding-top: var(--header-h); background: var(--canvas); color: var(--ink); font-family: var(--font-body); font-size: 1rem; line-height: 1.5; overflow-x: clip; -webkit-font-smoothing: antialiased; }
::selection { background: var(--ink); color: var(--on-primary); }
a { color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--charcoal); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
img, video, canvas, svg { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 500; }
p { margin: 0 0 1em; }
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.container.reading { max-width: calc(72rem + 2 * var(--gutter)); }
.container.narrow { max-width: calc(50rem + 2 * var(--gutter)); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -100%; z-index: 100; background: var(--ink); color: var(--on-primary); padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) var(--radius-sm); text-decoration: none; font-size: .875rem; font-weight: 500; }
.skip-link:focus { top: 0; }

/* ---------- Type: one display tier, then 32 / 24 / 16 / 14 / 12 ---------- */
.display { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-display); line-height: .9; letter-spacing: -.005em; text-transform: uppercase; color: var(--ink); text-wrap: balance; margin: 0; }
.cinzel { font-family: var(--font-display); text-transform: uppercase; }
.h1, .h2 { font-family: var(--font-body); font-weight: 500; font-size: var(--fs-h2); line-height: 1.2; letter-spacing: 0; color: var(--ink); text-wrap: balance; margin: 0; }
.h3 { font-family: var(--font-body); font-weight: 500; font-size: var(--fs-h3); line-height: 1.2; color: var(--ink); margin: 0; }
.lede { font-size: 1rem; line-height: 1.5; color: var(--charcoal); max-width: 60ch; }
.eyebrow { display: block; margin: 0 0 .5rem; font-size: .875rem; font-weight: 500; line-height: 1.5; color: var(--mute); }
.eyebrow::after { display: none; }
.micro { font-size: .75rem; font-weight: 500; line-height: 1.5; color: var(--mute); }
.display em, .h1 em, .h2 em, .h3 em, .heading em { font-style: normal; font-weight: inherit; color: var(--mute); }
.heading .line { display: block; }
.heading .line > span { display: block; }
.serif { font-family: var(--font-body); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Buttons: pills only. Black primary, soft-cloud secondary, white on imagery ---------- */
.btn-gold, .btn-line, .btn-on-image { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: 12px 32px; border: 0; border-radius: var(--radius-pill); font-family: var(--font-body); font-size: 1rem; font-weight: 500; line-height: 1.5; text-decoration: none; cursor: pointer; transition: opacity .15s ease, transform .15s ease, background-color .15s ease; }
.btn-gold { background: var(--ink); color: var(--on-primary); }
.btn-gold:hover { background: var(--charcoal); color: var(--on-primary); }
.btn-line { background: var(--soft-cloud); color: var(--ink); }
.btn-line:hover { background: var(--hairline-soft); color: var(--ink); }
.btn-on-image { min-height: 48px; padding: 12px 24px; background: var(--canvas); color: var(--ink); }
.btn-on-image:hover { background: var(--soft-cloud); color: var(--ink); }
.btn-gold:active, .btn-line:active, .btn-on-image:active { transform: scale(.97); opacity: .5; }
.btn-gold[disabled], .btn-gold[aria-busy="true"] { opacity: .5; cursor: progress; }
.btn-gold.btn-lg { min-height: 56px; padding: 14px 36px; }
.btn-shimmer::before { display: none; }
.link-arrow { display: inline-flex; align-items: center; min-height: 44px; font-size: 1rem; font-weight: 500; line-height: 1.75; color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }
.link-arrow:hover { color: var(--charcoal); }
.link-on-image { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; color: #fff; text-decoration: underline; text-underline-offset: .2em; }
.link-on-image:hover { color: #fff; opacity: .8; }

/* ---------- Surfaces: flat, square, no shadow ---------- */
.glass { background: var(--canvas); border: 0; }
.corners::before, .corners::after { display: none; }
.light-pool { display: none; }
.lozenges { list-style: none; margin: 0; padding: 0; }
.lozenges li { position: relative; padding-left: 1.1rem; margin: .5rem 0; }
.lozenges li::before { content: ""; position: absolute; left: .15rem; top: .62em; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }
.tile { position: relative; background: var(--soft-cloud); border: 0; border-radius: 0; padding: 24px; }
.tile > :first-child { margin-top: 0; }
.tile > :last-child { margin-bottom: 0; }
.tile h3, .tile .tile-title { font-size: 1rem; font-weight: 500; line-height: 1.75; margin: 0 0 .25rem; }
.tile p { color: var(--charcoal); font-size: 1rem; }

/* ---------- Numbered rows: hairline dividers, small grey labels, medium values ---------- */
.rows { list-style: none; margin: 0; padding: 0; counter-reset: row; }
.rows > li, .rows > div { display: grid; grid-template-columns: 2rem minmax(6rem, 1fr) minmax(0, 2fr); gap: .25rem 1rem; align-items: baseline; padding: 16px 0; border-top: 1px solid var(--hairline); }
.rows > li:last-child, .rows > div:last-child { border-bottom: 1px solid var(--hairline); }
.rows > li::before, .rows > div::before { counter-increment: row; content: counter(row, decimal-leading-zero); font-size: .75rem; font-weight: 500; color: var(--mute); font-variant-numeric: tabular-nums; }
.rows .label, .rows dt { margin: 0; font-size: .875rem; font-weight: 500; color: var(--mute); }
.rows .value, .rows dd { margin: 0; font-size: 1rem; font-weight: 500; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.rows .value small { font-size: .875rem; font-weight: 400; color: var(--mute); }
.rows .value p { margin: 0; font-size: .875rem; font-weight: 400; color: var(--charcoal); }
@media (max-width: 40rem) {
  .rows:not(.compact) > li, .rows:not(.compact) > div { grid-template-columns: 2rem 1fr; }
  .rows:not(.compact) .value, .rows:not(.compact) dd { grid-column: 2; }
}

/* ---------- Page opening: caption, display title, body copy on the right ---------- */
.page-open { display: grid; gap: 1rem 3rem; align-items: end; padding-block: var(--section) 24px; margin-bottom: var(--section); border-bottom: 1px solid var(--hairline-soft); }
.page-open .lede { margin: 0; }
@media (min-width: 64rem) {
  .page-open { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .page-open .lede { justify-self: end; max-width: 44ch; padding-bottom: .35em; }
}

/* ---------- Progress rail ---------- */
.rail { list-style: none; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; counter-reset: step; min-height: 3.5rem; }
.rail li { border-top: 2px solid var(--hairline-soft); padding-top: 8px; font-size: .75rem; font-weight: 500; line-height: 1.5; color: var(--mute); }
.rail li::before { counter-increment: step; content: counter(step, decimal-leading-zero); display: block; font-variant-numeric: tabular-nums; }
.rail li.is-done { border-top-color: var(--hairline); color: var(--charcoal); }
.rail li[aria-current="step"] { border-top-color: var(--ink); color: var(--ink); }
@media (max-width: 44rem) {
  .rail li span { display: none; }
  .rail li[aria-current="step"] span { display: block; }
}

/* ---------- Placeholders still to be filled in config.js ---------- */
.is-placeholder { outline: 1.5px dashed var(--sale); outline-offset: 2px; background: rgb(211 0 5 / .05); color: var(--ink); border-radius: 2px; padding-inline: .15em; }
a.is-placeholder, .is-placeholder a { color: var(--ink); }

/* ---------- Reveal once: a plain fade (ui.js adds .js-reveal and .is-in) ---------- */
.js-reveal [data-reveal] { opacity: 0; transition: opacity .6s ease; transition-delay: calc(var(--i, 0) * 60ms); }
.js-reveal [data-reveal].is-in { opacity: 1; }

/* ---------- Primary navigation: white bar, 2px underline on the active link ---------- */
.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: var(--header-h); background: var(--canvas); box-shadow: inset 0 -1px 0 var(--hairline-soft); transition: transform .3s ease; }
.site-header.is-hidden { transform: translateY(-100%); }
.header-pill { display: flex; align-items: center; gap: 24px; height: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.wordmark { display: inline-flex; align-items: baseline; gap: .28em; font-family: var(--font-display); font-weight: 400; font-size: 1.75rem; line-height: 1; letter-spacing: .01em; text-transform: uppercase; color: var(--ink); text-decoration: none; white-space: nowrap; }
.wordmark:hover { color: var(--ink); }
.wordmark-for, .wordmark-mind { font-style: normal; color: inherit; }
.site-nav { display: none; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.btn-nav { min-height: 40px; padding: 8px 20px; font-size: .875rem; }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--soft-cloud); color: var(--ink); cursor: pointer; flex-shrink: 0; }
.nav-toggle svg { width: 1.25rem; height: 1.25rem; }
.nav-toggle[aria-expanded="true"] .icon-menu, .nav-toggle:not([aria-expanded="true"]) .icon-close { display: none; }
/* Phones: menu button left, wordmark centred, Register right; the menu is a full-height sheet */
@media (max-width: 63.99rem) {
  .header-pill { gap: 12px; }
  .nav-toggle { order: -1; }
  .header-pill > .wordmark { flex: 1; justify-content: center; font-size: 1.5rem; }
  .site-nav.is-open { display: flex; flex-direction: column; position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; padding: 8px var(--gutter) 32px; background: var(--canvas); overflow-y: auto; }
  .site-nav.is-open a { padding: 20px 0; font-size: 1.5rem; line-height: 1.2; border-bottom: 1px solid var(--hairline-soft); }
  .site-nav.is-open a[aria-current="page"] { text-decoration: underline; text-underline-offset: .25em; text-decoration-thickness: 2px; }
}
@media (min-width: 64rem) {
  .nav-toggle { display: none; }
  .site-nav { display: flex; gap: 24px; margin-inline: auto; }
  .site-nav a { padding: 6px 0; border-bottom: 2px solid transparent; font-size: 1rem; line-height: 1.5; }
  .site-nav a:hover, .site-nav a[aria-current="page"] { border-bottom-color: var(--ink); }
}

/* ---------- Footer: white, one hairline, four quiet columns, fine print ---------- */
.site-footer { margin-top: var(--section); background: var(--canvas); border-top: 1px solid var(--hairline); color: var(--mute); }
.site-footer a { color: var(--mute); font-weight: 500; text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.footer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; padding-block: 48px 32px; }
@media (min-width: 64rem) { .footer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.site-footer h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 500; line-height: 1.5; color: var(--ink); }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-links a, .site-footer p { font-size: .875rem; line-height: 1.5; }
.footer-links a[aria-current="page"] { color: var(--ink); }
.site-footer p a { text-decoration: underline; text-underline-offset: .2em; }
.footer-tagline { color: var(--ink); font-weight: 500; }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-block: 16px 24px; border-top: 1px solid var(--hairline); }
.footer-bottom p { margin: 0; font-size: .6875rem; line-height: 1.75; font-weight: 500; color: var(--mute); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js-reveal [data-reveal] { opacity: 1; transition: none; }
  .site-header, .btn-gold, .btn-line, .btn-on-image { transition: none; }
}
