/* UPLOAD TO: public_html/assets/css/theme.css  (REPLACES your existing one) */

/* ==========================================================================
   KELLY CREMIO — DESIGN SYSTEM
   "The Route" — a driving school and skills institute.
   Loaded AFTER Bootstrap 5. This file overrides/extends Bootstrap rather
   than fighting it — Bootstrap gives us grid + form + component behaviour,
   this file gives the brand its actual identity.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* ---- Colour tokens ---- */
  --ink-950: #050912;   /* page background */
  --ink-900: #0a1428;   /* section band background */
  --ink-800: #10203f;   /* card / panel base */
  --ink-700: #182b52;   /* raised panel / hover */

  --blue-600: #2f5fe0;  /* primary action */
  --blue-500: #3f6cf0;
  --blue-400: #5b8dff;  /* hover / link */
  --cyan-400: #4cd5f0;  /* route glow, secondary accent */

  --white: #ffffff;
  --mist-100: #eaf0fb;  /* primary text on dark */
  --mist-300: #b7c4e0;
  --mist-400: #93a3c4;  /* secondary / muted text */
  --mist-600: #5c6d92;

  --glass-fill: rgba(255, 255, 255, 0.045);
  --glass-fill-strong: rgba(255, 255, 255, 0.075);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-border-strong: rgba(255, 255, 255, 0.18);

  --ok-400: #4ade80;
  --warn-400: #fbbf24;
  --danger-400: #f87171;

  /* ---- Type ---- */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  /* ---- Shape / motion ---- */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(.16,.84,.44,1);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---- Base ---- */
html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(60rem 40rem at 85% -10%, rgba(47,95,224,.20), transparent 60%),
    radial-gradient(50rem 30rem at -10% 20%, rgba(76,213,240,.10), transparent 55%),
    var(--ink-950);
  color: var(--mist-100);
  font-family: var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  /* "Sticky footer" layout - NOT position:sticky, a different technique:
     on short pages this keeps the footer pinned to the bottom of the
     viewport instead of floating mid-screen; on long pages it scrolls
     with the content as normal. Fixed-position elements (nav, WhatsApp
     button) are unaffected since fixed removes them from this flow. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Consumes any leftover vertical space in the body flex column, which
   is what actually pushes the footer down to the bottom on short pages. */
.footer-route {
  margin-top: auto;
}

h1, h2, h3, h4, .display-font {
  font-family: var(--font-display);
  color: var(--white);
  letter-spacing: -0.01em;
  font-weight: 600;
}

.font-mono { font-family: var(--font-mono); letter-spacing: .02em; }

a { color: var(--blue-400); text-decoration: none; }
a:hover { color: var(--cyan-400); }

::selection { background: var(--blue-600); color: var(--white); }

/* visible keyboard focus everywhere, always */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--cyan-400);
  outline-offset: 3px;
  border-radius: 4px;
}

.text-muted-mist { color: var(--mist-400) !important; }
.text-gradient {
  background: linear-gradient(100deg, var(--white) 30%, var(--cyan-400) 75%, var(--blue-400) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cyan-400);
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}
.eyebrow::before {
  content: '';
  width: 22px; height: 1px;
  background: var(--cyan-400);
  display: inline-block;
}

.section-pad { padding: 6rem 0; }
@media (max-width: 767.98px) { .section-pad { padding: 3.5rem 0; } }

.divider-hair { height: 1px; background: linear-gradient(90deg, transparent, var(--glass-border-strong), transparent); border: 0; }

/* ---- Buttons ---- */
.btn { font-family: var(--font-body); font-weight: 700; border-radius: 999px; padding: .72rem 1.6rem; font-size: .92rem; letter-spacing: .01em; transition: all .25s var(--ease); }

.btn-route {
  background: linear-gradient(100deg, var(--blue-600), var(--blue-500) 60%, var(--cyan-400) 130%);
  color: var(--white);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 8px 30px -8px rgba(47,95,224,.65);
}
.btn-route:hover { transform: translateY(-2px); box-shadow: 0 12px 36px -6px rgba(76,213,240,.55); color: var(--white); }
.btn-route:active { transform: translateY(0); }

.btn-glass {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border-strong);
  color: var(--mist-100);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn-glass:hover { background: var(--glass-fill-strong); color: var(--white); border-color: var(--cyan-400); }

.btn-sm-pill { padding: .45rem 1.05rem; font-size: .8rem; }

/* ---- Glass panels / cards ---- */
.glass {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.glass-card {
  background: linear-gradient(160deg, var(--glass-fill-strong), var(--glass-fill));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.glass-card:hover {
  transform: translateY(-4px);
  border-color: var(--glass-border-strong);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.6);
}

/* ---- Navbar ---- */
.nav-route {
  background: rgba(5, 9, 18, 0.55);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background .3s ease, border-color .3s ease;
}
.nav-route.is-scrolled { background: rgba(5, 9, 18, 0.86); border-bottom-color: var(--glass-border); }

.brand-mark { font-family: var(--font-display); font-weight: 700; font-size: 1.28rem; color: var(--white); letter-spacing: -.01em; }
.brand-mark small { display: block; font-family: var(--font-mono); font-size: .6rem; letter-spacing: .16em; color: var(--mist-400); font-weight: 400; margin-top: 1px; }

.nav-link-route { color: var(--mist-300) !important; font-weight: 600; font-size: .92rem; padding: .5rem 1rem !important; position: relative; }
.nav-link-route:hover, .nav-link-route.active { color: var(--white) !important; }
.nav-link-route.active::after {
  content: ''; position: absolute; left: 1rem; right: 1rem; bottom: .15rem; height: 2px;
  background: linear-gradient(90deg, var(--cyan-400), var(--blue-500));
  border-radius: 2px;
}

/* ---- Route line (signature element) ---- */
.route-svg path.route-path {
  fill: none;
  stroke: url(#routeGrad);
  stroke-width: 2;
  stroke-dasharray: 8 10;
  opacity: .55;
}
.route-svg circle.route-node {
  fill: var(--ink-950);
  stroke: var(--cyan-400);
  stroke-width: 2;
}
.route-svg circle.route-node.is-active {
  fill: var(--cyan-400);
  filter: drop-shadow(0 0 8px var(--cyan-400));
}

/* Waypoint step (used in "process" + portal route tracker) */
.waypoint { position: relative; text-align: center; }
.waypoint-badge {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 1rem;
  background: var(--ink-800); border: 1px solid var(--glass-border-strong);
  color: var(--mist-300); margin: 0 auto 1rem;
  transition: all .3s var(--ease);
}
.waypoint.is-done .waypoint-badge { background: var(--blue-600); border-color: var(--blue-400); color: var(--white); }
.waypoint.is-current .waypoint-badge { background: var(--cyan-400); border-color: var(--cyan-400); color: var(--ink-950); box-shadow: 0 0 0 6px rgba(76,213,240,.15); }

/* ---- Stat counters ---- */
.stat-num { font-family: var(--font-mono); font-weight: 700; font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--white); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--mist-400); margin-top: .35rem; }

/* ---- Badges ---- */
.badge-route { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; padding: .38rem .7rem; border-radius: 999px; border: 1px solid var(--glass-border-strong); background: var(--glass-fill); color: var(--mist-300); text-transform: uppercase; }
.badge-status-active { color: var(--ok-400); border-color: rgba(74,222,128,.35); background: rgba(74,222,128,.08); }
.badge-status-warn { color: var(--warn-400); border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.08); }
.badge-status-danger { color: var(--danger-400); border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }

/* ---- Category pills (courses filter) ---- */
.pill-tab { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em; padding: .55rem 1.15rem; border-radius: 999px; border: 1px solid var(--glass-border); color: var(--mist-300); background: transparent; transition: all .25s var(--ease); }
.pill-tab.active, .pill-tab:hover { color: var(--white); border-color: var(--cyan-400); background: rgba(76,213,240,.08); }

/* ---- Reveal on scroll ---- */
/* Content is visible by default — JavaScript is a progressive
   enhancement, never a requirement to see the page. main.js adds
   .reveal-armed to elements right before it starts observing them,
   which is the ONLY thing that hides them; if JS never runs, nothing
   ever gets armed, so nothing ever hides. */
[data-reveal].reveal-armed { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
[data-reveal].reveal-armed.is-visible { opacity: 1; transform: translateY(0); }

/* ---- Forms (dark, glass) ---- */
.form-control-route, .form-select-route {
  background: var(--ink-900); border: 1px solid var(--glass-border-strong); color: var(--mist-100);
  border-radius: var(--radius-sm); padding: .7rem 1rem; font-family: var(--font-body);
}
.form-control-route::placeholder { color: var(--mist-600); }
.form-control-route:focus, .form-select-route:focus { background: var(--ink-900); border-color: var(--cyan-400); color: var(--white); box-shadow: 0 0 0 3px rgba(76,213,240,.15); }
label.form-label-route { font-size: .8rem; color: var(--mist-400); font-weight: 600; margin-bottom: .4rem; }

/* ---- Footer ---- */
.footer-route { background: var(--ink-900); border-top: 1px solid var(--glass-border); }

/* ---- Utility: soft top glow divider between sections ---- */
.band-alt { background: linear-gradient(180deg, transparent, rgba(255,255,255,.02) 20%, rgba(255,255,255,.02) 80%, transparent); }

/* ============================================================
   PORTAL LAYOUT (student dashboard)
   ============================================================ */
.portal-shell { display: flex; min-height: 100vh; }

.portal-sidebar {
  width: 268px; flex-shrink: 0;
  background: var(--ink-900);
  border-right: 1px solid var(--glass-border);
  position: fixed; top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column;
  /* Collapsed by default on ALL sizes — JS opens it */
  transform: translateX(-100%);
  transition: transform .3s var(--ease);
  z-index: 1040;
}
/* Opened by JS on both mobile and desktop */
.portal-sidebar.is-open { transform: translateX(0); }

/* Bottom nav has a higher z-index than the sidebar (needed elsewhere) -
   without this it renders ON TOP of the open sidebar's bottom section,
   covering the Logout button. Simplest fix: don't show it at all while
   the full menu is already open - it's redundant at that point anyway. */
.portal-sidebar.is-open ~ .mobile-bottom-nav { display: none !important; }

/* Desktop: push content right when sidebar is open */
.portal-main {
  flex: 1;
  margin-left: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: visible; /* without this, overflow-x:hidden alone implicitly makes this a scroll container, which breaks position:sticky inside it */
  max-width: 100vw;
  transition: margin-left .3s var(--ease), max-width .3s var(--ease);
}
@media (min-width: 992px) {
  .portal-sidebar-open .portal-main {
    margin-left: 268px;
    max-width: calc(100vw - 268px);
  }
}
/* Mobile: content never shifts, sidebar overlays */
@media (max-width: 991.98px) {
  .portal-main { margin-left: 0 !important; max-width: 100vw !important; }
}

.portal-nav-link {
  display: flex; align-items: center; gap: .8rem;
  padding: .72rem 1.1rem; margin: .15rem .8rem; border-radius: var(--radius-sm);
  color: var(--mist-300); font-weight: 600; font-size: .9rem;
  border-left: 2px solid transparent;
}
.portal-nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.portal-nav-link:hover { background: var(--glass-fill); color: var(--white); }
.portal-nav-link.active { background: rgba(76,213,240,.08); color: var(--white); border-left-color: var(--cyan-400); }

.portal-topbar {
  position: sticky; top: 0; z-index: 1020;
  background: rgba(5,9,18,.7); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
}

.avatar-ring {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(140deg, var(--blue-600), var(--cyan-400));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; color: var(--white); font-size: .9rem;
}

.progress-route { height: 6px; border-radius: 999px; background: var(--ink-800); overflow: hidden; }
.progress-route > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-600), var(--cyan-400)); border-radius: 999px; }

.table-route { color: var(--mist-200, var(--mist-100)); }
.table-route thead th { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mist-400); border-bottom: 1px solid var(--glass-border-strong); font-weight: 600; }
.table-route td, .table-route th { border-color: var(--glass-border); vertical-align: middle; padding: .85rem .75rem; }
.table-route tbody tr:hover { background: var(--glass-fill); }
.table { --bs-table-bg: transparent; --bs-table-striped-bg: transparent;
         --bs-table-hover-bg: rgba(255,255,255,.04); --bs-table-border-color: var(--glass-border);
         color: inherit; }
.table > :not(caption) > * > * { background-color: transparent !important; color: inherit; box-shadow: none; }

.modal-route .modal-content { background: var(--ink-900); border: 1px solid var(--glass-border-strong); color: var(--mist-100); border-radius: var(--radius-lg); }
.modal-route .modal-header, .modal-route .modal-footer { border-color: var(--glass-border); }
.modal-route .btn-close { filter: invert(1) grayscale(1); }

/* ============================================================
   MOBILE BOTTOM NAV — floating rounded pill bar, phones only.
   Used on both the public site and the student portal.
   ============================================================ */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1060;
  width: 93%;
  max-width: 460px;
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
  padding: 8px;
  background: rgba(9, 15, 30, 0.90);
  border: 1px solid var(--glass-border-strong);
  border-radius: 26px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  /* premium touch: soft drop shadow + a faint inner top highlight, like glass catching light */
  box-shadow:
    0 20px 46px -16px rgba(0,0,0,.72),
    inset 0 1px 0 rgba(255,255,255,.06);
  transition: bottom .4s cubic-bezier(.16,.84,.44,1), opacity .4s cubic-bezier(.16,.84,.44,1);
}

@media (max-width: 767.98px) {
  .mobile-bottom-nav { display: flex; }
  /* keep content clear of the floating bar + its bottom gap */
  body { padding-bottom: 96px; }
  .portal-main { padding-bottom: 0; }
}

.mobile-bottom-nav a {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 2px;
  border-radius: 18px;
  color: var(--mist-400);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .01em;
  transition: all .25s var(--ease);
}
.mobile-bottom-nav a i {
  font-size: 1.15rem;
  line-height: 1;
  width: 32px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  transition: all .25s var(--ease);
}
.mobile-bottom-nav a:hover { color: var(--white); }
.mobile-bottom-nav a.active { color: var(--white); }
.mobile-bottom-nav a.active i {
  background: linear-gradient(140deg, var(--blue-600), var(--cyan-400));
  box-shadow: 0 6px 16px -6px rgba(76,213,240,.6);
}

/* Portal pages already have a fixed sidebar toggle; on phones the bottom
   nav is now primary, so quiet the hamburger down instead of two nav
   systems competing for attention. Website/Logout stay reachable there. */
@media (max-width: 767.98px) {
  .portal-topbar [data-sidebar-toggle] { opacity: .7; }
}
/* ============================================================
   THEME: DB-DRIVEN CSS VARIABLES
   The <style> tag injected by site-shell-open.php overrides
   these defaults with values from site_settings at runtime.
   ============================================================ */
:root {
  --kc-primary:  var(--theme-primary,  var(--blue-600));
  --kc-accent:   var(--theme-accent,   var(--cyan-400));
  --kc-bg:       var(--theme-bg,       var(--ink-950));
  --kc-surface:  var(--theme-surface,  var(--ink-900));
  --kc-text:     var(--theme-text,     var(--mist-100));
}

/* ============================================================
   HERO SLIDER
   ============================================================ */
.kc-hero {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.kc-hero-track {
  position: relative;
  width: 100%;
}

.kc-hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .9s cubic-bezier(.16,.84,.44,1);
  pointer-events: none;
  z-index: 0;
}
.kc-hero-slide.is-active {
  position: relative;
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.kc-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.kc-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
/* Ken Burns: a slow, subtle zoom while a slide is active — the classic
   "this hero is alive" touch. Scoped to .is-active so it only runs on
   the visible slide, and only when motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
  .kc-hero-slide.is-active .kc-hero-bg img {
    animation: kcHeroZoom 9s ease-out both;
  }
}
@keyframes kcHeroZoom {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}
/* Multi-layer scrim: bottom-heavy for text legibility, side vignette for depth */
.kc-hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right,  rgba(5,9,18,.75) 0%, rgba(5,9,18,.30) 60%, transparent 100%),
    linear-gradient(to top,    rgba(5,9,18,.90) 0%, rgba(5,9,18,.40) 40%, transparent 70%),
    linear-gradient(to bottom, rgba(5,9,18,.50) 0%, transparent 25%);
}

.kc-hero-content {
  position: relative;
  z-index: 2;
}
@media (prefers-reduced-motion: no-preference) {
  .kc-hero-slide.is-active .kc-hero-content .col-lg-7,
  .kc-hero-slide.is-active .kc-hero-content .col-lg-6,
  .kc-hero-slide.is-active .kc-hero-content .col-xl-6 {
    animation: kcHeroContentIn .8s cubic-bezier(.16,.84,.44,1) both;
    animation-delay: .15s;
  }
}
@keyframes kcHeroContentIn {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.kc-hero-headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.08;
  color: var(--white);
  letter-spacing: -.02em;
  margin-bottom: 1rem;
  text-shadow: 0 2px 24px rgba(0,0,0,.4);
}
.kc-hero-sub {
  font-size: clamp(.95rem, 2vw, 1.2rem);
  color: rgba(234,240,251,.85);
  max-width: 36rem;
  line-height: 1.65;
  text-shadow: 0 1px 12px rgba(0,0,0,.5);
}

/* Arrow controls */
.kc-hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,9,18,.55);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  color: var(--white);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.kc-hero-arrow:hover {
  background: var(--kc-primary);
  border-color: var(--kc-primary);
  transform: translateY(-50%) scale(1.08);
}
.kc-hero-prev { left: 1.2rem; }
.kc-hero-next { right: 1.2rem; }

@media (max-width: 575.98px) {
  .kc-hero-arrow { width: 38px; height: 38px; font-size: .9rem; }
  .kc-hero-prev  { left: .5rem; }
  .kc-hero-next  { right: .5rem; }
}

/* Dot indicators */
.kc-hero-dots {
  position: absolute;
  bottom: 1.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: .5rem;
  align-items: center;
}
.kc-hero-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  border: none;
  cursor: pointer;
  transition: all .3s;
  padding: 0;
  position: relative;
  overflow: hidden;
}
.kc-hero-dot.is-active {
  background: rgba(255,255,255,.35);
  width: 28px;
  border-radius: 4px;
  box-shadow: 0 0 8px var(--kc-accent);
}
/* Fill sweeps left-to-right over exactly the autoplay interval (JS sets
   --hero-interval so this can never drift out of sync with it), giving
   a visible "time until next slide" cue — a small, standard touch on
   modern marketing sites that makes the rotation feel intentional
   rather than just something that randomly happens. */
.kc-hero-dot.is-active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--kc-accent);
  transform-origin: left center;
  transform: scaleX(0);
}
@media (prefers-reduced-motion: no-preference) {
  .kc-hero-dot.is-active::after {
    animation: kcDotFill var(--hero-interval, 5500ms) linear both;
  }
}
@media (prefers-reduced-motion: reduce) {
  .kc-hero-dot.is-active::after { transform: scaleX(1); }
}
@keyframes kcDotFill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ============================================================
   STATS BAND
   ============================================================ */
.kc-stats-band {
  background: linear-gradient(90deg, rgba(47,95,224,.08), rgba(76,213,240,.06));
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  padding: 2.5rem 0;
}
.kc-stat-cell {
  padding: 1.2rem 1.5rem;
  text-align: center;
  border-right: 1px solid var(--glass-border);
}
.kc-stat-cell:last-child { border-right: none; }
@media (max-width: 767.98px) {
  .kc-stat-cell:nth-child(2) { border-right: none; }
  .kc-stat-cell:nth-child(3) { border-top: 1px solid var(--glass-border); }
}

/* ============================================================
   COURSE CARDS
   ============================================================ */
.kc-course-card { transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.kc-course-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.7), 0 0 0 1px var(--kc-accent, rgba(76,213,240,.3));
}

.kc-course-thumb {
  position: relative;
  height: 200px;
  overflow: hidden;
  flex-shrink: 0;
}
.kc-course-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform .6s var(--ease);
  display: block;
}
.kc-course-card:hover .kc-course-thumb img { transform: scale(1.05); }

.kc-course-thumb-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--ink-800), var(--ink-700));
  display: flex; align-items: center; justify-content: center;
}
.kc-course-thumb-placeholder i {
  font-size: 3rem;
  color: var(--kc-accent);
  opacity: .85;
}
.kc-course-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5,9,18,.6) 0%, transparent 60%);
}
.kc-course-thumb-badges {
  position: absolute;
  bottom: .75rem;
  left: .75rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.kc-course-arrow {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--mist-400);
  transition: all .25s var(--ease);
  flex-shrink: 0;
}
.kc-course-card:hover .kc-course-arrow {
  background: var(--kc-primary);
  border-color: var(--kc-primary);
  color: var(--white);
}

/* ============================================================
   WHY US ICONS
   ============================================================ */
.kc-why-icon {
  width: 54px; height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(47,95,224,.25), rgba(76,213,240,.15));
  border: 1px solid rgba(76,213,240,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: var(--kc-accent);
}

/* ============================================================
   CONTACT STRIP
   ============================================================ */
.kc-contact-strip {
  padding: 3rem 0;
  background: rgba(255,255,255,.018);
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}
.kc-contact-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(76,213,240,.1);
  border: 1px solid rgba(76,213,240,.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--kc-accent);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.kc-contact-label { font-size: .72rem; color: var(--mist-400); margin-bottom: .1rem; }
.kc-contact-value { font-weight: 600; color: var(--white); font-size: .95rem; }
a.kc-contact-value:hover { color: var(--kc-accent); }

/* ============================================================
   CTA BLOCK
   ============================================================ */
.kc-cta-block {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  background: linear-gradient(140deg, rgba(47,95,224,.18), rgba(76,213,240,.08));
  border: 1px solid rgba(76,213,240,.2);
  overflow: hidden;
}
.kc-cta-glow {
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76,213,240,.18) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none;
}

/* ============================================================
   MOBILE BOTTOM NAV — HIDE ON SCROLL DOWN, SHOW ON SCROLL UP
   JS adds / removes .is-hidden via IntersectionObserver trick.
   ============================================================ */
.mobile-bottom-nav.is-hidden {
  bottom: -120px !important;
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   PORTAL SIDEBAR — PUBLIC-SITE PAGES ONLY (slim version)
   ============================================================ */
.portal-sidebar .portal-nav-link.is-external {
  opacity: .6;
  font-size: .8rem;
}

/* ============================================================
   GLOBAL MOBILE OVERFLOW FIXES
   No element should break out of the viewport on phones.
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

/* Prevent any direct child of .container from overflowing */
.container, .container-fluid { overflow-x: clip; }

/* Tables scroll horizontally instead of breaking layout */
.table-responsive-always { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 767.98px) {
  /* Force all rows inside containers to stack if they overflow */
  .row { --bs-gutter-x: 1rem; }

  /* Hero headline smaller on tiny phones */
  .kc-hero-headline { font-size: clamp(1.6rem, 7vw, 2.4rem); }

  /* Stats band: 2 columns, always */
  .kc-stat-cell { padding: 1rem; }
  .stat-num { font-size: 1.6rem; }

  /* Course cards full-width on phones */
  .kc-course-thumb { height: 160px; }

  /* Contact strip stack nicely */
  .kc-contact-strip .col-md-4 + .col-md-4 {
    border-top: 1px solid var(--glass-border);
    padding-top: 1.2rem;
  }

  /* CTA block tighter padding */
  .kc-cta-block { padding: 2.5rem 1.2rem; }

  /* Admin tables on small screens */
  .table-route { font-size: .82rem; }
  .table-route td, .table-route th { padding: .6rem .5rem; }

  /* Prevent badge text wrapping and breaking card width */
  .badge-route { white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

  /* Section padding tighter */
  .section-pad { padding: 2.8rem 0; }
}

@media (max-width: 400px) {
  .kc-hero-headline { font-size: 1.5rem; }
  .btn-lg { font-size: .85rem; padding: .6rem 1.2rem; }
}

/* ============================================================
   COURSE IMAGE — PROGRAMMES LISTING (.kc-prog-thumb)
   Fixed 200px height, any image fills cleanly without distortion.
   Placeholder icon shown when no image uploaded — same dimensions.
   ============================================================ */
.kc-prog-thumb {
  position: relative;
  height: 200px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--ink-800), var(--ink-700));
}
.kc-prog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform .5s cubic-bezier(.16,.84,.44,1);
}
.glass-card:hover .kc-prog-thumb img { transform: scale(1.04); }
.kc-prog-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kc-prog-thumb-placeholder i {
  font-size: 2.8rem;
  color: var(--cyan-400);
  opacity: .85;
}

/* ============================================================
   COURSE IMAGE — SINGLE PAGE HERO (.kc-show-hero)
   Responsive height using aspect-ratio so it looks right on
   every screen without a fixed px height that clips portraits.
   ============================================================ */
.kc-show-hero {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(135deg, var(--ink-800), var(--ink-700));
  /* 16:9 default — naturally clips landscape photos beautifully */
  aspect-ratio: 16 / 6;
  max-height: 340px;
}
.kc-show-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top; /* bias toward top so faces/subjects aren't cropped */
  display: block;
}
.kc-show-hero-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kc-show-hero-placeholder i {
  font-size: 4.5rem;
  color: var(--cyan-400);
  opacity: .85;
}
@media (max-width: 575.98px) {
  .kc-show-hero { aspect-ratio: 16 / 7; max-height: 220px; }
}

/* ============================================================
   PORTAL: overflow prevention + table fixes
   ============================================================ */
.portal-shell { overflow-x: hidden; overflow-y: visible; width: 100%; }
@media (max-width: 991.98px) {
  .portal-shell,
  .portal-main,
  .container-fluid { overflow-x: hidden !important; overflow-y: visible !important; max-width: 100vw !important; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .table-responsive > .table { min-width: 480px; }
  * { max-width: 100%; }
  img, video, iframe { max-width: 100% !important; height: auto; }
  .row { --bs-gutter-x: .75rem; margin-left: 0 !important; margin-right: 0 !important; }
  [class*='col-'] { padding-left: .5rem; padding-right: .5rem; }
}

/* ============================================================
   BOTTOM NAV ACTIVE — obeys theme palette
   ============================================================ */
.mobile-bottom-nav a.active,
.mobile-bottom-nav a.active i { color: var(--cyan-400) !important; }

/* ── Course image uniform sizing ────────────────────────────────────── */
.kc-prog-thumb {
  position: relative; height: 200px; overflow: hidden;
  flex-shrink: 0; background: linear-gradient(135deg, var(--ink-800), var(--ink-700));
}
.kc-prog-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.kc-prog-thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.kc-prog-thumb-placeholder i { font-size: 2.8rem; color: var(--cyan-400); opacity: .85; }
/* ============================================================
   TESTIMONIALS (homepage)
   ============================================================ */
.kc-testimonial-card {
  position: relative;
}
.kc-testimonial-quote-icon {
  font-size: 1.8rem;
  color: var(--kc-accent);
  opacity: .5;
  line-height: 1;
  margin-bottom: .75rem;
  display: block;
}
.kc-testimonial-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── Portal sticky top section (topbar + desktop nav row) ──────────── */
/* Switched from position:sticky to position:fixed - sticky kept
   silently breaking depending on ancestor overflow/flex context, fixed
   is what the public site's nav already uses successfully. Content
   below gets its top padding synced to this element's real height via
   JS in portal-shell-close.php, since fixed removes it from flow. */
.portal-top-sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1020;
  background: rgba(5,9,18,.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
}
@media (min-width: 992px) {
  .portal-sidebar-open .portal-top-sticky { left: 268px; }
}
/* Topbar inside sticky wrapper — remove its own stickiness and border */
.portal-top-sticky .portal-topbar {
  position: static;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}
/* Desktop nav row inside sticky wrapper */
.portal-desktop-nav {
  border-top: 1px solid var(--glass-border);
}