/* =============================================================================
 *  Rowan Tutor - single-screen hero
 * ============================================================================= */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-var.woff2') format('woff2');
}

:root {
  /* Brand: deep night-blue with an indigo→teal accent */
  --bg:        #0a0e16;
  --bg-2:      #0d121d;
  --surface:   rgba(255, 255, 255, 0.05);
  --surface-h: rgba(255, 255, 255, 0.09);
  --border:    rgba(255, 255, 255, 0.10);
  --border-2:  rgba(255, 255, 255, 0.16);

  --text:   #f3f5fb;
  --muted:  #aab3c5;
  --subtle: #7d869b;

  --indigo: #818cf8;
  --teal:   #2dd4bf;
  --accent: #6ee7d6;
  --grad:   linear-gradient(115deg, #818cf8 0%, #2dd4bf 100%);

  --good:   #34d399;
  --warn:   #fbbf24;
  --bad:    #f87171;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius:    20px;
  --radius-sm: 12px;
  --pill:      999px;

  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --glow:   0 0 0 1px rgba(110, 231, 214, 0.25), 0 8px 40px -8px rgba(45, 212, 191, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
html, body { min-height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  min-height: 100dvh;
}

.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;
}

.skip-link {
  position: absolute; left: 50%; top: -60px; transform: translateX(-50%);
  z-index: 100; background: var(--accent); color: #04201c; padding: 10px 16px;
  border-radius: var(--pill); font-weight: 600; text-decoration: none;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

/* ── Map background ───────────────────────────────────────────────────────── */
#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}
.scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(1200px 760px at 16% 32%, rgba(10, 14, 22, 0.88), rgba(10, 14, 22, 0.35) 48%, rgba(10, 14, 22, 0) 78%),
    linear-gradient(180deg, rgba(10, 14, 22, 0.55) 0%, rgba(10, 14, 22, 0.1) 38%, rgba(10, 14, 22, 0.55) 100%);
}

/* Leaflet tweaks for dark theme - brighten tiles so roads read closer to white */
.leaflet-container { background: var(--bg) !important; font-family: var(--font); }
.leaflet-tile { filter: brightness(1.75) contrast(1.05) saturate(0.85); }
.leaflet-control-attribution { display: none; } /* shown in our own footer */

/* Subtle dark-theme +/- zoom buttons */
.leaflet-control-zoom {
  margin: 0 16px 20px 0 !important; border: 0 !important; box-shadow: none !important;
}
.leaflet-control-zoom a {
  width: 32px; height: 32px; line-height: 30px;
  color: var(--muted); background: rgba(14, 20, 30, 0.66); backdrop-filter: blur(8px);
  border: 1px solid var(--border) !important; font-size: 18px; font-weight: 600;
  transition: color .18s, background .18s;
}
.leaflet-control-zoom a:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.leaflet-control-zoom a:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); border-top: 0 !important; }
.leaflet-control-zoom a:hover { color: var(--text); background: rgba(20, 28, 40, 0.85); }
.leaflet-control-zoom a.leaflet-disabled { opacity: 0.4; }

/* School pins reset (Leaflet div icon) */
.leaflet-div-icon { background: none; border: 0; }

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed; z-index: 10; inset: 0 0 auto 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(14px, 2.5vw, 22px) clamp(18px, 4vw, 40px);
  pointer-events: none;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); pointer-events: auto;
  padding: 4px 6px; border: 1px solid transparent; border-radius: var(--pill);
  transition: background .35s ease, border-color .35s ease, padding .35s ease;
}
.brand-mark {
  width: 50px; height: 50px; display: block;
  /* No CSS filter here: a filter on an SVG <img> forces 1x rasterisation
     (blurry/pixelated on high-DPI). Keep it as a crisp vector. */
  transition: width .35s ease, height .35s ease, transform .6s cubic-bezier(.2, .8, .2, 1);
}
/* Scrolled: condense + add a rounded plate behind logo + name for legibility */
body.scrolled .brand {
  background: rgba(10, 14, 22, 0.72);
  border-color: var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 5px 16px 5px 6px;
}
body.scrolled .brand-mark { width: 38px; height: 38px; transform: rotate(360deg); }
.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 1.05rem; }
.topbar-tag {
  color: var(--muted); font-size: 0.85rem; font-weight: 500;
  background: rgba(10, 14, 22, 0.5); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: var(--pill); backdrop-filter: blur(8px);
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  position: relative; z-index: 5;
  min-height: 100dvh;
  display: grid;
  align-content: center;
  padding: clamp(90px, 14vh, 140px) clamp(18px, 5vw, 64px) clamp(96px, 13vh, 140px);
  gap: 24px;
  pointer-events: none; /* let clicks reach the map (school pins) in empty areas */
}
.card, .scroll-cue, .attribution { pointer-events: auto; }

.card {
  max-width: 620px;
  background: linear-gradient(180deg, rgba(15, 20, 32, 0.78), rgba(12, 16, 26, 0.72));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: rise .7s cubic-bezier(.2, .8, .2, 1) both;
}

.eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.74rem;
  font-weight: 600; color: var(--accent); margin-bottom: 14px;
}
h1 {
  font-size: clamp(2.1rem, 5.5vw, 3.6rem);
  line-height: 1.05; letter-spacing: -0.03em; font-weight: 800;
  margin-bottom: 16px;
}
.grad {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.lede {
  color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.55; max-width: 48ch; margin-bottom: 20px;
}

.trust {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px;
}
.trust li {
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: var(--pill);
}

/* ── Lookup form ──────────────────────────────────────────────────────────── */
.lookup {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.lookup input {
  flex: 1 1 200px; min-width: 0;
  font: inherit; font-size: 1.05rem; font-weight: 500;
  color: var(--text); background: rgba(0, 0, 0, 0.25);
  border: 1.5px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 15px 18px; text-transform: uppercase; letter-spacing: 0.04em;
  transition: border-color .2s, box-shadow .2s;
}
.lookup input::placeholder { color: var(--subtle); text-transform: none; letter-spacing: 0; }
.lookup input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }

.lookup button {
  position: relative; flex: 0 0 auto;
  font: inherit; font-weight: 700; font-size: 1rem; color: #06201c;
  background: var(--grad); border: 0; border-radius: var(--radius-sm);
  padding: 15px 26px; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s, filter .2s;
  box-shadow: 0 10px 30px -10px rgba(45, 212, 191, 0.6);
}
.lookup button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.lookup button:active { transform: translateY(0); }
.lookup button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-spinner {
  position: absolute; inset: 0; margin: auto; width: 20px; height: 20px;
  border: 2.5px solid rgba(6, 32, 28, 0.35); border-top-color: #06201c;
  border-radius: 50%; display: none;
}
body.loading .btn-label { opacity: 0; }
body.loading .btn-spinner { display: block; animation: spin .7s linear infinite; }
body.loading .lookup button { pointer-events: none; }

/* ── Result states ────────────────────────────────────────────────────────── */
.result { margin-top: 0; }
.result:empty { display: none; }
.result-box {
  margin-top: 22px; padding: 20px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface);
  animation: rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
.result-box.is-good { border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.08); }
.result-box.is-warn { border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.07); }
.result-box.is-bad  { border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.06); }

.result-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; }
.result-text { color: var(--muted); line-height: 1.5; font-size: 0.97rem; }
.result-text .pc { color: var(--text); font-weight: 600; }

.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.cta {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 0.95rem; text-decoration: none;
  padding: 12px 20px; border-radius: var(--pill); cursor: pointer;
  transition: transform .15s ease, filter .2s, background .2s;
}
.cta:hover { transform: translateY(-1px); }
.cta-primary { background: var(--grad); color: #06201c; box-shadow: 0 10px 26px -10px rgba(45, 212, 191, 0.6); }
.cta-primary:hover { filter: brightness(1.06); }
.cta-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-2); }
.cta-ghost:hover { background: var(--surface-h); }
.cta svg { width: 18px; height: 18px; }

.retry {
  background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600;
  cursor: pointer; padding: 0; margin-top: 12px; text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Map pin (postcode) + school pins ─────────────────────────────────────── */
.pin {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid #06201c;
  box-shadow: 0 0 0 0 rgba(110, 231, 214, 0.6);
  animation: pulse 2s infinite;
}
.school-pin {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font: inherit; font-size: 0.78rem; font-weight: 700; color: var(--text);
  background: rgba(13, 18, 29, 0.92); border: 1px solid var(--border-2);
  padding: 5px 11px 5px 5px; border-radius: var(--pill); cursor: pointer;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.8); transition: transform .15s, border-color .2s;
}
.school-pin:hover { transform: translate(-50%, -50%) scale(1.06); border-color: var(--accent); }
.sp-count {
  display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: var(--pill); background: var(--grad); color: #06201c; font-weight: 800; font-size: 0.8rem;
}
.school-pin.is-empty { opacity: 0.6; }
.school-pin.is-empty .sp-count { background: var(--surface-h); color: var(--muted); }

/* ── Attribution (in hero) ────────────────────────────────────────────────── */
.attribution {
  position: absolute; left: clamp(18px, 5vw, 64px); bottom: 14px;
  font-size: 0.7rem; color: var(--subtle); z-index: 6;
}
.attribution a { color: var(--subtle); }

/* ── Scroll cue ───────────────────────────────────────────────────────────── */
.scroll-cue {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 7; display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  text-decoration: none; color: var(--muted); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; transition: color .2s;
}
.scroll-cue:hover { color: var(--text); }
.scroll-cue svg { width: 26px; height: 26px; animation: bob 1.8s ease-in-out infinite; }

/* ── Testimonials ─────────────────────────────────────────────────────────── */
.testimonials {
  position: relative; z-index: 8; background: var(--bg);
  border-top: 1px solid var(--border);
  padding: clamp(56px, 9vw, 110px) clamp(18px, 5vw, 64px) clamp(40px, 6vw, 72px);
  scroll-margin-top: 0;
}
.t-head { max-width: var(--max-w); margin: 0 auto clamp(26px, 4vw, 44px); text-align: center; }
.t-head h2 { font-size: clamp(1.7rem, 4vw, 2.8rem); letter-spacing: -0.02em; }
.t-sub { color: var(--muted); margin-top: 10px; font-size: clamp(0.95rem, 1.4vw, 1.08rem); }

.stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(20px, 5vw, 56px);
  max-width: var(--max-w); margin: clamp(20px, 3vw, 32px) auto 0;
}
.stat { display: flex; flex-direction: column; align-items: center; }
.stat b {
  font-size: clamp(1.9rem, 4.4vw, 2.8rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.stat span { color: var(--muted); font-size: 0.82rem; font-weight: 500; margin-top: 7px; }

.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: clamp(24px, 4vw, 36px); }
.chip {
  font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
  padding: 8px 14px; border-radius: var(--pill); transition: all .18s;
}
.chip:hover { color: var(--text); background: var(--surface-h); }
.chip b { color: var(--subtle); font-weight: 700; margin-left: 4px; }
.chip.active { color: #06201c; background: var(--grad); border-color: transparent; }
.chip.active b { color: #06201c; }

.masonry { max-width: var(--max-w); margin: 0 auto; display: flex; gap: clamp(14px, 1.6vw, 22px); align-items: flex-start; }
.mcol { flex: 1; display: flex; flex-direction: column; gap: clamp(14px, 1.6vw, 22px); min-width: 0; }
.sentinel { height: 1px; }

.tcard {
  background: linear-gradient(180deg, var(--bg-2), rgba(13, 18, 29, 0.7));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
  animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
}
.tcard blockquote { color: var(--text); line-height: 1.55; font-size: 1rem; }
.tcard blockquote::before { content: "\201C"; color: var(--accent); font-weight: 700; }
.tcard blockquote::after { content: "\201D"; color: var(--accent); font-weight: 700; }
.tcard figcaption { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.tc-name { font-weight: 700; color: var(--text); font-size: 0.92rem; }
.tc-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-size: 0.72rem; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); padding: 3px 10px; border-radius: var(--pill);
}
.tag-grade { color: #06201c; background: var(--grad); border-color: transparent; }
.tag-role { color: var(--accent); border-color: var(--accent); background: transparent; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.66rem; }
.tag-sen { color: var(--subtle); font-style: italic; }
.tc-school {
  align-self: flex-start; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--accent);
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
}
.tc-school:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Anonymised result cards (grade + qualification + school, no quote/name) */
.rcard { display: flex; flex-direction: column; gap: 14px; }
.rc-grades { display: flex; flex-direction: column; gap: 10px; }
.rc-item { display: inline-flex; align-items: center; gap: 10px; }
.rc-item .tag-grade {
  font-size: 1.1rem; font-weight: 800; min-width: 40px; padding: 7px 12px; text-align: center;
  border-radius: var(--radius-sm);
}
.rc-qual { color: var(--text); font-size: 0.9rem; font-weight: 600; }
.rc-sen { display: flex; flex-wrap: wrap; gap: 7px; }
.rc-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rc-mult { font-weight: 800; color: var(--accent); font-size: 1rem; }

/* "Show all reviews" - clears an active school filter, shown at the grid's end */
.show-all {
  display: block; margin: clamp(20px, 3vw, 30px) auto 0; font: inherit; font-size: 0.9rem; font-weight: 600;
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
  padding: 10px 22px; border-radius: var(--pill); cursor: pointer; transition: all .18s;
}
.show-all:hover { background: var(--surface-h); border-color: var(--accent); }
.show-all[hidden] { display: none; }

/* ── Review-submission CTA (below the reviews) ────────────────────────────── */
.review-cta {
  position: relative; z-index: 8; background: var(--bg); border-top: 1px solid var(--border);
  text-align: center; padding: clamp(48px, 8vw, 88px) clamp(18px, 5vw, 64px);
}
.review-cta h2 { font-size: clamp(1.4rem, 3vw, 2.1rem); letter-spacing: -0.02em; }
.review-cta p {
  max-width: 46ch; margin: 12px auto 24px; color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.05rem); line-height: 1.55;
}
.review-cta .cta { display: inline-flex; }
.review-cta[hidden] { display: none; }

/* ── Site footer ──────────────────────────────────────────────────────────── */
.site-foot {
  position: relative; z-index: 8; background: var(--bg); border-top: 1px solid var(--border);
  text-align: center; padding: 26px 20px; color: var(--subtle); font-size: 0.8rem;
}

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(110, 231, 214, 0.55); }
  70%  { box-shadow: 0 0 0 16px rgba(110, 231, 214, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 231, 214, 0); }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .hero { align-content: center; }
}
@media (max-width: 640px) {
  .masonry { flex-direction: column; }
}
@media (max-width: 520px) {
  .topbar-tag { display: none; }
  .lookup button { flex: 1 1 100%; }
  h1 { font-size: clamp(1.9rem, 8vw, 2.5rem); }
  /* Stack the booking CTAs full-width so they line up */
  .cta-row { flex-direction: column; }
  .cta { width: 100%; justify-content: center; }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .pin, .scroll-cue svg { animation: none; }
}
