/*
 * montura.app – the website's one stylesheet. Colours, radii and type follow the app's tokens
 * (apps/mobile/src/ui/theme.ts) and docs/design/direction.md: oat background, blueberry ink,
 * vanilla cards, the system serif for names and figures, the system sans for everything else.
 * No web fonts, no external requests (the Caddyfile's CSP allows only 'self').
 */
:root {
  color-scheme: light;
  --background: #f4f1e9;
  --surface: #fbfaf6;
  --sunken: #eae6df;
  --ink: #293244;
  --muted: #525d6b;
  --faint: #606773;
  --hairline: #dbd8d2;
  --brand: #3f4b68;
  --brand-deep: #2b3550;
  --brand-soft: #e6eaf2;
  --on-brand-muted: #eaedf5;
  --accent: #54688a;
  --card-border: rgba(41, 50, 68, 0.08);
  --control-border: rgba(41, 50, 68, 0.14);

  /* Gaits (gaitColors) and their light companions on the dark card (gaitOnDarkColors). */
  --walk: #58775f;
  --trot: #41698b;
  --canter: #58427c;
  --walk-on-dark: #a9c4ae;
  --trot-on-dark: #9dbdd8;
  --canter-on-dark: #c3b4e0;

  /* Context colours (horsePalette): saddle copper and oat gold. */
  --context-1: #a46c54;
  --context-2: #ae8d4f;

  --serif: ui-serif, 'New York', 'Iowan Old Style', Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radius-card: 16px;
  --radius-control: 12px;
  --radius-inner: 10px;
  --radius-bar: 3px;

  --page: 1040px;
  --gutter: 20px;
}

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  background: var(--background);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

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

a:hover {
  color: var(--brand);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

.serif {
  font-family: var(--serif);
}

.figure {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--gutter);
  top: 12px;
  z-index: 1;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: var(--radius-inner);
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  min-height: 48px;
}

.brand:hover {
  color: var(--ink);
}

.brand svg {
  width: 40px;
  height: 34px;
  color: var(--brand);
}

.brand span {
  font-family: var(--serif);
  font-size: 27px;
  letter-spacing: -0.01em;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  font-size: 15px;
  text-decoration: none;
}

/* Buttons: soft rectangles, never pills (direction.md, "One style system"). */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: var(--radius-control);
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 150ms ease,
    transform 150ms ease;
}

.button:hover {
  background: var(--brand-deep);
  color: #fff;
}

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

.button.is-waiting {
  background: var(--sunken);
  color: var(--muted);
  font-weight: 500;
  cursor: default;
}

.button.is-waiting:active {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }
  .button:active {
    transform: none;
  }
}

.fine {
  font-size: 13px;
  color: var(--faint);
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 48px;
  align-items: center;
  padding-top: 40px;
  padding-bottom: 72px;
}

.hero h1 {
  font-size: clamp(2.25rem, 5.2vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.lead {
  margin-top: 18px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 34em;
}

.hero .actions {
  margin-top: 28px;
}

.hero .fine {
  margin-top: 10px;
}

/* The dark card: one per screen, like the app's tabs. */

.dark-card {
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-card);
  padding: 22px;
  box-shadow:
    0 1px 2px rgba(41, 50, 68, 0.08),
    0 12px 32px rgba(41, 50, 68, 0.14);
}

.dark-card .label {
  font-size: 13px;
  color: var(--on-brand-muted);
}

.dark-card .title {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.25;
  margin-top: 2px;
}

.agenda {
  list-style: none;
  padding: 0;
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.agenda li {
  display: grid;
  grid-template-columns: 48px 10px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  font-size: 15px;
}

.agenda time {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  color: var(--on-brand-muted);
}

.agenda small {
  display: block;
  font-size: 13px;
  color: var(--on-brand-muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dot, var(--faint));
}

.dark-card .divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
  margin: 18px 0 14px;
}

/* Gait bars and their legends. */

.gait-bar {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: var(--radius-bar);
  overflow: hidden;
}

.gait-bar span {
  flex: var(--share) 1 0;
  background: var(--colour);
}

.gait-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 10px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}

.gait-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gait-legend .dot {
  width: 8px;
  height: 8px;
}

.dark-card .gait-legend {
  color: var(--on-brand-muted);
}

/* Sections */

.section {
  padding: 72px 0;
  border-top: 1px solid var(--hairline);
}

.section-head h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.section-head p {
  margin-top: 10px;
  font-size: 17px;
  color: var(--muted);
  max-width: 36em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: 0 2px 8px rgba(41, 50, 68, 0.04);
}

/* Who it is for */

.audiences {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.audiences h3 {
  font-size: 19px;
  line-height: 1.3;
  margin-top: 14px;
}

.audiences p {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
}

.well {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-inner);
  background: var(--brand-soft);
  color: var(--brand);
}

.well svg {
  width: 24px;
  height: 24px;
}

/* The two pillars: text on one side, a piece of the app on the other. */

.pillar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}

.pillar.is-flipped .pillar-text {
  order: 2;
}

.pillar-text h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-top: 16px;
}

.pillar-text > p {
  margin-top: 14px;
  font-size: 17px;
  color: var(--muted);
}

.ticks {
  list-style: none;
  padding: 0;
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.ticks li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  font-size: 16px;
}

.ticks svg {
  width: 22px;
  height: 22px;
  color: var(--brand);
  margin-top: 1px;
}

/* A ride's summary, like the ride detail in the app. */

.ride-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ride-head h3 {
  font-size: 22px;
}

.ride-head span {
  font-size: 13px;
  color: var(--faint);
}

.ride-sub {
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
}

.figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.figures div {
  background: var(--sunken);
  border-radius: var(--radius-inner);
  padding: 10px 12px;
}

.figures .figure {
  display: block;
  font-size: 22px;
  line-height: 1.2;
  white-space: nowrap;
}

.figures small {
  font-size: 12px;
  color: var(--faint);
}

.timeline {
  height: 28px;
  border-radius: 6px;
}

.timeline-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* A planned session in three parts, like the planner in the app. */

.plan-head h3 {
  font-size: 22px;
}

.plan-head p {
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
}

.phase {
  margin-top: 16px;
}

.phase-title {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.phase-title span:last-child {
  font-weight: 400;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.blocks {
  list-style: none;
  padding: 0;
  margin-top: 8px;
  border-radius: var(--radius-inner);
  background: var(--sunken);
  overflow: hidden;
}

.blocks li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  font-size: 15px;
}

.blocks li + li {
  border-top: 1px solid var(--background);
}

.blocks small {
  display: block;
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.blocks .figure {
  font-size: 16px;
  color: var(--muted);
}

/* Everything else, as grouped rows. */

.rows {
  margin-top: 28px;
  padding: 4px 20px;
}

.row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 16px 0;
}

.row + .row {
  border-top: 1px solid var(--hairline);
}

.row .well {
  background: var(--sunken);
  color: var(--ink);
}

.row h3 {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 2px;
}

.row p {
  margin-top: 2px;
  font-size: 15px;
  color: var(--muted);
}

@media (min-width: 761px) {
  .rows {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 40px;
    padding: 4px 24px;
  }
  .row + .row {
    border-top: 0;
  }
  .row:nth-child(n + 3) {
    border-top: 1px solid var(--hairline);
  }
}

/* Privacy and beta */

.closing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.closing h2 {
  font-size: 24px;
  line-height: 1.25;
}

.closing p {
  margin-top: 8px;
  font-size: 16px;
  color: var(--muted);
}

.closing .card {
  padding: 24px;
}

.card.is-soft {
  background: var(--brand-soft);
  border-color: transparent;
  box-shadow: none;
}

.card.is-soft p {
  color: var(--brand);
}

.closing .actions {
  margin-top: 20px;
}

.closing .fine {
  margin-top: 10px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 20px 0 32px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 14px;
  color: var(--faint);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--brand);
}

/* Legal pages */

.legal {
  max-width: 40em;
  padding: 32px 0 72px;
}

.legal h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.1;
}

.legal h2 {
  font-size: 20px;
  margin-top: 32px;
}

.legal p {
  margin-top: 10px;
  color: var(--muted);
}

.legal .card {
  margin-top: 24px;
}

.legal address {
  font-style: normal;
  line-height: 1.6;
}

/* Phone width */

@media (max-width: 760px) {
  :root {
    --gutter: 16px;
  }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
    padding-top: 16px;
    padding-bottom: 56px;
  }
  .lead {
    font-size: 17px;
  }
  .hero .button {
    width: 100%;
  }
  .section {
    padding: 56px 0;
  }
  .audiences {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .pillar {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  .pillar.is-flipped .pillar-text {
    order: 0;
  }
  .closing {
    grid-template-columns: minmax(0, 1fr);
  }
  .closing .button {
    width: 100%;
  }
  .rows {
    padding: 4px 16px;
  }
  .figures div {
    padding: 10px;
  }
  .figures .figure {
    font-size: 18px;
  }
}
