/* vmg.watch — the one stylesheet.
 *
 * Every colour is a token from the apps' Palette (VMGWatch/Views/Palette.swift,
 * docs/design/colours.md), named by what it means; docs/design/style-guide.md says when each
 * one may appear on the web. Never a hex value below the :root block. */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* The ground. Black, as every screen of the apps. */
  --ground: #000;

  /* The hues, Apple's workout vocabulary — each with the one meaning it has in the apps. */
  --upwind: #92E82A;     /* Palette.green: working to windward, always with ▲; Start */
  --downwind: #FA114F;   /* Palette.red: working to leeward, always with ▼; Discard */
  --countdown: #FFD60A;  /* Palette.yellow: a time before a gun; save; a favorite */
  --tint: #1AD5F8;       /* Palette.cyan: the iPhone's tint (AccentColor) — links and focus; water, wind */
  --regatta: #0A84FF;    /* Palette.blue: the ways into a regatta, SAP Sailing */
  --warning: #FF9E0A;    /* Palette.orange: attention without loss */

  /* White and its steps. */
  --ink: #fff;                         /* text and the speed: white, as the speed numeral */
  --ink-2: #8D8D93;                    /* the iPhone's secondary text (.secondary on black): a label, "watch" in the logo */
  --edge: rgb(255 255 255 / 0.55);     /* Palette.separator: the outline of something to press */
  --chip: rgb(255 255 255 / 0.18);     /* Palette.chip: a tag — BEST, LOW */
  --rule: rgb(255 255 255 / 0.12);     /* Palette.grid: rules and quiet edges behind content */
  --wash: rgb(255 255 255 / 0.08);     /* Palette.selection: a faint panel */
  --tile-ink: #000;                    /* Palette.tileInk: ink on any fill is black */

  /* Type. Inter (SIL OFL 1.1), the logo's face; self-hosted, nothing fetched from elsewhere. */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --numeral: clamp(6rem, 22vw, 13rem);  /* the hero number, as Live's VMG */
  --display: clamp(2.6rem, 6.4vw, 4.75rem);
  --h1: clamp(2.2rem, 4.6vw, 3.4rem);
  --h2: clamp(1.6rem, 3vw, 2.25rem);
  --h3: 1.375rem;
  --lead: clamp(1.2rem, 1.9vw, 1.45rem);
  --body: 1.125rem;
  --small: 0.9375rem;
  --label: 0.8125rem;

  /* Shape, from the iPhone's own controls. */
  --r-tile: 24px;    /* a filled tile: Start 5:00 */
  --r-card: 20px;    /* an outlined card: All legs, End session */
  --r-row: 10px;     /* a selected row */
  --r-chip: 4px;     /* BEST, LOW */
  --stroke: 1.5px;   /* the outline of a card */

  --gutter: clamp(16px, 4vw, 40px);
  --measure: 38rem;
  --wide: 72rem;
}

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

html {
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--body);
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }

a { color: var(--tint); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.08; letter-spacing: -0.022em; }
h1 { font-size: var(--h1); font-weight: 800; }
h2 { font-size: var(--h2); font-weight: 700; letter-spacing: -0.018em; }
h3 { font-size: var(--h3); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.measure { max-width: var(--measure); }

/* --- Type roles -------------------------------------------------------------------------- */

.display { font-size: var(--display); font-weight: 800; line-height: 1.02; letter-spacing: -0.03em; }
.lead { font-size: var(--lead); line-height: 1.45; color: var(--ink); }
.small { font-size: var(--small); }
.quiet { color: var(--ink-2); }

/* The apps' labels: heavy capitals over a number — VMG ▲, BEAM, SOG km/h. */
.label {
  font-size: var(--label);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* A number that is the point: heavy, tabular, tight. */
.numeral {
  font-size: var(--numeral);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.num { font-variant-numeric: tabular-nums; font-weight: 700; }

/* Leg colours: never colour alone — the glyph rides with it (colours.md, P-A1). */
.up { color: var(--upwind); }
.down { color: var(--downwind); }
.gun { color: var(--countdown); }

/* --- Controls ------------------------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 48px;
  padding: 0.7em 1.35em;
  border-radius: var(--r-card);
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
/* The page's one main action: a light fill, black ink — no hue, since it means nothing on the water. */
.button.primary { background: var(--ink); color: var(--tile-ink); border: 0; }
.button.primary:hover { background: rgb(255 255 255 / 0.86); }
/* Anything else: outlined, as All legs › is. */
.button.outline { background: transparent; color: var(--ink); border: var(--stroke) solid var(--edge); }
.button.outline:hover { border-color: var(--ink); }

/* A filled tile in an app colour. Only where that colour's app meaning holds. */
.tile {
  display: inline-grid;
  place-items: center;
  gap: 0.1em;
  padding: 0.9em 1.4em;
  border-radius: var(--r-tile);
  color: var(--tile-ink);
  font-weight: 800;
  line-height: 1.05;
}
.tile.start { background: var(--upwind); }
.tile.save { background: var(--countdown); }
.tile.discard { background: var(--downwind); }
.tile.regatta { background: var(--regatta); }

.chip {
  display: inline-block;
  padding: 0.12em 0.45em;
  border-radius: var(--r-chip);
  background: var(--chip);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* --- Surfaces ----------------------------------------------------------------------------- */

.card {
  border: var(--stroke) solid var(--rule);
  border-radius: var(--r-card);
  padding: clamp(20px, 3vw, 32px);
}
a.card { display: block; color: inherit; text-decoration: none; border-color: var(--edge); }
a.card:hover { border-color: var(--ink); }
.panel { background: var(--wash); border-radius: var(--r-card); padding: clamp(20px, 3vw, 32px); }
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* A screen of the app, shown as it is: rounded as the device rounds it, no frame drawn round it. */
.screen {
  border-radius: 9% / 4.2%;
  outline: 1px solid var(--rule);
  outline-offset: -1px;
}

/* --- Header and footer --------------------------------------------------------------------- */

.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
/* The logo as live text: the mark two capitals tall and half a capital from the name, centred on
 * the capitals; "VMG" Extrabold in white, "watch" Regular in --ink-2, no space (logo, 2026-10-24). */
.brand, .lockup {
  display: inline-flex; align-items: center; gap: 0.3635em;
  color: var(--ink); text-decoration: none; white-space: nowrap; line-height: 1;
}
.brand { font-size: 1.25rem; }
.brand img, .lockup img { height: 1.454em; width: auto; flex: none; }
.brand .name, .lockup .name { text-box: trim-both cap alphabetic; letter-spacing: -0.012em; }
.vmg { font-weight: 800; color: var(--ink); }
.watch { font-weight: 400; color: var(--ink-2); }
.site-nav { display: flex; gap: 1.4rem; font-size: var(--small); }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); }

.site-footer { border-top: 1px solid var(--rule); color: var(--ink-2); font-size: var(--small); }
.site-footer .wrap { padding-top: 28px; padding-bottom: 40px; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--ink); }

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

/* --- The home page ------------------------------------------------------------------------ */

.hero { padding: clamp(56px, 10vw, 128px) 0 clamp(48px, 8vw, 96px); }
.hero .wrap { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.hero h1 { font-size: var(--display); font-weight: 800; line-height: 1.02; letter-spacing: -0.03em; margin-bottom: 0.45em; }
.hero .lead { color: var(--ink-2); max-width: 32rem; margin-bottom: 1.6em; }
.hero .lead strong { color: var(--ink); font-weight: 600; }
.hero .soon { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.hero .soon .label { color: var(--ink); }
.hero-mark { justify-self: center; width: min(100%, 300px); }

/* The lap drawing itself, as in the apps' launch: the beat, then the run carrying straight on. */
.lap polyline { fill: none; stroke-width: 108; stroke-linecap: round; stroke-linejoin: round; }
.lap .beat { stroke: var(--upwind); }
.lap .run { stroke: var(--downwind); }
@media (prefers-reduced-motion: no-preference) {
  .lap .beat, .lap .run { stroke-dasharray: 1; stroke-dashoffset: 1; }
  .lap .beat { animation: lap-draw 0.75s cubic-bezier(.4, 0, .2, 1) 0.3s forwards; }
  .lap .run { animation: lap-draw 0.75s cubic-bezier(.4, 0, .2, 1) 1.05s forwards; }
}
@keyframes lap-draw { to { stroke-dashoffset: 0; } }

.readout { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.readout .wrap { display: grid; grid-template-columns: 1fr 1fr; }
.readout .cell { padding: clamp(24px, 4vw, 48px) 0; }
.readout .cell + .cell { border-left: 1px solid var(--rule); padding-left: clamp(20px, 4vw, 48px); }
.readout .numeral { font-size: clamp(3.25rem, 13vw, 11rem); margin-top: 8px; }
.readout .unit { font-size: 0.16em; font-weight: 700; letter-spacing: 0; color: var(--ink-2); margin-left: 0.2em; }

.section { padding: clamp(64px, 10vw, 128px) 0; }
.section-head { max-width: 40rem; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head p { color: var(--ink-2); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.features .card .label { display: block; margin-bottom: 18px; }
.features .card p { color: var(--ink-2); margin: 0; }
.features .card .fine { font-size: var(--small); margin-top: 0.9em; }

.after .wrap { display: grid; grid-template-columns: minmax(0, 22rem) 1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.after-shot { margin: 0; }
.after-shot figcaption { color: var(--ink-2); font-size: var(--small); margin-top: 12px; }
.after h2 { margin-top: 14px; }
.site-footer .tm { flex-basis: 100%; margin: 6px 0 0; font-size: 0.8125rem; }
.screens { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 3vw, 40px); align-items: start; margin-top: clamp(40px, 6vw, 72px); }
.screens figure { margin: 0; }
.screens img { width: 100%; }
.screens figcaption { color: var(--ink-2); font-size: var(--small); margin-top: 12px; }

.needs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.needs .panel p { color: var(--ink-2); margin: 0; }
.needs .panel h3 { margin-bottom: 0.4em; }

/* A text page: the privacy policy, the terms. */
.doc { padding: clamp(48px, 8vw, 96px) 0; }
.doc .wrap { max-width: calc(var(--measure) + 2 * var(--gutter) + 6rem); }
.doc h1 { margin-bottom: 0.3em; }
.doc h2 { font-size: 1.5rem; margin-top: 2.2em; }
.doc h3 { font-size: 1.15rem; margin-top: 1.6em; }
.doc p, .doc li { color: rgb(255 255 255 / 0.86); }
.doc li { margin-bottom: 0.45em; }
.doc strong { color: var(--ink); }
.doc table { width: 100%; border-collapse: collapse; font-size: var(--small); margin: 0 0 1em; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--rule); }
.doc th { color: var(--ink-2); font-weight: 600; }
.table-scroll { overflow-x: auto; }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-mark { order: -1; width: 120px; justify-self: start; }
  .features, .needs, .after .wrap { grid-template-columns: 1fr; }
  .after-shot { max-width: 20rem; }
}
@media (max-width: 380px) {
  .readout .wrap { grid-template-columns: 1fr; }
  .readout .cell + .cell { border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; }
}
@media (max-width: 560px) {
  .screens { grid-template-columns: 1fr 1fr; }
  .screens figure:last-child { display: none; }
}
