/* ============================================================
   ONETORUN — Landing (public home)
   The page is laid out as a single run: a route line runs down
   the left gutter and every section is a checkpoint whose node
   lights up as the reader reaches it. Colours come from the
   design tokens in themes.css, so the page follows the active
   light/dark theme. Copy lives in config/locales/*.yml.
   ============================================================ */

.landing {
  /* Monospace is the "data voice" of the page (route labels, eyebrows);
     prose stays in the app's sans stack. */
  --landing-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --landing-rail: rgba(var(--color-brand-rgb), 0.32);

  max-width: 58rem;
  margin-inline: auto;
  color: var(--color-txt-main);
}

/* ---------- Sections & the route line ---------- */

.landing__section {
  --landing-pad-top: clamp(3.25rem, 7vw, 5.5rem);
  --landing-gutter: 2.25rem;
  position: relative;
  padding-top: var(--landing-pad-top);
  padding-bottom: clamp(3.25rem, 7vw, 5.5rem);
  /* The route line is the shared left border of the sections, so the segments
     join into one continuous line from START to FINISH — on phones too. */
  border-left: 2px solid var(--landing-rail);
  padding-left: var(--landing-gutter);
}

.landing__section--hero {
  --landing-pad-top: clamp(1.75rem, 5vw, 3.25rem);
}

@media (min-width: 48rem) {
  .landing__section { --landing-gutter: 3.5rem; }
}

/* Checkpoint node: centred on the line and level with the section's eyebrow
   label, so the label and its dot sit on the same row. */
.landing__section::before {
  content: "";
  position: absolute;
  top: calc(var(--landing-pad-top) + 0.34rem);
  left: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-panel-main);
  border: 2px solid var(--landing-rail);
  transform: translate(-50%, -50%);
  transition: background-color 0.35s ease, border-color 0.35s ease,
    box-shadow 0.35s ease;
}

.landing__section.is-reached::before {
  background: var(--color-brand);
  border-color: var(--color-brand);
  box-shadow: 0 0 0 4px rgba(var(--color-brand-rgb), 0.15);
}

/* ---------- The data voice: eyebrows ---------- */

.landing__eyebrow {
  /* Block-level and shrink-wrapped so its top edge lines up with the section
     padding — that keeps the label level with its checkpoint node. */
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  line-height: 1;
  font-family: var(--landing-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-txt-muted);
}

.landing__eyebrow::before {
  content: "";
  width: 1.25rem;
  height: 2px;
  background: var(--color-brand);
}

/* ---------- Hero ---------- */

/* The wordmark sits on a dark surface, the way the app itself pairs its gold
   with a dark panel (see .nav-active) — readable in both themes. */
.landing__brand {
  display: inline-block;
  margin: 1.25rem 0 0;
  padding: 0.16em 0.42em 0.24em;
  border-radius: var(--radius-lg);
  background: var(--color-panel-dark);
  font-size: clamp(2.5rem, 10vw, 5.5rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--color-brand);
}

.landing__headline {
  margin: 0.75rem 0 0;
  max-width: 24ch;
  font-size: clamp(1.4rem, 3.6vw, 2.1rem);
  line-height: 1.2;
  font-weight: 600;
  color: var(--color-txt-main);
}

.landing__headline--lg {
  max-width: 20ch;
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: -0.01em;
}

.landing-hero__lead {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
  max-width: 52ch;
}

.landing-hero__lead p {
  margin: 0;
  font-size: clamp(1rem, 1.8vw, 1.125rem);
  line-height: 1.65;
  color: var(--color-txt-muted);
}

.landing-author {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 2.5rem 0 0;
}

.landing-author__role {
  font-family: var(--landing-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-txt-dim);
}

.landing-author__name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  margin-top: 0.15rem;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--color-border-strong);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-txt-main);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.landing-author__name::after {
  content: "\2192";
  font-weight: 400;
}

.landing-author__name:hover {
  color: var(--color-brand);
  border-color: var(--color-brand);
}

.landing-author__name:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 3px;
}

/* ---------- Shared headings & prose ---------- */

.landing__title {
  margin: 0.75rem 0 0;
  max-width: 30ch;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-txt-main);
}

.landing__lead {
  margin: 1.25rem 0 0;
  max-width: 42ch;
  font-size: clamp(1.125rem, 2.4vw, 1.4rem);
  line-height: 1.5;
  font-weight: 500;
  color: var(--color-txt-main);
}

.landing__body {
  margin: 1.25rem 0 0;
  max-width: 54ch;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-txt-muted);
}

/* ---------- Two audiences ---------- */

.landing-cols {
  display: grid;
  gap: 1.25rem;
  margin-top: 2rem;
}

@media (min-width: 48rem) {
  .landing-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

.landing-card {
  padding: 1.75rem 1.75rem 1.9rem;
  background: var(--color-panel-muted);
  border: 1px solid var(--color-border-light);
  border-top: 3px solid var(--landing-card-accent, var(--color-brand));
  border-radius: var(--radius-lg);
}

/* Two roles, two existing semantic accents: the coach side is the brand gold,
   the athlete side is the emerald the app already uses for performed data. */
.landing-card--coach {
  --landing-card-accent: var(--color-brand);
}

.landing-card--athlete {
  --landing-card-accent: var(--wkt-actual-text);
}

.landing-card__title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-txt-main);
}

.landing-card__lead {
  margin: 0 0 1.35rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-txt-main);
}

.landing-card__body {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--color-txt-muted);
}

.landing-card__list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.landing-card__list li {
  display: flex;
  gap: 0.7rem;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--color-txt-muted);
}

.landing-card__list li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 0.45rem;
  border-radius: 2px;
  background: var(--landing-card-accent);
}

/* ---------- Philosophy ---------- */

.landing-statement {
  margin: 1.25rem 0 0;
  max-width: 46ch;
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  line-height: 1.4;
  font-weight: 600;
  color: var(--color-txt-main);
}

.landing-points {
  display: grid;
  gap: 1rem;
  margin: 2.25rem 0 0;
  padding: 0;
  max-width: 48ch;
  list-style: none;
}

.landing-points li {
  position: relative;
  padding-left: 1.75rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-txt-muted);
}

.landing-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 12px;
  height: 2px;
  background: var(--color-brand);
}

/* ---------- One system: the unified tool bar ---------- */

.landing-modules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 2.75rem 0 0;
  padding: 0;
  background: var(--color-border-light);
  border: 1px solid var(--color-border-light);
  border-left: 3px solid var(--color-brand);
  border-radius: var(--radius-lg);
  overflow: hidden;
  list-style: none;
}

.landing-modules__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  background: var(--color-panel-main);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-txt-main);
}

.landing-modules__item::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--color-brand);
}

@media (min-width: 48rem) {
  .landing-modules {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Finish ---------- */

.landing-finale__manifesto {
  margin: 1.25rem 0 0;
  max-width: 26ch;
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  line-height: 1.3;
  font-weight: 700;
  color: var(--color-txt-main);
}

.landing-finale__tagline {
  margin: 1.25rem 0 0;
  font-family: var(--landing-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  color: var(--color-brand);
}

.landing-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.25rem;
  padding: 0.9rem 1.75rem;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--color-brand);
  color: var(--color-txt-on-brand);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.landing-cta:hover {
  background: var(--color-brand-hover);
  transform: translateY(-1px);
}

.landing-cta:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 3px;
}

/* ---------- Invitation-only modal (opened by the CTA) ---------- */

.landing-modal {
  width: min(30rem, calc(100% - 2rem));
  margin: auto;
  padding: 0;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  background: var(--color-panel-elevated);
  color: var(--color-txt-main);
  box-shadow: var(--shadow-popover, var(--shadow-elevated));
}

.landing-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.landing-modal__panel {
  padding: clamp(1.5rem, 4vw, 2rem);
  text-align: center;
}

.landing-modal__text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-txt-muted);
}

.landing-modal__text--strong {
  margin-top: 1rem;
  color: var(--color-txt-main);
  font-weight: 600;
}

.landing-modal__social {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  margin-top: 1.75rem;
}

.landing-modal__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--color-txt-muted);
  background: var(--color-panel-muted);
  border: 1px solid var(--color-border-light);
  border-radius: 9999px;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.landing-modal__link:hover {
  color: var(--color-txt-on-brand);
  background: var(--color-brand);
  border-color: var(--color-brand);
}

.landing-modal__link:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 3px;
}

.landing-modal__close {
  margin-top: 1.75rem;
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-btn);
  background: var(--color-panel-muted);
  color: var(--color-txt-main);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.landing-modal__close:hover {
  background: var(--color-border-light);
}

.landing-modal__close:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 3px;
}

/* ---------- Motion ---------- */

@keyframes landing-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes landing-rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Hero plays a short entrance sequence on load (pure CSS, no JS needed). */
.landing__section--hero .landing__eyebrow,
.landing__section--hero .landing__brand,
.landing__section--hero .landing__headline,
.landing__section--hero .landing-hero__lead,
.landing__section--hero .landing-author {
  animation: landing-enter 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.landing__section--hero .landing__brand {
  animation-delay: 0.06s;
}
.landing__section--hero .landing__headline {
  animation-delay: 0.12s;
}
.landing__section--hero .landing-hero__lead {
  animation-delay: 0.18s;
}
.landing__section--hero .landing-author {
  animation-delay: 0.24s;
}

/* The rest rises in when its checkpoint is reached (class added by the
   landing-route controller). Without JS the content stays simply visible. */
.landing__section.is-reached .landing__reveal {
  animation: landing-rise 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .landing *,
  .landing *::before,
  .landing *::after {
    animation: none !important;
    transition: none !important;
  }

  .landing-cta:hover {
    transform: none;
  }
}

/* Coach page: a single block, so the run's rail is not drawn. */
.landing--coach .landing__section {
  border-left: 0;
  padding-left: 0;
}

.landing--coach .landing__section::before {
  display: none;
}
