/* ==========================================================================
   HẠT VIỆT — gạo & nông sản xuất khẩu
   Demo for Hoàng Anh Studio. Fictional brand, no real contact details.

   CONCEPT
   An agrarian lab report: rice paper, ink, and a single hairline grid. The page
   reads like a specification sheet an exporter would actually hand over — a
   numbered field report where every claim is a measured column, not a slogan.

   PALETTE  (hex · role · measured contrast)
   --paper      #F5EEDF  rice-paper cream, page ground
   --paper-2    #EDE3CF  recessed bands, hero figures, table zebra
   --paper-3    #E4D8BF  raised chips, disabled ground
   --ink        #1B2A1F  primary text on paper            13.01:1
   --ink-soft   #565847  body / muted text on paper       6.31:1
   --ink-dim    #6B6650  meta, table captions on paper    4.99:1
   --green      #14322A  deep paddy green, dark surfaces  11.96:1 vs paper
   --green-2    #2A5443  secondary green, rules on dark    7.43:1 vs paper
   --amber      #9E4A1C  burnt amber, links & accents      5.27:1 on paper
   --amber-deep #8C3F16  reserved for amber-on-paper emphasis  6.41:1
   --amber-lt   #E9B87C  amber on dark surfaces            7.64:1 on --green
   --error      #F2A38E  form error text on --green        6.85:1
   --paper-lt   #F5EEDF  text on --green                  11.96:1
   --rule       #C9BCA2  section hairlines, decorative only (1.62:1)
   --rule-strong #8C7F63 control boundaries, chips         3.41:1 on --paper
   Text on dark: --paper-lt 11.96:1, --amber-lt 7.64:1, --ink-soft-on-dark
   #C9D3C4 8.95:1. Placeholders #6B6650 = 4.99:1. No text under 4.5:1.

   TYPE
   Fraunces (display, optical size axis 9–144, weight 300–700) + Inter (text).
   One scale, tokenised in :root; every rule reads from a token, so there are
   no one-off sizes in the file.
   --fs-h1      clamp(36px, 7.2vw, 84px) / 0.99 / -0.032em / 400  opsz 120
   --fs-h2      clamp(30px, 4.4vw, 52px) / 1.04 / -0.026em / 400  opsz 96
   --fs-h3      24px / 1.14 / -0.022em / 500                      opsz 48
   --fs-figure  clamp(32px, 7.4vw, 68px) / 0.92 / -0.045em / 300  opsz 144
   --fs-body    17px / 1.65 / 0 / 400        (≥16px)
   --fs-small   15px / 1.55 / 0 / 400
   --fs-control 14px / 1.4  / .01em / 500    (buttons, chips, nav, labels)
   --fs-meta    12px / 1.4  / .07em uppercase (≥12px, never below)
   --fs-brand   21px / 1.1  / -.02em / 600   (wordmark only)
   The hero figures are display numerals but sit below h1 in size, so nothing
   on the page out-shouts the headline.

   LAYOUT
   A 12-column asymmetric editorial grid with a persistent left numeral rail:
   every section is numbered 01–04 in Fraunces, hung outside the text column,
   so the page scans like a document with tabs. One structural idea: the
   horizontal specification table is the page's spine — it reappears as the
   card metadata language, the hero figures, and the form's field labels.

   SIGNATURE MOTION
   One moment: the hero title rises gently into place, always painted. The
   field photograph stays visible without an opacity entrance. Everything
   else is a quiet 680ms reveal.

   SPACING
   --sp-1..--sp-7 on a 2px base, --section-y and --section-gap for the section
   rhythm, so vertical spacing is decided once rather than per component.

   MOTION TOKENS — see :root. Compositor-only properties throughout.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --paper: #F5EEDF;
  --paper-2: #EDE3CF;
  --paper-3: #E4D8BF;
  --ink: #1B2A1F;
  --ink-soft: #565847;
  --ink-dim: #6B6650;
  --green: #14322A;
  --green-2: #2A5443;
  --amber: #9E4A1C;
  --amber-deep: #8C3F16;
  --amber-lt: #E9B87C;
  --error: #F2A38E;  --paper-lt: #F5EEDF;
  --on-dark-soft: #C9D3C4;
  --rule: #C9BCA2;
  --rule-strong: #8C7F63;
  --rule-dark: #3C5A4C;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-text: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --fs-h1: clamp(36px, 7.2vw, 84px);
  --fs-h2: clamp(30px, 4.4vw, 52px);
  --fs-h3: 24px;
  --fs-figure: clamp(32px, 7.4vw, 68px);
  --fs-body: 17px;
  --fs-small: 15px;
  --fs-control: 14px;
  --fs-meta: 12px;
  --fs-brand: 21px;

  --ease-enter: cubic-bezier(.16, 1, .3, 1);
  --ease-expo: cubic-bezier(.19, 1, .22, 1);
  --ease-move: cubic-bezier(.65, 0, .35, 1);
  --ease-exit: cubic-bezier(.7, 0, .84, 0);
  --ease-pop: cubic-bezier(.34, 1.4, .64, 1);
  --dur-micro: 140ms;
  --dur-small: 220ms;
  --dur-med: 320ms;
  --dur-large: 480ms;
  --dur-reveal: 680ms;
  --dur-hero: 900ms;

  --shell: 1180px;
  --gutter: clamp(20px, 5vw, 56px);
  --rail: 92px;
  --header-h: 72px;

  /* Spacing, on a 4px base. Components read from these so vertical rhythm
     does not drift between sections. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --section-y: clamp(64px, 9vw, 112px);
  --section-gap: clamp(34px, 4.4vw, 56px);
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, p, figure, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
::selection { background: var(--amber); color: var(--paper-lt); }

/* Author display rules outrank the UA's [hidden] rule; restore it. */
[hidden] { display: none !important; }

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--green);
  color: var(--paper-lt);
  font-size: var(--fs-control);
  font-weight: 500;
  text-decoration: none;
  border-radius: 2px;
  translate: 0 -160%;
  transition: translate var(--dur-small) var(--ease-exit);
}
.skip-link:focus-visible { translate: 0 0; outline: 2px solid var(--amber-lt); outline-offset: 2px; }

/* Focus ring — one rule for every focusable element. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 2px;
}
.on-dark :where(a, button, input, select, textarea, [tabindex]):focus-visible,
.site-footer :where(a, button):focus-visible {
  outline-color: var(--amber-lt);
}

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  isolation: isolate;
  background: var(--paper);
  border-bottom: 1px solid transparent;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-h);
}

/* CSS-only scroll reaction. Only opacity and scale animate, so the header
   settles onto the page without ever triggering layout. */
.site-header::before,
.site-header::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.site-header::before {
  inset: 0;
  z-index: -1;
  background: var(--paper-2);
  opacity: 0;
}
.site-header::after {
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--rule);
  scale: 0 1;
  transform-origin: left;
}
@supports (animation-timeline: scroll()) {
  .site-header::before {
    animation: header-ground linear both;
    animation-timeline: scroll(root block);
    animation-range: 0 72px;
  }
  .site-header::after {
    animation: header-rule linear both;
    animation-timeline: scroll(root block);
    animation-range: 0 72px;
  }
  @keyframes header-ground { from { opacity: 0; } to { opacity: 1; } }
  @keyframes header-rule { from { scale: 0 1; } to { scale: 1 1; } }
}
@supports not (animation-timeline: scroll()) {
  .site-header { border-bottom-color: var(--rule); background: var(--paper); }
  .site-header::before { opacity: 1; }
  .site-header::after { scale: 1 1; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}
.brand__mark { color: var(--green); flex: none; }
.brand__text { display: flex; flex-direction: column; gap: 1px; }
.brand__name {
  font-family: var(--font-display);
  font-size: var(--fs-brand);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.brand__sub {
  font-size: var(--fs-meta);
  line-height: 1.3;
  letter-spacing: .04em;
  color: var(--ink-soft);
}

.site-nav { display: flex; align-items: center; gap: 30px; }
.site-nav__list { display: flex; align-items: center; gap: 26px; }
.site-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--fs-control);
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--dur-small) var(--ease-move);
}
.site-nav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  height: 1px;
  background: var(--amber);
  scale: 0 1;
  transform-origin: left;
  transition: scale var(--dur-med) var(--ease-enter);
}
.site-nav__link[aria-current] { color: var(--ink); }
.site-nav__link[aria-current]::after { scale: 1 1; }

.nav-toggle__label { font-weight: 500; }
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 2px;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: var(--fs-control);
  font-weight: 500;
  letter-spacing: .02em;
  transition: transform var(--dur-micro) var(--ease-move);
}
.nav-toggle__bars { display: grid; gap: 5px; width: 22px; }
.nav-toggle:active { transform: scale(.97); }
.nav-toggle__bars span {
  display: block;
  height: 1.5px;
  background: var(--ink);
  transition: transform var(--dur-small) var(--ease-move);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:last-child { transform: translateY(-3.25px) rotate(-45deg); }

/* ---------- 4. Buttons ---------- */
.btn {
  --btn-bg: var(--green);
  --btn-fg: var(--paper-lt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 26px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid transparent;
  border-radius: 1px;
  font-size: var(--fs-control);
  font-weight: 500;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-small) var(--ease-move),
              color var(--dur-small) var(--ease-move),
              border-color var(--dur-small) var(--ease-move),
              transform var(--dur-micro) var(--ease-move);
}
.btn--sm { min-height: 44px; padding: 0 18px; font-size: var(--fs-control); }
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: var(--ink);
}
.btn--light { --btn-bg: var(--paper-lt); --btn-fg: var(--green); }
.btn--outline-light {
  --btn-bg: transparent;
  --btn-fg: var(--paper-lt);
  border-color: rgba(245, 238, 223, .5);
}
.btn:active { transform: scale(.97); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: var(--fs-control);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color var(--dur-small) var(--ease-move);
}
.link-arrow__glyph { transition: translate var(--dur-small) var(--ease-enter); }

/* ---------- 5. Hero ---------- */
.hero {
  position: relative;
  padding-top: clamp(40px, 6vw, 76px);
  padding-bottom: clamp(56px, 8vw, 96px);
  border-bottom: 1px solid var(--rule);
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(36px, 6vw, 64px);
  align-items: end;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-meta);
  line-height: 1.4;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: clamp(20px, 3vw, 30px);
}
.eyebrow__tick {
  width: 26px;
  height: 1px;
  background: var(--amber);
  flex: none;
}

.hero__copy { min-width: 0; }
.hero__title {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-variation-settings: "opsz" 120, "wght" 400;
  line-height: .99;
  letter-spacing: -.032em;
  color: var(--ink);
  text-wrap: balance;
}
.hero__title em {
  font-style: italic;
  font-variation-settings: "opsz" 120, "wght" 300;
  letter-spacing: -.036em;
  color: var(--green);
}
.hero__lead {
  max-width: 46ch;
  margin-top: clamp(22px, 3vw, 32px);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink-soft);
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 26px;
  margin-top: clamp(28px, 3.4vw, 40px);
}

/* Field photography replaces the drawn grain specimen. */
.hero__art { width: 100%; margin: 0; min-width: 0; }
.hero__art img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.hero__art figcaption { margin-top: 12px; color: var(--ink-dim); font-size: 12px; line-height: 1.5; }
@media (prefers-reduced-motion: no-preference) {
  .hero__title { animation: field-title-rise var(--dur-hero) var(--ease-enter) both; }
}
@keyframes field-title-rise { from { translate: 0 12px; } to { translate: 0 0; } }

/* ---------- 6. Hero figures ---------- */
.figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: clamp(40px, 6vw, 68px);
  background: var(--rule);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.figure {
  padding: var(--sp-5) 20px var(--sp-5) 0;
  background: var(--paper);
}
.figure + .figure { padding-left: 20px; }
.figure__value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-display);
  font-size: var(--fs-figure);
  font-variation-settings: "opsz" 144, "wght" 300;
  line-height: .92;
  letter-spacing: -.045em;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.figure__unit {
  /* .32em would fall under 12px at the smallest figure size; the floor keeps
     the contract's minimum for any rendered text. */
  font-size: max(12px, .32em);
  letter-spacing: -.01em;
  color: var(--amber);
  font-variation-settings: "opsz" 24, "wght" 500;
}
.figure__label {
  margin-top: var(--sp-3);
  max-width: 22ch;
  font-size: var(--fs-control);
  line-height: 1.45;
  color: var(--ink-soft);
}
.figures__note {
  margin-top: 14px;
  font-size: var(--fs-meta);
  line-height: 1.4;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ---------- 7. Section shell ---------- */
.section {
  padding-block: var(--section-y);
  border-bottom: 1px solid var(--rule);
}

.sec-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px 0;
  margin-bottom: var(--section-gap);
}
.sec-head__num {
  font-family: var(--font-display);
  font-size: var(--fs-control);
  font-variation-settings: "opsz" 24, "wght" 500;
  letter-spacing: .06em;
  color: var(--amber);
  line-height: 1;
  padding-top: .45em;
}
.sec-head__num--light { color: var(--amber-lt); }
.sec-head__text { min-width: 0; }
.sec-head__title {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-variation-settings: "opsz" 96, "wght" 400;
  line-height: 1.04;  letter-spacing: -.026em;
  color: var(--ink);
  text-wrap: balance;
}
.sec-head__lead {
  max-width: 62ch;
  margin-top: 16px;
  font-size: var(--fs-body);
  line-height: 1.68;
  color: var(--ink-soft);
}

/* ---------- 8. Specification table ---------- */
.table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-top: 1px solid var(--ink);
  scrollbar-width: thin;
}
.spec {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: var(--fs-control);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.spec th,
.spec td {
  padding: 15px 18px 15px 0;
  text-align: left;
  vertical-align: baseline;
  border-bottom: 1px solid var(--rule);
}
.spec thead th {
  font-size: var(--fs-meta);
  font-weight: 600;
  letter-spacing: .075em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding-block: 12px;
  border-bottom-color: var(--ink);
  white-space: nowrap;
}
.spec thead th:not(:first-child),
.spec td { padding-left: 18px; }
.spec tbody th {
  font-weight: 400;
  color: var(--ink-soft);
  white-space: nowrap;
}
.spec td {
  color: var(--ink);
  font-family: var(--font-display);
  font-variation-settings: "opsz" 24, "wght" 400;
  font-size: var(--fs-small);
  letter-spacing: -.005em;
}
.spec tbody tr:last-child th,
.spec tbody tr:last-child td { border-bottom: 0; }
.spec tbody tr { transition: background-color var(--dur-small) var(--ease-move); }
.table-note {
  max-width: 68ch;
  margin-top: 18px;
  font-size: var(--fs-control);
  line-height: 1.6;
  color: var(--ink-dim);
}

/* ---------- 9. Filters ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2px;
}
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
  margin: -2px;
  max-width: 100%;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  position: relative;
  flex: none;
  min-height: 40px;
  padding: 0 16px;
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  font-size: var(--fs-control);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-small) var(--ease-move),
              color var(--dur-small) var(--ease-move),
              border-color var(--dur-small) var(--ease-move),
              transform var(--dur-micro) var(--ease-move);
}
/* Chips are 40px tall by design; the pseudo-element extends the hit area to
   44px without changing the visual height. */
.chip::after {
  content: "";
  position: absolute;
  inset: -2px 0;
}
.chip[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--paper-lt);
}
.chip:not([aria-pressed="true"]):focus-visible { border-color: var(--ink); color: var(--ink); }
.chip:active { transform: scale(.97); }
.filter-count {
  font-size: var(--fs-meta);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}

/* ---------- 10. Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  margin-top: 2px;
}
.card {
  border-bottom: 1px solid var(--rule);
  min-width: 0;
  /* Filter transition — survivors cross-fade, never reflow. */
  transition: opacity var(--dur-small) var(--ease-move), translate var(--dur-med) var(--ease-enter);
}
.card[hidden] { display: none; }
.card__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--sp-5) 0;
}
.card__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-meta);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.card__index { color: var(--amber); font-variant-numeric: tabular-nums; }
.card__season { color: var(--ink-dim); }
.card__title {
  margin-top: var(--sp-4);
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-variation-settings: "opsz" 48, "wght" 500;
  line-height: 1.14;
  letter-spacing: -.022em;
  color: var(--ink);
  transition: color var(--dur-small) var(--ease-move);
}
.card__region {
  margin-top: var(--sp-1);
  font-size: var(--fs-control);
  letter-spacing: .03em;
  color: var(--ink-dim);
}
.card__note {
  margin-top: var(--sp-3);
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink-soft);
  flex: 1;
}
.card__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  min-height: 44px;
  margin-top: var(--sp-2);
  font-size: var(--fs-control);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color var(--dur-small) var(--ease-move);
}
.card__arrow { transition: translate var(--dur-small) var(--ease-enter); }

.cards-empty {
  padding: 48px 0 8px;
  text-align: center;
}
.cards-empty p {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-variation-settings: "opsz" 48, "wght" 400;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

/* Cards sit in a continuous ledger: one hairline per row, spanning the full
   measure. Column rhythm is a left inset on every column after the first.
   JS stamps each visible card with data-col2 / data-col3 = (visible index %
   2) and (visible index % 3), so the inset follows the visible order after a
   filter change at either breakpoint, and stays correct when the viewport
   crosses between 2 and 3 columns without JS having to re-run.
   Without JS there are no attributes, so the nth-child fallbacks below
   rebuild the same rhythm from DOM order. */
@media (min-width: 600px) and (max-width: 879px) {
  .card[data-col2="1"] .card__inner { padding-left: 26px; }
  .card:not([data-col2]):nth-child(2n) .card__inner { padding-left: 26px; }
}
@media (min-width: 880px) {
  .card[data-col3="1"] .card__inner,
  .card[data-col3="2"] .card__inner { padding-left: 26px; }
  .card:not([data-col3]):nth-child(3n+2) .card__inner,
  .card:not([data-col3]):nth-child(3n+3) .card__inner { padding-left: 26px; }
}

/* Filter transition — the survivors fade and rise back in, staggered. */
html.js-motion .card.is-filtering { opacity: 0; translate: 0 10px; }

/* ---------- 11. Process ---------- */
.section--process { background: var(--paper-2); }
.steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
}
.step {
  padding: var(--sp-5) 0;
  border-bottom: 1px solid var(--rule);
}
.step__num {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-control);
  font-variation-settings: "opsz" 24, "wght" 500;
  letter-spacing: .06em;
  color: var(--amber-deep);
  margin-bottom: var(--sp-3);
}
.step__title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-variation-settings: "opsz" 48, "wght" 500;
  line-height: 1.14;
  letter-spacing: -.022em;
  color: var(--ink);
}
.step__text {
  margin-top: var(--sp-2);
  max-width: 34ch;
  font-size: var(--fs-small);
  line-height: 1.62;
  color: var(--ink-soft);
}

/* ---------- 12. Quote / form ---------- */
.on-dark {
  background: var(--green);
  color: var(--paper-lt);
  border-bottom: 0;
}
.quote__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(34px, 5vw, 64px);
}
.quote__intro { min-width: 0; }
.quote__panel { min-width: 0; }
.quote__title {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-variation-settings: "opsz" 96, "wght" 400;
  line-height: 1.04;
  letter-spacing: -.026em;
  color: var(--paper-lt);
  text-wrap: balance;
}
.quote__lead {
  margin-top: 20px;
  max-width: 44ch;
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--on-dark-soft);
}
.quote__meta {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-dark);
  font-size: var(--fs-meta);
  line-height: 1.5;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--on-dark-soft);
}

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 18px;
}
.field { display: flex; flex-direction: column; gap: 7px; grid-column: 1 / -1; min-width: 0; }
.field--half { grid-column: span 1; }
.field__label {
  font-size: var(--fs-control);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .02em;
  color: var(--paper-lt);
}
.field__opt { font-weight: 400; color: var(--on-dark-soft); }
.field__input {
  width: 100%;
  min-height: 50px;
  padding: 13px 14px;
  background: rgba(245, 238, 223, .07);
  border: 1px solid rgba(245, 238, 223, .45);
  border-radius: 1px;
  color: var(--paper-lt);
  font-size: var(--fs-body);
  line-height: 1.4;
  transition: border-color var(--dur-small) var(--ease-move), background-color var(--dur-small) var(--ease-move);
}
.field__input::placeholder { color: var(--on-dark-soft); opacity: 1; }
.field__input:focus { border-color: var(--amber-lt); background: rgba(245, 238, 223, .1); }
.field__input:focus-visible { outline: 2px solid var(--amber-lt); outline-offset: 2px; }
.field__area { min-height: 96px; resize: vertical; }
.field__select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--paper-lt) 50%),
                    linear-gradient(135deg, var(--paper-lt) 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 1px), calc(100% - 14px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
.field__select option { background: var(--green); color: var(--paper-lt); }
.field__input[aria-invalid="true"] {
  border-color: var(--error);
  background: rgba(242, 163, 142, .12);
}
.field__err {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--fs-control);
  line-height: 1.45;
  color: var(--error);
}
.field__err::before { content: "!"; font-weight: 700; }
.field__hint { font-size: var(--fs-meta); line-height: 1.5; color: var(--on-dark-soft); }

.form__foot {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-top: 6px;
}
.form__note { font-size: var(--fs-meta); line-height: 1.5; color: var(--on-dark-soft); }

.form-done { padding-top: 6px; }
.form-done__eyebrow {
  font-size: var(--fs-meta);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--amber-lt);
}
.form-done__title {
  margin-top: 12px;
  max-width: 24ch;
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-variation-settings: "opsz" 48, "wght" 400;
  line-height: 1.14;
  letter-spacing: -.02em;
  color: var(--paper-lt);
}
.form-done__list {
  margin-top: 26px;
  border-top: 1px solid var(--rule-dark);
}
.form-done__list > div {
  display: grid;
  grid-template-columns: minmax(96px, 130px) minmax(0, 1fr);
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule-dark);
}
.form-done__list dt {
  font-size: var(--fs-meta);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--on-dark-soft);
}
.form-done__list dd { font-size: var(--fs-body); color: var(--paper-lt); overflow-wrap: anywhere; }
.form-done__note {
  margin-top: 20px;
  max-width: 48ch;
  font-size: var(--fs-small);
  line-height: 1.65;
  color: var(--on-dark-soft);
}
.form-done .btn { margin-top: 24px; }

/* ---------- 13. Footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--paper-lt);
  padding-block: 44px 36px;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}
.site-footer__brand { min-width: 0; }
.site-footer__name {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-variation-settings: "opsz" 48, "wght" 500;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.site-footer__line {
  margin-top: 8px;
  max-width: 34ch;
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--on-dark-soft);
}
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.site-footer__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--fs-control);
  color: var(--on-dark-soft);
  text-decoration: none;
  transition: color var(--dur-small) var(--ease-move);
}
.site-footer__credit {
  max-width: 42ch;
  font-size: var(--fs-meta);
  line-height: 1.6;
  color: var(--on-dark-soft);
}
.site-footer__credit a {
  display: inline-block;
  min-height: 24px;
  color: var(--amber-lt);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 14. Reveal system ---------- */
html.js-motion [data-reveal] {
  opacity: 0;
  translate: 0 18px;
  transition: opacity var(--dur-reveal) var(--ease-enter),
              translate var(--dur-reveal) var(--ease-enter);
}
html.js-motion [data-reveal].is-revealed {
  opacity: 1;
  translate: 0 0;
  transition-delay: calc(var(--stagger, 0) * 55ms);
}

/* ---------- 15. Breakpoints ---------- */
@media (min-width: 600px) {
  .sec-head { grid-template-columns: var(--rail) minmax(0, 1fr); gap: 0 24px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step { padding: 28px 24px 30px 0; }
  .step:nth-child(odd) { border-right: 1px solid var(--rule); }
  .step:nth-child(even) { padding-left: 24px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 880px) {
  :root { --header-h: 78px; }
  .hero__grid { grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); gap: clamp(36px, 5vw, 72px); align-items: center; }
  .hero__art { width: 100%; order: 0; }
  .figure { padding-block: var(--sp-6) var(--sp-5); }
  .quote__grid { grid-template-columns: minmax(0, .82fr) minmax(0, 1fr); align-items: start; }
  .quote__intro { position: sticky; top: calc(var(--header-h) + 40px); }
  .site-footer__grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, .8fr) minmax(0, 1fr); gap: 40px; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .sec-head { grid-template-columns: 120px minmax(0, 1fr); gap: 0 40px; }
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .step { padding: 30px 26px 34px 0; border-right: 1px solid var(--rule); border-bottom: 0; }
  .step:not(:first-child) { padding-left: 26px; }
  .step:last-child { padding-right: 0; border-right: 0; }
}

@media (max-width: 899px) {
  /* Without JS the nav simply wraps under the brand — no hidden content.
     The CTA is dropped here because the hero and the closing section both
     carry the same link, so nothing becomes unreachable. */
  .site-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 20px;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    opacity: 1;
    translate: 0;
    visibility: visible;
  }
  .site-nav__list { flex-direction: row; flex-wrap: wrap; gap: 0 18px; }
  .site-nav__link { min-height: 44px; font-size: var(--fs-control); }
  .site-nav .btn { display: none; }
  .nav-toggle { display: none; }
  .site-header__inner { flex-wrap: wrap; row-gap: 0; padding-block: 8px; }
  .site-header__inner .brand { flex: 1 1 auto; }
}

@media (max-width: 899px) {
  /* JS available: the nav collapses behind a 44px toggle. */
  html.js .nav-toggle { display: inline-flex; }
  html.js .site-header__inner { flex-wrap: nowrap; padding-block: 0; }
  html.js .site-nav {
    position: absolute;
    left: 0; right: 0; top: 100%;
    display: grid;
    gap: 0;
    padding: 8px var(--gutter) 22px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 18px 30px -24px rgba(27, 42, 31, .5);
    opacity: 0;
    translate: 0 -8px;
    visibility: hidden;
    transition: opacity var(--dur-small) var(--ease-move),
                translate var(--dur-med) var(--ease-enter),
                visibility 0s linear var(--dur-med);
  }
  html.js .site-nav.is-open {
    opacity: 1;
    translate: 0 0;
    visibility: visible;
    transition: opacity var(--dur-med) var(--ease-enter),
                translate var(--dur-med) var(--ease-enter),
                visibility 0s;
  }
  html.js .site-nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  html.js .site-nav__link { min-height: 52px; border-bottom: 1px solid var(--rule); font-size: var(--fs-body); }
  html.js .site-nav__link::after { display: none; }
  html.js .site-nav .btn { display: inline-flex; margin-top: var(--sp-4); width: 100%; }
}

@media (max-width: 479px) {
  .figure { padding: var(--sp-4) 12px var(--sp-4) 0; }
  .figure + .figure { padding-left: 12px; }
  .figure__label { font-size: var(--fs-meta); max-width: 14ch; }
  .figures__note { letter-spacing: .03em; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .field--half { grid-column: 1 / -1; }
  /* The chips scroll horizontally; the count sits beneath them rather than
     competing for the same line. */
  .filter-bar { display: block; }
  .filter-count { margin-top: var(--sp-3); }
}

/* ---------- 16. Hover-only affordances ---------- */
/* Every hover lives behind this query. The base rules above are the resting
   state, so a touch device never keeps a hover colour after a tap.
   :not(:active) keeps the press transform authoritative while the pointer is
   down — both rules have the same specificity, so without it the later hover
   declaration would override the press feedback. */
@media (hover: hover) and (pointer: fine) {
  .site-nav__link:hover { color: var(--ink); }
  .btn--primary:hover:not(:active) { background: #0C241D; transform: translateY(-1px); }
  .btn--ghost:hover { background: var(--ink); color: var(--paper-lt); }
  .btn--light:hover { background: #FFFFFF; }
  .btn--outline-light:hover { border-color: var(--paper-lt); background: rgba(245, 238, 223, .08); }
  .link-arrow:hover { border-bottom-color: var(--amber); }
  .link-arrow:hover .link-arrow__glyph { translate: 4px 0; }
  .spec tbody tr:hover { background: var(--paper-2); }
  .chip:not([aria-pressed="true"]):hover { border-color: var(--ink); color: var(--ink); background: var(--paper-3); }
  .chip:hover:not(:active) { transform: translateY(-1px); }
  .card__link:hover { border-bottom-color: var(--amber); }
  .card__link:hover .card__arrow { translate: 3px 0; }
  .card:hover .card__title { color: var(--green); }
  .field__input:hover:not(:focus) { border-color: rgba(245, 238, 223, .6); }
  .site-footer__nav a:hover { color: var(--paper-lt); }
}

/* Mirror the card affordance for keyboard users. */
.card:focus-within .card__title { color: var(--green); }

/* ---------- 17. Reduced motion & preference fallbacks ---------- */
@media (prefers-reduced-motion: reduce) {
  html.js-motion [data-reveal] { opacity: 1 !important; translate: none !important; scale: none !important; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .site-header, .site-header__inner { animation: none !important; }
  .site-nav { transition: none !important; }
  html { scroll-behavior: auto; }
}

@media (prefers-contrast: more) {
  :root { --ink-soft: #3D3F31; --ink-dim: #454734; --rule: #8C7F63; --rule-strong: #5E5340; --on-dark-soft: #E6EBE2; --rule-dark: #7E9A8C; }
  .site-header { background: var(--paper); border-bottom-color: var(--ink); }
  .field__input { border-color: var(--paper-lt); background: rgba(245, 238, 223, .12); }
  .chip { border-color: var(--ink); }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--paper); }
  /* The field gets an opaque ground here, so the translucent border would
     composite to 2.83:1 against it; use the solid on-dark text colour, which
     measures 5.56:1. */
  .field__input { background: var(--green-2); border-color: var(--on-dark-soft); }
}

/* ---------- 18. Print ---------- */
@media print {
  .site-header, .nav-toggle, .hero__art, .form, .cards-empty { display: none; }
  body { background: #fff; color: #000; }
  .on-dark { background: #fff; color: #000; }
  /* Printing shows every card, so the data-col gutters no longer describe the
     printed flow; the ledger reads as a flat list instead. */
  .card[hidden] { display: block; }
  .card .card__inner { padding-left: 0 !important; }
}

/* A field report uses full-size photographs, not ornamental grain thumbnails. */
.grain-study { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(20px, 4vw, 48px); align-items: center; margin: 0 0 36px; padding: 24px; background: var(--paper-2); }
.grain-study img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.grain-study__label { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1.2; margin-bottom: 14px; color: var(--green); }
.grain-study p { font-size: 16px; line-height: 1.65; color: var(--ink-soft); }
.grain-study small { display: block; margin-top: 14px; font-size: 12px; line-height: 1.5; color: var(--ink-dim); }
@media (min-width: 960px) { .hero__grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; } }
@media (max-width: 600px) { .grain-study { grid-template-columns: minmax(0, 1fr); padding: 18px; } }
