/* CAF Drill Routine Simulator — Copyright (C) 2026 Matthew Dodd
 * SPDX-License-Identifier: LicenseRef-Proprietary  (see LICENSE for full terms)
 *
 * Styles for the apex landing page (landing/index.html). External rather than a
 * <style> block so the page's CSP needs no 'unsafe-inline' — the same standard
 * the app holds itself to.
 *
 * THE PALETTE IS THE APP'S LIGHT THEME, token-for-token (see the
 * `:root[data-theme="light"]` block in src/app/app.css): warm parchment, beige
 * panels behind hairline borders, dark-brown ink, an olive accent. The front
 * door and the simulator are meant to read as one product, so when a light-theme
 * token changes there, change it here too. The two files cannot share a runtime
 * copy — they ship in different Pages bundles (see docs/DEPLOY.md).
 *
 * NO dark variant here, deliberately: the app's theme lives in localStorage on
 * app.drillteamroutine.com, which this origin cannot read, so a
 * prefers-color-scheme guess would disagree with the app as often as it agreed.
 */

:root {
  /* The ONE element identity colour this page draws with, copied from the app
     where the set is held stable across themes. The other three (--navy/--air/
     --cmd) are deliberately NOT mirrored here: a copy nothing reads is what
     drifts, and this file's had — its --air was #5d9cec against the app's
     #2f6f8f. Need another? Copy it from src/app/app.css at the point of use. */
  --army: #5b6e4f;

  /* The app's light theme, verbatim — which now means the DARKENED --dim and
     --accent it adopted on 2026-08-24 to clear WCAG AA. Keep them in step: this
     file's whole premise is that the front door and the app are one palette. */
  --bg: #f3ead6;
  --panel: #e9dcc0;
  --panel2: #ddcaa4;
  --line: #c7b186;
  --ink: #3a2e1b;
  --dim: #5d513a;
  --accent: #4c6519;
  --on-accent: #fbf6e7;
  --stage: #efe5cd;
  --grid: #d8c5a0;

  /* Two page-only tokens. This page is PROSE, where the app is chrome: text sits
     at body size on the parchment for whole paragraphs at a time, so both of
     these are the app tokens darkened to clear 4.5:1 against --bg.
       --accent-ink: the olive, for any fill or label that CARRIES TEXT (--accent
         behind --on-accent is only ~3.5:1, fine for a 30px toolbar button, thin
         for a hero CTA). --accent itself still does hairlines, hovers and rings.
       --prose: secondary text on this page. It was --dim darkened because the app's
         --dim then missed AA as text (4.39:1 on --bg, 3.87:1 on --panel). The app
         has since darkened --dim past this value, so the two are now within a
         hair of each other and BOTH clear AA; the pair is kept because the guard
         reads literal hex per token, and because naming the prose colour separately
         is what stopped this page inheriting a chrome token by accident. */
  --accent-ink: #4f6a17;
  --prose: #6b5c3f;

  /* The page's reading column. Deliberately in REM, not px: the root font-size
   * below scales with the viewport, so the container and the type grow together
   * and the line length in CHARACTERS stays roughly constant (~85ch) instead of
   * running away on a wide monitor. There is no separate cap on paragraphs — a
   * text block that stops short of the box it sits in reads as a bug, because the
   * heading rule and the demo cards do reach the edge. */
  --column: 54rem;
}

* {
  box-sizing: border-box;
}

/* The page's base colour lives on <html> so it covers the WHOLE canvas, however
 * tall the document gets. Do not move it back onto body with
 * `background-attachment: fixed`: that paints only the first viewport box, so
 * everything below the fold fell back to white with near-white text on it — and
 * iOS Safari mishandles fixed attachment anyway. */
html {
  scroll-behavior: smooth;
  background-color: var(--bg);
  /* 16px until ~1200px wide, easing to 19px by 1920. Everything else is sized in
   * rem, so this scales the whole page rather than just the body copy. */
  font-size: clamp(16px, 11px + 0.42vw, 19px);
}

body {
  margin: 0;
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  padding: 0 24px 64px;
}

/* Fixed backdrop: the parade-square floor. The grid is DOTTED at half strength,
 * drawn the same way #v2-floor draws it in the app — two radial-gradient tiles,
 * one per axis, a dot every 40px = 1 pace, pulled back by half a tile so the
 * dots land on 0/40/80. `circle` is load-bearing: a radial-gradient defaults to
 * an ELLIPSE sized to its box, so in a 40x4px tile the dot stretches into a dash
 * and the grid draws as solid streaks. The first --grid-dot is the fallback for
 * browsers without color-mix(); the second wins where it is supported.
 * Fixed and viewport-sized over the html base colour, so it stays put while
 * scrolling and can never leave bare canvas behind. */
.grid-bg {
  position: fixed;
  inset: 0;
  --grid-dot: var(--grid);
  --grid-dot: color-mix(in srgb, var(--grid) 50%, transparent);
  background-image:
    radial-gradient(circle, var(--grid-dot) 0.8px, transparent 0.9px),
    radial-gradient(circle, var(--grid-dot) 0.8px, transparent 0.9px),
    radial-gradient(1200px 600px at 50% -10%, rgba(107, 142, 35, 0.12), transparent 62%),
    linear-gradient(180deg, var(--stage) 0%, var(--bg) 55%);
  background-size:
    40px 4px,
    4px 40px,
    auto,
    auto;
  background-position:
    -20px -2px,
    -2px -20px,
    0 0,
    0 0;
  pointer-events: none;
  z-index: 0;
}

header,
main,
footer {
  position: relative;
  z-index: 1;
  width: min(100%, var(--column));
  margin: 0 auto;
}

/* ---- header ---------------------------------------------------------------- */

header {
  text-align: center;
  padding: 72px 0 8px;
}

/* The version pill, matching the app sidebar's `#side h1 .tag`: a solid olive
 * pill in cream, no border. */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  background: var(--accent-ink);
  color: var(--on-accent);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 22px;
}

h1 {
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  margin: 0 0 14px;
  line-height: 1.15;
  font-weight: 700;
}

.tagline {
  font-size: 1.08rem;
  color: var(--prose);
  max-width: 52ch;
  margin: 0 auto 30px;
}

abbr {
  text-decoration: underline dotted var(--dim);
  cursor: help;
}

/* The app's `button.primary` (Build & Run), at hero scale: solid olive, cream
 * label, weight 700, the same 7px radius the app gives every control. The lift
 * and shadow are warm brown rather than a coloured glow — nothing in the app
 * glows. */
.cta {
  display: inline-block;
  background: var(--accent-ink);
  color: var(--on-accent);
  border: 1px solid var(--accent-ink);
  border-radius: 7px;
  font-weight: 700;
  text-decoration: none;
  padding: 13px 30px;
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    box-shadow 0.12s ease;
  box-shadow: 0 4px 12px rgba(58, 46, 27, 0.16);
}

.cta:hover,
.cta:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(58, 46, 27, 0.22);
}

/* Release line under the CTA — quieter than the tagline, it is a status note. */
.release {
  margin: 22px auto 0;
  /* Wider than the tagline's measure: this is centred, so a narrow cap turned it
   * into six short ragged lines once the page started scaling up. */
  max-width: 64ch;
  font-size: 0.9rem;
  color: var(--prose);
}

/* ---- sections -------------------------------------------------------------- */

main {
  padding-top: 40px;
}

section {
  margin: 0 0 52px;
}

/* Hairline rule in --line under each heading: the app separates every sidebar
 * section and dialog head the same way. */
h2 {
  font-size: 1.3rem;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

p {
  color: var(--prose);
  margin: 0 0 16px;
}

.quiet {
  color: var(--prose);
  font-size: 0.94rem;
}

a {
  color: var(--accent-ink);
}

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

/* Visible keyboard focus everywhere — the page is all links. Same ring the app
 * paints on every control. */
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.features {
  margin: 0;
  padding-left: 22px;
  color: var(--prose);
}

.features li {
  margin-bottom: 7px;
}

/* ---- demo cards ------------------------------------------------------------ */

.demos {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 14px;
  /* min() inside minmax so the track can shrink below its 20rem preference on a
   * narrow phone — a bare minmax(20rem, 1fr) cannot, and overflowed at 320px. */
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
}

/* Panel on parchment inside a hairline border — the app's `.unit` card and its
 * ko-fi panel, at reading scale. */
.demo a {
  display: grid;
  gap: 5px;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--army);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  transition:
    background 0.14s ease,
    border-left-color 0.14s ease,
    transform 0.14s ease;
}

.demo a:hover,
.demo a:focus-visible {
  background: var(--panel2);
  border-left-color: var(--accent);
  transform: translateX(3px);
}

.demo-title {
  font-size: 1.08rem;
  font-weight: 600;
}

/* Small, letterspaced, uppercase, dim: the app labels a unit's kind this way. */
.demo-meta {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--prose);
}

.demo-desc {
  color: var(--prose);
  font-size: 0.95rem;
}

.demo-go {
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-ink);
}

/* ---- legal ----------------------------------------------------------------- */

.legal {
  margin: 0;
}

.legal dt {
  font-weight: 600;
  color: var(--ink);
  margin-top: 18px;
  padding-bottom: 2px;
}

.legal dt:first-child {
  margin-top: 0;
}

.legal dd {
  margin: 0;
  color: var(--prose);
  font-size: 0.96rem;
  border-left: 2px solid var(--line);
  padding-left: 14px;
}

/* ---- footer ---------------------------------------------------------------- */

footer {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--prose);
}

footer p {
  max-width: none;
  margin: 0 0 6px;
  color: inherit;
}

/* ---- motion / small screens ------------------------------------------------ */

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

  .cta,
  .demo a {
    transition: none;
  }

  .cta:hover,
  .cta:focus-visible,
  .demo a:hover,
  .demo a:focus-visible {
    transform: none;
  }
}

@media (min-width: 68rem) {
  .features {
    columns: 2;
    column-gap: 2.5rem;
  }

  .features li {
    break-inside: avoid;
  }
}

@media (max-width: 560px) {
  body {
    padding: 0 18px 48px;
  }

  header {
    padding-top: 52px;
  }

  .cta {
    display: block;
  }
}
