/* SchoolList International – small custom layer on top of Tailwind */
:root { --navy:#163A70; --edu:#2563EB; --teal:#0F766E; --paper:#F8FAFC; --ink:#1E293B; }
html { scroll-padding-top: 5rem; }
:focus-visible { outline: 3px solid var(--edu); outline-offset: 2px; border-radius: 4px; }
.ring-dashed { --tw-ring-color: transparent; box-shadow: none !important; outline: 1px dashed #94a3b8; outline-offset: -1px; }
.tabular-nums { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Form controls */
.input, .select, .textarea { width:100%; border:1px solid #CBD5E1; background:#fff; border-radius:.5rem; padding:.6rem .75rem; font-size:15px; color:var(--ink); }
.input:focus, .select:focus, .textarea:focus { outline:none; border-color:var(--edu); box-shadow:0 0 0 3px rgba(37,99,235,.18); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color:#BE123C; }
.label { display:block; font-size:14px; font-weight:600; color:#334155; margin-bottom:.35rem; }
.hint { font-size:13px; color:#64748B; margin-top:.3rem; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:.5rem; border-radius:.5rem; padding:.62rem 1.1rem; font-weight:600; font-size:15px; transition:background-color .15s, color .15s; }
.btn-primary { background:var(--navy); color:#fff; } .btn-primary:hover { background:#0F2A52; }
.btn-teal { background:var(--teal); color:#fff; } .btn-teal:hover { background:#0B5E58; }
.btn-ghost { background:#fff; color:var(--navy); border:1px solid #CBD5E1; } .btn-ghost:hover { background:#F1F5F9; }
.btn-danger { background:#BE123C; color:#fff; } .btn-danger:hover { background:#9F1239; }
.btn[disabled] { opacity:.6; cursor:not-allowed; }
.btn.hidden, .check-tile.hidden { display:none; } /* .btn sets display, so let Tailwind's "hidden" still win */
.check-tile { display:flex; align-items:center; gap:.6rem; border:1px solid #E2E8F0; border-radius:.5rem; padding:.55rem .75rem; background:#fff; font-size:14px; cursor:pointer; }
.check-tile:has(input:checked) { border-color:var(--teal); background:#F0FDFA; }
.check-tile input { accent-color: var(--teal); width:1rem; height:1rem; }

/* Hero map: the map is the hero; the search panel sits over it */
.hero-map { height: 340px; }
@media (min-width: 1024px) { .hero-map { height: 600px; } }
.hero-map .leaflet-control-attribution { font-size: 10px; }

/* Map markers: availability-coloured pins */
.nsl-pin { width: 26px; height: 34px; }
.nsl-pin svg { filter: drop-shadow(0 1px 1.5px rgba(15,42,82,.45)); }
.nsl-pin.is-active svg { transform: scale(1.25); transform-origin: 50% 100%; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(22,58,112,.18) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background-color: #163A70 !important; color: #fff !important; font-weight: 700; font-family: inherit; }
.leaflet-popup-content { margin: 12px 14px; font-family: inherit; }
.leaflet-popup-content-wrapper { border-radius: 10px; }
.leaflet-container { font-family: inherit; }

/* Search split view */
.search-split { height: calc(100vh - 4rem - 64px); }
.result-card.is-active { outline: 2px solid var(--edu); outline-offset: -2px; }
.skeleton { background: linear-gradient(90deg,#EEF2F7 25%,#F8FAFC 50%,#EEF2F7 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius:.5rem; }
@keyframes sk { to { background-position: -200% 0; } }

/* Region index: the 14 regions as a typographic list */
.region-row:hover .region-arrow { transform: translateX(3px); }
.region-arrow { transition: transform .15s; }

/* Search page on mobile has a list/map toggle at the bottom; lift the compare tray above it */
@media (max-width: 1023px) { body.has-view-toggle #compare-tray { bottom: 4.5rem; } }

/* ===================================================================
   Motion. Everything below is switched off for "reduce motion" users,
   and hidden-until-revealed states only apply when JavaScript runs
   (html.js-motion), so content can never get stuck invisible.
   =================================================================== */
:root { --ease-out: cubic-bezier(.2,.7,.2,1); --ease-spring: cubic-bezier(.34,1.56,.64,1); }

/* Page arrives softly */
@keyframes page-in { from { opacity: 0 } to { opacity: 1 } }
body { animation: page-in .35s ease-out both; }

/* Brand: the pin gently drops in on load, and bobs on hover */
@keyframes brand-drop { 0% { transform: translateY(-10px); opacity: 0 } 60% { transform: translateY(2px); opacity: 1 } 100% { transform: none } }
header a[aria-label$="home"] svg { animation: brand-drop .7s var(--ease-spring) .1s both; }
header a[aria-label$="home"]:hover svg { animation: brand-bob .9s ease-in-out infinite; }
@keyframes brand-bob { 0%,100% { transform: none } 50% { transform: translateY(-3px) } }
@media (max-width: 400px) { .brand-word { font-size: 15px; } }

/* Scroll reveal: sections and cards rise into place, staggered by JS via --d */
html.js-motion .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); transition-delay: var(--d, 0ms); }
html.js-motion .reveal.is-visible { opacity: 1; transform: none; }

/* Hero: search card slides up after the map fades in */
@keyframes hero-card-in { from { opacity: 0; transform: translateY(28px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes hero-map-in { from { opacity: 0; filter: saturate(.4) } to { opacity: 1; filter: none } }
.hero .hero-card { animation: hero-card-in .8s var(--ease-out) .15s both; }
.hero #hero-map { animation: hero-map-in 1.1s ease-out both; }
.hero .hero-card h1 { background: linear-gradient(90deg, var(--navy), var(--navy) 40%, var(--teal) 50%, var(--navy) 60%, var(--navy)); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: headline-sheen 2.4s ease-out .9s 1 both; }
@keyframes headline-sheen { from { background-position: 100% 0 } to { background-position: 0 0 } }

/* Map pins drop in one after another; the focused pin bounces */
@keyframes pin-drop { 0% { transform: translateY(-26px) scale(.5); opacity: 0 } 65% { transform: translateY(3px) scale(1.05); opacity: 1 } 100% { transform: none; opacity: 1 } }
.nsl-pin.drop svg { animation: pin-drop .6s var(--ease-spring) var(--d, 0ms) both; transform-origin: 50% 100%; }
@keyframes pin-bounce { 0%,100% { transform: scale(1.25) translateY(0) } 50% { transform: scale(1.25) translateY(-8px) } }
.nsl-pin.is-active svg { animation: pin-bounce .9s ease-in-out 2; }
.nsl-pin svg { transition: transform .2s var(--ease-spring); }
.nsl-pin:hover svg { transform: scale(1.15); }
@keyframes cluster-pop { from { transform: scale(.4); opacity: 0 } to { transform: none; opacity: 1 } }
.marker-cluster > div { animation: cluster-pop .45s var(--ease-spring) both; }
.leaflet-popup { animation: popup-in .25s var(--ease-out); }
@keyframes popup-in { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

/* Cards lift on hover */
.result-card, .stat-card { transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .25s; }
.result-card:hover, a > .stat-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -14px rgba(15,42,82,.35); border-color: #CBD5E1; }
.result-card img { transition: transform .4s var(--ease-out); }
.result-card:hover img { transform: scale(1.06) rotate(-2deg); }
.result-card.is-active { animation: card-flash 1s ease-out; }
@keyframes card-flash { 0% { box-shadow: 0 0 0 0 rgba(37,99,235,.45) } 100% { box-shadow: 0 0 0 12px rgba(37,99,235,0) } }

/* Buttons: small lift on hover, press-in on click, shine on primary actions */
.btn { transition: background-color .15s, color .15s, transform .15s var(--ease-out), box-shadow .2s; position: relative; overflow: hidden; }
.btn:hover:not([disabled]) { transform: translateY(-1px); }
.btn:active:not([disabled]) { transform: translateY(0) scale(.97); }
.btn-primary:hover, .btn-teal:hover { box-shadow: 0 8px 18px -8px rgba(15,42,82,.55); }
.btn-primary::after, .btn-teal::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.28) 50%, transparent 65%); transform: translateX(-120%); }
.btn-primary:hover::after, .btn-teal:hover::after { transform: translateX(120%); transition: transform .7s ease; }

/* Toggle feedback when Save / Compare is pressed */
@keyframes pop { 0% { transform: scale(1) } 40% { transform: scale(1.35) } 100% { transform: scale(1) } }
.pop svg, .pop i { animation: pop .4s var(--ease-spring); }
[data-save][aria-pressed="true"] svg { color: var(--teal); fill: rgba(15,118,110,.15); }
[data-compare][aria-pressed="true"] { border-color: var(--edu); color: var(--edu); }

/* "Spaces available" dots pulse like a live signal */
.status-dot { position: relative; }
.status-dot.status-available::after, .status-dot.status-limited::after { content: ""; position: absolute; inset: -3px; border-radius: 9999px; background: currentColor; opacity: 0; animation: live-pulse 2.2s ease-out infinite; }
.status-dot.status-available { color: #0D9488; } .status-dot.status-limited { color: #F59E0B; }
@keyframes live-pulse { 0% { transform: scale(.6); opacity: .55 } 80%, 100% { transform: scale(2.4); opacity: 0 } }

/* Notification bell rings once when there is something unread */
@keyframes bell-ring { 0%,100% { transform: rotate(0) } 15% { transform: rotate(14deg) } 30% { transform: rotate(-12deg) } 45% { transform: rotate(8deg) } 60% { transform: rotate(-5deg) } 75% { transform: rotate(2deg) } }
.bell-ring svg { animation: bell-ring 1s ease-in-out .8s 2; transform-origin: 50% 10%; }
.bell-ring span { animation: cluster-pop .4s var(--ease-spring) .6s both; }

/* Toasts slide in and out */
[data-flash] > div { animation: toast-in .45s var(--ease-spring) both; }
[data-flash] > div.toast-out { animation: toast-out .35s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) } to { opacity: 1; transform: none } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }

/* Compare tray rises up when it appears */
#compare-tray:not(.hidden) { animation: tray-in .5s var(--ease-spring) both; }
@keyframes tray-in { from { opacity: 0; transform: translateY(30px) } to { opacity: 1; transform: none } }

/* Menus, FAQ answers and tabs open smoothly */
#mobile-nav:not(.hidden), #more-filters:not(.hidden), #dash-nav:not(.hidden) { animation: drop-down .3s var(--ease-out); }
@keyframes drop-down { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }
details[open] > :not(summary) { animation: drop-down .3s var(--ease-out); }
[role="tabpanel"]:not(.hidden) { animation: page-in .3s ease-out; }

/* "How it works" numbers fill in as each step appears */
.step > span:first-child { transition: background-color .5s ease, color .5s ease, transform .5s var(--ease-spring); transition-delay: calc(var(--d, 0ms) + 250ms); }
html.js-motion .step.is-visible > span:first-child { background: var(--navy); color: #fff; transform: rotate(360deg); }

/* Region rows: a teal bar slides in on hover */
.region-row { position: relative; transition: background-color .2s, padding-left .25s var(--ease-out); }
.region-row::before { content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px; border-radius: 3px; background: var(--teal); transform: scaleY(0); transition: transform .25s var(--ease-out); }
.region-row:hover { padding-left: 1.4rem; }
.region-row:hover::before { transform: scaleY(1); }

/* Dashboard sidebar links glide */
#dash-nav a { transition: background-color .2s, padding-left .2s var(--ease-out); }
#dash-nav a:hover:not([aria-current]) { padding-left: 1rem; }

/* Inputs: a soft glow grows on focus */
.input, .select, .textarea { transition: border-color .2s, box-shadow .25s var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  html.js-motion .reveal { opacity: 1 !important; transform: none !important; }
  .hero .hero-card h1 { color: var(--navy); background: none; }
  .status-dot::after { display: none; }
}

/* AI chat: typing dots and new bubbles */
.typing { display: inline-flex; gap: 4px; } .typing i { width: 6px; height: 6px; border-radius: 9999px; background: #94A3B8; animation: typing 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s } .typing i:nth-child(3) { animation-delay: .3s }
@keyframes typing { 0%, 80%, 100% { transform: translateY(0); opacity: .5 } 40% { transform: translateY(-4px); opacity: 1 } }
#chat > div { animation: drop-down .3s var(--ease-out); }
.ai-answer { animation: drop-down .35s var(--ease-out); }

/* Platform announcement banner */
.announce { overflow: hidden; }
html.js-motion .announce { animation: announce-in .45s cubic-bezier(.2,.8,.2,1) both; }
.announce-out { transition: opacity .25s ease, max-height .25s ease; opacity: 0; max-height: 0 !important; }
@keyframes announce-in { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { html.js-motion .announce { animation: none; } }
/* Admin report bars */
.meter { height: .5rem; border-radius: 9999px; background: #E2E8F0; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: #0F766E; transform-origin: left; }
html.js-motion .reveal .meter > span { transform: scaleX(0); transition: transform .9s cubic-bezier(.2,.8,.2,1) .15s; }
html.js-motion .reveal.is-visible .meter > span { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { html.js-motion .reveal .meter > span { transform: none !important; transition: none !important; } }
