/* Sooty Woods — woodland library theme
   Palette: bark, moss, parchment, ember, soot */

:root {
  --bark: #5d3a1e;
  --bark-dark: #3a2412;
  --moss: #2d4a3e;
  --moss-deep: #1f3329;
  --leaf: #6f8f5b;
  --parchment: #f4ead5;
  --parchment-warm: #ead9b6;
  --ember: #e8a838;
  --ember-glow: #f4c66a;
  --soot: #1f1a17;
  --soot-soft: #3a322c;
  --rule: rgba(31, 26, 23, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 18px;
  line-height: 1.65;
  color: var(--soot);
  background: var(--parchment);
  background-image:
    radial-gradient(ellipse 60% 40% at 20% 0%, rgba(232, 168, 56, 0.12), transparent 60%),
    radial-gradient(ellipse 50% 50% at 100% 100%, rgba(45, 74, 62, 0.10), transparent 60%),
    repeating-linear-gradient(
      92deg,
      rgba(93, 58, 30, 0.025) 0 2px,
      transparent 2px 9px
    );
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: "Playfair Display", "Iowan Old Style", Palatino, Georgia, serif;
  color: var(--moss-deep);
  letter-spacing: 0.01em;
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 4vw + 1rem, 3.4rem); }
h2 { font-size: clamp(1.6rem, 2vw + 1rem, 2.2rem); }
h3 { font-size: 1.25rem; color: var(--bark-dark); }

p { margin: 0 0 1em; }

a {
  color: var(--moss);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(45, 74, 62, 0.4);
}
a:hover { color: var(--ember); text-decoration-color: var(--ember); }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(180deg, var(--soot) 0%, var(--soot-soft) 100%);
  color: var(--parchment);
  border-bottom: 4px solid var(--bark);
  position: relative;
  overflow: hidden;
}
.site-header::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 12% 80%, rgba(232, 168, 56, 0.18), transparent 30%),
    radial-gradient(circle at 88% 20%, rgba(232, 168, 56, 0.12), transparent 35%);
  pointer-events: none;
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: relative;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--parchment);
}
.brand-mark {
  width: 46px; height: 46px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.brand-text { line-height: 1.1; }
.brand-name {
  font-family: "Playfair Display", Palatino, Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ember-glow);
  display: block;
}
.brand-tag {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--parchment-warm);
  opacity: 0.8;
}

/* ---------- Nav ---------- */
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  align-items: center;
}
.nav a {
  color: var(--parchment);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.35rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav a:hover, .nav a[aria-current="page"] {
  color: var(--ember-glow);
  border-bottom-color: var(--ember);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--parchment-warm);
  color: var(--parchment);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  .nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--soot);
    padding: 0.5rem 1.5rem 1rem;
    border-top: 1px solid var(--bark);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 0.6rem 0; border-bottom: 1px solid rgba(244, 234, 213, 0.08); }
}

/* ---------- Layout ---------- */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}
.container--narrow { max-width: 820px; }

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bark);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    linear-gradient(180deg, rgba(31, 26, 23, 0.0) 0%, rgba(31, 26, 23, 0.0) 100%),
    radial-gradient(ellipse at top, var(--moss-deep), var(--soot) 70%);
  color: var(--parchment);
  overflow: hidden;
}
.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 4rem 1.5rem 5rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  align-items: center;
  position: relative;
}
.hero h1 {
  color: var(--ember-glow);
  font-size: clamp(2.4rem, 4vw + 1rem, 4rem);
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.hero p.lead {
  font-size: 1.2rem;
  color: var(--parchment-warm);
  max-width: 36rem;
}
.hero-art {
  position: relative;
  min-height: 280px;
}
.hero-art svg { width: 100%; height: auto; }

@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; padding: 3rem 1.5rem 3.5rem; }
}

.hero-cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.3rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s, background 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--ember);
  color: var(--soot);
  box-shadow: 0 4px 0 rgba(0,0,0,0.25);
}
.btn-primary:hover { background: var(--ember-glow); color: var(--soot); }
.btn-ghost {
  background: transparent;
  color: var(--parchment);
  border-color: var(--parchment-warm);
}
.btn-ghost:hover { color: var(--ember-glow); border-color: var(--ember-glow); background: rgba(232, 168, 56, 0.08); }

/* ---------- Page intro ---------- */
.page-intro {
  background: linear-gradient(180deg, var(--moss-deep), var(--moss) 90%);
  color: var(--parchment);
  border-bottom: 4px solid var(--bark);
}
.page-intro .container { padding-top: 3rem; padding-bottom: 3rem; }
.page-intro h1 { color: var(--ember-glow); }
.page-intro p { color: var(--parchment-warm); max-width: 50rem; font-size: 1.1rem; }

/* ---------- Bookshelf ---------- */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
  padding: 1.25rem 1.25rem 1.5rem;
  background:
    linear-gradient(180deg, transparent 0%, transparent calc(100% - 14px), var(--bark) calc(100% - 14px), var(--bark-dark) 100%),
    repeating-linear-gradient(
      90deg,
      rgba(93, 58, 30, 0.05) 0 6px,
      rgba(93, 58, 30, 0.10) 6px 14px
    );
  border-radius: 10px 10px 4px 4px;
  box-shadow: inset 0 0 0 1px rgba(93, 58, 30, 0.18);
}

.book {
  display: block;
  position: relative;
  padding: 1.25rem 1.25rem 1.4rem;
  border-radius: 4px 4px 2px 2px;
  background: var(--moss);
  color: var(--parchment);
  text-decoration: none;
  min-height: 200px;
  border-left: 6px solid rgba(0,0,0,0.25);
  border-right: 1px solid rgba(0,0,0,0.2);
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(255,255,255,0.05);
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.book::after {
  /* spine highlight */
  content: "";
  position: absolute;
  left: 6px; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, rgba(255,255,255,0.15), transparent);
}
.book:hover { transform: translateY(-4px); box-shadow: 0 8px 0 rgba(0,0,0,0.25); color: var(--parchment); }

.book--bark { background: var(--bark); }
.book--moss { background: var(--moss); }
.book--ember { background: var(--ember); color: var(--soot); }
.book--ember .book-meta { color: var(--bark-dark); }
.book--soot { background: var(--soot-soft); }
.book--leaf { background: var(--leaf); color: var(--soot); }
.book--leaf .book-meta { color: var(--moss-deep); }

.book-meta {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 0.5rem;
}
.book-title {
  font-family: "Playfair Display", Palatino, Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: inherit;
}
.book-desc {
  font-size: 0.95rem;
  opacity: 0.92;
  margin: 0;
}
.book-arrow {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.85rem;
  opacity: 0.85;
}

/* ---------- Card ---------- */
.card {
  background: #fbf4e0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1.5rem 1.6rem;
  box-shadow: 0 2px 0 rgba(93, 58, 30, 0.08);
}
/* Stack spacing for cards outside a grid. Inside .grid, use grid gap instead
   so all cells stay the same height (otherwise the first cell visibly extends
   1rem lower than its neighbours). */
.card + .card { margin-top: 1rem; }
.grid > .card + .card { margin-top: 0; }
.card h3 { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

/* ---------- Phoneme tiles ---------- */
.tile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.75rem 0 1.25rem;
}
.tile {
  font-family: "Playfair Display", Georgia, serif;
  background: var(--parchment-warm);
  color: var(--bark-dark);
  border: 1px solid rgba(93, 58, 30, 0.25);
  border-radius: 8px;
  padding: 0.6rem 0.95rem;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, color 0.15s;
  box-shadow: 0 2px 0 rgba(93, 58, 30, 0.18);
}
.tile:hover, .tile.is-active {
  background: var(--ember);
  color: var(--soot);
  transform: translateY(-2px);
}
.tile small {
  display: block;
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.75;
  margin-top: 2px;
}

/* ---------- Tag list ---------- */
.tags {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  list-style: none; padding: 0; margin: 0.5rem 0 0;
}
.tags li {
  background: var(--parchment-warm);
  border: 1px solid var(--rule);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--bark-dark);
}

/* ---------- Word lists ---------- */
.word-list {
  columns: 3 9rem;
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 1rem;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.1rem;
}
.word-list li {
  break-inside: avoid;
  padding: 0.15rem 0;
  color: var(--bark-dark);
}

/* ---------- Activity callout ---------- */
.callout {
  border-left: 4px solid var(--ember);
  background: rgba(232, 168, 56, 0.10);
  padding: 1rem 1.2rem;
  border-radius: 0 8px 8px 0;
  margin: 1rem 0;
}
.callout h4 {
  margin: 0 0 0.3rem;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--bark-dark);
}
.callout p { margin: 0; }

/* ---------- Stats / pillars ---------- */
.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.pillar {
  background: var(--parchment-warm);
  border-radius: 12px;
  padding: 1.2rem;
  border-top: 4px solid var(--moss);
}
.pillar svg { width: 38px; height: 38px; margin-bottom: 0.5rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--soot);
  color: var(--parchment-warm);
  padding: 2.5rem 1.5rem 2rem;
  border-top: 4px solid var(--bark);
  margin-top: 3rem;
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}
.site-footer h4 {
  color: var(--ember-glow);
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 0.7rem;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.35rem; }
.site-footer a { color: var(--parchment-warm); text-decoration: none; }
.site-footer a:hover { color: var(--ember-glow); }
.footer-fineprint {
  max-width: 1180px;
  margin: 1.5rem auto 0;
  border-top: 1px solid rgba(244, 234, 213, 0.12);
  padding-top: 1rem;
  font-size: 0.82rem;
  opacity: 0.7;
}

@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; }
}

/* ---------- Section dividers ---------- */
.section-divider {
  text-align: center;
  margin: 2.5rem 0 1rem;
  color: var(--bark);
  opacity: 0.55;
  font-size: 1.4rem;
  letter-spacing: 1rem;
}

/* ---------- Audience cards (teachers/parents) ---------- */
.audience {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.audience-card {
  display: block;
  text-decoration: none;
  color: var(--soot);
  background: var(--parchment-warm);
  border-radius: 12px;
  padding: 1.6rem 1.6rem 1.4rem;
  border: 1px solid var(--rule);
  transition: transform 0.15s, box-shadow 0.15s;
}
.audience-card:hover { transform: translateY(-3px); box-shadow: 0 6px 0 rgba(93, 58, 30, 0.12); color: var(--soot); }
.audience-card h3 { color: var(--moss-deep); margin: 0.4rem 0 0.4rem; font-size: 1.4rem; }
.audience-card svg { width: 44px; height: 44px; }
@media (max-width: 700px) { .audience { grid-template-columns: 1fr; } }

/* ---------- Phase ribbon (year pages) ---------- */
.phase-ribbon {
  display: inline-block;
  background: var(--ember);
  color: var(--soot);
  padding: 0.3rem 0.85rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.8rem;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ember);
  color: var(--soot);
  padding: 0.6rem 1rem;
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- Misc helpers ---------- */
.lead { font-size: 1.15rem; }
.muted { color: var(--soot-soft); opacity: 0.85; }
hr.rule {
  border: 0; border-top: 1px dashed var(--rule);
  margin: 2rem 0;
}

/* ============================================================
   Display & accessibility options
   ============================================================ */

/* Floating launcher button (bottom-right, clear of mobile nav toggle) */
.a11y-launcher {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 60;
  background: var(--ember);
  color: var(--soot);
  border: 2px solid var(--bark-dark);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: 600 0.9rem/1 "Iowan Old Style", Palatino, Georgia, serif;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,0.25);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.a11y-launcher:hover { background: var(--ember-glow); }
.a11y-launcher:focus-visible {
  outline: 3px solid var(--moss-deep);
  outline-offset: 2px;
}
.a11y-launcher .a11y-icon {
  width: 18px; height: 18px;
  display: inline-block;
}

/* Slide-in settings panel */
.a11y-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(360px, 92vw);
  height: 100vh;
  background: var(--parchment);
  color: var(--soot);
  border-left: 4px solid var(--bark);
  box-shadow: -8px 0 24px rgba(31, 26, 23, 0.25);
  padding: 1.25rem 1.4rem 2rem;
  overflow-y: auto;
  z-index: 70;
  transform: translateX(110%);
  transition: transform 0.25s ease;
}
.a11y-panel.is-open { transform: translateX(0); }
.a11y-panel h2 {
  font-size: 1.2rem;
  margin: 0 0 0.25rem;
  color: var(--moss-deep);
}
.a11y-panel p.a11y-intro {
  font-size: 0.9rem;
  margin: 0 0 1rem;
  color: var(--soot-soft);
}
.a11y-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font: inherit;
  cursor: pointer;
  color: var(--soot);
}
.a11y-group {
  margin: 0.9rem 0 1.1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px dashed var(--rule);
}
.a11y-group:last-child { border-bottom: 0; }
.a11y-group legend,
.a11y-group .a11y-label {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bark-dark);
  margin-bottom: 0.5rem;
  display: block;
}
.a11y-segmented {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.a11y-segmented button {
  flex: 1 1 auto;
  padding: 0.45rem 0.6rem;
  font: 600 0.9rem/1 inherit;
  background: var(--parchment-warm);
  color: var(--bark-dark);
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
}
.a11y-segmented button[aria-pressed="true"] {
  background: var(--moss);
  color: var(--parchment);
  border-color: var(--moss-deep);
}
.a11y-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  cursor: pointer;
  font-size: 0.95rem;
}
.a11y-toggle input { width: 18px; height: 18px; cursor: pointer; }
.a11y-reset {
  margin-top: 0.4rem;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font: inherit;
  color: var(--soot);
}
.a11y-reset:hover { background: var(--parchment-warm); }

/* Backdrop when panel is open */
.a11y-backdrop {
  position: fixed; inset: 0;
  background: rgba(31, 26, 23, 0.35);
  z-index: 65;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.a11y-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* Body-level modifiers driven by the settings panel */
body.a11y-text-large { font-size: 20px; }
body.a11y-text-xlarge { font-size: 23px; }
body.a11y-text-xlarge .word-list,
body.a11y-text-large .word-list { font-size: 1.25rem; }

body.a11y-dyslexia,
body.a11y-dyslexia h1,
body.a11y-dyslexia h2,
body.a11y-dyslexia h3,
body.a11y-dyslexia h4,
body.a11y-dyslexia .tile,
body.a11y-dyslexia .word-list,
body.a11y-dyslexia .book-title {
  font-family: "Verdana", "Trebuchet MS", "Comic Sans MS", "Atkinson Hyperlegible", sans-serif;
  letter-spacing: 0.02em;
  word-spacing: 0.05em;
}
body.a11y-dyslexia { line-height: 1.8; }

body.a11y-contrast {
  background: #fffbe9;
  color: #000;
}
body.a11y-contrast .card,
body.a11y-contrast .pillar,
body.a11y-contrast .audience-card {
  background: #fff;
  border-color: #000;
  color: #000;
}
body.a11y-contrast h1,
body.a11y-contrast h2,
body.a11y-contrast h3,
body.a11y-contrast h4 { color: #000; }
body.a11y-contrast .tile {
  background: #fff;
  color: #000;
  border-color: #000;
  border-width: 2px;
}
body.a11y-contrast .tile:hover,
body.a11y-contrast .tile.is-active {
  background: #000;
  color: #fff;
}
body.a11y-contrast a { color: #003a73; }
body.a11y-contrast .site-header,
body.a11y-contrast .page-intro,
body.a11y-contrast .hero { background: #000; color: #fff; }
body.a11y-contrast .nav a,
body.a11y-contrast .brand { color: #fff; }
body.a11y-contrast .callout {
  background: #fff;
  border-left-color: #000;
  border: 1px solid #000;
  border-left-width: 6px;
}

body.a11y-no-motion *,
body.a11y-no-motion *::before,
body.a11y-no-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* Reading ruler — a horizontal band that follows the cursor */
.a11y-ruler {
  position: fixed;
  left: 0;
  right: 0;
  height: 3.2rem;
  background: rgba(31, 26, 23, 0.55);
  pointer-events: none;
  z-index: 55;
  display: none;
  border-top: 1px solid rgba(232, 168, 56, 0.4);
  border-bottom: 1px solid rgba(232, 168, 56, 0.4);
}
.a11y-ruler::before,
.a11y-ruler::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 100vh;
  background: rgba(31, 26, 23, 0.55);
  pointer-events: none;
}
.a11y-ruler::before { bottom: 100%; }
.a11y-ruler::after { top: 100%; }
body.a11y-ruler-on .a11y-ruler { display: block; }

/* ============================================================
   Whiteboard / focus pop-out
   ============================================================ */
.popout {
  position: fixed; inset: 0;
  background: rgba(31, 26, 23, 0.92);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.popout.is-open { display: flex; }
.popout-inner {
  background: var(--parchment);
  color: var(--soot);
  border-radius: 18px;
  border: 4px solid var(--ember);
  padding: clamp(2rem, 6vw, 5rem) clamp(2rem, 8vw, 6rem);
  text-align: center;
  max-width: min(1100px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 20px 0 rgba(0,0,0,0.35);
}
.popout-grapheme {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  font-size: clamp(8rem, 28vw, 22rem);
  line-height: 1;
  color: var(--bark-dark);
  margin: 0;
}
.popout-example {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--moss-deep);
  margin: 0;
}
.popout-example strong { color: var(--bark-dark); }
.popout-meta {
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--soot-soft);
  margin: 0;
}
.popout-controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}
.popout-btn {
  background: var(--moss);
  color: var(--parchment);
  border: 2px solid var(--moss-deep);
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font: 600 1rem/1 inherit;
  cursor: pointer;
}
.popout-btn:hover { background: var(--moss-deep); }
.popout-btn--ghost {
  background: transparent;
  color: var(--bark-dark);
  border-color: var(--bark);
}
.popout-btn--ghost:hover { background: var(--parchment-warm); }
.popout-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--parchment);
  color: var(--soot);
  border: 2px solid var(--bark);
  border-radius: 999px;
  width: 44px; height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
}

/* "Click to enlarge" affordance on tiles & word-list items */
.tile { position: relative; }
.tile::after {
  content: "⤢";
  position: absolute;
  top: 2px; right: 4px;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.15s;
  font-family: sans-serif;
}
.tile:hover::after, .tile:focus-visible::after { opacity: 0.6; }

.word-list li {
  cursor: pointer;
  border-radius: 4px;
  padding-left: 0.25rem;
}
.word-list li:hover,
.word-list li:focus-visible {
  background: var(--parchment-warm);
  outline: none;
}

/* Per-section "Present this set" launcher */
.present-launch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.25rem 0 0.6rem;
  padding: 0.35rem 0.8rem;
  font: 600 0.85rem/1 inherit;
  background: var(--parchment-warm);
  color: var(--bark-dark);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
}
.present-launch:hover { background: var(--ember-glow); }
.present-launch::before { content: "▶"; font-size: 0.7rem; }

@media (max-width: 540px) {
  .a11y-launcher { padding: 0.4rem 0.7rem; font-size: 0.82rem; }
  .popout-inner { padding: 1.5rem 1rem; }
}

@media print {
  .a11y-launcher, .a11y-panel, .a11y-backdrop, .a11y-ruler,
  .popout, .present-launch { display: none !important; }
}
