/* ------------------------------------------------------------------ */
/* Closing Count launch site. Built to docs/site/BRIEF.md.              */
/* Tokens first: the palette is the app's, so the page and the embedded */
/* app read as one object.                                              */
/* ------------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  /* Surfaces: cream paper */
  --color-background: #f4ecdf;
  --color-surface: #fdf8f0;
  --color-surface-raised: #fffdf9;
  --color-surface-sunken: #ede3d3;

  /* Ink: espresso */
  --color-text: #2a1c13;
  --color-text-muted: #6d5c50;
  --color-text-faint: #9b8a7d;
  --color-border: #e2d5c3;
  --color-border-strong: #c9b8a2;

  /* Accent: terracotta, the one thing to do next */
  --color-accent: #b4471c;
  --color-accent-hover: #9c3b15;
  --color-accent-text: #fff6ee;
  --color-accent-soft: #f6dfd0;

  /* Semantic triples: edge, soft fill, ink on that fill */
  --color-success: #2f7a4b;
  --color-success-soft: #dcefe1;
  --color-success-ink: #1f5c37;
  --color-warning: #b7791f;
  --color-warning-soft: #f8e9cc;
  --color-warning-ink: #7a4f0c;

  /* Site-only */
  --color-rule: #e6dbc9;
  --color-focus: #b4471c;
  --shadow-sm: 0 1px 2px rgb(42 28 19 / 0.06), 0 1px 1px rgb(42 28 19 / 0.04);
  --shadow-md: 0 2px 4px rgb(42 28 19 / 0.06), 0 8px 20px rgb(42 28 19 / 0.08);
  --shadow-lg:
    0 4px 10px rgb(42 28 19 / 0.08), 0 24px 48px rgb(42 28 19 / 0.16);
  --shadow-focus: 0 0 0 4px rgb(180 71 28 / 0.2);

  /* Type */
  --font-display:
    "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans:
    "Inter", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lead: 1.25rem;
  --text-card: 1.5rem;
  --text-section: clamp(2rem, 1.2rem + 2.6vw, 3rem);
  --text-hero: clamp(2.4rem, 1rem + 3vw, 3.5rem);

  /* Shape and motion, matching the app */
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --tap-target: 44px;
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 320ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);

  /* Layout */
  --content-max: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section-pad: clamp(4rem, 8vw, 7rem);
  --header-height: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #171110;
    --color-surface: #211915;
    --color-surface-raised: #2b211c;
    --color-surface-sunken: #110d0b;
    --color-text: #f3eadf;
    --color-text-muted: #b3a394;
    --color-text-faint: #7f7066;
    --color-border: #39302a;
    --color-border-strong: #54463d;
    --color-accent: #ea7d4e;
    --color-accent-hover: #f28f63;
    --color-accent-text: #1b120e;
    --color-accent-soft: #3d241a;
    --color-success: #6fc08d;
    --color-success-soft: #1d3326;
    --color-success-ink: #9fdcb5;
    --color-warning: #e0aa4c;
    --color-warning-soft: #3a2b12;
    --color-warning-ink: #f1c982;
    --color-rule: #241c18;
    --color-focus: #ea7d4e;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 2px 4px rgb(0 0 0 / 0.3), 0 8px 20px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 4px 10px rgb(0 0 0 / 0.4), 0 24px 48px rgb(0 0 0 / 0.6);
    --shadow-focus: 0 0 0 4px rgb(234 125 78 / 0.3);
  }
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

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

html {
  font-family: var(--font-sans);
  font-size: 100%;
  line-height: 1.6;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--color-background);
  color: var(--color-text);
  font-size: var(--text-md);
  overflow-x: clip;
}

h1,
h2,
h3,
p,
dl,
dd,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "SOFT" 50;
  font-optical-sizing: auto;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* One sentence per line at every width: each span is its own line, and
   balancing is off so a sentence is never rebalanced across two. The size
   is the brief's scale, capped by the copy column's width: the longest
   sentence, "Order what's missing.", is about 9.4em wide in Fraunces. */
.hero-heading {
  font-size: var(--text-hero);
  font-size: min(var(--text-hero), 10.4cqi);
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: wrap;
}

.hero-heading > span {
  display: block;
}

.section-heading {
  font-size: var(--text-section);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.card-heading {
  font-size: var(--text-card);
}

.lead {
  font-size: var(--text-lead);
  line-height: 1.5;
  text-wrap: pretty;
}

.caption {
  font-size: var(--text-sm);
}

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

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

.eyebrow {
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.numeral {
  font-variant-numeric: tabular-nums lining-nums;
}

a {
  color: var(--color-accent);
  text-decoration-color: color-mix(
    in srgb,
    var(--color-accent) 40%,
    transparent
  );
  text-underline-offset: 0.2em;
  transition: text-decoration-color var(--duration-fast) var(--ease-standard);
}

a:hover {
  text-decoration-color: currentColor;
}

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

::selection {
  background: var(--color-accent-soft);
  color: var(--color-text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section {
  padding-block: var(--section-pad);
}

.band-surface {
  background: var(--color-surface);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.band-surface .card {
  background: var(--color-surface-raised);
}

/* ------------------------------------------------------------------ */
/* Buttons, pills, lockup                                              */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--tap-target);
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

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

.btn-primary {
  background: var(--color-accent);
  color: var(--color-accent-text);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-surface-raised);
  color: var(--color-text);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
}

.btn-large {
  min-height: 3.5rem;
  padding: 0 2rem;
  font-size: var(--text-md);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 0.5rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

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

.lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius-pill);
}

a.lockup {
  min-height: var(--tap-target);
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "SOFT" 50;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.lockup-small .wordmark {
  font-size: 1rem;
}

/* ------------------------------------------------------------------ */
/* 1. Header                                                           */
/* ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration-base) var(--ease-standard);
}

.site-header.is-scrolled {
  border-bottom-color: var(--color-border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-height);
}

.site-nav {
  display: none;
  margin-left: auto;
  gap: 0.25rem;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target);
  padding: 0 0.875rem;
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-weight: 500;
  text-decoration: none;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard);
}

.site-nav a:hover {
  color: var(--color-text);
  background: var(--color-accent-soft);
}

.site-nav a:active {
  background: var(--color-surface-sunken);
}

.site-header .btn {
  margin-left: auto;
}

@media (min-width: 720px) {
  .site-nav {
    display: flex;
  }

  .site-header .btn {
    margin-left: 0.5rem;
  }
}

/* ------------------------------------------------------------------ */
/* 2. Hero                                                             */
/* ------------------------------------------------------------------ */

.hero {
  --pointer-x: 0;
  --pointer-y: 0;
  --rules-scroll: 0px;
  position: relative;
  overflow: clip;
  padding-block: clamp(3rem, 6vw, 5.5rem) var(--section-pad);
}

/* Background plane: a clipboard sheet of faint ruled lines. */
.hero-rules {
  position: absolute;
  inset: -3rem 0 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(2.5rem - 1px),
    var(--color-rule) calc(2.5rem - 1px),
    var(--color-rule) 2.5rem
  );
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
  transform: translate3d(
    calc(var(--pointer-x) * -6px),
    calc(var(--pointer-y) * -6px + var(--rules-scroll)),
    0
  );
  transition: transform var(--duration-fast) linear;
}

.hero-inner {
  position: relative;
  display: grid;
  gap: 3rem;
  align-items: center;
}

.hero-copy {
  container-type: inline-size;
  display: grid;
  gap: 1.5rem;
  max-width: 36rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-visual {
  position: relative;
}

.hero-device {
  width: 100%;
}

/* Foreground plane: the order card. */
.hero-order {
  margin-top: 1.5rem;
  transform: translate3d(
    calc(var(--pointer-x) * 10px),
    calc(var(--pointer-y) * 10px),
    0
  );
  transition: transform var(--duration-base) var(--ease-out);
}

/* From 900px the card hangs off the tablet's bottom-right corner, low
   enough that the three rows, the group headings and the progress line
   stay visible at the end of the sequence. */
@media (min-width: 900px) {
  .hero-inner {
    grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
    gap: clamp(2rem, 4vw, 4rem);
  }

  /* The visual carries the card's hang below the tablet; the copy carries
     the same so it centres on the tablet, not on tablet plus hang. */
  .hero-visual {
    padding: 0 0 17rem;
  }

  .hero-copy {
    padding-bottom: 17rem;
  }

  /* The card overhangs the tablet's right edge by 2.5rem, or less where
     the viewport is close, so it is never clipped: the room beyond the
     content box is the container's outer margin plus the gutter. */
  .hero-order {
    --bleed: min(
      2.5rem,
      max(0px, (100vw - var(--content-max)) / 2) + var(--gutter) - 1.5rem
    );
    position: absolute;
    right: calc(-1 * var(--bleed));
    bottom: 0;
    width: 60%;
    min-width: 18rem;
    margin-top: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Tablet frame and the Count screen mockup                            */
/* ------------------------------------------------------------------ */

.device {
  container: mock / inline-size;
  padding: 12px;
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.device-screen {
  overflow: hidden;
  border-radius: 8px;
  background: var(--color-background);
}

/* The mockup is the app at about 85%, drawn with the app's own tokens. */
.mock {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--color-text);
}

.hero-device .mock {
  display: grid;
  grid-template-columns: 11em 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header screen"
    "rail screen";
}

.mock-header {
  grid-area: header;
  display: flex;
  align-items: center;
  height: 4.5em;
  padding: 0 0.5em 0 1em;
  min-width: 0;
  overflow: hidden;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
}

.mock-title {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1em;
  white-space: nowrap;
}

.mock-title::before {
  content: "";
  flex: none;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.mock-rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  padding: 0.5em 0.5em 1.5em;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
}

.mock-nav {
  display: flex;
  align-items: center;
  gap: 0.6em;
  min-height: 2.75em;
  padding: 0 0.75em;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: max(0.8125rem, 0.9em);
  font-weight: 500;
  white-space: nowrap;
}

.mock-nav.is-active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 600;
}

.mock-icon {
  flex: none;
  width: 1.5em;
  height: 1.5em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mock-screen {
  grid-area: screen;
  display: grid;
  gap: 0.5em;
  padding: 1.5em 1.25em 1.25em;
  min-width: 0;
}

.mock-screen-title {
  margin-bottom: 0.75em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.75em;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.mock-group-title {
  margin-top: 0.5em;
  padding-bottom: 0.25em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25em;
  line-height: 1.2;
}

.mock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0.75em 1em;
  padding: 1em;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.mock-row.is-counted {
  border-left-color: var(--color-success);
}

.mock-row.is-below-par {
  border-left-color: var(--color-warning);
  background: color-mix(
    in srgb,
    var(--color-warning-soft) 55%,
    var(--color-surface)
  );
}

.mock-row-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25em 0.75em;
  min-width: 0;
}

.mock-row-name {
  font-size: 1.125em;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.mock-row-par {
  color: var(--color-text-muted);
  font-size: max(0.8125rem, 0.875em);
  font-variant-numeric: tabular-nums;
}

.mock-badge {
  align-self: center;
  padding: 2px 0.5em;
  border-radius: var(--radius-pill);
  background: var(--color-warning-soft);
  color: var(--color-warning-ink);
  font-size: max(0.8125rem, 0.75em);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.mock-stepper {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.mock-step {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface-raised);
  font-size: 1.125rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.mock-input {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 2.75rem;
  padding: 0 0.5em;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
}

.mock-typed {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
}

.mock-footer {
  display: grid;
  gap: 0.75em;
  margin-top: 1em;
  padding: 1em;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.mock-progress {
  display: grid;
  color: var(--color-text-muted);
  font-size: max(0.8125rem, 0.875em);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.mock-progress > span {
  grid-area: 1 / 1;
}

.mock-bar {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
  overflow: hidden;
}

.mock-bar > span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--color-accent);
  transform-origin: left center;
  transform: scaleX(0.1667);
}

.mock-footer-actions {
  display: flex;
  gap: 0.5em;
}

.mock-btn {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.25em;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: max(0.8125rem, 1em);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.mock-btn-primary {
  background: var(--color-accent);
  color: var(--color-accent-text);
}

.mock-btn-secondary {
  background: var(--color-surface-raised);
  color: var(--color-text);
  border-color: var(--color-border);
}

/* Wide enough: rows go two-column, as the app does from 640px. */
@container mock (min-width: 32rem) {
  .mock-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .mock-input {
    flex: none;
    width: 4.5ch;
  }
}

/* Narrow (a phone): the header spans the top and the rail keeps icons only. */
@container mock (max-width: 23.99rem) {
  .hero-device .mock {
    grid-template-columns: 3.25em 1fr;
    grid-template-areas:
      "header header"
      "rail screen";
  }

  .mock-header {
    height: 3.5em;
    padding: 0 1em;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .mock-rail {
    padding-inline: 0.25em;
  }

  .mock-nav {
    justify-content: center;
    padding: 0;
  }

  .mock-nav > span {
    display: none;
  }

  .mock-screen {
    padding: 1em 0.75em;
  }
}

/* The hero sequence: "count becomes order". Base styles are the end
   state; each animation plays once from its `from` keyframe, so under
   reduced motion the end state simply shows. */
.mock-typed-milk {
  width: 2ch;
  animation: type-two 0.6s steps(2, end) 0.6s backwards;
}

.mock-typed-oat {
  width: 1ch;
  animation: type-one 0.4s steps(1, end) 1.4s backwards;
}

.mock-row-milk {
  border-left-color: var(--color-success);
  animation: edge-success var(--duration-base) var(--ease-standard) 1.2s
    backwards;
}

.mock-row-oat {
  border-left-color: var(--color-warning);
  background: color-mix(
    in srgb,
    var(--color-warning-soft) 55%,
    var(--color-surface)
  );
  animation: row-warning var(--duration-base) var(--ease-standard) 2s backwards;
}

.mock-row-oat .mock-badge {
  animation: badge-in var(--duration-base) var(--ease-spring) 2s backwards;
}

.mock-progress-before {
  opacity: 0;
  animation: fade-out var(--duration-base) var(--ease-standard) 2.2s backwards;
}

.mock-progress-after {
  animation: fade-in var(--duration-base) var(--ease-standard) 2.2s backwards;
}

.hero-device .mock-bar > span {
  animation: bar-fill var(--duration-slow) var(--ease-out) 2.2s backwards;
}

.mock-save {
  animation: press 0.24s var(--ease-standard) 2.6s;
}

.hero-order .order-card {
  animation: rise 0.6s cubic-bezier(0, 0, 0.2, 1) 2.9s backwards;
}

.order-copied {
  animation: badge-in var(--duration-base) var(--ease-spring) 4s backwards;
}

@keyframes type-two {
  from {
    width: 0;
  }
}

@keyframes type-one {
  from {
    width: 0;
  }
}

@keyframes edge-success {
  from {
    border-left-color: var(--color-border);
  }
}

@keyframes row-warning {
  from {
    border-left-color: var(--color-border);
    background-color: var(--color-surface);
  }
}

@keyframes badge-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
}

@keyframes bar-fill {
  from {
    transform: scaleX(0);
  }
}

@keyframes press {
  50% {
    transform: scale(0.97);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

/* ------------------------------------------------------------------ */
/* The order card (hero foreground and closing)                        */
/* ------------------------------------------------------------------ */

.order-card {
  container-type: inline-size;
  display: grid;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
}

.order-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.order-card-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "SOFT" 50;
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.order-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
  margin-top: -0.5rem;
}

.order-contact a {
  flex: none;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: var(--tap-target);
  margin-block: -0.5rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.order-contact a:active {
  color: var(--color-accent-hover);
}

.order-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

.order-table th,
.order-table td {
  padding: 0.625rem 0.5rem;
  border-top: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.order-table th:first-child,
.order-table td:first-child {
  padding-left: 0;
}

.order-table th:last-child,
.order-table td:last-child {
  padding-right: 0;
}

.order-table thead th {
  padding-top: 0;
  border-top: 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.order-table tbody th {
  font-weight: 600;
}

.order-table td {
  color: var(--color-text-muted);
}

.order-qty {
  color: var(--color-accent);
  font-weight: 600;
}

/* In a narrow card (the hero's, or any card on a phone) the four columns
   stack, each cell carrying its label. The card's width decides, not the
   viewport's, so the wide closing card keeps its columns. */
@container (max-width: 26rem) {
  .order-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .order-table,
  .order-table tbody {
    display: block;
  }

  /* Three short lines per item: the name, on hand and par side by side,
     then the order quantity on a line of its own so it never breaks. */
  .order-table tbody tr {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.25rem 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--color-border);
  }

  .order-table tbody th,
  .order-table tbody td {
    display: block;
    padding: 0;
    border: 0;
  }

  .order-table tbody th,
  .order-table td.order-qty {
    grid-column: 1 / -1;
  }

  .order-table td::before {
    content: attr(data-label);
    margin-right: 0.4em;
    color: var(--color-text-faint);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
}

/* ------------------------------------------------------------------ */
/* 3. The problem                                                      */
/* ------------------------------------------------------------------ */

.problem-inner {
  display: grid;
  gap: 0.75rem;
  max-width: 40rem;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Section heads                                                       */
/* ------------------------------------------------------------------ */

.section-head {
  display: grid;
  gap: 1rem;
  max-width: 40rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.section-head-centred {
  margin-inline: auto;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* 4. How it works                                                     */
/* ------------------------------------------------------------------ */

.steps {
  display: grid;
  gap: 1.25rem;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.75rem;
}

.step p {
  color: var(--color-text-muted);
  text-wrap: pretty;
}

.step-number {
  color: var(--color-accent);
  font-size: 2rem;
  line-height: 1;
}

.mini {
  container: mock / inline-size;
  display: grid;
  gap: 0.5rem;
  margin-top: auto;
  padding: 1rem;
  background: var(--color-surface-sunken);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.mini .mock-row {
  font-size: 0.85rem;
}

.mini-form {
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.mini-field {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.mini-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.mini-label {
  font-size: var(--text-xs);
  font-weight: 500;
}

.mini-input {
  display: flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-select {
  justify-content: space-between;
}

.mini-select::after {
  content: "";
  flex: none;
  width: 0.5em;
  height: 0.5em;
  margin-left: 0.5rem;
  border-right: 1.5px solid var(--color-text-muted);
  border-bottom: 1.5px solid var(--color-text-muted);
  transform: translateY(-25%) rotate(45deg);
}

.mini-order {
  display: grid;
  gap: 0.25rem;
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.mini-order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
}

.mini-order-head .mock-btn {
  flex: none;
  min-height: 2.25rem;
  padding: 0 1em;
}

.mini-order-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "SOFT" 50;
  font-size: 1.0625rem;
  line-height: 1.2;
}

.mini-order-contact {
  display: block;
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.mini-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
}

.mini-line .order-qty {
  text-align: right;
}

@media (min-width: 720px) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------------ */
/* 5. The reorder rule                                                 */
/* ------------------------------------------------------------------ */

.rule-inner {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

.rule-copy {
  display: grid;
  gap: 1.25rem;
  max-width: 34rem;
}

.rule-card {
  display: grid;
  gap: 0.25rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
}

.rule-card-title {
  font-size: var(--text-card);
}

.rule-range {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin-top: 1.75rem;
}

.rule-range label {
  font-weight: 500;
}

.rule-range output {
  color: var(--color-text-muted);
  font-weight: 500;
}

.rule-range input[type="range"] {
  --fill: 35.7%;
  grid-column: 1 / -1;
  width: 100%;
  height: var(--tap-target);
  margin: 0;
  padding: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.rule-range input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    to right,
    var(--color-accent) var(--fill),
    var(--color-surface-sunken) var(--fill)
  );
}

.rule-range input[type="range"]::-webkit-slider-thumb {
  width: var(--tap-target);
  height: var(--tap-target);
  margin-top: -18px;
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-md);
  appearance: none;
  -webkit-appearance: none;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.rule-range input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
}

.rule-range input[type="range"]::-moz-range-progress {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
}

.rule-range input[type="range"]::-moz-range-thumb {
  width: var(--tap-target);
  height: var(--tap-target);
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-md);
}

.rule-range input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.05);
}

.rule-range input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(0.96);
  box-shadow: var(--shadow-focus);
}

.rule-range input[type="range"]:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-pill);
}

.rule-result {
  margin-top: 1.5rem;
}

.rule-result.is-changing > * {
  animation: fade-in var(--duration-fast) var(--ease-out);
}

.rule-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.rule-figures div {
  display: grid;
  gap: 0.25rem;
}

.rule-figures dt {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rule-figures dd {
  font-size: 2.5rem;
  line-height: 1;
}

.rule-figures div:last-child dd {
  font-size: clamp(1.5rem, 1rem + 1.6vw, 2.5rem);
  line-height: 1.1;
}

.rule-at-par {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 2rem 1.5rem;
  text-align: center;
  border: 1px solid color-mix(in srgb, var(--color-success) 25%, transparent);
  border-radius: var(--radius-lg);
  background: var(--color-success-soft);
  color: var(--color-success-ink);
}

.rule-at-par p {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "SOFT" 50;
  font-size: var(--text-card);
  line-height: 1.2;
}

.rule-at-par-icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--color-success);
  color: var(--color-success-soft);
}

.rule-at-par[hidden],
.rule-figures[hidden] {
  display: none;
}

@media (min-width: 900px) {
  .rule-inner {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(2rem, 5vw, 5rem);
  }
}

/* ------------------------------------------------------------------ */
/* 6. Features                                                         */
/* ------------------------------------------------------------------ */

.feature-grid {
  display: grid;
  gap: 1.25rem;
}

.feature {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  padding: 1.75rem;
}

.feature h3 {
  font-size: var(--text-lead);
}

.feature p {
  color: var(--color-text-muted);
  text-wrap: pretty;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 0.25rem;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (min-width: 600px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------------ */
/* 7. Try it                                                           */
/* ------------------------------------------------------------------ */

.try-inner {
  display: grid;
  justify-items: center;
}

.device-embed {
  width: 100%;
  max-width: calc(960px + 24px);
  padding: 6px;
}

.device-embed iframe {
  display: block;
  width: 100%;
  height: 640px;
  border: 0;
  background: var(--color-background);
}

.try-after {
  display: grid;
  justify-items: center;
  gap: 1rem;
  max-width: 36rem;
  margin-top: 2rem;
  text-align: center;
}

@media (min-width: 720px) {
  .device-embed {
    padding: 12px;
  }

  .device-embed iframe {
    height: 680px;
  }
}

/* ------------------------------------------------------------------ */
/* 8. Good to know                                                     */
/* ------------------------------------------------------------------ */

.know-inner {
  display: grid;
  gap: 1.5rem;
  max-width: 44rem;
}

.know-list li {
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-wrap: pretty;
}

.know-list li:last-child {
  border-bottom: 1px solid var(--color-border);
}

.know-list strong {
  color: var(--color-text);
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* 9. Closing call to action                                           */
/* ------------------------------------------------------------------ */

.closing {
  padding-block: clamp(5rem, 10vw, 9rem);
}

.closing-inner {
  display: grid;
  gap: 3rem;
  align-items: center;
}

.closing-copy {
  container-type: inline-size;
  display: grid;
  gap: 1.5rem;
  max-width: 36rem;
}

.closing-copy .btn {
  justify-self: start;
}

/* 6/6 like the hero, so the closing card is wide enough (over 26rem from
   about 1100px) to keep its four columns. */
@media (min-width: 900px) {
  .closing-inner {
    grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
    gap: clamp(2rem, 5vw, 5rem);
  }
}

/* ------------------------------------------------------------------ */
/* 10. Footer                                                          */
/* ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: 2rem;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.site-footer-inner p:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

/* ------------------------------------------------------------------ */
/* Scroll reveal: fade and rise 12px, once, only when the script runs. */
/* ------------------------------------------------------------------ */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.6s var(--ease-out),
    transform 0.6s var(--ease-out);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

.js .step:nth-child(2),
.js .feature:nth-child(3n + 2) {
  transition-delay: 80ms;
}

.js .step:nth-child(3),
.js .feature:nth-child(3n) {
  transition-delay: 160ms;
}

/* ------------------------------------------------------------------ */
/* Reduced motion: end states only, no reveal, no parallax, no fades.  */
/* ------------------------------------------------------------------ */

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .hero-rules,
  .hero-order {
    transform: none;
  }
}
