
/* Shared proportions keep the change of scene from moving the main controls. */
.theme-page {
  background: var(--theme-surface, var(--cream));
  --navy: var(--theme-accent, #152f61);
  --blue: var(--theme-link, #28519b);
}
.theme-home { --theme-surface: #faf9f4; }
.theme-home .hero { border-bottom-color: #d9e6df; }

.themed-hero {
  background: var(--hero-bg, #edf3f8);
  border-color: var(--hero-border, #dce4ee);
  padding-block: clamp(34px, 5vw, 72px);
}
.themed-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
  gap: clamp(1.65rem, 5.5vw, 5rem);
  align-items: center;
}
.themed-hero-copy h1 { color: var(--hero-heading, var(--deep)); }
.themed-hero-copy p { color: var(--hero-text, var(--muted)); max-width: 46ch; }
.themed-hero-copy .search-form { margin-top: 1.1rem; }
.hero-scene { min-width: 0; margin: 0; }
.sample-card {
  position: relative;
  background: #fff;
  color: var(--deep);
  border: 1px solid var(--hero-border, #dce4ee);
  border-radius: 17px;
  padding: clamp(1rem, 2.6vw, 1.65rem);
  box-shadow: 0 14px 36px #10234417;
}
.sample-card h2 { margin: .18rem 0 .55rem; font-size: clamp(1.07rem, 2.7vw, 1.6rem); }
.sample-card .scene-label, .scene-label { color: var(--navy); font-size: .96rem; font-weight: 700; }
.sample-card a, .scene-link { display: inline-block; margin-top: .7rem; font-weight: 700; }

/* Question bank — index cards with a real practice entry. */
.theme-bank {
  --theme-surface: #f5f8fd;
  --theme-accent: #16356a;
  --theme-link: #224f9b;
  --hero-bg: radial-gradient(ellipse at 90% 12%, #b8cdee, transparent 66%), #e7effb;
  --hero-border: #c6d7ed;
}
.bank-scene { position: relative; isolation: isolate; padding: 8px 20px 20px 0; }
.bank-scene::before, .bank-scene::after {
  position: absolute;
  content: "";
  inset: 18px 9px 9px 13px;
  z-index: -1;
  border: 1px solid #9ebde3;
  background: #c9ddf8;
  border-radius: 17px;
}
.bank-scene::after { inset: 31px 0 0 29px; background: #adc8ef; z-index: -2; }
.sample-answers { display: flex; flex-wrap: wrap; gap: .4rem; }
.sample-answers span { padding: .22rem .64rem; border: 1px solid #cbd8ee; border-radius: 7px; background: #f0f5fc; color: #234376; }

/* Notes — lined notebook with a worked topic link. */
.theme-notes {
  --theme-surface: #fcf9f1;
  --theme-accent: #764315;
  --theme-link: #74400e;
  --hero-bg: radial-gradient(ellipse at 88% 52%, #f1d4a4, transparent 68%), #fff3d9;
  --hero-border: #deca9e;
}
.notebook-sample {
  padding-inline-start: clamp(1.5rem, 3.3vw, 2.2rem);
  background:
    linear-gradient(90deg, transparent 18px, #dd7d6b70 18px, #dd7d6b70 19px, transparent 19px),
    repeating-linear-gradient(180deg, transparent 0 25px, #d5af7538 25px 26px),
    #fffdf5;
  border-radius: 8px 18px 18px 8px;
}
.notebook-sample h2 { text-align: left; color: #4b2c12; }
.theme-notes .note-example { background: #fcf1d9; border-color: #ecd7aa; }

/* Paper builder — lilac drafting grid, separate from the editable paper. */
.theme-paper {
  --theme-surface: #f7f5fc;
  --theme-accent: #493583;
  --theme-link: #4c3a85;
  --hero-bg: #eee8fb;
  --hero-border: #d9cbea;
}
.theme-paper .themed-hero {
  background-image: linear-gradient(#ae98d52b 1px, transparent 1px), linear-gradient(90deg, #ae98d52b 1px, transparent 1px);
  background-size: 23px 23px;
}
.paper-scene { padding: .1rem clamp(0px, 4vw, 46px); }
.layout-sample { border-radius: 8px; border-top: 5px solid #795ab1; }
.layout-sample dl { margin: .35rem 0 0; }
.layout-sample dl div { display: flex; justify-content: space-between; gap: .65rem; padding: .28rem 0; border-bottom: 1px solid #ede5f6; }
.layout-sample dl div:last-child { font-weight: 700; border: 0; }
.layout-sample dd { margin: 0; white-space: nowrap; }
.theme-paper .paper-toolbar button[aria-pressed="true"] { background: #eee5fa; border-color: #8d76b7; }

/* Quiz — dark, focused stage and a visible timing cue. */
.theme-quiz {
  --theme-accent: #623581;
  --theme-link: #643984;
  --theme-surface: #f9f5fb;
  --hero-bg: radial-gradient(ellipse at 83% 40%, #794376, transparent 68%), #301b44;
  --hero-border: #60456f;
  --hero-heading: #fff;
  --hero-text: #f1e4fa;
}
.theme-quiz .themed-hero .btn-primary { background: #f5edff; color: #452361; }
.theme-quiz .themed-hero .btn-primary:hover { background: #e8d7f8; }
.quiz-scene { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: clamp(.9rem, 3vw, 1.7rem); color: #f6eafd; }
.quiz-dial {
  display: grid;
  place-content: center;
  width: clamp(95px, 15vw, 155px);
  aspect-ratio: 1;
  text-align: center;
  border-radius: 50%;
  border: 5px solid #dca15f;
  border-inline-end-color: #b397dc;
  background: #301e45;
  box-shadow: 0 0 0 7px #ffffff19;
}
.quiz-dial strong { font-family: var(--heading); font-size: clamp(1.6rem, 4vw, 3.15rem); line-height: 1.08; }
.quiz-dial span { font-size: .92rem; }
.quiz-mode-copy p:first-child { font-weight: 700; margin-bottom: .3rem; }

/* Textbooks */
.theme-books {
  --theme-surface: #f1f8f4;
  --theme-accent: #16533f;
  --theme-link: #155a48;
  --hero-heading: #132c31;
  --hero-text: #31534f;
  --hero-border: #d1e3da;
}
.theme-books .textbook-hero {
  background: radial-gradient(ellipse at 73% 61%, #c9e7d9 0, transparent 57%),
    linear-gradient(112deg, #f8faf2 8%, #e5f2eb 70%, #dcece8);
  padding-block: clamp(32px, 5vw, 70px);
}
.textbook-hero .themed-hero-grid {
  grid-template-columns: minmax(14rem, .68fr) minmax(0, 1.32fr);
  grid-template-rows: 1fr 1fr;
  grid-template-areas: "copy shelf" "links shelf";
  gap: 1.4rem clamp(1rem, 4vw, 3.5rem);
}
.textbook-hero .themed-hero-copy { grid-area: copy; align-self: end; }
.book-shelf-links { grid-area: links; align-self: start; margin: 0; }
.textbook-hero h1 { font-size: clamp(2.5rem, 5vw, 4.6rem); }
.textbook-hero .btn-primary {
  background: #15543f;
  box-shadow: 0 3px 0 #0d3c2e, 0 8px 18px #1c634326;
}
.textbook-hero .btn-primary:hover { background: #104633; }
.textbook-hero .btn-primary span { margin-inline-start: .55rem; }
.book-shelf { grid-area: shelf; min-width: 0; }
.book-shelf-stage {
  --book-width: clamp(7rem, 13.4vw, 11.25rem);
  position: relative;
  height: clamp(14rem, 23vw, 19rem);
  perspective: 740px;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}
.book-shelf-stage::before {
  content: "";
  position: absolute;
  inset: auto 6% 3% 6%;
  height: 33%;
  background: radial-gradient(ellipse at 50% 30%, #395f4a42, transparent 65%);
  border-bottom: 1px solid #4c776344;
  border-radius: 50%;
  pointer-events: none;
}
.shelf-book {
  --cover-top: #205d51;
  --cover-bottom: #123b39;
  --cover-mark: #b9ead4;
  --position-x: 50%;
  --position-y: 45%;
  --depth: 0px;
  --yaw: -9deg;
  position: absolute;
  z-index: 2;
  top: var(--position-y);
  left: var(--position-x);
  width: var(--book-width);
  aspect-ratio: .71;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: .2rem;
  padding: clamp(.65rem, 1.3vw, 1.1rem);
  border: 1px solid #ffffff27;
  border-radius: .5rem .22rem .22rem .5rem;
  background: linear-gradient(90deg, #0003, transparent 10%), linear-gradient(145deg, var(--cover-top), var(--cover-bottom));
  box-shadow: inset 5px 0 #fff1, 0 13px 18px -10px #142b2780;
  color: #fffdf4;
  text-align: start;
  cursor: pointer;
  transform: translate(-50%, -50%) translateZ(var(--depth)) rotateY(var(--yaw));
  transform-style: preserve-3d;
  transition: transform 400ms cubic-bezier(.22,.72,.22,1), top 400ms ease, left 400ms ease;
}
.shelf-book:disabled { cursor: default; }
.shelf-book:focus-visible { outline: 3px solid #2062a0; outline-offset: 5px; }
.shelf-book[data-position="left"], .shelf-book[data-position="right"] {
  --position-y: 52%;
  --depth: -112px;
  z-index: 1;
}
.shelf-book[data-position="left"] { --position-x: 23%; --yaw: 30deg; }
.shelf-book[data-position="right"] { --position-x: 77%; --yaw: -34deg; }
.shelf-book[data-book-year="2025"] { --cover-top: #855736; --cover-bottom: #4c291e; --cover-mark: #ffe1a7; }
.shelf-book[data-book-year="2024"] { --cover-top: #446597; --cover-bottom: #25395d; --cover-mark: #d3e3fe; }
.shelf-book::before {
  content: "";
  position: absolute;
  inset: 1px auto 1px 100%;
  width: .8rem;
  background: repeating-linear-gradient(90deg, #e7ddc3 0 1px, #fff7e5 1px 3px);
  border-inline-end: 2px solid var(--cover-bottom);
  transform: rotateY(90deg);
  transform-origin: left center;
  pointer-events: none;
}
.shelf-book::after {
  content: "";
  position: absolute;
  inset: 0 100% 0 auto;
  width: .8rem;
  background: linear-gradient(90deg, var(--cover-bottom), var(--cover-top));
  transform: rotateY(-90deg);
  transform-origin: right center;
  pointer-events: none;
}
.shelf-book-art {
  position: absolute;
  inset: 10% 11% 44%;
  background: repeating-radial-gradient(ellipse at 10% 103%, transparent 0 8%, var(--cover-mark) 8.5% 9%, transparent 9.5% 16%);
  border-block-end: 1px solid var(--cover-mark);
  opacity: .62;
  pointer-events: none;
}
.shelf-book-label { font-size: clamp(.68rem, 1.35vw, .89rem); font-weight: 600; color: var(--cover-mark); }
.shelf-book strong { font: 800 clamp(1.25rem, 3.05vw, 2.55rem)/1.18 var(--heading); }
.book-shelf-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.6rem, 2.5vw, 1.2rem);
}
.shelf-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #98bcad;
  border-radius: 50%;
  background: #f9fcf8;
  color: #173b30;
  font: 1.15rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.shelf-arrow:hover { background: #edf7ef; border-color: #4b7b66; }
.shelf-edition { min-width: 8rem; text-align: center; color: #29483d; font-weight: 600; }
.theme-books :is(#official-books, #archive) { scroll-margin-top: 5rem; }

/* Teacher corner — an uncluttered, full-width classroom board. */
.theme-teachers {
  --theme-surface: #f1f6ed;
  --theme-accent: #1c5946;
  --theme-link: #205c49;
  --teacher-board-image: url("teacher-board.jpg");
}
.teacher-hero { background: radial-gradient(ellipse at 50% 100%, #d5e5d2, transparent 65%), #e8f1e5; padding-block: clamp(24px, 4vw, 48px); border-color: #bdd4c2; }
.teacher-intro { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 1rem; margin-bottom: clamp(1rem, 3vw, 1.6rem); }
.teacher-intro p { max-width: 48ch; }
.teacher-board {
  position: relative;
  min-height: clamp(270px, 35vw, 420px);
  display: grid;
  place-content: center;
  gap: .65rem;
  text-align: center;
  border: clamp(7px, 1.4vw, 16px) solid #745137;
  border-radius: 15px;
  padding: clamp(1.2rem, 5vw, 3rem);
  background: linear-gradient(112deg, #0b241a72, #14382772), var(--teacher-board-image, linear-gradient(145deg, #15372c, #28513e)) center / cover;
  color: #fff8e3;
  box-shadow: 0 20px 40px #2946382b, inset 0 0 0 2px #fff5da38;
}
.teacher-board blockquote { margin: 0; font: 800 clamp(1.6rem, 4.9vw, 3.65rem)/1.48 var(--heading); letter-spacing: -.02em; }
.teacher-board p { color: #fff3d6; margin-inline: auto; }
.teacher-board .board-caption { color: #d8e8b0; font-weight: 700; font-size: .92rem; }
.teacher-board .board-reflection { font-size: clamp(.94rem, 2.1vw, 1.16rem); }
.teacher-reflection { background: #e6efe5; }
.theme-teachers .tool-card { border-top: 3px solid #a4c2a2; }

/* Parents — warm window light and practices for individual growth. */
.theme-parents {
  --theme-surface: #fffaf1;
  --theme-accent: #78432a;
  --theme-link: #793f23;
  --hero-bg: radial-gradient(ellipse at 92% 35%, #efd2aa, transparent 70%), #fff0da;
  --hero-border: #e5caae;
}
.parent-scene {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 215px;
  aspect-ratio: 1.58;
  border: 1px solid #d9bb9b;
  border-radius: 22px 22px 22px 5px;
  background: radial-gradient(circle at 65% 36%, #f4d79c, #d4aa7d 43%, #84654a 89%);
  box-shadow: 0 15px 35px #623a201e;
}
.parent-scene img { display: block; width: 100%; height: 100%; object-fit: cover; }
.parent-scene figcaption {
  position: absolute;
  inset: auto 0 0;
  background: linear-gradient(transparent, #21170eeb);
  color: #fffdf4;
  padding: 1.6rem 1rem .65rem;
  font-weight: 700;
}
.parent-principles { border-bottom: 1px solid #ead9c5; background: #fff8ec; }
.growth-card { border-color: #ead9c5; background: #fffcf6; padding: 1.05rem 1.2rem; }
.growth-card h3 { margin-bottom: .4rem; color: #673e28; }
.parent-guides .parent-topics .panel { border-inline-start: 4px solid #d3ae80; }

/* About, contact, search, and missing routes keep distinct quiet layouts. */
.theme-about {
  --theme-surface: #f9f6fb;
  --theme-accent: #54376a;
  --theme-link: #573869;
  --hero-bg: radial-gradient(circle at 78% 48%, #ddccea, transparent 56%), #f0eaf6;
  --hero-border: #dfd0eb;
}
.about-scene blockquote {
  margin: 0;
  padding: clamp(1rem, 3vw, 1.85rem);
  border-inline-start: 4px solid #81599a;
  border-radius: 0 16px 16px 0;
  background: #fff9;
  color: #422c55;
  font: 700 clamp(1.2rem, 3.4vw, 2.05rem)/1.55 var(--heading);
}
.theme-contact {
  --theme-surface: #fdf6f4;
  --theme-accent: #803b41;
  --theme-link: #853e48;
  --hero-bg: radial-gradient(ellipse at 88% 40%, #f1c5ba, transparent 66%), #f9e7e3;
  --hero-border: #e6c6bd;
}
.contact-slip {
  border-start-start-radius: 2px;
  border-inline-start: 5px solid #a85652;
  background: #fffaf8;
}
.contact-slip ol { margin: .4rem 0 0; padding-inline-start: 1.25rem; }
.contact-slip li + li { margin-top: .28rem; }

.theme-search {
  --theme-surface: #f3f7fa;
  --theme-accent: #24445e;
  --theme-link: #215272;
  --hero-bg: linear-gradient(126deg, #e8f0f8, #d0e2ec);
  --hero-border: #c4d7e3;
}
.search-scene { border-inline-start: 2px solid #a3bbc9; padding-inline-start: 1.4rem; }
.search-examples { margin-top: .55rem; display: flex; align-items: start; flex-wrap: wrap; gap: .5rem; }
.search-examples a { color: #26465c; background: #f8fcfe; padding: .35rem .68rem; border-radius: 8px; font-weight: 600; }
.theme-missing {
  --theme-surface: #f2f5f7;
  --theme-accent: #37485b;
  --theme-link: #3b536d;
  --hero-bg: linear-gradient(140deg, #e8edf1, #dce3eb);
  --hero-border: #cdd7e0;
}
.missing-scene { text-align: center; color: #536579; font: 800 clamp(4.5rem, 14vw, 9.5rem)/1.15 var(--heading); letter-spacing: -.045em; }

@media (min-width: 601px) {
  .admin-bar .site-header { top: var(--wp-admin--admin-bar--height, 32px); }
}

@media (max-width: 740px) {
  .themed-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 1.35rem; }
  .themed-hero .hero-scene { max-width: 510px; width: 100%; }
  .textbook-hero .themed-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "copy" "shelf" "links";
  }
  .book-shelf { width: min(100%, 31rem); margin-inline: auto; }
  .book-shelf-stage { --book-width: clamp(5.5rem, 29vw, 8.75rem); height: clamp(12rem, 47vw, 15rem); }
  .shelf-book[data-position="left"], .shelf-book[data-position="right"] { --depth: -74px; }
  .shelf-book[data-position="left"] { --position-x: 20%; }
  .shelf-book[data-position="right"] { --position-x: 80%; align-items: flex-end; text-align: end; }
  .teacher-intro { align-items: start; }
  .theme-missing .missing-scene { text-align: start; }
}
@media (prefers-reduced-motion: reduce) {
  .shelf-book { transition: none; }
}
@media print {
  .theme-page { background: white; }
}
