/*
 * The page speaks the app's design system, ported from src/ui/theme.ts in the
 * app repo. The rules that came along with the tokens:
 *
 *   - Colour is semantic, never decorative. Moss is money, amber is the
 *     clock, clay is loss. Nothing gets a colour to look lively.
 *   - Cards are flat: a hairline on paper, no shadow anywhere in this file.
 *   - Every figure that could sit above another figure is tabular. Money is
 *     bold tabular sans, never monospace, which gives the thousands comma a
 *     full character cell. Only the countdown is monospace, because it is
 *     the one string whose letters change every second.
 *   - No webfonts. The page renders in the face the phone already has, which
 *     is also why it makes zero third-party requests.
 */

:root {
  --paper: #F2F4F0;
  --surface: #FFFFFF;
  --ink: #14231B;
  --ink-muted: #5E6E64;
  --ink-faint: #8B978F;
  --line: #DFE4DD;
  --line-strong: #C7D0C7;

  --moss: #1D6B4F;
  --moss-deep: #185C44;
  --moss-soft: #E4F0E9;
  --moss-ink: #134634;
  --amber: #B87400;
  --amber-soft: #FBEFD8;
  --clay: #A93A29;
  --clay-soft: #F8E5E1;
  --action-ink: #FFFFFF;

  --space-xxs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-xxxl: 48px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --motion-fast: 140ms;
  --motion-base: 220ms;
  --motion-slow: 320ms;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* The countdown, and nothing else. */
  --font-mono: ui-monospace, "SF Mono", Consolas, monospace;

  --measure: 62ch;
  --page-max: 1040px;
}

/* ---------------------------------------------------------------- reset -- */

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

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 22px;
}

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

a {
  color: inherit;
}

::selection {
  background: var(--moss-soft);
  color: var(--moss-ink);
}

:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ----------------------------------------------------------------- type -- */

.display {
  /*
   * The app caps display at 30px; a marketing hero read at arm's length on a
   * laptop earns more. A decision, not drift: everything else keeps the
   * app's scale exactly.
   */
  font-size: clamp(30px, 4.5vw, 44px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.heading {
  font-size: 17px;
  line-height: 23px;
  font-weight: 600;
}

.body {
  font-size: 15px;
  line-height: 22px;
}

.lead {
  font-size: 17px;
  line-height: 26px;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.caption {
  font-size: 13px;
  line-height: 18px;
}

.label {
  /* The labelling language of a ledger: eyebrows and column headers. */
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.muted {
  color: var(--ink-muted);
}

.faint {
  color: var(--ink-faint);
}

.figure,
.clock,
time {
  font-variant-numeric: tabular-nums;
}

.clock {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* The countdown wears the urgency ramp the app's clock does. */
.clock.is-amber {
  color: var(--amber);
}

.clock.is-clay {
  color: var(--clay);
}

/* --------------------------------------------------------------- layout -- */

.wrap {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--space-xl);
}

@media (max-width: 480px) {
  .wrap {
    padding-inline: var(--space-lg);
  }
}

/* ------------------------------------------------------------ components -- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 48px; /* the app's hit size: one-handed, sometimes wet */
  padding: 0 var(--space-xl);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: 600 15px/22px var(--font-sans);
  text-decoration: none;
  cursor: pointer;
}

/* The platform marks on the download buttons inherit the label colour. */
.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .btn {
    transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease;
  }
}

.btn-primary {
  background: var(--moss);
  color: var(--action-ink);
}

.btn-primary:hover {
  background: var(--moss-deep);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--moss);
  color: var(--moss-ink);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xxs) var(--space-md);
  border-radius: var(--radius-pill);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
}

.pill-moss {
  background: var(--moss-soft);
  color: var(--moss-ink);
}

.pill-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill-clay {
  background: var(--clay-soft);
  color: var(--clay);
}

.pill-neutral {
  background: var(--paper);
  color: var(--ink-muted);
}

/* Crop chips carry each crop's own tint from the app, the one place a
 * colour other than the semantic three appears, because the colour *is* the
 * datum: it names the crop. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xxs) var(--space-md) var(--space-xxs) var(--space-sm);
  border-radius: var(--radius-pill);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-xl);
}

.wordmark {
  color: var(--moss);
  text-decoration: none;
}

.header-cta {
  min-height: 44px; /* the app's hit floor */
  padding: 0 var(--space-lg);
  font-size: 13px;
}

/* ----------------------------------------------------------------- hero -- */

.hero {
  display: grid;
  gap: var(--space-xxl);
  /* The crop strip closes the section and brings its own breathing room. */
  padding-block: var(--space-xxl) 0;
  align-items: center;
}

@media (min-width: 880px) {
  .hero {
    grid-template-columns: 1fr 400px;
    gap: var(--space-xxxl);
    padding-block: var(--space-xxxl) 0;
  }
}

.hero-copy > * + * {
  margin-top: var(--space-lg);
}

.hero-copy .lead {
  max-width: var(--measure);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.hero-actions + .caption {
  margin-top: var(--space-md);
}

/* --------------------------------------------------------- price board -- */

.board {
  padding: var(--space-xl);
  display: grid;
  gap: var(--space-lg);
}

.board-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
}

.board-figure {
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.1;
  font-weight: 700;
}

.board-figure .per-unit {
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  color: var(--ink-muted);
}

.board-lot {
  margin-top: var(--space-xxs); /* an optical nudge, not a layout gap */
}

.bar {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--moss);
}

.bar-fill.is-amber {
  background: var(--amber);
}

.bar-fill.is-clay {
  background: var(--clay);
}

.board-note {
  border-top: 1px solid var(--line);
  padding-top: var(--space-md);
}

/* ------------------------------------------------------------ crop strip -- */

.crop-block {
  display: grid;
  gap: var(--space-md);
  padding-block: var(--space-xl) var(--space-xxl);
  border-top: 1px solid var(--line);
}

@media (min-width: 880px) {
  .crop-block {
    grid-column: 1 / -1;
  }
}

.crop-strip {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* ---------------------------------------------------------------- story -- */

.story {
  padding-block: var(--space-xxxl);
  border-top: 1px solid var(--line);
}

.section-head {
  max-width: var(--measure);
  margin-bottom: var(--space-xxl);
}

.section-head > * + * {
  margin-top: var(--space-sm);
}

h2 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
}

/* The story is set as a ledger: a labelled left column against ruled
 * hairlines, which is the same structure the app's price board header uses. */
.ledger-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-lg) var(--space-xxl);
  padding-block: var(--space-xl);
  border-top: 1px solid var(--line);
}

.ledger-row:last-of-type {
  border-bottom: 1px solid var(--line);
}

.ledger-row .label {
  color: var(--moss);
  padding-top: var(--space-xs);
}

.ledger-body {
  max-width: var(--measure);
}

.ledger-body > * + * {
  margin-top: var(--space-sm);
}

@media (max-width: 640px) {
  .ledger-row {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
}

/* ------------------------------------------------------------ field strip -- */

.field-head {
  margin-top: var(--space-xxl);
}

.field-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xl);
  margin-top: var(--space-xxl);
}

@media (max-width: 760px) {
  .field-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

.field-fact {
  display: grid;
  gap: var(--space-sm);
  color: var(--ink-muted);
}

.field-fact svg {
  color: var(--ink-faint);
}

/* ---------------------------------------------------------- how it works -- */

.how {
  padding-block: var(--space-xxxl);
  border-top: 1px solid var(--line);
}

.role-cards {
  display: grid;
  gap: var(--space-lg);
}

@media (min-width: 760px) {
  .role-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.role-card {
  padding: var(--space-xl);
}

.role-card > .label {
  color: var(--moss);
}

.role-card > .heading {
  margin-top: var(--space-sm);
}

.steps {
  list-style: none;
  padding: 0;
  margin-top: var(--space-lg);
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: var(--space-xl) 1fr;
  gap: var(--space-md);
  padding-block: var(--space-md);
  border-top: 1px solid var(--line);
}

.steps li::before {
  content: counter(step);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--moss);
}

.pill-samples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* ------------------------------------------------------------- download -- */

.download {
  padding-block: var(--space-xxxl);
  border-top: 1px solid var(--line);
  text-align: center;
}

.download .section-head {
  margin-inline: auto;
  margin-bottom: var(--space-xl);
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
}

.download-actions + .caption {
  margin-top: var(--space-md);
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-xl) var(--space-xxxl);
  display: grid;
  gap: var(--space-lg);
}

.site-footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
}
