:root {
  --ink: #17161a;
  --cream: #fbf3e2;
  --red: #e63946;
  --red-dark: #c62f3b;
  --blue: #2a75bb;
  --blue-dark: #205d96;
  --yellow: #ffcf3f;
  --teal: #2ec4b6;
  --card: #fffdf7;
  --muted: #17161a99;
  --shadow-color: var(--ink);
  --radius-panel: 16px 8px 18px 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-weight: 700;
  background-color: var(--cream);
  background-image: radial-gradient(rgba(23, 22, 26, 0.07) 1.4px, transparent 1.5px);
  background-size: 16px 16px;
  color: var(--ink);
  line-height: 1.6;
  cursor: url('/img/cursor-star.svg') 16 16, auto;
}

a, button, summary, .btn, [role="button"] {
  cursor: url('/img/cursor-star-active.svg') 16 16, pointer;
}

input, textarea, [contenteditable], .ql-editor, .ql-editor * {
  cursor: text;
}

.cursor-fx {
  position: fixed;
  top: 0;
  left: 0;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  margin-top: -17px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  will-change: transform;
}
.cursor-fx-icon {
  width: 100%;
  height: 100%;
  background: url('/img/cursor-star.svg') center / contain no-repeat;
}
.cursor-fx-icon.is-interactive { background-image: url('/img/cursor-star-active.svg'); }

a { color: var(--blue); text-decoration: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
a:hover { color: var(--red); }

h1, h2, h3, h4 {
  font-family: 'Bangers', cursive;
  letter-spacing: 1.5px;
  font-weight: 400;
}

/* ---------- admin bar ---------- */

.admin-bar {
  background: var(--ink);
  color: var(--cream);
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 0.5rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 800;
  border-bottom: 3px solid var(--yellow);
}
.admin-bar a { color: var(--yellow); }
.admin-bar .link-button {
  background: none;
  border: none;
  color: var(--yellow);
  font-size: 0.85rem;
  font-weight: 800;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
}

/* ---------- header / nav ---------- */

.site-header {
  background: var(--ink);
  border-bottom: 5px solid var(--yellow);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.13);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
  color: var(--cream);
  text-decoration: none;
}
.brand:hover { color: var(--cream); }
.brand img { width: 52px; height: 52px; flex: none; }
.brand .brand-future {
  font-family: 'Bangers', cursive;
  font-size: 0.9rem;
  letter-spacing: 2px;
  color: var(--yellow);
  display: block;
  line-height: 1;
}
.brand .brand-peds {
  font-family: 'Bangers', cursive;
  font-size: 1.85rem;
  letter-spacing: 2px;
  color: var(--cream);
  display: block;
  line-height: 1;
  text-shadow: 2px 2px 0 var(--red);
}
.site-nav {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
}
.site-nav a {
  color: var(--cream);
  text-decoration: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 2px solid transparent;
  white-space: nowrap;
}
.site-nav a.active {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--ink);
}
.site-nav a:hover:not(.active) {
  border-color: var(--yellow);
  color: var(--yellow);
}

.nav-dropdown {
  position: relative;
}
.nav-dropdown summary {
  color: var(--cream);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 2px solid transparent;
  white-space: nowrap;
  list-style: none;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after { content: ' ▾'; }
.nav-dropdown summary:hover,
.nav-dropdown summary.active {
  border-color: var(--yellow);
  color: var(--yellow);
}
.nav-dropdown[open] summary {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--ink);
}
.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 var(--ink);
  overflow: hidden;
  padding: 0.4rem;
  gap: 0.2rem;
}
.nav-dropdown-panel a {
  color: var(--ink) !important;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  border: none !important;
  white-space: nowrap;
}
.nav-dropdown-panel a:hover { background: var(--yellow); }
.nav-dropdown-panel a.active { background: var(--blue); color: var(--cream) !important; }

/* ---------- main content ---------- */

.site-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1rem;
}

.page-content.narrow { max-width: 560px; margin: 0 auto; }

.page-content-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-content-head #edit-page-btn { margin-left: auto; }

h1 {
  color: var(--ink);
  font-size: 2.4rem;
  margin: 0;
  text-shadow: 3px 3px 0 var(--yellow);
}

/* content panel: the comic "page" the text sits on */
.content-block {
  background: var(--card);
  border: 5px solid var(--ink);
  border-radius: var(--radius-panel);
  box-shadow: 8px 8px 0 var(--shadow-color);
  padding: 2rem 2rem 2.25rem;
  scroll-margin-top: 1.5rem;
}

.content-block h2 { color: var(--blue-dark); margin-top: 0; font-size: 1.9rem; }
.content-block h2:not(:first-child) { margin-top: 2rem; }
.content-block h3 {
  color: var(--blue-dark);
  font-size: 1.5rem;
  letter-spacing: 1px;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 3px solid var(--yellow);
}
.content-block h4 {
  color: var(--red-dark);
  margin-top: 1.5rem;
  margin-bottom: 0.35rem;
  font-size: 1.3rem;
  letter-spacing: 1px;
}
.content-block ul { padding-left: 1.3rem; }
.content-block li { margin-bottom: 0.35rem; }
.content-block p { margin: 0.6rem 0; }
.content-block strong { color: var(--ink); }

/* Top-level lists become a grid of tiles; nested lists (e.g. a book list
   inside one tile) keep the plain indented-bullet style above. */
.content-block > ul,
.content-block > ol {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  grid-auto-flow: dense;
  gap: 0.9rem;
  padding-left: 0;
  list-style: none;
  margin: 1rem 0 1.5rem;
}
.content-block > ul > li,
.content-block > ol > li {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 12px 6px 12px 6px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 0.85rem 1rem;
  margin-bottom: 0;
  transition: transform 0.12s ease;
}
.content-block > ul > li:hover,
.content-block > ol > li:hover {
  transform: translateY(-3px);
}
.content-block > ul > li.wide-item,
.content-block > ol > li.wide-item {
  grid-column: 1 / -1;
  background: var(--cream);
}

/* Plain fact/topic lists (no links) — a simple checklist instead of a grid
   of clickable-looking cards. */
.content-block > ul.fact-list,
.content-block > ol.fact-list {
  display: block;
  list-style: none;
  padding-left: 0;
  margin: 1rem 0 1.5rem;
}
.content-block > ul.fact-list > li,
.content-block > ol.fact-list > li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 3px dashed rgba(23, 22, 26, 0.25);
  font-weight: 800;
  transform: none;
}
.content-block > ul.fact-list > li:last-child,
.content-block > ol.fact-list > li:last-child {
  border-bottom: none;
}
.content-block > ul.fact-list > li:hover,
.content-block > ol.fact-list > li:hover {
  transform: none;
}
.fact-list > li::before {
  content: '✓';
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--ink);
}

/* Prose-style lists (tips meant to be read one at a time) render as an
   auto-advancing carousel instead of a grid — see lib/tile-programs.js. */
.carousel {
  border: 5px solid var(--ink);
  border-radius: 14px 8px 16px 8px;
  background: var(--card);
  box-shadow: 7px 7px 0 var(--ink);
  margin: 1.25rem 0 1.75rem;
  overflow: hidden;
}

/* A carousel item too long to shrink into a slide (e.g. a resource list with
   its own nested sub-list) renders as a normal readable section instead —
   not a tile, not a slide, just a plain callout note. */
.carousel-overflow {
  margin: 0 0 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--card);
  border-left: 5px solid var(--blue);
  border-radius: 0 12px 12px 0;
}
.carousel-overflow > *:first-child { margin-top: 0; }
.carousel-overflow > *:last-child { margin-bottom: 0; }
.carousel-overflow ul { margin-top: 0.75rem; }
.carousel-viewport { overflow: hidden; }
.content-block .carousel-track {
  display: flex;
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.carousel-track {
  transition: transform 0.45s ease;
}
.content-block .carousel-slide {
  position: relative;
  flex: 0 0 100%;
  min-width: 0;
  margin-bottom: 0;
  box-sizing: border-box;
  height: var(--slide-height, 300px);
  overflow: hidden;
}
.carousel-slide-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.carousel-slide-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: linear-gradient(
    125deg,
    rgba(23, 22, 26, 0.92) 0%,
    rgba(42, 117, 187, 0.72) 55%,
    rgba(23, 22, 26, 0.55) 100%
  );
}
.carousel-slide-text {
  position: relative;
  z-index: 2;
  height: 100%;
  box-sizing: border-box;
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  color: var(--cream);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  scrollbar-width: thin;
  scrollbar-color: rgba(251, 243, 226, 0.5) transparent;
}
.carousel-slide-text::-webkit-scrollbar { width: 6px; }
.carousel-slide-text::-webkit-scrollbar-thumb {
  background: rgba(251, 243, 226, 0.5);
  border-radius: 3px;
}
.carousel-slide-inner > *:first-child { margin-top: 0; }
.carousel-slide-inner > *:last-child { margin-bottom: 0; }
.carousel-slide-text--center {
  justify-content: center;
  text-align: center;
  overflow-y: visible;
}
.carousel-slide-text strong:first-of-type {
  display: block;
  font-family: 'Bangers', cursive;
  font-size: 1.35em;
  letter-spacing: 1px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 var(--ink);
  margin-bottom: 0.3rem;
}
.carousel-slide-text a {
  color: var(--yellow);
  text-decoration: underline;
}
.carousel-slide-text a:hover { color: var(--cream); }
.carousel-slide-text ul {
  color: var(--cream);
  opacity: 0.95;
}
.carousel-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.65rem 1.1rem;
  border-top: 3px solid var(--ink);
  background: var(--yellow);
}
.carousel-btn {
  font-family: 'Bangers', cursive;
  font-size: 1.2rem;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 999px;
  width: 2.1rem;
  height: 2.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  flex: none;
}
.carousel-btn:hover { background: var(--cream); }
.carousel-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.carousel-pause { margin-left: auto; font-size: 0.95rem; }
.carousel-dots {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
}
.carousel-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--card);
  padding: 0;
  cursor: pointer;
  flex: none;
}
.carousel-dot.is-active { background: var(--red); }

@media (prefers-reduced-motion: no-preference) {
  .carousel-btn:hover { transform: translateY(-1px); }
}
.content-block > ul > li ul,
.content-block > ol > li ol {
  display: block;
  list-style: disc;
  padding-left: 1.2rem;
  margin: 0.5rem 0 0;
}
.content-block > ul > li ul li,
.content-block > ol > li ol li {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  transform: none;
}

/* Program directories (elementary/middle/high school listings) are grouped
   into tiles at render time — see lib/tile-programs.js. */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-flow: dense;
  gap: 1.1rem;
  margin: 1.25rem 0 1.75rem;
}
.program-tile {
  background: var(--card);
  border: 4px solid var(--ink);
  border-radius: 12px 6px 14px 8px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 1.1rem 1.2rem;
  transition: transform 0.15s ease;
}
.program-tile:hover { transform: translateY(-4px); }
.program-tile--wide {
  grid-column: 1 / -1;
  background: var(--cream);
}
.program-tile--wide p, .program-tile--wide .tile-desc { max-width: 70ch; }
.program-tile h4 { margin-top: 0; }
.program-tile p, .program-tile .tile-desc { font-size: 0.92rem; }
.program-tile .tile-desc ul, .program-tile .tile-desc ol { margin: 0.5em 0 0; padding-left: 1.2em; }
.program-tile .tile-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  margin-top: 0.7rem;
}
.program-tile .tile-links strong { display: none; }
.program-tile .tile-links a {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 0.8rem;
  background: var(--blue);
  color: var(--cream) !important;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
}
.program-tile .tile-links a:hover { background: var(--blue-dark); }
.program-tile .tile-links a::after { content: ' ↗'; }

/* Decorative photo filling out a grid's otherwise-blank trailing slots —
   not a tile, not clickable, just visual — see lib/tile-programs.js. */
.grid-filler {
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.grid-filler::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    135deg,
    rgba(23, 22, 26, 0.6) 0%,
    rgba(42, 117, 187, 0.45) 60%,
    rgba(23, 22, 26, 0.35) 100%
  );
}
.tile-grid .grid-filler {
  border: 4px solid var(--ink);
  border-radius: 12px 6px 14px 8px;
  box-shadow: 5px 5px 0 var(--ink);
  min-height: 140px;
}
.content-block > ul > li.grid-filler,
.content-block > ol > li.grid-filler {
  border: 3px solid var(--ink);
  border-radius: 12px 6px 12px 6px;
  box-shadow: 4px 4px 0 var(--ink);
  min-height: 90px;
  padding: 0;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font-family: 'Bangers', cursive;
  letter-spacing: 1.5px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.5rem 1.3rem;
  font-size: 1.05rem;
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}
.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}
.btn-primary { background: var(--blue); color: var(--cream); }
.btn-primary:hover { background: var(--blue-dark); color: var(--cream); }
.btn-accent { background: var(--red); color: var(--cream); }
.btn-accent:hover { background: var(--red-dark); color: var(--cream); }
.btn-secondary { background: var(--cream); color: var(--ink); }
.btn-secondary:hover { color: var(--ink); background: #f0e6d3; }
.btn-danger { background: var(--yellow); color: var(--ink); }
.btn-danger:hover { color: var(--ink); background: #ffbf1f; }
.btn-small { padding: 0.3rem 0.9rem; font-size: 0.85rem; box-shadow: 3px 3px 0 var(--ink); }

.inline-form { display: inline; }

/* ---------- explore more / footer ---------- */

.explore-more {
  background: var(--yellow);
  border-top: 5px solid var(--ink);
  border-bottom: 5px solid var(--ink);
  margin-top: 3rem;
}
.explore-more-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.explore-more h3 {
  margin-top: 0;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  color: var(--ink);
  font-size: 1.8rem;
  display: block;
}
.explore-more p { font-weight: 800; }
.explore-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}
.explore-links a {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  text-decoration: none;
  background: var(--cream);
  color: var(--ink);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  display: inline-block;
}
.explore-links a:hover { background: var(--red); color: var(--cream); }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 1.5rem;
}
.footer-contact { margin-top: 0.4rem; }
.footer-contact a { color: var(--red-dark); }

/* ---------- home hero ---------- */

.comic-hero {
  position: relative;
  overflow: hidden;
  margin: 0 0 2.5rem;
  padding: 3rem 2.5rem 5rem;
  border: 6px solid var(--ink);
  border-radius: 22px 10px 26px 12px;
  background-image:
    linear-gradient(125deg, rgba(23, 22, 26, 0.78) 0%, rgba(42, 117, 187, 0.6) 55%, rgba(23, 22, 26, 0.4) 100%),
    url('/img/hero-kids.jpg');
  background-size: cover;
  background-position: center 35%;
  box-shadow: 12px 12px 0 var(--ink);
  color: var(--cream);
}
.comic-hero .eyebrow {
  font-family: 'Bangers', cursive;
  letter-spacing: 3px;
  font-size: 1.1rem;
  color: var(--yellow);
  margin: 0 0 0.5rem;
}
.comic-hero .hero-future {
  font-family: 'Bangers', cursive;
  letter-spacing: 3px;
  font-size: 1.6rem;
  line-height: 0.9;
  color: var(--cream);
  display: block;
}
.comic-hero .hero-peds {
  font-family: 'Bangers', cursive;
  letter-spacing: 1px;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 0.95;
  color: var(--yellow);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 4px 4px 0 var(--red), 4px 4px 0 var(--ink);
  display: block;
}
.comic-hero p.tagline {
  max-width: 42ch;
  margin: 1.5rem 0 0;
  font-weight: 800;
  font-size: 1.15rem;
  text-shadow: 1px 1px 0 rgba(23, 22, 26, 0.35);
}
.comic-hero .sticker {
  position: absolute;
  font-family: 'Bangers', cursive;
  -webkit-text-stroke: 2px var(--ink);
}
.comic-hero .sticker-pow {
  top: 1.25rem;
  right: 2rem;
  font-size: 2rem;
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-8deg);
}
.comic-hero .hero-cta {
  position: absolute;
  right: 2.5rem;
  bottom: 1.75rem;
  font-size: 1.4rem;
  padding: 0.75rem 1.9rem;
  box-shadow: 6px 6px 0 var(--ink);
}
.comic-hero .hero-cta:active { box-shadow: 2px 2px 0 var(--ink); }

.chapter-panels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 5px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 8px 8px 0 var(--ink);
  margin: 2.75rem 0 3rem;
}
.chapter-panel {
  padding: 1.5rem 1.25rem;
  text-decoration: none;
  border-right: 5px solid var(--ink);
  transition: filter 0.1s ease;
}
.chapter-panel:last-child { border-right: none; }
.chapter-panel:hover { filter: brightness(1.06); }
.chapter-panel .chapter-title {
  font-family: 'Bangers', cursive;
  font-size: 1.5rem;
  letter-spacing: 1px;
  display: block;
}
.chapter-panel p { font-weight: 700; font-size: 0.88rem; margin: 0.4rem 0 0; }
.chapter-panel.tone-elementary { background: var(--blue); color: var(--cream); }
.chapter-panel.tone-elementary:hover { color: var(--cream); }
.chapter-panel.tone-middle { background: var(--teal); color: var(--ink); }
.chapter-panel.tone-middle:hover { color: var(--ink); }
.chapter-panel.tone-high { background: var(--red); color: var(--cream); }
.chapter-panel.tone-high:hover { color: var(--cream); }

.home-ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0 2.5rem;
}

/* ---------- pediatricians page ---------- */

.admin-actions { margin: 1rem 0; }

.pediatrician-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.75rem;
  margin-top: 1.5rem;
}
.pediatrician-card {
  background: var(--card);
  border: 5px solid var(--ink);
  border-radius: 14px 8px 16px 8px;
  box-shadow: 7px 7px 0 var(--ink);
  padding: 1.25rem;
}
.pediatrician-card:nth-child(3n+2) { box-shadow: 7px 7px 0 var(--blue); }
.pediatrician-card:nth-child(3n+3) { box-shadow: 7px 7px 0 var(--teal); }
.pediatrician-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 4px solid var(--ink);
  margin-bottom: 0.75rem;
}
.pediatrician-photo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--yellow);
}
.pp-carousel {
  position: relative;
  margin-bottom: 0.75rem;
}
.pp-carousel-track {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}
.pp-carousel .pp-slide {
  position: absolute;
  inset: 0;
  margin-bottom: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}
.pp-carousel .pp-slide.is-active {
  opacity: 1;
  visibility: visible;
}
.pp-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  font-family: 'Bangers', cursive;
  font-size: 1.1rem;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 999px;
  width: 1.9rem;
  height: 1.9rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
.pp-nav:hover { background: var(--cream); }
.pp-nav:active { transform: translateY(-50%) translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.pp-prev { left: 0.5rem; }
.pp-next { right: 0.5rem; }
.pp-dots {
  position: absolute;
  bottom: 0.5rem;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}
.pp-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--card);
  cursor: pointer;
  padding: 0;
}
.pp-dot.is-active { background: var(--red); }
.pediatrician-card h2 {
  margin: 0.25rem 0 0;
  font-size: 1.4rem;
  color: var(--ink);
  text-shadow: none;
}
.pediatrician-title {
  font-family: 'Nunito', sans-serif;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.85rem;
  margin: 0.15rem 0 0.9rem;
}
.pediatrician-photo-wrap { position: relative; }
.qa-bubble {
  position: fixed;
  z-index: 60;
  width: 260px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 0.7rem 0.9rem;
  box-shadow: 4px 4px 0 var(--ink);
}
.qa-bubble[hidden] { display: none; }
.qa-bubble.is-popping { animation: bubblePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Tail pointing down — used when the bubble sits above the photo. */
.qa-bubble.tail-down::after {
  content: '';
  position: absolute;
  left: var(--tail-x, 24px);
  bottom: -13px;
  border-width: 9px 9px 0 0;
  border-style: solid;
  border-color: var(--ink) transparent transparent transparent;
}
.qa-bubble.tail-down::before {
  content: '';
  position: absolute;
  left: calc(var(--tail-x, 24px) + 3px);
  bottom: -8px;
  border-width: 6px 6px 0 0;
  border-style: solid;
  border-color: var(--cream) transparent transparent transparent;
  z-index: 1;
}

/* Tail pointing up — used when the bubble sits below the photo. */
.qa-bubble.tail-up::after {
  content: '';
  position: absolute;
  left: var(--tail-x, 24px);
  top: -13px;
  border-width: 0 9px 9px 0;
  border-style: solid;
  border-color: transparent transparent var(--ink) transparent;
}
.qa-bubble.tail-up::before {
  content: '';
  position: absolute;
  left: calc(var(--tail-x, 24px) + 3px);
  top: -8px;
  border-width: 0 6px 6px 0;
  border-style: solid;
  border-color: transparent transparent var(--cream) transparent;
  z-index: 1;
}

.qa-bubble-text {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  max-height: 180px;
  overflow-y: auto;
}
.qa-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.9rem;
}
.qa-question-btn {
  font-family: 'Bangers', cursive;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
  color: var(--red-dark);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.1s ease;
}
.qa-question-btn:hover { background: var(--cream); }
.qa-question-btn:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.qa-question-btn.is-active {
  background: var(--yellow);
  color: var(--ink);
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--ink);
}
.card-admin-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}
.empty-state { color: var(--muted); font-weight: 700; font-style: italic; }

.contact-message-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.contact-message-card {
  background: var(--card);
  border: 4px solid var(--ink);
  border-radius: 14px 8px 16px 8px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 1.1rem 1.3rem;
}
.contact-message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.contact-message-head a { margin-left: 0.5rem; }
.contact-message-date { color: var(--muted); font-weight: 700; font-size: 0.82rem; }
.contact-message-body {
  white-space: pre-wrap;
  margin: 0 0 0.75rem;
  font-weight: 700;
}

/* ---------- forms ---------- */

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.stacked-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 800;
  font-size: 0.92rem;
}
.stacked-form input[type="text"],
.stacked-form input[type="email"],
.stacked-form input[type="password"],
.stacked-form textarea {
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.55rem 0.7rem;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--card);
}
.stacked-form input[type="file"] { font-weight: 700; }
.hint { font-weight: 700; color: var(--muted); font-size: 0.82rem; }
.form-error {
  background: var(--yellow);
  border: 3px solid var(--ink);
  color: var(--ink);
  font-weight: 800;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
}
.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form-success {
  background: var(--teal);
  border: 3px solid var(--ink);
  color: var(--ink);
  font-weight: 800;
  padding: 1rem 1.2rem;
  border-radius: 10px;
}
.current-photo-preview {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid var(--ink);
}

.existing-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}
.existing-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.remove-photo-label {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.photo-form-row {
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--card);
}
.photo-form-row label { flex: 1; }
.photo-crop-preview {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  border: 3px solid var(--ink);
  flex: none;
}
.crop-container {
  height: 420px;
  max-height: 55vh;
  overflow: hidden;
  background: #000;
  border: 2px solid var(--ink);
}
.crop-container img { max-width: 100%; display: block; }

.face-mark-container {
  height: 380px;
  max-height: 55vh;
  overflow: hidden;
  background: #000;
  border: 2px solid var(--ink);
}
.face-mark-container img { max-width: 100%; display: block; }
.mark-face-btn { margin: 0.3rem 0; }

/* Cropper.js's default selection box (thin blue lines, tiny handles) is
   easy to miss against a photo. Make the face-marking box loud and
   unmistakable — bright, thick, oversized handles — since this is the
   one control on the page that's easy to overlook otherwise. */
.face-mark-container .cropper-view-box {
  outline: 3px solid var(--red);
  outline-color: var(--red);
}
.face-mark-container .cropper-face { background-color: var(--yellow); opacity: 0.25; }
.face-mark-container .cropper-line { background-color: var(--red); opacity: 0.9; }
.face-mark-container .cropper-point {
  background-color: var(--red);
  opacity: 1;
  width: 14px;
  height: 14px;
}
.face-mark-container .cropper-point.point-se,
.face-mark-container .cropper-point.point-sw,
.face-mark-container .cropper-point.point-ne,
.face-mark-container .cropper-point.point-nw {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--card);
}

.qa-form-row {
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--card);
}

.form-submit-row {
  border-top: 3px solid var(--ink);
  padding-top: 1rem;
  justify-content: flex-end;
}

.admin-page-list { padding-left: 1.2rem; }
.admin-page-list li { margin-bottom: 0.5rem; font-weight: 700; }

/* ---------- page builder (admin) ---------- */

.link-form-row {
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--card);
}

.quill-editor-mount {
  min-height: 140px;
  max-height: 40vh;
  overflow-y: auto;
  background: #fff;
  font-family: 'Nunito', sans-serif;
  border: 2px solid var(--ink);
  border-top: none;
}

#sections-list { margin-bottom: 1.5rem; }

.builder-section {
  border: 3px solid var(--ink);
  border-radius: 12px;
  margin-bottom: 1rem;
  background: var(--card);
  overflow: hidden;
}
.builder-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}
.builder-section-head {
  background: var(--yellow);
  border-bottom: 3px solid var(--ink);
  flex-wrap: wrap;
}
.builder-heading-label { flex: 1; }
.builder-type-badge {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--cream);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.builder-items { padding: 0.5rem; }
.builder-item {
  border: 2px solid var(--ink);
  border-radius: 8px;
  margin: 0.4rem;
  background: #fff;
}
.builder-item-label { flex: 1; font-weight: 700; font-size: 0.9rem; }
.builder-item-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--ink);
  flex: none;
}
.builder-actions { display: flex; gap: 0.4rem; flex: none; }
.builder-add-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 2px dashed rgba(23, 22, 26, 0.3);
}
.drag-handle {
  cursor: grab;
  flex: none;
  font-size: 1.1rem;
  color: var(--muted);
  touch-action: none;
}
.drag-handle:active { cursor: grabbing; }
.builder-item.sortable-ghost, .builder-section.sortable-ghost {
  opacity: 0.4;
}

/* ---------- edit modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 22, 26, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--card);
  border: 5px solid var(--ink);
  border-radius: 16px;
  box-shadow: 10px 10px 0 var(--ink);
  padding: 1.5rem;
  width: min(720px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
#crop-phase, #face-phase {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
#crop-phase[hidden], #face-phase[hidden] { display: none; }
.modal h3 {
  margin: 0;
  color: var(--ink);
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  display: block;
  font-size: 1.6rem;
}
.quill-editor {
  flex: 1;
  min-height: 320px;
  max-height: 55vh;
  overflow-y: auto;
  background: #fff;
  font-family: 'Nunito', sans-serif;
  border: 2px solid var(--ink) !important;
}
.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
}
.save-status { margin-right: auto; color: var(--muted); font-weight: 800; font-size: 0.9rem; }

/* ---------- motion ---------- */

@keyframes cursorTwinkle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(18deg) scale(1.15); }
}
@keyframes cursorPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.7); }
  100% { transform: scale(1); }
}
@keyframes wobble {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 6px 6px 0 var(--ink), 0 0 0 rgba(255, 207, 63, 0); }
  50% { box-shadow: 6px 6px 0 var(--ink), 0 0 20px 5px rgba(255, 207, 63, 0.55); }
}
@keyframes heroPopIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes dropdownIn {
  from { transform: translateY(-6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes bubblePop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.btn:hover:not(:active) { transform: translateY(-2px); }

.chapter-panel { transition: transform 0.15s ease, filter 0.1s ease; }
.chapter-panel:hover { transform: translateY(-5px) rotate(-1deg); }

.pediatrician-card { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.pediatrician-card:hover { transform: translateY(-5px); }

.explore-links a { transition: transform 0.12s ease; }
.explore-links a:hover { transform: translateY(-3px) rotate(-2deg); }

.nav-dropdown-panel { transform-origin: top left; }

@media (prefers-reduced-motion: no-preference) {
  .cursor-fx-icon { animation: cursorTwinkle 2.2s ease-in-out infinite; }
  .cursor-fx-icon.is-clicking { animation: cursorPop 0.35s ease; }
  .comic-hero .sticker-pow { animation: wobble 2.6s ease-in-out infinite; }
  .comic-hero .hero-cta { animation: pulseGlow 2.8s ease-in-out infinite; }
  .comic-hero .hero-lockup { animation: heroPopIn 0.5s ease; }
  .brand:hover img { animation: wiggle 0.5s ease-in-out; }
  .nav-dropdown[open] .nav-dropdown-panel { animation: dropdownIn 0.16s ease; }
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .site-nav { justify-content: flex-start; width: 100%; }
  h1 { font-size: 1.8rem; }
  .comic-hero { padding-bottom: 3rem; }
  .comic-hero .hero-cta {
    position: static;
    display: inline-block;
    margin-top: 1.75rem;
  }
  .chapter-panels { grid-template-columns: 1fr; }
  .chapter-panel { border-right: none; border-bottom: 5px solid var(--ink); }
  .chapter-panel:last-child { border-bottom: none; }

  .content-block .carousel-slide { height: calc(var(--slide-height, 300px) + 60px); }
  .carousel-slide-text { padding: 1.25rem 1.4rem; }
}
