/* HappyDance Books - happydancebooks.com
   Palette is happydance-brand-guidelines.md section 4 (source of truth).
   Interactive colours are contrast-checked: coral fails WCAG AA for normal-size
   text (3.02:1 on white), so coral is a display/accent colour and navy
   (5.73:1 with white) carries buttons and links. */

/* ---------- fonts ---------- */
@font-face {
  font-family: "Fredoka One";
  src: url("/fonts/fredoka-one-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/fonts/hanken-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/fonts/hanken-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/fonts/hanken-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  color-scheme: light;

  --ink: #1F1D1B;
  --paper: #FFFFFF;
  --muted: #6B645C;          /* 5.83:1 on paper, 5.32:1 on wash */
  --aqua-wash: #EAF7F9;
  --sea-band: #BFE8EF;
  --ocean: #3D9DBE;
  --whale-teal: #8FD4E0;
  --coral: #F2695C;
  --navy: #1F6E8C;
  --navy-deep: #185874;
  --sunshine: #FFD166;
  --sand: #F7E8C3;
  --go-green: #2FA84F;
  --rule: #D4E9EE;

  --font-display: "Fredoka One", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --step--1: clamp(0.88rem, 0.85rem + 0.15vw, 0.95rem);
  --step-0:  clamp(1.05rem, 1rem + 0.25vw, 1.18rem);
  --step-1:  clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-3:  clamp(1.9rem, 1.5rem + 1.9vw, 2.9rem);
  --step-4:  clamp(2.3rem, 1.7rem + 3vw, 4rem);

  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --stack: clamp(3rem, 7vw, 5.5rem);
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 2px 4px rgba(31, 29, 27, .05), 0 10px 26px -14px rgba(31, 110, 140, .34);
  --shadow-lift: 0 4px 8px rgba(31, 29, 27, .06), 0 20px 42px -18px rgba(31, 110, 140, .45);
  --measure: 66ch;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--step-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.12; margin: 0 0 .5em; }
h1 { font-size: var(--step-4); letter-spacing: -.01em; color: var(--navy); }
h2 { font-size: var(--step-3); color: var(--navy); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); font-family: var(--font-body); font-weight: 700; line-height: 1.3; }
p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

a { color: var(--navy); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--navy-deep); }

img, svg { max-width: 100%; height: auto; }
ul, ol { margin: 0 0 1.15em; padding-left: 1.3em; }
li { margin-bottom: .4em; }
strong { font-weight: 700; }
hr { border: 0; border-top: 2px solid var(--rule); margin: 2.5rem 0; }

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--navy); color: #fff; padding: .7rem 1.1rem;
  border-radius: 0 0 var(--radius) 0; font-weight: 700;
}
.skip-link:focus { left: 0; color: #fff; }

.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;
}

/* ---------- layout ---------- */
.wrap { width: min(100% - (var(--gutter) * 2), 1120px); margin-inline: auto; }
.wrap--narrow { width: min(100% - (var(--gutter) * 2), 760px); margin-inline: auto; }
.section { padding-block: var(--stack); }
.section--wash { background: var(--aqua-wash); }
.section--sand { background: var(--sand); }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.prose { max-width: var(--measure); }
.lede { font-size: var(--step-1); }

/* ---------- header ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 2px solid var(--rule);
  padding-block: .85rem;
}
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1.6rem; }
.brand { display: inline-flex; align-items: center; text-decoration: none; flex: 0 0 auto; }
.brand img { width: clamp(148px, 20vw, 188px); display: block; }
.site-nav { margin-left: auto; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: .35rem 1.4rem; list-style: none; margin: 0; padding: 0; }
.site-nav li { margin: 0; }
.site-nav a {
  display: inline-block; padding: .35rem .1rem;
  font-weight: 600; font-size: var(--step--1); letter-spacing: .01em;
  color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--navy); border-bottom-color: var(--whale-teal); }
.site-nav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--coral); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .8rem 1.5rem; border-radius: 999px; border: 2px solid transparent;
  font-family: var(--font-body); font-weight: 700; font-size: var(--step-0);
  line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn--primary { background: var(--navy); color: #fff; box-shadow: var(--shadow); }
.btn--primary:hover { background: var(--navy-deep); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn--secondary { background: var(--paper); color: var(--navy); border-color: var(--navy); }
.btn--secondary:hover { background: var(--aqua-wash); color: var(--navy); transform: translateY(-2px); }
.btn[aria-disabled="true"], .btn:disabled {
  background: var(--sea-band); color: var(--ink); box-shadow: none;
  cursor: default; pointer-events: none; border-color: transparent;
}
.btn-row { display: flex; flex-wrap: wrap; gap: .85rem; align-items: center; }

/* ---------- decorative wave ---------- */
.wave { display: block; width: 100%; height: clamp(22px, 3.5vw, 40px); color: var(--ocean); }
.wave svg { display: block; width: 100%; height: 100%; }

/* ---------- hero ---------- */
.hero { background: var(--aqua-wash); padding-block: clamp(2.6rem, 6vw, 5rem); }
.hero__grid { display: grid; gap: clamp(1.8rem, 5vw, 3.6rem); align-items: center; }
@media (min-width: 860px) { .hero__grid { grid-template-columns: 1.05fr .95fr; } }
.hero h1 { color: var(--navy); margin-bottom: .35em; }
.hero__lede { font-size: var(--step-1); color: var(--ink); max-width: 34ch; }
.hero__figure { margin: 0; justify-self: center; }
.hero__figure img {
  width: min(100%, 380px); border-radius: 6px; box-shadow: var(--shadow-lift);
  border: 1px solid rgba(31,110,140,.14);
}
.eyebrow {
  display: inline-block; font-weight: 700; font-size: var(--step--1);
  letter-spacing: .11em; text-transform: uppercase; color: var(--navy); margin-bottom: .9rem;
}
.section-intro { max-width: 60ch; margin-bottom: clamp(1.8rem, 4vw, 2.8rem); }
.section-intro h2 { color: var(--navy); }

/* ---------- cards ---------- */
.card-grid { display: grid; gap: clamp(1.2rem, 3vw, 2rem); }
.card-grid--3 { grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
.card-grid--wide { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.mt-lg { margin-top: 2rem; }
.card {
  background: var(--paper); border: 2px solid var(--rule); border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
}
.card h3 { color: var(--navy); font-size: var(--step-1); }
.card p:last-child { margin-bottom: 0; }
.card--flat { background: var(--aqua-wash); border-color: transparent; }

/* ---------- book cards ---------- */
.book-list { display: grid; gap: clamp(1.6rem, 4vw, 2.6rem); list-style: none; margin: 0; padding: 0; }
.book-list li { margin: 0; }
.book-card {
  display: grid; gap: clamp(1.2rem, 3vw, 2.2rem); align-items: start;
  background: var(--paper); border: 2px solid var(--rule);
  border-radius: var(--radius-lg); padding: clamp(1.3rem, 3vw, 2rem);
}
@media (min-width: 680px) { .book-card { grid-template-columns: 210px 1fr; } }
.book-card--bare { border: 0; padding: 0; }
.book-card__cover img {
  width: 100%; border-radius: 6px; box-shadow: var(--shadow);
  border: 1px solid rgba(31,110,140,.14);
}
.book-card__body h2, .book-card__body h3 { margin-bottom: .2em; color: var(--navy); }
.book-card__body h2 a, .book-card__body h3 a { text-decoration: none; color: inherit; }
.book-card__body h2 a:hover, .book-card__body h3 a:hover { text-decoration: underline; }
.book-card__sub {
  font-family: var(--font-body); font-weight: 700; color: var(--navy);
  font-size: var(--step-1); margin-bottom: .5em;
}
.book-meta { font-size: var(--step--1); color: var(--muted); margin-bottom: 1em; }

.badge {
  display: inline-block; padding: .28rem .8rem; border-radius: 999px;
  font-weight: 700; font-size: var(--step--1); line-height: 1.35;
}
.badge--ages { background: var(--sunshine); color: var(--ink); }
.badge--soon { background: var(--sea-band); color: var(--ink); }
.badge--live { background: var(--go-green); color: #fff; }
.badge-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

/* ---------- sample pages ---------- */
.samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.2rem; list-style: none; margin: 0; padding: 0; }
.samples li { margin: 0; }
.samples figure { margin: 0; }
.samples img { width: 100%; background: #fff; border: 2px solid var(--rule); border-radius: 10px; display: block; }
.samples figcaption { font-size: var(--step--1); color: var(--muted); margin-top: .5rem; }

/* ---------- research prose ---------- */
.prose h2 { color: var(--navy); margin-top: 2.2em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { color: var(--ink); font-size: var(--step-1); margin-top: 1.9em; }
.prose ul { padding-left: 1.2em; }

.grade {
  display: inline-block; font-family: var(--font-body); font-weight: 700;
  font-size: .72em; letter-spacing: .08em; text-transform: uppercase;
  padding: .18rem .6rem; border-radius: 6px; margin-right: .5rem;
}
.grade--strong { background: var(--go-green); color: #fff; }
.grade--moderate { background: var(--sunshine); color: var(--ink); }
.grade--weak { background: var(--sand); color: var(--ink); }
.grade--not-supported { background: var(--coral); color: var(--ink); }

.callout {
  background: var(--aqua-wash); border-left: 6px solid var(--ocean);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: clamp(1.1rem, 3vw, 1.6rem) clamp(1.2rem, 3vw, 1.8rem);
  margin: 1.8em 0;
}
.callout--warn { background: #FDEFED; border-left-color: var(--coral); }
.callout h3, .callout h4 { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }

.pull-claim {
  font-family: var(--font-display); font-size: var(--step-2); line-height: 1.3;
  color: var(--navy); margin: 1.4em 0; padding-left: 1rem; border-left: 6px solid var(--sunshine);
}

.source-note { font-size: var(--step--1); color: var(--muted); }
.source-list { list-style: none; padding: 0; }
.source-list li { padding: .7rem 0; border-bottom: 1px solid var(--rule); font-size: var(--step--1); line-height: 1.55; }
.source-list li:last-child { border-bottom: 0; }
.source-list cite { font-style: italic; }

.claim-table { width: 100%; border-collapse: collapse; margin: 1.6em 0; font-size: var(--step--1); }
.claim-table th, .claim-table td { text-align: left; padding: .8rem .7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.claim-table th { font-weight: 700; color: var(--navy); }
.claim-table tbody th { font-weight: 500; color: var(--ink); }
.table-scroll { overflow-x: auto; }

/* ---------- form ---------- */
.form-grid { display: grid; gap: 1.25rem; }
/* align-items:end keeps the inputs on a row level with each other even when one
   field carries a hint line and its neighbour does not */
@media (min-width: 640px) { .form-grid--2 { grid-template-columns: 1fr 1fr; align-items: end; } }
.field label { display: block; font-weight: 700; margin-bottom: .35rem; }
.field .hint { display: block; font-weight: 500; font-size: var(--step--1); color: var(--muted); margin-bottom: .45rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .72rem .9rem; font: inherit; font-size: var(--step-0);
  color: var(--ink); background: var(--paper);
  border: 2px solid #A6BCC3; border-radius: 12px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy); }
.field textarea { min-height: 120px; resize: vertical; }
.field--check { display: flex; gap: .7rem; align-items: flex-start; }
.field--check input {
  width: 1.25rem; height: 1.25rem; margin-top: .28rem;
  flex: 0 0 auto; accent-color: var(--navy);
}
.field--check label { font-weight: 500; }
.req { color: #A8321F; font-weight: 700; }
.form-status { margin-top: 1.2rem; padding: 1rem 1.2rem; border-radius: var(--radius); font-weight: 600; }
.form-status[data-state="ok"] { background: #E7F6EC; border: 2px solid var(--go-green); }
.form-status[data-state="error"] { background: #FDEFED; border: 2px solid var(--coral); }
.form-status[hidden] { display: none; }
.honey { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- footer ---------- */
.site-footer { background: var(--navy); color: #fff; padding-block: clamp(2.4rem, 5vw, 3.6rem); }
.site-footer h2, .site-footer h3 { color: #fff; }   /* headings default to navy */
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--sunshine); }
.site-footer__grid { display: grid; gap: 1.8rem; }
@media (min-width: 720px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.site-footer img { width: 168px; }
/* The footer mark is the one-colour ink wordmark flipped to white. This lives
   here rather than in a style attribute because the site's CSP sets
   style-src 'self', which blocks inline styles outright. */
.site-footer__mark { filter: brightness(0) invert(1); }
.site-footer .tagline { margin-top: 1rem; max-width: 34ch; color: #EAF7F9; }
.footer-nav h2 { font-size: var(--step-1); margin-bottom: .6em; }
.footer-nav ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 1.6rem; }
.footer-nav li { margin-bottom: .5rem; break-inside: avoid; }
.footer-fine { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid rgba(255,255,255,.28); font-size: var(--step--1); color: #E4F2F6; }
.footer-fine p { margin-bottom: .5em; }
