/* Creature Counts — public sites (platform flagship + project microsites).
   Builds on base.css. */

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-block: var(--s-4);
  background: rgb(250 247 240 / 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow 250ms var(--ease), background-color 250ms var(--ease);
}

.site-header.is-scrolled {
  box-shadow: 0 1px 0 var(--line), 0 4px 24px rgb(27 39 33 / 0.06);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--pine);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.wordmark:hover { color: var(--pine); }

.wordmark svg { width: 1.85rem; height: 1.85rem; flex-shrink: 0; }

.site-nav { display: flex; gap: var(--s-8); }

.site-nav a {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 150ms var(--ease);
}
.site-nav a:hover { color: var(--pine); }

/* Mobile: the nav folds into a calm panel below the header. */

.nav-toggle {
  display: none;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding-inline: var(--s-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--pine);
}

.nav-toggle-bars {
  position: relative;
  width: 1.15rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: background-color 150ms var(--ease);
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--pine);
  border-radius: 2px;
  transition: transform 220ms var(--ease);
}
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after  { top: 6px; }

.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after  { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 44em) {
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: var(--s-2) var(--s-6) var(--s-6);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 40px rgb(27 39 33 / 0.1);
    display: none;
  }

  body.nav-open .site-nav { display: flex; }

  .site-nav a {
    padding-block: var(--s-4);
    font-size: var(--text-base);
    border-bottom: 1px solid var(--line-soft);
  }
  .site-nav a:last-child { border-bottom: none; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: clip;
}

.hero-copy {
  text-align: center;
  padding-block: var(--s-16) var(--s-12);
  max-width: 46rem;
}

@media (min-width: 48em) {
  .hero-copy { padding-block: var(--s-24) var(--s-16); }
}

.hero-copy h1 {
  font-size: clamp(var(--text-3xl), 8vw, var(--text-5xl));
  margin-block: var(--s-5) var(--s-6);
}

.hero-copy h1 em { font-style: italic; }

.hero-copy .lead {
  max-width: 36rem;
  margin-inline: auto;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-8);
}

.hero-scene { line-height: 0; }

.hero-scene svg {
  width: 100%;
  height: clamp(280px, 40vw, 560px);
}

/* The microsite scene is a shallower composition — don't let it over-crop. */
.project-hero .hero-scene svg { height: clamp(170px, 24vw, 340px); }

/* Organic movement: slow drift on the water, a breath of sway in the reeds. */

.scene-ripples { animation: scene-drift 16s var(--ease) infinite alternate; }

@keyframes scene-drift {
  from { transform: translateX(-10px); }
  to   { transform: translateX(10px); }
}

.scene-reeds { transform-origin: 50% 100%; transform-box: fill-box; }
.scene-reeds--l { animation: reed-sway 9s var(--ease) infinite alternate; }
.scene-reeds--r { animation: reed-sway 11s var(--ease) infinite alternate-reverse; }

@keyframes reed-sway {
  from { transform: rotate(-0.5deg); }
  to   { transform: rotate(0.6deg); }
}

.scene-sunpath { animation: sunpath-shimmer 7s var(--ease) infinite alternate; }

@keyframes sunpath-shimmer {
  from { opacity: 0.75; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-ripples, .scene-reeds--l, .scene-reeds--r, .scene-sunpath { animation: none; }
}

/* ---------- Mission band (flows straight out of the hero's deep water) ---------- */

.band--flush {
  background: var(--pine-deep);
}

.mission {
  padding-block: var(--s-8) var(--s-24);
}

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

.mission .container { text-align: center; }

.mission-statement {
  font-size: clamp(var(--text-2xl), 4.5vw, var(--text-4xl));
  margin-block: var(--s-5) var(--s-6);
}

.mission .lead { margin-inline: auto; max-width: 38rem; }

.mission-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2) var(--s-3);
  margin-top: var(--s-10);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--band-soft);
}

.mission-meta strong { color: var(--sun); font-weight: 650; }

/* ---------- Section scaffolding ---------- */

.section--wash { background: var(--wash); }

.section-head { max-width: 42rem; margin-bottom: var(--s-16); }

.section-head h2 {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl));
  margin-block: var(--s-3) var(--s-4);
}

/* ---------- Method (how it works) — editorial columns, not boxes ---------- */

.method {
  display: grid;
  gap: var(--s-12) var(--s-10);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 48em) {
  .method { grid-template-columns: repeat(3, 1fr); }
}

.method-step {
  border-top: 2px solid var(--pine);
  padding-top: var(--s-5);
}

.method-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-6);
}

.method-num {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--clay);
}

.method-icon { width: 2rem; height: 2rem; color: var(--water); }

.method-step h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin-bottom: var(--s-3);
}

.method-step p { color: var(--ink-soft); }

/* ---------- Project card ---------- */

.project-card {
  display: grid;
  overflow: clip;
  text-decoration: none;
  color: inherit;
  transition: transform 300ms var(--ease-out), box-shadow 300ms var(--ease-out);
}

.project-card:hover, .project-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

@media (min-width: 48em) {
  .project-card { grid-template-columns: 5fr 6fr; align-items: stretch; }
}

.project-card-scene { line-height: 0; background: var(--pine-deep); }

.project-card-scene svg { width: 100%; height: 100%; min-height: 12rem; object-fit: cover; }

.project-card-body {
  padding: var(--s-8);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
}

@media (min-width: 48em) {
  .project-card-body { padding: var(--s-10); }
}

.project-card-body h3 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  letter-spacing: -0.01em;
}

.project-card .go {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
  font-weight: 600;
  color: var(--clay);
}

.project-card .go svg { width: 1rem; height: 1rem; transition: transform 250ms var(--ease-out); }

.project-card:hover .go svg { transform: translateX(4px); }

.projects-note { margin-top: var(--s-8); font-size: var(--text-sm); }

/* ---------- Science grid ---------- */

.science-grid {
  display: grid;
  gap: var(--s-10) var(--s-10);
}

@media (min-width: 40em) {
  .science-grid { grid-template-columns: repeat(2, 1fr); }
}

.science-item {
  border-top: 1px solid var(--line);
  padding-top: var(--s-6);
}

.science-icon {
  width: 1.9rem;
  height: 1.9rem;
  color: var(--water);
  margin-bottom: var(--s-4);
}

.science-item h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin-bottom: var(--s-2);
}

.science-item p { color: var(--ink-soft); }

/* ---------- For organisations ---------- */

.orgs { text-align: center; }

.orgs h2 {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl));
  margin-block: var(--s-3) var(--s-4);
}

.orgs .lead { margin-inline: auto; max-width: 36rem; }

.orgs-meta {
  margin-block: var(--s-6) var(--s-8);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--band-eyebrow);
}

/* ---------- Stats ---------- */

.stat-row {
  display: grid;
  gap: var(--s-8);
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.stat .stat-number {
  font-family: var(--font-display);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-4xl));
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat .stat-label {
  margin-top: var(--s-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--band-soft);
}

/* On light surfaces only — scoped away from .band so the band's white
   numbers can never lose the cascade to this heavier selector again. */
main > .section:not(.band) .stat .stat-number { color: var(--pine); }

.band .stat .stat-number { color: #fff; }

/* ---------- Microsite: hero ---------- */

.project-hero .hero-copy { max-width: 50rem; }

.hero-place {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
}

.hero-place svg { width: 1rem; height: 1rem; color: var(--clay); flex-shrink: 0; }

/* ---------- Microsite: prose (the story) ---------- */

.story-grid {
  display: grid;
  gap: var(--s-12);
}

@media (min-width: 54em) {
  .story-grid { grid-template-columns: 1fr 1fr; gap: var(--s-16); }
}

.prose h2:not(.display),
.prose h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin-bottom: var(--s-4);
}

.prose p:not(.eyebrow) {
  margin-bottom: var(--s-4);
  color: var(--ink-soft);
  text-wrap: pretty;
}

.prose p:first-of-type { font-size: var(--text-lg); line-height: 1.6; }

/* ---------- Microsite: species ---------- */

.species-grid {
  display: grid;
  gap: var(--s-6);
}

@media (min-width: 44em) {
  .species-grid { grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
}

.species-card { overflow: clip; display: flex; flex-direction: column; }

.species-portrait {
  line-height: 0;
  background: linear-gradient(180deg, #eef3ea 0%, #dce8dd 100%);
  border-bottom: 1px solid var(--line-soft);
}

.species-portrait svg { width: 100%; height: auto; }

.species-portrait img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.species-card-body { padding: var(--s-6); }

.species-card h3 { font-family: var(--font-display); font-size: var(--text-xl); }

.species-card .sci {
  font-size: var(--text-sm);
  color: var(--stone);
  margin-block: var(--s-1) var(--s-3);
}

.species-card p { font-size: var(--text-base); color: var(--ink-soft); }

/* ---------- Microsite: take part ---------- */

.take-part-steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-8);
}

@media (min-width: 48em) {
  .take-part-steps { grid-template-columns: repeat(3, 1fr); gap: var(--s-10); }
}

.take-part-steps li {
  counter-increment: step;
  border-top: 2px solid var(--pine);
  padding-top: var(--s-5);
}

.take-part-steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--clay);
  margin-bottom: var(--s-3);
}

.take-part-steps p { color: var(--ink-soft); }

/* ---------- Microsite: results ---------- */

.results-empty {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
  max-width: 38rem;
}

.results-empty svg { width: 2.4rem; height: auto; flex-shrink: 0; color: var(--band-eyebrow); margin-top: 0.3rem; }

/* ---------- Microsite: the stewards ---------- */

.stewards-grid {
  display: grid;
  gap: var(--s-10);
}

@media (min-width: 44em) {
  .stewards-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); }
}

.steward {
  border-top: 2px solid var(--pine);
  padding-top: var(--s-5);
}

.steward-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-6);
}

.steward-head > div { min-width: 0; }

.steward-logo {
  flex-shrink: 0;
  height: 3rem;
  width: auto;
  max-width: 6.5rem;
  object-fit: contain;
  object-position: right top;
}

@media (min-width: 44em) {
  .steward-logo { max-width: 8.5rem; }
}

.steward-role {
  font-size: var(--text-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--clay);
  margin-bottom: var(--s-3);
}

.steward h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
  margin-bottom: var(--s-3);
}

.steward p { color: var(--ink-soft); max-width: 40rem; }

.steward-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-4);
  font-weight: 600;
  color: var(--pine);
  text-decoration: none;
}

.steward-link:hover { color: var(--moss); }

.steward-link svg { width: 1rem; height: 1rem; transition: transform 250ms var(--ease-out); }

.steward-link:hover svg { transform: translateX(4px); }

/* ---------- Microsite: signup ---------- */

.signup {
  padding: var(--s-10);
  text-align: center;
}

.signup h2 {
  font-size: clamp(var(--text-xl), 3vw, var(--text-2xl));
  margin-block: var(--s-3) var(--s-3);
}

.signup .muted { max-width: 30rem; margin-inline: auto; }

.signup-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-6);
}

.signup-form input { flex: 1 1 16rem; max-width: 24rem; }

.form-note { margin-top: var(--s-4); font-size: var(--text-sm); color: var(--ink-soft); }

/* ---------- Footer ---------- */

.site-footer {
  padding-block: var(--s-10) var(--s-12);
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.site-footer .ripple-divider { margin-bottom: var(--s-10); }

.footer-grid {
  display: grid;
  gap: var(--s-10);
}

@media (min-width: 48em) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; gap: var(--s-16); }
}

.footer-brand .wordmark { margin-bottom: var(--s-4); }

.footer-brand p { max-width: 20rem; }

.footer-nav, .footer-contact { display: flex; flex-direction: column; gap: var(--s-3); align-items: flex-start; }

.footer-nav h3, .footer-contact h3 {
  font-size: var(--text-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft); /* --stone fails AA at this size */
  margin-bottom: var(--s-1);
}

.footer-nav a, .footer-contact a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
}
.footer-nav a:hover, .footer-contact a:hover { color: var(--pine); }

.footer-legal {
  margin-top: var(--s-12);
  padding-top: var(--s-6);
  border-top: 1px solid var(--line-soft);
  font-size: var(--text-xs);
  color: var(--ink-soft); /* --stone fails AA at this size */
}

/* The maker's mark: reads as plain text, rewards the curious on hover. */
.credit-link { color: inherit; text-decoration: none; }
.credit-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Load state for config-hydrated pages ---------- */

[data-page-state="loading"] main,
[data-page-state="loading"] .site-footer,
[data-page-state="loading"] .site-header { visibility: hidden; }

/* A quiet pulse if (and only if) hydration takes long enough to notice. */
[data-page-state="loading"] body::after {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;
  width: 2.75rem;
  height: 2.75rem;
  margin: -1.375rem;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--pine);
  opacity: 0;
  animation:
    boot-appear 300ms 350ms var(--ease) forwards,
    boot-spin 900ms linear infinite;
}

@keyframes boot-appear { to { opacity: 1; } }
@keyframes boot-spin { to { transform: rotate(360deg); } }

.page-error {
  max-width: 32rem;
  margin: 18vh auto;
  padding: var(--s-10);
  text-align: center;
}

/* ---------- Privacy ---------- */

.privacy-title {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl));
  margin-block: var(--s-3) var(--s-8);
}

.prose h2:not(.display),
.prose h3 { margin-top: var(--s-8); }

.privacy-contact { margin-top: var(--s-10); font-weight: 550; }

/* ---------- Interior pages (the science, get involved) ---------- */

/* The current page, named in the nav. */
.site-nav a[aria-current="page"] { color: var(--pine); }

/* A shallower hero than the homepage's: the story starts sooner. */
.page-hero .hero-copy { padding-block: var(--s-16) var(--s-10); }

@media (min-width: 48em) {
  .page-hero .hero-copy { padding-block: var(--s-20) var(--s-12); }
}

.page-hero h1 { font-size: clamp(var(--text-3xl), 6.5vw, var(--text-4xl)); }

.page-hero .hero-scene svg { height: clamp(160px, 21vw, 300px); }

/* Section headings on narrow prose pages. */
.page-h2 {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl));
  margin-block: var(--s-3) var(--s-6);
}

/* A closing line after a grid; a quiet onward link after a section. */
.section-more { margin-top: var(--s-12); max-width: 42rem; }

.go-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 600;
  color: var(--clay);
  text-decoration: none;
}
.go-link:hover { color: var(--clay-deep); }

.go-link svg { width: 1rem; height: 1rem; transition: transform 250ms var(--ease-out); }
.go-link:hover svg { transform: translateX(4px); }

/* ---------- The record table (the science) ---------- */

/* Wide content scrolls inside its own container; the page never does. */
.table-scroll { overflow-x: auto; }

.record-table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
}

.record-table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--stone);
  padding: 0 var(--s-8) var(--s-3) 0;
}

.record-table td {
  border-top: 1px solid var(--line);
  padding: var(--s-4) var(--s-8) var(--s-4) 0;
  vertical-align: top;
  color: var(--ink-soft);
}

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

.record-table td:first-child {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.table-note { margin-top: var(--s-6); font-size: var(--text-sm); }

/* ---------- Questions, answered (get involved) ---------- */

.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }

.faq summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-6);
  padding-block: var(--s-5);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--pine);
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1;
  color: var(--clay);
}

.faq details[open] summary::after { content: "–"; }

.faq details > p {
  padding-bottom: var(--s-6);
  max-width: 40rem;
  color: var(--ink-soft);
}
