/* Theme: a classroom desk — graph paper, sticky notes, taped photos, a chalkboard, crayon colours. */
:root {
  --ink: #1b2a4a;
  --paper: #f4f8ff;
  --grid: #dbe6f7;
  --tomato: #ff5a5f;
  --sun: #ffc93c;
  --grass: #3bb273;
  --sky: #3a86ff;
  --grape: #8338ec;
  --chalk: #24443a;
  --muted: #5b6b86;
  --line: #d5deec;
  --display: "Fredoka", "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --press: 0 5px 0 var(--ink);
  --primary: var(--ink); /* used by the admin panel */
  --bg: var(--paper);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--body); color: var(--ink); line-height: 1.6; font-size: 1.05rem;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
img { max-width: 100%; display: block; }
a { color: var(--sky); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; }
:focus-visible { outline: 3px dashed var(--grape); outline-offset: 3px; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.25rem; background: #fff; border-bottom: 3px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.25rem; margin-right: auto; }
.logo {
  width: 44px; height: 44px; border-radius: 14px; background: var(--sun); color: var(--ink); border: 3px solid var(--ink);
  display: grid; place-items: center; font-weight: 700; font-size: 1.3rem; transform: rotate(-6deg); cursor: pointer;
  transition: transform .25s cubic-bezier(.34, 1.8, .64, 1);
}
.logo:hover { transform: rotate(8deg) scale(1.1); }
nav { display: flex; gap: .3rem; }
nav a {
  color: var(--ink); text-decoration: none; padding: .4rem .85rem; border-radius: 12px; font-weight: 800;
  border: 2px solid transparent; transition: background .2s, transform .2s;
}
nav a:hover { background: color-mix(in srgb, var(--c) 18%, #fff); transform: translateY(-2px); }
nav a.active { background: var(--c); border-color: var(--ink); color: #fff; box-shadow: 0 3px 0 var(--ink); }
nav a[href="#about"].active { color: var(--ink); }
.menu-btn { display: none; background: none; border: 0; color: var(--ink); font-size: 1.7rem; cursor: pointer; }
@media (max-width: 800px) {
  .menu-btn { display: block; }
  nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: #fff; padding: .6rem 1rem 1rem; border-bottom: 3px solid var(--ink); }
  .nav-open nav { display: flex; }
}

/* Scrolling notice ticker */
.ticker { background: var(--ink); color: #fff; overflow: hidden; white-space: nowrap; font-weight: 700; font-size: .95rem; }
.ticker-track { display: inline-block; padding: .45rem 0; padding-left: 100%; animation: ticker 28s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-track span { margin-right: 3rem; }
.ticker-track span::before { content: "★ "; color: var(--sun); }
@keyframes ticker { to { transform: translateX(-100%); } }

main { max-width: 1150px; margin: 0 auto; padding: 2rem 1.25rem 4rem; min-height: 70vh; }
main.enter > * { animation: pop-in .45s cubic-bezier(.34, 1.4, .64, 1) both; }
main.enter > *:nth-child(2) { animation-delay: .06s; }
main.enter > *:nth-child(3) { animation-delay: .12s; }
main.enter > *:nth-child(n+4) { animation-delay: .18s; }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.loading { font-family: var(--display); text-align: center; padding: 4rem 0; font-size: 1.3rem; }

.page-title { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: .1em; }
.page-title .squiggle, .squiggle { position: relative; display: inline-block; }
.squiggle::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.18em; height: .32em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 10'%3E%3Cpath d='M0 5 Q5 0 10 5 T20 5 T30 5 T40 5' fill='none' stroke='%23ffc93c' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x;
  background-size: 1.4em 100%;
}
.lede { color: var(--muted); font-size: 1.1rem; margin: .6rem 0 2rem; max-width: 60ch; }
.section-title { font-size: 2rem; margin: 3rem 0 1.2rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font-family: var(--display); font-weight: 600; font-size: 1.05rem; text-decoration: none; cursor: pointer;
  background: var(--sun); color: var(--ink); padding: .6rem 1.3rem; border-radius: 14px; border: 3px solid var(--ink);
  box-shadow: var(--press); transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.secondary, .btn.ghost { background: #fff; }
.btn-row { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; padding: 1rem 0 2rem; position: relative; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(2.6rem, 6.5vw, 4.8rem); font-weight: 700; line-height: 1.02; margin-bottom: .3em; }
.hero h1 .ch { display: inline-block; animation: bounce-in .7s cubic-bezier(.34, 1.8, .64, 1) both; animation-delay: calc(var(--i) * 35ms); }
.hero h1 .ch:nth-child(5n+1) { color: var(--tomato); }
.hero h1 .ch:nth-child(5n+3) { color: var(--sky); }
.hero h1 .ch:nth-child(5n+4) { color: var(--grass); }
@keyframes bounce-in { from { opacity: 0; transform: translateY(-60px) rotate(-12deg); } }
.hero .tag { font-family: var(--display); font-size: 1.45rem; font-weight: 600; margin-bottom: .8rem; }
.hero p { max-width: 46ch; font-size: 1.12rem; }

.polaroid {
  background: #fff; padding: 12px 12px 44px; border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink);
  transform: rotate(var(--tilt, 3deg)); position: relative; transition: transform .3s cubic-bezier(.34, 1.6, .64, 1);
}
.polaroid::before { /* tape */
  content: ""; position: absolute; top: -14px; left: 50%; width: 90px; height: 26px; transform: translateX(-50%) rotate(-4deg);
  background: color-mix(in srgb, var(--sun) 65%, transparent); border: 1px dashed rgba(27, 42, 74, .25);
}
.polaroid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.polaroid figcaption { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-family: var(--display); font-weight: 600; font-size: .98rem; padding: 0 .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .polaroid { margin: 1rem 1rem 0; }

.doodle { position: absolute; font-size: 2rem; pointer-events: none; animation: float 5s ease-in-out infinite; opacity: .9; }
@keyframes float { 50% { transform: translateY(-12px) rotate(8deg); } }
@media (max-width: 860px) { .doodle { display: none; } }

/* Stats as stickers */
.stats { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 2rem 0; }
.stat { background: var(--c, var(--sky)); color: #fff; border: 3px solid var(--ink); border-radius: 22px; padding: 1.1rem; text-align: center; box-shadow: var(--press); transform: rotate(var(--r, 0deg)); }
.stat b { display: block; font-family: var(--display); font-size: 2.6rem; line-height: 1.1; }
.stat span { font-weight: 800; }
.stat.dark-text { color: var(--ink); }

/* Sticky notes */
.notes { display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.note {
  background: var(--c); padding: 1.4rem 1.2rem 1.6rem; transform: rotate(var(--r)); border-radius: 2px 2px 18px 2px;
  box-shadow: 0 10px 16px -10px rgba(27, 42, 74, .55); transition: transform .3s cubic-bezier(.34, 1.8, .64, 1); position: relative;
}
.note::before { content: ""; position: absolute; top: -10px; left: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--tomato); border: 2px solid var(--ink); transform: translateX(-50%); }
.note:hover { transform: rotate(0) scale(1.05); }
.note h3 { font-size: 1.25rem; }
.note p { margin: 0; }

/* Chalkboard + contact */
.board-row { display: grid; gap: 1.6rem; grid-template-columns: 1.5fr 1fr; margin-top: 3rem; }
@media (max-width: 800px) { .board-row { grid-template-columns: 1fr; } }
.chalkboard {
  background: var(--chalk); color: #f2f5ef; border: 12px solid #a0703f; border-radius: 10px; padding: 1.4rem 1.6rem;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .35), 0 6px 0 #6e4b28;
}
.chalkboard h3 { font-size: 1.6rem; color: var(--sun); }
.chalkboard ul { list-style: none; padding: 0; margin: 0; }
.chalkboard li { display: flex; gap: 1rem; padding: .55rem 0; border-bottom: 2px dashed rgba(255, 255, 255, .18); }
.chalkboard li:last-child { border: 0; }
.chalkboard time { flex: none; min-width: 6.8rem; font-family: var(--display); color: #9fe3c1; }
.card { background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 1.4rem; box-shadow: 6px 6px 0 var(--ink); }
.card h3 { font-size: 1.4rem; }
.contact p { margin: .3rem 0; }

/* ---------- About ---------- */
.about-grid { display: grid; gap: 2rem; grid-template-columns: 1.4fr 1fr; align-items: start; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }
.prose { white-space: pre-line; font-size: 1.1rem; }
.mv { display: grid; gap: 1.4rem; }
.mv .note { --r: 2deg; }
.mv .note + .note { --r: -2deg; }
.principal { display: grid; grid-template-columns: 200px 1fr; gap: 2rem; align-items: center; margin-top: 1rem; }
@media (max-width: 600px) { .principal { grid-template-columns: 1fr; } }
.principal blockquote { margin: 0; font-family: var(--display); font-size: 1.35rem; font-weight: 500; line-height: 1.4; }
.principal cite { display: block; margin-top: .8rem; font-family: var(--body); font-style: normal; font-weight: 800; font-size: 1rem; }
.principal .polaroid { --tilt: -4deg; }

/* ---------- Gallery ---------- */
.gallery { display: grid; gap: 2.2rem 1.6rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); padding-top: 1rem; }
.gallery .polaroid { cursor: zoom-in; margin: 0; }
.gallery .polaroid:hover { transform: rotate(0) scale(1.06); z-index: 2; }
dialog#lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; overflow: visible; }
dialog#lightbox::backdrop { background: rgba(27, 42, 74, .9); }
dialog#lightbox figure { margin: 0; background: #fff; padding: 12px 12px 8px; border-radius: 6px; }
dialog#lightbox img { max-height: 78vh; margin: auto; }
dialog#lightbox figcaption { text-align: center; font-family: var(--display); font-size: 1.15rem; padding-top: .4rem; }
.lb-btn { position: fixed; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ink); background: var(--sun); font-size: 1.8rem; line-height: 1; cursor: pointer; box-shadow: 0 4px 0 var(--ink); }
.lb-prev { left: 2vw; } .lb-next { right: 2vw; }
.lb-close { top: 2rem; right: 2vw; transform: none; font-size: 1.2rem; background: #fff; }

/* ---------- Staff: flip cards ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: 1.6rem; }
.search { flex: 1 1 260px; max-width: 380px; padding: .7rem 1rem .7rem 2.6rem; border: 3px solid var(--ink); border-radius: 14px; font: inherit; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b2a4a' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat .8rem center / 1.2rem; }
.staff-grid { display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.flip { perspective: 900px; height: 300px; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: center; }
.flip-inner { position: relative; height: 100%; transition: transform .6s cubic-bezier(.34, 1.3, .64, 1); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
@media (hover: hover) { .flip:hover .flip-inner { transform: rotateY(180deg); } }
.face { position: absolute; inset: 0; backface-visibility: hidden; border: 3px solid var(--ink); border-radius: 22px; padding: 1.4rem 1rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; box-shadow: 6px 6px 0 var(--ink); }
.face.front { background: #fff; }
.face.front::before { content: ""; position: absolute; inset: 0 0 auto; height: 88px; background: var(--c); border-radius: 18px 18px 0 0; border-bottom: 3px solid var(--ink); }
.face.back { background: var(--c); transform: rotateY(180deg); }
.face.back.dark-text, .face.back.dark-text * { color: var(--ink); }
.face.back { color: #fff; }
.face h3 { font-size: 1.25rem; margin: .3rem 0 0; }
.face .role { font-weight: 800; color: var(--muted); }
.face.back .big { font-family: var(--display); font-size: 1.4rem; font-weight: 600; }
.avatar { position: relative; width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid var(--ink); background: var(--paper); display: grid; place-items: center; font-family: var(--display); font-size: 2.2rem; font-weight: 700; color: var(--ink); }
.flip-hint { font-size: .8rem; color: var(--muted); margin-top: .4rem; }

/* ---------- Enrollments ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { font: inherit; font-weight: 800; padding: .45rem 1rem; border-radius: 999px; border: 3px solid var(--ink); background: #fff; cursor: pointer; transition: transform .15s; }
.chip:hover { transform: translateY(-2px); }
.chip[aria-pressed="true"] { background: var(--grape); color: #fff; box-shadow: 0 3px 0 var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 1.2rem 2rem; align-items: center; margin-bottom: 1.5rem; }
.filters label { font-weight: 800; display: flex; align-items: center; gap: .6rem; }
select, input, textarea { font: inherit; padding: .55rem .7rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.filters select { border: 3px solid var(--ink); border-radius: 14px; font-weight: 700; padding: .45rem .8rem; }
.bars { background: #fff; border: 3px solid var(--ink); border-radius: 22px; padding: 1.3rem 1.4rem; box-shadow: 6px 6px 0 var(--ink); }
.legend { display: flex; gap: 1.2rem; margin-bottom: 1rem; font-weight: 800; font-size: .95rem; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--ink); margin-right: .35rem; vertical-align: -2px; }
.bar-row { display: grid; grid-template-columns: 7.5rem 1fr 3.5rem; gap: .8rem; align-items: center; padding: .35rem 0; }
.bar-row .label { font-weight: 800; }
.bar-row .total { font-family: var(--display); font-weight: 600; text-align: right; font-size: 1.1rem; }
.track { display: flex; height: 26px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.track span { height: 100%; width: 0; transition: width .9s cubic-bezier(.34, 1.2, .64, 1); color: #fff; font-size: .75rem; font-weight: 800; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.track .boys { background: var(--sky); }
.track .girls { background: var(--tomato); }
.bar-total { display: flex; justify-content: space-between; border-top: 3px dashed var(--line); margin-top: .8rem; padding-top: .8rem; font-family: var(--display); font-size: 1.2rem; font-weight: 600; }

/* ---------- Footer ---------- */
.footer { position: relative; background: var(--ink); color: #cfd8ea; padding: 3rem 1.25rem 2rem; margin-top: 3rem; }
.footer::before { content: ""; position: absolute; left: 0; right: 0; top: -24px; height: 26px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 26' preserveAspectRatio='none'%3E%3Cpath d='M0 13 Q15 0 30 13 T60 13 T90 13 T120 13 V26 H0Z' fill='%231b2a4a'/%3E%3C/svg%3E") repeat-x; background-size: 240px 26px; }
.footer .inner { max-width: 1150px; margin: 0 auto; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.footer h3 { color: var(--sun); font-size: 1.25rem; }
.footer a { color: #9ec5ff; }
.footer .copy { max-width: 1150px; margin: 2rem auto 0; font-size: .85rem; color: #8494b3; }
.empty { color: var(--muted); padding: 2rem; text-align: center; font-weight: 700; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .ticker-track { padding-left: 1rem; white-space: normal; }
}
