/* ============================================================
   AI Tools for Teachers — shared stylesheet
   Design system: "warm-editorial" (open-design-library)
   Tokens (non-negotiable, from DESIGN.md):
     bg #FAF7F2 · fg #1C1A17 · accent #C0512F (terracotta)
     forest #2F5B4F · muted #8A817A · surface #FFFFFF
   Type: serif display (GT Sectra → Georgia fallback), sans body
   Scale: 12 / 14 / 16 / 20 / 28 / 40 / 56 / 80 · 8pt spacing rhythm

   Visual overhaul pass ("100 improvements"):
     - elevation scale, warm layered shadows, paper grain
     - fluid type ramp, measure discipline, tighter rhythm
     - hyperframes-derived motion (calm settles, capped staggers,
       bounded ambient) — ALL inside @media (prefers-reduced-motion:
       no-preference); reduced-motion users get a static, complete page
     - per-page theming via body[data-page]
   ============================================================ */

/* ---------- 1. tokens ---------- */

:root {
  --bg: #FAF7F2;
  --fg: #1C1A17;
  --accent: #C0512F;
  --forest: #2F5B4F;
  --muted: #8A817A;
  --surface: #FFFFFF;

  --border-soft: color-mix(in srgb, var(--forest) 10%, transparent);
  --border-strong: color-mix(in srgb, var(--fg) 16%, transparent);
  --border-hairline: color-mix(in srgb, var(--fg) 7%, transparent);
  --tint-forest: color-mix(in srgb, var(--forest) 7%, var(--surface));
  --tint-accent: color-mix(in srgb, var(--accent) 7%, var(--surface));
  --tint-muted: color-mix(in srgb, var(--muted) 12%, var(--surface));

  /* darker muted for small text — AA on bg and surface */
  --muted-text: color-mix(in srgb, var(--fg) 42%, var(--muted));

  /* elevation scale — layered warm (fg-tinted) shadows, never grey */
  --elev-1: 0 1px 2px color-mix(in srgb, var(--fg) 5%, transparent),
            0 2px 8px color-mix(in srgb, var(--fg) 5%, transparent);
  --elev-2: 0 1px 2px color-mix(in srgb, var(--fg) 6%, transparent),
            0 6px 16px color-mix(in srgb, var(--fg) 8%, transparent),
            0 12px 32px color-mix(in srgb, var(--fg) 5%, transparent);
  --elev-3: 0 2px 4px color-mix(in srgb, var(--fg) 7%, transparent),
            0 12px 24px color-mix(in srgb, var(--fg) 10%, transparent),
            0 24px 48px color-mix(in srgb, var(--fg) 7%, transparent);
  --elev-4: 0 4px 8px color-mix(in srgb, var(--fg) 8%, transparent),
            0 20px 40px color-mix(in srgb, var(--fg) 12%, transparent),
            0 40px 80px color-mix(in srgb, var(--fg) 8%, transparent);

  /* radius harmony */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-btn: 12px;
  --radius-card: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* fluid type ramp (12→14→16→20→28→40→56 at the breakpoints) */
  --step--1: clamp(0.8125rem, 0.80rem + 0.06vw, 0.875rem);
  --step-0: clamp(1rem, 0.975rem + 0.12vw, 1.0625rem);
  --step-1: clamp(1.1875rem, 1.15rem + 0.18vw, 1.25rem);
  --step-2: clamp(1.5rem, 1.42rem + 0.4vw, 1.75rem);
  --step-3: clamp(1.875rem, 1.70rem + 0.9vw, 2.375rem);
  --step-4: clamp(2.5rem, 1.95rem + 2.4vw, 3.5rem);

  --font-display: 'GT Sectra', Georgia, 'Times New Roman', serif;
  --font-body: 'Söhne', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* hyperframes motion vocabulary — calm settles, no bounce */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);   /* expo.out — entrances */
  --ease-settle: cubic-bezier(0.22, 1, 0.36, 1); /* power3.out — reveals */
  --ease-press: cubic-bezier(0.3, 0.1, 0.3, 1);

  --s-1: 8px;
  --s-2: 16px;
  --s-3: 24px;
  --s-4: 32px;
  --s-5: 40px;
  --s-6: 48px;
  --s-8: 64px;
  --s-10: 80px;

  /* per-page theme — overridden by body[data-page] rules below */
  --theme-accent: var(--accent);
  --theme-soft: var(--tint-accent);

  --header-h: 72px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
}

/* paper grain — one inline SVG, no request, floats over everything at 2.8% */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, .site-header, .site-footer { position: relative; }

/* translucent header needs a fallback when backdrop-filter is missing */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: var(--bg); }
}

/* anchor targets clear the sticky header */
section[id], [id] { scroll-margin-top: calc(var(--header-h) + var(--s-2)); }

::selection {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--fg);
}

/* warm thin scrollbars (table scroller + page, where supported) */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--fg) 22%, transparent) transparent; }
*::-webkit-scrollbar { height: 8px; width: 8px; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--fg) 20%, transparent);
  border-radius: var(--radius-pill);
}
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- 2. layout primitives ---------- */

.wrap {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--s-2);
}

.measure { max-width: 66ch; }

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

@media (min-width: 640px) {
  section { padding-block: var(--s-6); }
}

@media (min-width: 1024px) {
  section { padding-block: var(--s-10); }
}

/* ---------- 3. typography ---------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.18;
  margin: 0 0 var(--s-2);
  text-wrap: balance;
}

h1 { font-size: var(--step-4); letter-spacing: -0.015em; }
h2 { font-size: var(--step-3); letter-spacing: -0.01em; }
h3 { font-size: var(--step-1); line-height: 1.35; letter-spacing: -0.005em; }
h4 { font-size: 1rem; font-family: var(--font-body); font-weight: 600; }

p, ul, ol { margin: 0 0 var(--s-2); }
p { text-wrap: pretty; }

li { margin-bottom: var(--s-1); }

/* list markers earn their color */
ul { list-style: disc; }
ul li::marker { color: color-mix(in srgb, var(--forest) 85%, var(--fg)); }
ol { list-style: decimal; }
ol li::marker {
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: 56ch;
  color: color-mix(in srgb, var(--fg) 92%, var(--muted));
}

/* eyebrow device: rule + tracked label */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--forest);
  margin-bottom: var(--s-1);
}

.eyebrow::before {
  content: "" / "";
  width: 20px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--theme-accent);
}

.small { font-size: var(--step--1); color: var(--muted-text); }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 42%, transparent);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

a:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  text-decoration-color: var(--accent);
}

/* focus ring system: double ring, inherits radius */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: var(--radius-xs);
}

.skip-link {
  position: absolute;
  left: var(--s-2);
  top: -100px;
  z-index: 100;
  background: var(--fg);
  color: var(--bg);
  padding: var(--s-1) var(--s-2);
  border-radius: var(--radius-btn);
  text-decoration: none;
  box-shadow: var(--elev-2);
}

.skip-link:focus { top: var(--s-2); }

/* ---------- 4. header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.site-header.scrolled {
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  box-shadow: var(--elev-1);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding-block: var(--s-2);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand:hover { background: none; color: var(--accent); }

.brand span { color: var(--accent); }

.nav-toggle {
  display: none;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  padding: var(--s-1) var(--s-2);
  min-height: 44px;
  cursor: pointer;
}

.nav-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  padding: 4px 2px;
  position: relative;
}

/* underline slide — ::after rail, scalex from left */
.site-nav a::after {
  content: "" / "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: none;
  text-decoration: none;
}

.site-nav a[aria-current="page"]::after { transform: scaleX(1); }

@media (min-width: 1024px) {
  .site-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--s-2);
    justify-content: flex-end;
  }
}

/* ---------- 5. hero ---------- */

.hero {
  position: relative;
  padding-block: var(--s-6) var(--s-4);
  overflow: hidden;
}

@media (min-width: 640px) { .hero { padding-block: var(--s-8); } }
@media (min-width: 1024px) { .hero { padding-block: var(--s-10); } }

.hero h1 { max-width: 22ch; }
.hero .lede { margin-bottom: var(--s-3); }

/* home hero signature: planning-paper rules + warm glows */
body[data-page="home"] .hero::before {
  content: "" / "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 35px,
      color-mix(in srgb, var(--forest) 5%, transparent) 35px,
      color-mix(in srgb, var(--forest) 5%, transparent) 36px
    ),
    linear-gradient(
      to right,
      transparent 0,
      transparent clamp(48px, 8vw, 96px),
      color-mix(in srgb, var(--accent) 14%, transparent) clamp(48px, 8vw, 96px),
      color-mix(in srgb, var(--accent) 14%, transparent) calc(clamp(48px, 8vw, 96px) + 1.5px),
      transparent calc(clamp(48px, 8vw, 96px) + 1.5px)
    );
  -webkit-mask-image: radial-gradient(120% 90% at 30% 0%, #000 30%, transparent 75%);
  mask-image: radial-gradient(120% 90% at 30% 0%, #000 30%, transparent 75%);
}

/* ambient bloom — terracotta top-right, forest floor */
body[data-page="home"] .hero::after {
  content: "" / "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(38% 44% at 82% 8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(46% 52% at 8% 96%, color-mix(in srgb, var(--forest) 11%, transparent), transparent 72%);
}

.hero .wrap { position: relative; }

/* evidence stats — marked, hanging, tabular */
.stat-list { padding-left: 1.4rem; }
.stat-list li {
  margin-bottom: var(--s-2);
  padding-left: var(--s-1);
  line-height: 1.55;
}
.stat-list li::marker { content: "— "; color: var(--accent); }

/* ---------- 6. buttons ---------- */

.btn {
  position: relative;
  display: inline-block;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  padding: 14px 20px;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--surface); /* pure white: 4.7:1 on terracotta, AA */
  box-shadow: var(--elev-1), inset 0 1px 0 color-mix(in srgb, #fff 22%, transparent);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 92%, var(--fg));
  color: var(--surface);
  box-shadow: var(--elev-2), inset 0 1px 0 color-mix(in srgb, #fff 22%, transparent);
}

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border-color: color-mix(in srgb, var(--fg) 28%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 30%, transparent);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--fg) 5%, transparent);
  color: var(--fg);
  border-color: var(--fg);
}

/* ---------- 7. card grids ---------- */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  counter-reset: cardno;
}

@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-cats { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--bg) 22%, #fff));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  box-shadow: var(--elev-1);
}

.card h3 { margin: 0; }
.card p { margin: 0; color: var(--fg); }
.card .small { margin-top: auto; }

/* ghost index numeral — categories are a real ordered list (sitemap positions) */
.grid-cats .card::before {
  counter-increment: cardno;
  content: counter(cardno, decimal-leading-zero) / "";
  position: absolute;
  top: var(--s-2);
  right: var(--s-3);
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
  color: color-mix(in srgb, var(--theme-accent) 30%, transparent);
  letter-spacing: -0.02em;
}

.grid-cats .card { padding-top: var(--s-4); }

/* linked card titles carry a chevron that nudges on hover */
.card h3 a {
  color: var(--fg);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card h3 a:hover {
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 4px;
}

.card h3 a::after {
  content: "" / "";
  width: 0.5em;
  height: 0.5em;
  flex: none;
  border-top: 2px solid var(--theme-accent);
  border-right: 2px solid var(--theme-accent);
  transform: rotate(45deg);
  translate: -2px 1px;
  opacity: 0.55;
}

/* ---------- 8. tool listings ---------- */

.tool {
  position: relative;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--bg) 14%, #fff));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: var(--s-3);
  margin-bottom: var(--s-3);
  box-shadow: var(--elev-1);
  overflow: hidden;
}

@media (min-width: 640px) { .tool { padding: var(--s-4); } }

.tool > h3 { margin-bottom: 4px; font-size: 1.3125rem; }

/* accent side rail, drawn on hover from the top */
.tool::before {
  content: "" / "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, var(--theme-accent), color-mix(in srgb, var(--theme-accent) 25%, transparent));
  transform: scaleY(0);
  transform-origin: top center;
}

.tool-role {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-text);
  margin: 0 0 var(--s-2);
}

.tool dl {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-2);
}

@media (min-width: 640px) {
  .tool dl { grid-template-columns: 168px 1fr; gap: var(--s-1) var(--s-3); }
}

.tool dt {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest);
  padding-top: 3px;
}

.tool dd {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  padding-bottom: var(--s-1);
  border-bottom: 1px solid var(--border-hairline);
}

.tool dd:last-of-type { border-bottom: 0; padding-bottom: 0; }
.tool dt:last-of-type + dd { border-bottom: 0; }

@media (max-width: 639px) {
  .tool dd { margin-bottom: var(--s-1); }
}

/* skip-it-if row earns a quiet warning wash */
body[data-page="lesson-planning"] .tool dd:nth-of-type(6),
body[data-page="grading-feedback"] .tool dd:nth-of-type(6),
body[data-page="worksheets-activities"] .tool dd:nth-of-type(6),
body[data-page="iep-special-education"] .tool dd:nth-of-type(6),
body[data-page="classroom-admin-communication"] .tool dd:nth-of-type(6),
body[data-page="research-study-tools"] .tool dd:nth-of-type(6) {
  background: color-mix(in srgb, var(--muted) 8%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--s-1) var(--s-2);
  margin-top: 2px;
}

/* privacy flag tiers — chip-cards with a status dot */
.flag {
  display: block;
  position: relative;
  border-left: 3px solid var(--muted);
  background: var(--tint-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--s-1) var(--s-2) var(--s-1) 30px;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.flag::before {
  content: "" / "";
  position: absolute;
  left: 11px;
  top: 1.05em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 22%, transparent);
}

.flag-district { border-left-color: var(--forest); background: var(--tint-forest); }
.flag-district::before {
  background: var(--forest);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 22%, transparent);
}

.flag-check { border-left-color: var(--accent); background: var(--tint-accent); }
.flag-check::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* flag legend — tier dots echo the chips */
.legend {
  position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--forest) 8%, var(--surface)), color-mix(in srgb, var(--forest) 4%, var(--surface)));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: var(--s-2) var(--s-3);
  margin-block: var(--s-3);
  box-shadow: var(--elev-1);
}

.legend ul { list-style: none; padding: 0; margin: 0; }
.legend li { margin-bottom: var(--s-1); padding-left: var(--s-3); position: relative; }
.legend li:last-child { margin-bottom: 0; }
.legend strong { display: inline; }

.legend li::before {
  content: "" / "";
  position: absolute;
  left: 2px;
  top: 0.5em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.legend li:nth-child(1)::before {
  background: var(--forest);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 22%, transparent);
}
.legend li:nth-child(2)::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.legend li:nth-child(3)::before {
  background: var(--muted);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 22%, transparent);
}

/* ---------- 9. tables ---------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--elev-1);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-size: 0.9375rem;
  margin: 0;
}

th, td {
  text-align: left;
  padding: var(--s-1) var(--s-2);
  border-bottom: 1px solid var(--border-hairline);
  vertical-align: top;
  line-height: 1.5;
}

tbody tr:last-child td { border-bottom: 0; }

th {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--forest);
  background: color-mix(in srgb, var(--forest) 5%, var(--surface));
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}

td { font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--forest) 2.5%, transparent); }
tbody tr:hover { background: color-mix(in srgb, var(--forest) 6%, var(--surface)); }

tbody td a { font-weight: 600; }

/* ---------- 10. callouts / FAQ / crumbs / related ---------- */

.callout {
  position: relative;
  border-left: 4px solid var(--forest);
  background: linear-gradient(180deg, color-mix(in srgb, var(--forest) 9%, var(--surface)), color-mix(in srgb, var(--forest) 5%, var(--surface)));
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  padding: var(--s-2) var(--s-3);
  margin-block: var(--s-3);
  box-shadow: var(--elev-1);
}

.callout-warning { border-left-color: var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), color-mix(in srgb, var(--accent) 5%, var(--surface))); }

.callout :first-child { margin-top: 0; }
.callout :last-child { margin-bottom: 0; }

/* guide pull-quote: oversized serif quote mark, blank alt text */
body[data-page^="guide-"] .callout::before {
  content: "\201C" / "";
  position: absolute;
  left: var(--s-2);
  top: -0.12em;
  font-family: var(--font-display);
  font-size: 3.25rem;
  line-height: 1;
  color: color-mix(in srgb, var(--forest) 45%, transparent);
  pointer-events: none;
}

body[data-page^="guide-"] .callout,
body[data-page^="guide-"] .callout-warning { padding-left: var(--s-6); }

body[data-page^="guide-"] .callout-warning::before {
  color: color-mix(in srgb, var(--accent) 50%, transparent);
}

.crumbs {
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--muted-text);
  padding-block: var(--s-3);
}

.crumbs a { color: var(--forest); }

.faq-item {
  margin-bottom: 0;
  padding-block: var(--s-3);
  border-bottom: 1px solid var(--border-hairline);
}
.faq-item:last-of-type { border-bottom: 0; padding-bottom: 0; }
.faq-item h3 { margin-bottom: var(--s-1); display: flex; align-items: baseline; gap: var(--s-1); }
.faq-item h3::before {
  content: "" / "";
  width: 8px;
  height: 8px;
  flex: none;
  translate: 0 -1px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 65%, transparent);
  transform: rotate(45deg);
}

.divider {
  border: 0;
  border-top: 1px solid var(--border-soft);
  margin-block: var(--s-4);
  position: relative;
  overflow: visible;
}

.divider::after {
  content: "" / "";
  display: block;
  width: 7px;
  height: 7px;
  margin: -4px auto 0;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  transform: rotate(45deg);
}

.related {
  border-top: 1px solid var(--border-soft);
  margin-top: var(--s-6);
  padding-top: var(--s-3);
}

.related h2 { font-size: 1.5rem; position: relative; padding-left: var(--s-3); }
.related h2::before {
  content: "" / "";
  position: absolute;
  left: 0;
  top: 0.28em;
  width: 4px;
  height: 0.9em;
  border-radius: var(--radius-pill);
  background: var(--theme-accent);
}

.related ul { list-style: none; padding: 0; }
.related li { position: relative; padding-left: var(--s-3); }
.related li::before {
  content: "" / "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 0.42em;
  height: 0.42em;
  border-top: 2px solid var(--theme-accent);
  border-right: 2px solid var(--theme-accent);
  transform: rotate(45deg);
  opacity: 0.7;
}

/* ---------- 11. footer ---------- */

.site-footer {
  border-top: 1px solid var(--border-soft);
  margin-top: var(--s-8);
  padding-block: var(--s-6) var(--s-4);
  font-size: 0.875rem;
  background:
    linear-gradient(180deg, transparent, color-mix(in srgb, var(--forest) 4%, transparent)),
    color-mix(in srgb, var(--bg) 96%, var(--surface));
  position: relative;
}

.site-footer::before {
  content: "" / "";
  position: absolute;
  top: -1px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--forest) 35%, transparent), transparent);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
}

@media (min-width: 640px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 3fr 2fr 2fr 2fr; } }

.site-footer h2 {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest);
  margin-bottom: var(--s-1);
}

.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 0; }

.site-footer a {
  color: color-mix(in srgb, var(--fg) 88%, var(--muted));
  text-decoration: none;
  display: inline-block;
  padding-block: 3px;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 0% 1.5px;
  background-position: 0 100%;
}

.site-footer a:hover {
  color: var(--accent);
  background: none;
  background-size: 100% 1.5px;
}

.footer-note {
  margin-top: var(--s-4);
  padding-top: var(--s-2);
  border-top: 1px solid var(--border-soft);
  color: var(--muted-text);
}

/* ---------- 12. 404 ---------- */

.error-page {
  text-align: center;
  padding-block: var(--s-10);
  position: relative;
}
.error-page .lede { margin-inline: auto; }
.error-page .btn { margin: var(--s-1) var(--s-1) var(--s-3); }
.error-page ul { display: inline-block; text-align: left; }

.error-page .code {
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 14vw, 6rem);
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--s-2);
  letter-spacing: -0.03em;
  /* stacked extrusion — depth without motion */
  text-shadow:
    2px 2px 0 color-mix(in srgb, var(--accent) 30%, transparent),
    4px 4px 0 color-mix(in srgb, var(--accent) 18%, transparent),
    6px 6px 0 color-mix(in srgb, var(--accent) 10%, transparent),
    10px 14px 32px color-mix(in srgb, var(--fg) 14%, transparent);
}

body[data-page="notfound"] main { overflow: hidden; }

body[data-page="notfound"] .error-page::before {
  content: "" / "";
  position: absolute;
  inset: -25%;
  z-index: -1;
  background: radial-gradient(40% 45% at 50% 30%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%);
}

/* 404 link list as roomy chip rows */
.error-page .stat-list { list-style: none; padding: 0; max-width: 30rem; margin-inline: auto; }
.error-page .stat-list li { margin: 0 0 var(--s-1); }
.error-page .stat-list li::marker { content: ""; }
.error-page .stat-list a {
  display: block;
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-btn);
  background: var(--surface);
  text-decoration: none;
  color: var(--fg);
  box-shadow: var(--elev-1);
}
.error-page .stat-list a:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
  background: var(--tint-accent);
}

/* ---------- 13. per-page theming ---------- */

body[data-page="home"]                    { --theme-accent: var(--accent); }
body[data-page="lesson-planning"]         { --theme-accent: var(--forest); }
body[data-page="grading-feedback"]        { --theme-accent: var(--accent); }
body[data-page="worksheets-activities"]   { --theme-accent: var(--forest); }
body[data-page="iep-special-education"]   { --theme-accent: var(--accent); }
body[data-page="classroom-admin-communication"] { --theme-accent: var(--forest); }
body[data-page="research-study-tools"]    { --theme-accent: var(--accent); }
body[data-page="guide-iep"]               { --theme-accent: var(--accent); }
body[data-page="guide-paid"]              { --theme-accent: var(--forest); }
body[data-page="guide-privacy"]           { --theme-accent: var(--forest); }
body[data-page="about"]                   { --theme-accent: var(--forest); }
body[data-page="contact"]                 { --theme-accent: var(--forest); }
body[data-page="privacy"]                 { --theme-accent: var(--forest); }
body[data-page="terms"]                   { --theme-accent: var(--forest); }
body[data-page="notfound"]                { --theme-accent: var(--accent); }

/* subpage heroes: eyebrow becomes a themed chip */
body:not([data-page="home"]) .eyebrow,
body:not([data-page]) .eyebrow {
  background: color-mix(in srgb, var(--theme-accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--theme-accent) 18%, transparent);
  border-radius: var(--radius-pill);
  padding: 5px 12px 5px 9px;
}
body:not([data-page="home"]) .eyebrow::before,
body:not([data-page]) .eyebrow::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* about: the four listing bars get circled numerals */
body[data-page="about"] article > ol { list-style: none; padding-left: 0; counter-reset: aboutbar; }
body[data-page="about"] article > ol li {
  counter-increment: aboutbar;
  position: relative;
  padding-left: var(--s-5);
}
body[data-page="about"] article > ol li::before {
  content: counter(aboutbar) / "";
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 1.65em;
  height: 1.65em;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--forest);
  border: 1.5px solid color-mix(in srgb, var(--forest) 45%, transparent);
  border-radius: 50%;
}

/* privacy check guide: each question heading becomes a checkpoint band */
body[data-page="guide-privacy"] article h2 {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-2);
  margin-top: var(--s-3);
  background: linear-gradient(90deg, color-mix(in srgb, var(--forest) 8%, transparent), transparent 72%);
  border-left: 3px solid var(--forest);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
body[data-page="guide-privacy"] article h2::before {
  content: "" / "";
  width: 9px;
  height: 9px;
  flex: none;
  translate: 0 -1px;
  border-radius: 50%;
  background: var(--forest);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 20%, transparent);
}

/* privacy + terms: fine-print comfort — wider leading, calmer measure */
body[data-page="privacy"] .measure,
body[data-page="terms"] .measure { max-width: 64ch; }
body[data-page="privacy"] article h2,
body[data-page="terms"] article h2 {
  padding-bottom: var(--s-1);
  border-bottom: 1px solid var(--border-hairline);
}

/* contact: what-to-reach-out list items as marked mini-rows */
body[data-page="contact"] article > ul { list-style: none; padding: 0; }
body[data-page="contact"] article > ul li {
  position: relative;
  padding: var(--s-1) var(--s-2) var(--s-1) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  margin-bottom: var(--s-1);
}
body[data-page="contact"] article > ul li::before {
  content: "" / "";
  position: absolute;
  left: var(--s-2);
  top: 1.05em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--forest);
}

/* classroom-admin: Otter's consent flag gets a touch more presence */
body[data-page="classroom-admin-communication"] .flag-check {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent);
}

/* research: related block reads as a next-steps panel */
body[data-page="research-study-tools"] .related {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--bg) 30%, var(--surface)));
  padding: var(--s-3);
  box-shadow: var(--elev-1);
}

/* grading: tool cards get a warmer rail tint variant */
body[data-page="grading-feedback"] .tool::before {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 85%, var(--fg)), color-mix(in srgb, var(--accent) 22%, transparent));
}

/* iep: warnings lean forward — stronger rail + tint */
body[data-page="iep-special-education"] .callout-warning {
  border-left-width: 5px;
  box-shadow: var(--elev-1), inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
}

/* worksheets: slightly airier stack for five listings */
body[data-page="worksheets-activities"] .tool { margin-bottom: var(--s-4); }

/* ---------- 14. motion layer ----------
   Everything that moves lives here, inside no-preference.
   Vocabulary from the hyperframes animation rules:
   calm settles (power3/expo out), staggers capped so a group
   lands inside one beat (i × 60ms ≤ 360ms), ambient amplitudes
   tiny and slow. Reduced motion: static page, nothing hidden. */

@media (prefers-reduced-motion: no-preference) {

  html { scroll-behavior: smooth; }

  .btn { transition: transform 90ms var(--ease-press), box-shadow 220ms var(--ease-settle), background-color 220ms ease, border-color 220ms ease, color 220ms ease; }

  /* one-pass sheen across the button surface */
  .btn::after {
    content: "" / "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 45%;
    background: linear-gradient(105deg, transparent, color-mix(in srgb, #fff 32%, transparent), transparent);
    transform: skewX(-18deg) translateX(0);
    opacity: 0;
    pointer-events: none;
  }
  .btn:hover::after {
    opacity: 1;
    transform: skewX(-18deg) translateX(320%);
    transition: transform 640ms cubic-bezier(0.25, 0, 0.3, 1), opacity 120ms ease-in;
  }

  /* press physics: quick compression, slower recovery */
  .btn:active { transform: scale(0.965); transition-duration: 90ms; }
  .btn-primary { will-change: transform; }

  .card {
    transition: transform 240ms var(--ease-settle), box-shadow 240ms var(--ease-settle), border-color 240ms ease;
    will-change: transform;
  }

  @media (hover: hover) {
    .card:hover {
      transform: translateY(-4px);
      box-shadow: var(--elev-3);
      border-color: color-mix(in srgb, var(--theme-accent) 26%, transparent);
    }
  }
  .card:active { transform: translateY(-1px); }

  .card h3 a::after { transition: translate 240ms var(--ease-settle), opacity 240ms ease; }
  @media (hover: hover) {
    .card:hover h3 a::after { translate: 2px 1px; opacity: 1; }
  }

  .tool {
    transition: box-shadow 260ms var(--ease-settle), border-color 260ms ease, transform 260ms var(--ease-settle);
  }
  .tool::before { transition: transform 320ms var(--ease-settle); will-change: transform; }
  @media (hover: hover) {
    .tool:hover {
      box-shadow: var(--elev-2);
      border-color: color-mix(in srgb, var(--theme-accent) 22%, transparent);
    }
    .tool:hover::before { transform: scaleY(1); }
  }

  .site-nav a { transition: color 200ms ease; }
  .site-nav a::after { transition: transform 260ms var(--ease-settle); will-change: transform; }
  @media (hover: hover) {
    .site-nav a:hover::after { transform: scaleX(1); }
  }

  .brand { transition: color 200ms ease; }

  .flag { transition: background-color 220ms ease, border-color 220ms ease; }
  @media (hover: hover) {
    .flag-district:hover { background: color-mix(in srgb, var(--forest) 11%, var(--surface)); }
    .flag-check:hover    { background: color-mix(in srgb, var(--accent) 11%, var(--surface)); }
    .flag:hover          { background: color-mix(in srgb, var(--muted) 16%, var(--surface)); }
  }

  .site-footer a { transition: color 200ms ease, background-size 280ms var(--ease-settle); }

  tbody tr { transition: background-color 160ms ease; }

  .faq-item h3 { transition: color 200ms ease; }
  .faq-item:hover h3 { color: color-mix(in srgb, var(--accent) 80%, var(--fg)); }

  .skip-link { transition: top 160ms var(--ease-settle); }

  /* mobile nav: grid-rows unfold + link cascade.
     (Consolidated with the base rules in section 15 so the
     reduced-motion fallback there stays authoritative.) */
  .site-header { transition: box-shadow 260ms ease, background-color 260ms ease; }

  /* -- hero entrance cascade (waterfall: one direction, overlaps) -- */
  .hero .eyebrow,
  .hero h1,
  .hero .lede,
  .hero > .wrap > p:not(.lede),
  .hero .stat-list {
    animation: hero-rise 700ms var(--ease-out) both;
  }
  .hero h1        { animation-delay: 80ms; }
  .hero .lede     { animation-delay: 150ms; }
  .hero > .wrap > p:not(.lede) { animation-delay: 220ms; }
  .hero .stat-list { animation-delay: 300ms; }

  @keyframes hero-rise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
  }

  /* -- ambient bloom, then a bounded slow breathe -- */
  body[data-page="home"] .hero::after {
    animation: bloom-in 1100ms var(--ease-settle) 120ms both;
  }
  body[data-page="home"] .hero.glow-on::after {
    animation: glow-breathe 11s ease-in-out infinite alternate;
  }

  @keyframes bloom-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: none; }
  }
  /* amplitude stays tiny: opacity ±0.03 around the resting wash */
  @keyframes glow-breathe {
    from { opacity: 0.97; }
    to   { opacity: 1; transform: scale(1.03); }
  }

  /* -- 404: slow float on the extruded numeral -- */
  body[data-page="notfound"] .error-page .code {
    animation: code-float 6s ease-in-out infinite alternate;
  }
  @keyframes code-float {
    from { transform: translateY(0); }
    to   { transform: translateY(-8px); }
  }
  body[data-page="notfound"] .error-page::before {
    animation: bloom-in 1000ms var(--ease-settle) 100ms both;
  }

  /* -- scroll reveals (IO adds .in; --i staggers, capped) --
     Selector list is mirrored in motion.js — keep the two in sync. */
  .js .grid > .card,
  .js .tool,
  .js .faq-item,
  .js .legend,
  .js .related,
  .js .callout,
  .js .table-scroll,
  .js article.measure > h2,
  .js .site-footer .footer-grid > div,
  .js .error-page > *:not(.code) {
    opacity: 0;
    transform: translateY(14px);
  }

  .js .in {
    animation: reveal-settle 520ms var(--ease-settle) both;
    animation-delay: calc(var(--i, 0) * 60ms);
  }

  @keyframes reveal-settle {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
  }

  /* legend tier dots pop once on entry */
  .js .legend.in li::before { animation: dot-pop 340ms var(--ease-settle) both; }
  .js .legend.in li:nth-child(2)::before { animation-delay: 90ms; }
  .js .legend.in li:nth-child(3)::before { animation-delay: 180ms; }

  @keyframes dot-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
  }

  /* touch devices: no hover-dependent motion */
  @media (hover: none) {
    .card, .tool { will-change: auto; }
  }
}

/* reduced motion: nothing hides, nothing moves, anchors jump */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- 15. responsive & a11y polish ---------- */

/* base mobile nav: reduced-motion-safe, plain toggle */
@media (max-width: 1023px) {
  :root { --header-h: 64px; }

  .nav-toggle { display: inline-flex; align-items: center; }

  .site-nav { display: none; width: 100%; padding-bottom: var(--s-2); }
  .site-nav.open { display: block; }
  .site-nav li { margin-bottom: 2px; }
  .site-nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
  }
  .site-nav a::after { display: none; }
  .site-nav a:hover { background: var(--tint-forest); }
  .site-nav a[aria-current="page"] { background: var(--tint-accent); }
}

/* animated mobile nav: grid-rows unfold + staggered link cascade */
@media (prefers-reduced-motion: no-preference) and (max-width: 1023px) {
  .site-nav,
  .site-nav.open {
    display: grid;
    grid-template-rows: 0fr;
    width: 100%;
    padding-bottom: 0;
    opacity: 0.001;
    transition: grid-template-rows 300ms var(--ease-settle), opacity 260ms ease, padding-bottom 300ms var(--ease-settle);
  }
  .site-nav ul {
    min-height: 0;
    overflow: hidden;
    gap: 0;
    visibility: hidden;
    transition: visibility 0s 300ms;
  }
  .site-nav li {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 260ms ease, transform 300ms var(--ease-settle);
  }
  .site-nav.open {
    grid-template-rows: 1fr;
    opacity: 1;
    padding-bottom: var(--s-2);
  }
  .site-nav.open ul { visibility: visible; transition-delay: 0s; }
  .site-nav.open li { opacity: 1; transform: none; }
  .site-nav.open li:nth-child(1) { transition-delay: 30ms; }
  .site-nav.open li:nth-child(2) { transition-delay: 60ms; }
  .site-nav.open li:nth-child(3) { transition-delay: 90ms; }
  .site-nav.open li:nth-child(4) { transition-delay: 120ms; }
  .site-nav.open li:nth-child(5) { transition-delay: 150ms; }
  .site-nav.open li:nth-child(6) { transition-delay: 180ms; }
  .site-nav.open li:nth-child(7) { transition-delay: 210ms; }
  .site-nav.open li:nth-child(8) { transition-delay: 240ms; }
  .site-nav.open li:nth-child(9) { transition-delay: 270ms; }
}

@media (max-width: 639px) {
  main h1 { font-size: clamp(2.125rem, 9vw, 2.625rem); }
  .hero > .wrap > p:not(.lede) .btn {
    display: flex;
    justify-content: center;
    margin-bottom: var(--s-1);
  }
  .grid { gap: var(--s-2); }
  .card { padding: var(--s-3); }
  .tool dl { gap: var(--s-1); }
  .tool dd { padding: var(--s-1) 0; }
  body[data-page^="guide-"] .callout, body[data-page^="guide-"] .callout-warning { padding-left: var(--s-5); }
  body[data-page^="guide-"] .callout::before { font-size: 2.5rem; }
  .table-scroll { position: relative; }
  .table-scroll::after {
    content: "" / "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 85%, transparent));
  }
  .footer-grid { gap: var(--s-3); }
  .footer-grid > div { padding-block: var(--s-1); }
  .site-footer a { padding-block: 6px; }
}

/* long tool names and narrow viewports */
h1, h2, h3, .tool > h3 { overflow-wrap: break-word; }

@media (max-width: 360px) {
  .btn { padding: 12px 14px; }
  .wrap { padding-inline: 14px; }
}

/* higher-contrast preference: deepen structure */
@media (prefers-contrast: more) {
  :root {
    --border-soft: color-mix(in srgb, var(--fg) 30%, transparent);
    --border-hairline: color-mix(in srgb, var(--fg) 20%, transparent);
    --muted-text: color-mix(in srgb, var(--fg) 65%, var(--muted));
  }
  a { text-decoration-color: currentColor; }
}

/* ---------- 16. print ---------- */

@media print {
  .site-header, .site-footer, .nav-toggle, .skip-link, body::after { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .card, .tool, .legend, .callout, .table-scroll { box-shadow: none; border: 1px solid #999; }
  .hero::before, .hero::after, .error-page::before { display: none; }
  a { color: #000; text-decoration: underline; }
  section { padding-block: 12pt; }
}
