/* ==========================================================================
   Base, layout and components. Layout depends on viewport width ONLY —
   never on motion tier — so switching tiers can't shift content (CLS).
   ========================================================================== */

@view-transition { navigation: auto; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--s-4)); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  position: relative;
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--lh-body);
  overflow-x: clip;
  padding-bottom: var(--action-bar-h);
}
:lang(ta) body, body:lang(ta) { line-height: 1.75; }

img, svg { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: var(--lh-heading); margin: 0 0 var(--s-4); }
h1 { font-size: var(--step-5); line-height: var(--lh-tight); letter-spacing: -0.01em; }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); font-weight: 600; }
/* Tamil script needs more vertical room and a narrower width axis to sit beside Barlow */
:lang(ta) h1, :lang(ta) h2, :lang(ta) h3 { font-stretch: 75%; line-height: 1.3; letter-spacing: 0; }
:lang(ta) h1 { font-size: clamp(1.6rem, 1.05rem + 2.75vw, 3.2rem); }
/* Long agglutinative Tamil words must never widen the layout (measured: 418px at a 320px viewport). */
:lang(ta) :is(h1, h2, h3, .btn, .lead) { overflow-wrap: anywhere; }
:lang(ta) h2 { font-size: var(--step-3); }
p { margin: 0 0 var(--s-4); max-width: var(--measure); }
a { color: inherit; text-underline-offset: 0.18em; }

:focus-visible {
  outline: 3px solid var(--focus-inner);
  outline-offset: 2px;
  box-shadow: 0 0 0 7px var(--focus-outer);
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: var(--z-skip);
  background: var(--c-navy); color: #fff; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm);
}
.skip-link:focus { top: var(--s-4); }

/* Visible placeholder for any un-supplied business fact */
.ph {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em;
  background: #FFF4D1; color: var(--c-navy); padding: 0 0.3em; border-radius: 4px;
  outline: 1px dashed #B88A00;
}
.verify { font-size: var(--step--1); font-weight: 700; color: #7A5B00; background: #FFF4D1; padding: 0 0.4em; border-radius: 4px; white-space: nowrap; }

/* ---------- Layout bands ---------- */
@media (min-width: 768px) {
  :root { --band-w: 120px; --band-left: auto; --band-right: 0; }
}
@media (min-width: 1024px) {
  :root { --band-w: clamp(400px, 40vw, 760px); }
}
.site-main, .site-footer { position: relative; z-index: var(--z-content); }
/* Home only: content steps aside for the road band (left gutter on phones, right band above). */
.has-journey .site-main { padding-left: calc(var(--band-w) + 8px); padding-right: 0; }
@media (min-width: 768px) {
  .has-journey .site-main { padding-left: 0; padding-right: var(--band-w); }
}
.wrap { max-width: 760px; margin-inline: auto; padding-inline: var(--gutter); }
.wrap--wide { max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
@media (max-width: 767.98px) { .has-journey .wrap { padding-inline: 0 var(--s-4); } }

.section { padding-block: var(--section-pad); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding-inline: var(--s-4) var(--s-4);
  background: var(--c-surface); border-bottom: 1px solid var(--c-line);
  view-transition-name: site-header;
}
.brand { display: flex; align-items: center; gap: var(--s-3); text-decoration: none; min-width: 0; }
.brand__mark { display: block; width: 48px; height: 48px; flex: none; }
.brand__mark img { display: block; width: 100%; height: 100%; }
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:lang(ta) .brand__name { font-stretch: 75%; font-size: var(--step-0); }
.site-nav { display: none; }
.site-nav ul, .nav-drawer__panel ul { list-style: none; margin: 0; padding: 0; }
@media (min-width: 1200px) {
  .site-nav { display: block; }
  .site-nav ul { display: flex; gap: var(--s-5); }
  .site-nav a { font-weight: 700; text-decoration: none; padding: var(--s-2) 0; border-bottom: 3px solid transparent; }
  .site-nav a:hover { border-bottom-color: var(--c-line-strong); }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--c-yellow); }
  .nav-drawer { display: none; }
}
/* Mobile/tablet drawer: native <details>, works without JS. */
.nav-drawer { position: relative; }
.nav-drawer__toggle {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 40px; padding: 0 var(--s-3); border-radius: var(--r-pill); border: 1px solid var(--c-line-strong);
  font-weight: 700; font-size: var(--step--1);
}
.nav-drawer__toggle::-webkit-details-marker { display: none; }
.nav-drawer__toggle svg { width: 20px; height: 20px; }
.nav-drawer__panel {
  position: absolute; right: 0; top: calc(100% + var(--s-2)); z-index: var(--z-header);
  width: min(78vw, 300px); background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: var(--s-3);
}
.nav-drawer__panel a { display: flex; align-items: center; min-height: 44px; padding: 0 var(--s-3); border-radius: var(--r-sm); text-decoration: none; font-weight: 700; }
.nav-drawer__panel a:hover { background: var(--c-lane-white); }
.nav-drawer__panel a[aria-current="page"] { background: var(--c-yellow); }
@media (max-width: 479.98px) { .nav-drawer__toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
.header-tools { display: flex; align-items: center; gap: var(--s-2); flex: none; }
.lang-switch {
  font-weight: 700; text-decoration: none; padding: var(--s-2) var(--s-3); border-radius: var(--r-pill);
  border: 1px solid var(--c-line-strong); min-height: 40px; display: inline-flex; align-items: center;
}
.lang-switch [lang="ta"] { font-family: system-ui, sans-serif; } /* avoid pulling the Tamil webfont on EN pages */
.sound-toggle {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font: inherit; font-size: var(--step--1); font-weight: 700; color: var(--c-ink);
  background: none; border: 1px solid var(--c-line-strong); border-radius: var(--r-pill);
  min-height: 40px; padding: 0 var(--s-3); cursor: pointer;
}
.sound-toggle[aria-pressed="true"] { background: var(--c-navy); color: #fff; border-color: var(--c-navy); }
.sound-toggle svg { width: 18px; height: 18px; }
@media (max-width: 767.98px) { .header-tools .header-cta { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--c-yellow); --btn-fg: var(--c-navy);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 var(--s-5);
  font: inherit; font-weight: 700; text-decoration: none; line-height: 1.2;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 2px solid var(--btn-bg); border-radius: var(--r-pill); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring), background-color var(--dur-fast);
}
.btn:active { transform: scale(0.97); }
.btn--secondary { --btn-bg: transparent; --btn-fg: var(--c-navy); border-color: var(--c-navy); }
.btn--dark { --btn-bg: var(--c-navy); --btn-fg: #fff; }
.btn--sm { min-height: 40px; padding: 0 var(--s-4); font-size: var(--step--1); }
.btn[aria-busy="true"] { pointer-events: none; }
.btn .ring { width: 20px; height: 20px; display: none; }
.btn[aria-busy="true"] .ring { display: block; }

/* ---------- KM marker: an Indian roadside milestone (yellow cap, white stone) ---------- */
.km {
  display: inline-flex; align-items: stretch; margin: 0 0 var(--s-5);
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  font-size: var(--step--1); line-height: 1; max-width: none;
  border: 2px solid var(--c-navy); border-radius: 14px 14px 4px 4px; overflow: hidden; background: var(--c-surface);
}
.km__num { background: var(--c-yellow); color: var(--c-navy); padding: 0.55em 0.7em; border-right: 2px solid var(--c-navy); }
.km__label { padding: 0.55em 0.8em; }
:lang(ta) .km__label { text-transform: none; letter-spacing: 0; font-stretch: 75%; }

/* ---------- Hero ---------- */
.hero { display: flex; align-items: center; padding-block: var(--s-7) var(--s-8); }
@media (min-width: 768px) { .hero { min-height: calc(100svh - var(--header-h)); padding-block: var(--s-8); } }
.hero h1 { view-transition-name: page-title; }
.lead { font-size: var(--step-1); color: var(--c-ink-muted); }
.cta-row { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }
.hero__call { margin-top: var(--s-5); font-weight: 700; }
.hero__concept { font-weight: 700; color: var(--c-navy); }

/* ---------- Course cards ---------- */
.course-list { list-style: none; margin: var(--s-7) 0 0; padding: 0; display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
@media (max-width: 767.98px) {
  .course-list {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--s-4);
    padding-bottom: var(--s-4); margin-right: calc(-1 * var(--s-4)); padding-right: var(--s-4);
    overscroll-behavior-x: contain;
  }
  .course-list > li { flex: 0 0 85%; scroll-snap-align: start; }
}
.course-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-md);
  padding: var(--s-5); box-shadow: var(--shadow-1);
  border-top: 6px solid var(--lane, var(--lane-1));
  transition: transform var(--dur-base) var(--ease-out-expo), box-shadow var(--dur-base) var(--ease-out-expo);
}
.course-card.is-active, .course-card:focus-within { transform: translateY(-4px); box-shadow: var(--shadow-2); }
@media (hover: hover) { .course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); } }
.course-card h3 { margin-bottom: var(--s-2); }
.course-card .btn { border-radius: var(--r-md); min-height: 44px; padding: var(--s-2) var(--s-4); text-align: center; }
.course-card p { color: var(--c-ink-muted); }
.course-card .meta { display: grid; grid-template-columns: auto 1fr; gap: var(--s-1) var(--s-4); margin: auto 0 var(--s-5); font-size: var(--step--1); }
.course-card .meta dt { font-weight: 700; }
.course-card .meta dd { margin: 0; }
.badge { align-self: flex-start; font-size: var(--step--1); font-weight: 700; background: var(--c-lane-white); border: 1px dashed var(--c-line-strong); border-radius: var(--r-pill); padding: 0.1em 0.7em; margin-bottom: var(--s-3); }
.lane-dot { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; background: var(--lane); margin-right: 0.4em; vertical-align: -0.05em; }

/* ---------- Form ---------- */
.enquiry { margin-top: var(--s-6); display: grid; gap: var(--s-5); max-width: 560px; }
.field { display: grid; gap: var(--s-2); }
.field label, .field legend { font-weight: 700; }
.field .hint { font-size: var(--step--1); color: var(--c-ink-muted); margin: 0; }
.input, .select {
  font: inherit; color: var(--c-ink); background: var(--c-surface);
  min-height: 48px; padding: var(--s-2) var(--s-3);
  border: 2px solid var(--c-line-strong); border-radius: var(--r-sm); width: 100%;
}
.input:focus-visible, .select:focus-visible { border-color: var(--c-navy); }
.field.has-error .input, .field.has-error .select { border-color: var(--c-red); }
.error { color: var(--c-red-text); font-size: var(--step--1); font-weight: 700; margin: 0; display: flex; gap: var(--s-2); }
.error:empty { display: none; }
.error:not(:empty) { animation: slide-in var(--dur-base) var(--ease-out-expo); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } }
fieldset.field { border: 0; padding: 0; margin: 0; }
.choices { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.choice { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-4); border: 2px solid var(--c-line-strong); border-radius: var(--r-pill); cursor: pointer; font-weight: 400; }
.choice:has(input:checked) { border-color: var(--c-navy); background: #EEF2F8; }
.choice input { width: 20px; height: 20px; accent-color: var(--c-navy); margin: 0; }
.captcha-row { display: flex; gap: var(--s-3); align-items: center; }
.captcha-row .input { max-width: 8rem; }
.consent { display: flex; gap: var(--s-3); align-items: flex-start; font-weight: 400 !important; }
.consent input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--c-navy); flex: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { min-height: 1.6em; font-weight: 700; }
.form-status.is-success { color: var(--c-green-text); }
.form-status.is-error { color: var(--c-red-text); }

/* ---------- Footer ---------- */
.site-footer { background: var(--c-navy); color: #E7ECF3; padding-block: var(--s-8) calc(var(--s-6) + var(--action-bar-h)); }
.site-footer a { color: #fff; }
.footer-row { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; justify-content: space-between; }
.motion-toggle { font: inherit; font-weight: 700; color: #fff; background: transparent; border: 1px solid #8DA0BC; border-radius: var(--r-pill); min-height: 44px; padding: 0 var(--s-4); cursor: pointer; }
.motion-toggle[aria-pressed="true"] { background: var(--c-yellow); color: var(--c-navy); border-color: var(--c-yellow); }
.proto-note { font-size: var(--step--1); color: #B9C5D6; margin-top: var(--s-4); }

/* ---------- Sticky mobile action bar (D-15: pure HTML/CSS) ---------- */
.action-bar { display: none; }
@media (max-width: 767.98px) {
  :root { --action-bar-h: 64px; }
  .action-bar {
    position: fixed; inset: auto 0 0 0; z-index: var(--z-action-bar);
    display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 1px;
    height: calc(var(--action-bar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--c-line); border-top: 1px solid var(--c-line);
  }
  .action-bar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: var(--c-surface); color: var(--c-navy); font-weight: 700; font-size: var(--step--1); text-decoration: none;
  }
  .action-bar a.is-primary { background: var(--c-yellow); }
  .action-bar svg { width: 22px; height: 22px; }
}

/* ---------- View transition: a quick "road wipe" in the direction of travel ---------- */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vt-out var(--dur-base) var(--ease-in-out-quart) both; }
  ::view-transition-new(root) { animation: vt-in var(--dur-base) var(--ease-in-out-quart) both; }
}
@keyframes vt-out { to { opacity: 0.4; } }
@keyframes vt-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

/* Tamil nav labels are ~1.6× longer: keep the drawer until there's room for one line. */
.site-nav a { white-space: nowrap; }
@media (min-width: 1200px) and (max-width: 1499.98px) {
  html[lang="ta"] .site-nav { display: none; }
  html[lang="ta"] .nav-drawer { display: block; }
}
.footer-logo { display: block; width: 64px; height: 64px; margin-bottom: var(--s-3); }
