/* ==========================================================================
   La Spartanière — stylesheet
   Design tokens first, then base, layout, components, sections, responsive.
   ========================================================================== */

:root {
  /* Brand colours */
  --pine: #1F4334;
  --pine-dark: #163025;
  --white: #FAF9F5;
  --granite: #42474B;
  --gold: #C79A3B;
  --gold-ink: #7F5F22;   /* WCAG AA-safe gold for text on light backgrounds (5.1-5.6:1) */
  --gold-on-dark: #D9AD52; /* WCAG AA-safe gold for text on Pine backgrounds (5.3:1) */
  --moss: #6A806A;
  --moss-ink: #566F52; /* WCAG AA-safe moss for text on light backgrounds (5.3:1) */
  --ice: #B8D3DF;

  /* Semantic aliases */
  --bg: var(--white);
  --bg-alt: #F1EFE6;
  --bg-tint: #EEF3F3; /* faint Ice Blue wash, used once for the Train With Us section */
  --text: var(--granite);
  --text-light: rgba(250, 249, 245, 0.92);
  --text-muted: rgba(66, 71, 75, 0.85);
  --border: rgba(66, 71, 75, 0.14);

  /* Type */
  --font-heading: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --content-max: 1280px;
  --content-pad: clamp(1.25rem, 4vw, 2.5rem);
  --section-pad-y: clamp(4rem, 9vw, 7.5rem);
  --radius: 6px;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 0.6s;
}

/* ---------------------------------- Reset -------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { max-width: 100%; display: block; height: auto; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; line-height: 1.15; margin: 0 0 0.6em; color: var(--pine); }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

/* Focus visibility everywhere. Two variants so the ring always has >=3:1
   contrast against its surface: gold-ink on light sections, gold-on-dark
   on Pine surfaces (hero, dark sections, footer). */
:focus-visible {
  outline: 2px solid var(--gold-ink);
  outline-offset: 3px;
  border-radius: 2px;
}
.hero :focus-visible,
.section-dark :focus-visible,
.section-cta :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--gold-on-dark);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--pine);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  z-index: 1000;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}

.noscript-banner {
  background: var(--gold);
  color: var(--pine-dark);
  text-align: center;
  padding: 0.75rem 1rem;
  margin: 0;
  font-size: 0.9rem;
}

/* ---------------------------------- Layout -------------------------------- */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--content-pad);
}

.section {
  padding-block: var(--section-pad-y);
}
.section-alt { background: var(--bg-alt); }
.section-dark {
  background: var(--pine);
  color: var(--text-light);
}
.section-dark h2, .section-dark h3 { color: var(--white); }
.section-dark p { color: var(--text-light); }

.eyebrow {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-ink);
  margin: 0 0 0.9em;
}
.eyebrow-light { color: var(--gold-on-dark); }

.section-intro {
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}
.section-intro h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.section-intro p { color: var(--text-muted); font-size: 1.08rem; max-width: 40rem; }
.section-dark .section-intro p { color: var(--text-light); }

/* ---------------------------------- Buttons -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.75rem;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--pine);
  color: var(--white);
}
.btn-primary:hover { background: var(--pine-dark); }
.btn-ghost-light {
  background: transparent;
  border-color: rgba(250, 249, 245, 0.65);
  color: var(--white);
}
.btn-ghost-light:hover { background: rgba(250, 249, 245, 0.12); }
.btn-link-light {
  background: transparent;
  color: var(--white);
  text-decoration: underline;
  text-underline-offset: 4px;
  padding-inline: 0.25rem;
}
.btn-small { padding: 0.6rem 1.35rem; font-size: 0.85rem; }
.btn-block { display: flex; width: 100%; }

@media (prefers-reduced-motion: no-preference) {
  .btn:hover { transform: translateY(-1px); }
}

/* ---------------------------------- Header -------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 249, 245, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 0.9rem;
}

.logo-lockup { display: flex; align-items: center; gap: 0.7rem; color: var(--pine); }
.logo-mark { width: 28px; height: 24px; flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-title { font-family: var(--font-heading); font-weight: 800; font-size: 1rem; letter-spacing: 0.02em; }
.logo-sub { font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--moss-ink); }

.nav-links { display: flex; gap: 2rem; }
.nav-links a {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--granite);
  position: relative;
  padding: 0.25rem 0;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.nav-links a:hover::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 1rem; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
}
.nav-toggle-bar {
  width: 22px; height: 2px;
  background: var(--pine);
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 1.5rem var(--content-pad) 2rem;
}
.mobile-nav-links { display: flex; flex-direction: column; gap: 1.1rem; margin-bottom: 1.5rem; }
.mobile-nav-links a {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--pine);
}

/* ---------------------------------- Hero -------------------------------- */
.hero {
  position: relative;
  min-height: clamp(600px, 88vh, 960px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(22, 48, 37, 0.72) 0%, rgba(22, 48, 37, 0.32) 42%, rgba(22, 48, 37, 0) 68%);
}
.hero-inner { position: relative; width: 100%; padding-block: clamp(2.5rem, 6vw, 5rem); }
.hero-panel { max-width: 42rem; }
.hero-headline {
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  margin-bottom: 0.5em;
  letter-spacing: -0.01em;
}
.hero-headline .headline-pine { color: var(--pine); }
.hero-headline .headline-gold { color: var(--gold); }
.hero-body {
  color: var(--text-light);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  max-width: 36rem;
}
.hero-support {
  color: var(--white);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 1.8em;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }

/* ---------------------------------- Split layout (Who We Are) ------------ */
.split-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}
.split-text { max-width: 34rem; }
.split-text h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.split-text p { color: var(--text-muted); font-size: 1.05rem; }
.split-media img,
.split-media video {
  width: 100%;
  border-radius: var(--radius);
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.principle-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1.5rem;
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}
.principle-list li {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--pine);
  padding-left: 1.1rem;
  position: relative;
}
.principle-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.5em;
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
}

/* ---------------------------------- Train With Us ----------------------- */
.section-tint { background: var(--bg-tint); }

.join-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(2rem, 4vw, 3rem);
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
  list-style: none;
  padding: 0;
}
.join-step {
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}
.join-step-number {
  display: block;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--gold-ink);
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}
.join-step h3 {
  font-size: 1.15rem;
  margin-bottom: 0.4em;
}
.join-step p {
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* ---------------------------------- Team grid -------------------------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 3vw, 2.25rem);
}
.athlete-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
@media (prefers-reduced-motion: no-preference) {
  .athlete-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -20px rgba(31, 67, 52, 0.35);
  }
}
.athlete-photo-wrap { aspect-ratio: 4 / 5; overflow: hidden; background: var(--pine); }
.athlete-photo-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s var(--ease);
}
@media (prefers-reduced-motion: no-preference) {
  .athlete-card:hover .athlete-photo-wrap img { transform: scale(1.045); }
}
.athlete-body { padding: 1.35rem 1.4rem 1.5rem; }
.athlete-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.15rem;
}
.athlete-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; color: var(--pine); margin: 0; }
.athlete-profession { color: var(--moss-ink); font-size: 0.88rem; font-weight: 500; margin-bottom: 0.9rem; }
.athlete-meta { display: grid; gap: 0.35rem; font-size: 0.88rem; color: var(--text-muted); }
.athlete-meta dt { font-weight: 600; color: var(--granite); display: inline; }
.athlete-meta dd { display: inline; margin: 0; }
.athlete-meta div { display: flex; gap: 0.4rem; }
.meta-placeholder { font-style: italic; color: var(--moss-ink); }

.instagram-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--pine);
  flex-shrink: 0;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.instagram-link:hover { background: var(--pine); color: var(--white); border-color: var(--pine); }
.instagram-link svg { width: 16px; height: 16px; }

/* ---------------------------------- Race list ---------------------------- */
.race-list { display: flex; flex-direction: column; }
.race-row {
  display: flex;
  align-items: baseline;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
}
.race-row:last-child { border-bottom: 1px solid var(--border); }
.race-dates {
  flex: 0 0 auto;
  width: 12rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--gold-ink);
}
.race-info { flex: 1; min-width: 0; }
.race-name { font-size: 1.2rem; margin-bottom: 0.2em; }
.race-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.race-meta { color: var(--text-muted); font-size: 0.95rem; margin: 0; }

/* ---------------------------------- Philosophy -------------------------- */
.philosophy-layout {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}
.philosophy-media img { border-radius: var(--radius); aspect-ratio: 3/4; object-fit: cover; }
.philosophy-text { max-width: 34rem; }
.philosophy-text h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.pull-quote {
  margin: 1.75rem 0;
  padding-left: 1.5rem;
  border-left: 3px solid var(--gold);
}
.pull-quote p {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}

/* ---------------------------------- Community collage -------------------- */
.community-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}
.community-text { max-width: 32rem; }
.community-text h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.community-text p { color: var(--text-muted); font-size: 1.05rem; }
.community-collage {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.community-collage img {
  border-radius: var(--radius);
  aspect-ratio: 1;
  object-fit: cover;
}
.community-collage img:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 16/10;
}

/* ---------------------------------- Partners -------------------------- */
.partner-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.partner-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  aspect-ratio: 16/9;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.partner-card:hover { border-color: var(--moss); }
@media (prefers-reduced-motion: no-preference) {
  .partner-card:hover { transform: translateY(-2px); }
}
.partner-card img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(1); opacity: 0.75; transition: filter 0.25s var(--ease), opacity 0.25s var(--ease); }
.partner-card:hover img { filter: grayscale(0); opacity: 1; }

.partners-cta { font-family: var(--font-heading); font-weight: 600; }
.partners-cta a { color: var(--pine); text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------- CTA -------------------------------- */
.section-cta {
  background: var(--pine);
  color: var(--text-light);
}
.section-cta h2 { color: var(--white); }
.section-cta p { color: var(--text-light); }
.cta-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}
.cta-text { max-width: 32rem; }
.cta-text h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); }
.cta-emphasis { font-family: var(--font-heading); font-weight: 600; color: var(--white); font-size: 1.05rem; }
.cta-media img { border-radius: var(--radius); aspect-ratio: 4/3; object-fit: cover; }

/* ---------------------------------- Footer ------------------------------ */
.site-footer {
  background: var(--pine-dark);
  color: rgba(250, 249, 245, 0.82);
  padding-top: clamp(3rem, 6vw, 4.5rem);
}
.footer-top {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(250, 249, 245, 0.14);
}
.footer-brand .logo-lockup { color: var(--white); margin-bottom: 1rem; }
.footer-brand .logo-sub { color: var(--ice); }
.footer-location, .footer-email { font-size: 0.92rem; margin-bottom: 0.35rem; }
.footer-email a { text-decoration: underline; text-underline-offset: 3px; }

.footer-heading {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
}
.footer-nav ul, .footer-partner-list { display: grid; gap: 0.65rem; font-size: 0.92rem; }
.footer-nav a:hover, .footer-partner-list a:hover { text-decoration: underline; }

.footer-insta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.footer-insta-grid img {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
}
.footer-insta-link { font-size: 0.88rem; text-decoration: underline; text-underline-offset: 3px; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-block: 1.5rem;
  font-size: 0.82rem;
  color: rgba(250, 249, 245, 0.6);
}
.footer-legal { display: flex; gap: 1.5rem; }
.footer-legal a:hover { text-decoration: underline; }

/* ---------------------------------- Reveal-on-scroll animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal.is-visible { opacity: 1; transform: none; transition: none; }
  .btn, .athlete-card, .athlete-photo-wrap img, .partner-card, .partner-card img, .nav-toggle-bar {
    transition: none !important;
  }
}

/* ========================================================================
   Responsive — tablet
   ======================================================================== */
@media (max-width: 1024px) {
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .partner-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-top { grid-template-columns: 1fr 1fr; row-gap: 2.5rem; }
}

/* ========================================================================
   Responsive — nav breakpoint
   ======================================================================== */
@media (max-width: 900px) {
  .primary-nav { display: none; }
  .header-actions .btn-primary.btn-small { display: none; }
  .nav-toggle { display: flex; }
}
@media (min-width: 901px) {
  .mobile-nav { display: none !important; }
}

/* ========================================================================
   Responsive — mobile
   ======================================================================== */
@media (max-width: 780px) {
  .split-layout,
  .philosophy-layout,
  .community-layout,
  .cta-layout {
    grid-template-columns: 1fr;
  }
  .philosophy-layout { display: flex; flex-direction: column-reverse; }
  .split-media, .cta-media { order: -1; }
  .hero { min-height: clamp(560px, 92vh, 820px); }
  .principle-list { grid-template-columns: 1fr 1fr; }
  .join-steps { grid-template-columns: 1fr; gap: 2rem; }
  .race-row { flex-direction: column; gap: 0.35rem; }
  .race-dates { width: auto; }
  .team-grid { grid-template-columns: 1fr; max-width: 26rem; margin-inline: auto; }
  .partner-grid { grid-template-columns: repeat(2, 1fr); }
  .community-collage { grid-template-columns: 1fr 1fr; }
  .footer-top { grid-template-columns: 1fr; text-align: left; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 460px) {
  .partner-grid { grid-template-columns: 1fr 1fr; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
}
