/* Creature Counts — design system foundation.
   Shared by the platform site, project microsites and the count field tool.
   No dependencies, no webfonts, no build step.

   The palette is a wetland at first light: deep pine and ink for authority,
   warm paper and stone for calm, teal water and reed-gold for life, one clay
   accent reserved for the action that matters. */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light;

  /* Colour */
  --paper:       #faf7f0;
  --wash:        #f2ecdf;
  --card:        #fffdf8;
  --ink:         #1b2721;
  --ink-soft:    #4b5a51;
  --stone:       #7d8378; /* decorative strokes and placeholders only — 3.6:1 on paper, fails AA for text */
  --line:        #e3dcca;
  --line-soft:   #ece6d6;

  --pine:        #0c3a2d;
  --pine-deep:   #072319;
  --moss:        #3e7c59;
  --water:       #175a4e;
  --water-light: #6fa295;
  --reed:        #8a6d24;
  --sun:         #e0b158;

  --clay:        #b4552d;
  --clay-deep:   #96431f;
  --accent:      var(--clay);
  --accent-deep: var(--clay-deep);
  --accent-ink:  #ffffff;

  /* On dark (band) surfaces */
  --band-ink:      #eef2ea;
  --band-soft:     #b7c9bb;
  --band-eyebrow:  #d5ae56;
  --band-line:     rgb(255 255 255 / 0.14);

  --focus: #1467c8; /* kingfisher — must stay loud on paper and pine alike */

  /* Type — system stacks only: zero requests, zero layout shift */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --text-xs:  0.8125rem;
  --text-sm:  0.9375rem;
  --text-base: 1.0625rem;
  --text-lg:  1.25rem;
  --text-xl:  1.5rem;
  --text-2xl: 1.875rem;
  --text-3xl: 2.375rem;
  --text-4xl: 3.25rem;
  --text-5xl: 4.25rem;

  /* Space — 8px scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-20: 5rem;
  --s-24: 6rem;
  --s-32: 8rem;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgb(27 39 33 / 0.05), 0 2px 8px rgb(27 39 33 / 0.05);
  --shadow: 0 1px 2px rgb(27 39 33 / 0.05), 0 6px 24px rgb(27 39 33 / 0.08);
  --shadow-lg: 0 2px 4px rgb(27 39 33 / 0.05), 0 18px 48px rgb(27 39 33 / 0.13);

  --ease: cubic-bezier(0.22, 0.08, 0.22, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset-lite ---------- */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4, p, figure { margin: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

input, select, textarea { font: inherit; color: inherit; }

/* The hidden attribute always wins, even against authored display values. */
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Headings receive programmatic focus for screen readers on screen changes;
   they are not interactive, so no visible ring. */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }

::selection { background: var(--water); color: #fff; }

/* ---------- Typography ---------- */

.display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.eyebrow {
  font-size: var(--text-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--water);
}

.lead {
  font-size: var(--text-lg);
  line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: pretty;
}

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

.sci { font-family: var(--font-display); font-style: italic; }

a {
  color: var(--pine);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 150ms var(--ease);
}
a:hover { color: var(--moss); }

/* ---------- Layout ---------- */

.container {
  width: min(100% - 3rem, 72rem);
  margin-inline: auto;
}

.container--narrow { width: min(100% - 3rem, 46rem); }

.section { padding-block: var(--s-20); }

@media (min-width: 48em) {
  .section { padding-block: var(--s-32); }
}

/* ---------- Dark band surfaces ---------- */

.band {
  background:
    radial-gradient(120% 90% at 50% -20%, rgb(23 90 78 / 0.55), transparent 60%),
    var(--pine-deep);
  color: var(--band-ink);
}

.band .eyebrow { color: var(--band-eyebrow); }
.band h2, .band h3, .band .display { color: #fff; }
.band .lead, .band .muted, .band p { color: var(--band-soft); }
.band a { color: #fff; }
.band a:hover { color: var(--band-soft); }
.band ::selection { background: var(--sun); color: var(--pine-deep); }

/* Cards keep their own ink even inside a band. */
.band .card, .band .card h3, .band .card p { color: initial; }
.band .card { color: var(--ink); }
.band .card h3 { color: var(--ink); }
.band .card p { color: var(--ink-soft); }

/* ---------- Components ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 3.125rem;
  padding: var(--s-3) var(--s-8);
  border-radius: 999px;
  font-weight: 600;
  font-size: var(--text-base);
  text-decoration: none;
  transition:
    background-color 180ms var(--ease),
    color 180ms var(--ease),
    box-shadow 180ms var(--ease),
    transform 180ms var(--ease);
}

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

.btn--primary {
  background: var(--pine);
  color: #fff;
  box-shadow: 0 1px 2px rgb(7 35 25 / 0.3);
}
.btn--primary:hover { background: var(--pine-deep); color: #fff; box-shadow: 0 3px 12px rgb(7 35 25 / 0.28); }

.btn--accent {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px rgb(150 67 31 / 0.35);
}
.btn--accent:hover { background: var(--accent-deep); color: var(--accent-ink); box-shadow: 0 3px 14px rgb(150 67 31 / 0.32); }

.btn--quiet {
  background: transparent;
  color: var(--pine);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.btn--quiet:hover { box-shadow: inset 0 0 0 1.5px var(--moss); color: var(--pine); }

.band .btn--quiet { color: #fff; box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.35); }
.band .btn--quiet:hover { box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.7); color: #fff; }

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

.field {
  width: 100%;
  min-height: 3.125rem;
  padding: var(--s-3) var(--s-4);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.field::placeholder { color: var(--stone); }
.field:focus {
  border-color: var(--water);
  outline: none;
  box-shadow: 0 0 0 3px rgb(23 90 78 / 0.18);
}

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

.skip-link {
  position: absolute;
  left: var(--s-4); top: var(--s-4);
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  background: var(--pine);
  color: #fff;
  border-radius: var(--radius);
  transform: translateY(-250%);
}
.skip-link:focus { transform: none; color: #fff; }

/* ---------- Ripple divider — the platform's signature mark between sections ---------- */

.ripple-divider {
  display: flex;
  justify-content: center;
  padding-block: var(--s-2);
  color: var(--stone);
  opacity: 0.7;
}
.ripple-divider svg { width: 5.5rem; height: auto; }

/* ---------- Scroll reveals (opt-in via data-reveal; JS adds .reveal-enabled) ---------- */

.reveal-enabled [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out);
  transition-delay: calc(var(--reveal-delay, 0) * 90ms);
}

.reveal-enabled [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
