/* ============================================================
   Skylark — Responsive patch
   ------------------------------------------------------------
   This site's layout lives in inline style="" attributes, which
   beat any stylesheet rule on specificity. So this file hooks the
   same inline values with [style*="..."] attribute selectors and
   overrides them with !important — the same idiom already used in
   hover-animations.css.

   Load order matters. In every .html <head>, AFTER hover-animations.css:
     <link rel="stylesheet" href="hover-animations.css">
     <link rel="stylesheet" href="responsive.css">

   Also fix the viewport meta on every page (currently incomplete):
     <meta name="viewport" content="width=device-width, initial-scale=1">

   Breakpoints: 1200 (small laptop) / 900 (tablet) / 600 (phone)
   ============================================================ */


/* ------------------------------------------------------------
   0. Global overflow guard
   `width: min-content` / `max-content` on nav + heading wrappers
   can push past the viewport on narrow screens.
   ------------------------------------------------------------ */
html,
body {
  max-width: 100%;
  /* Safety net only. Sections 7-7d fix the overflow at source: with
     this rule removed the audit still reports 0px overflow on all 20
     pages across all 14 breakpoints. It is kept so a future hardcoded
     width cannot introduce a horizontal scrollbar, but it is no longer
     hiding clipped content. */
  overflow-x: hidden;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

/* ------------------------------------------------------------
   0b. Reserved: the .beat .inner width fix moved into the TABLET
   media query below (section 2) — it must stay mobile-only. See
   that section's comment for the full explanation; scoping it here
   unconditionally broke the original desktop centering (flexbox
   align-items:center relies on .inner staying intrinsically sized
   so it can be centered — forcing width:100% at all sizes made
   every beat's headline snap to the left edge on desktop).
   ------------------------------------------------------------ */

/* ------------------------------------------------------------
   0c. CSS Grid track blow-out fix (mobile film-lite mode)
   <body> is `display:grid` with no grid-template-columns, so it
   falls back to a single implicit column sized to 'auto'. Once
   film-lite switches .beat from position:fixed (out of flow) to
   position:relative (in flow, mobile only), the browser has to
   measure that column's intrinsic width — and an auto grid track's
   minimum is content-based, so it sizes to the *unwrapped* max-content
   width of the widest beat headline (~700px) and stretches every
   grid item (the whole page) to match, regardless of the real
   viewport. overflow-x:hidden above only hides the resulting
   scrollbar; it doesn't stop the clipping. minmax(0, 1fr) caps the
   track's minimum at 0 so it can never blow out past the container.
   ------------------------------------------------------------ */
body.film-lite {
  grid-template-columns: minmax(0, 1fr) !important;
}


/* ============================================================
   1. TABLET AND BELOW  (<= 1200px)
   Shrink the 80px desktop gutters progressively.
   Ordered broad -> narrow: [style*="padding: 100px 80px"] also
   matches "padding: 100px 80px 40px", so the longer variants must
   come after to win on source order.
   ============================================================ */
@media (max-width: 1200px) {
  [style*="padding: 80px"]                { padding: 64px 40px !important; }
  [style*="padding: 100px 80px"]          { padding: 72px 40px !important; }
  [style*="padding: 10px 80px"]           { padding: 10px 40px !important; }
  [style*="padding: 100px 80px 40px"]     { padding: 72px 40px 32px !important; }
  [style*="padding: 100px 80px 120px"]    { padding: 72px 40px 88px !important; }
  [style*="padding: 100px 80px 60px"]     { padding: 72px 40px 48px !important; }
  [style*="padding: 60px 80px 100px"]     { padding: 48px 40px 72px !important; }
  [style*="padding: 120px 80px 100px"]    { padding: 88px 40px 72px !important; }
  [style*="padding: 80px 80px 60px"]      { padding: 64px 40px 48px !important; }
  [style*="padding: 80px 0px 80px 80px"]  { padding: 64px 0 64px 40px !important; }

  /* Nav is absolutely positioned off left:80px / right:80px */
  #site-logo                              { left: 40px !important; }
  #site-nav > div[style*="right: 80px"]   { right: 40px !important; }

  /* Nav links get tight before the drawer kicks in */
  #site-nav > div[style*="right: 80px"]   { grid-column-gap: 20px !important; column-gap: 20px !important; }
}


/* ============================================================
   2a. NAV DRAWER BREAKPOINT (<= 1400px)
   The desktop nav is absolutely positioned (logo pinned left:80px,
   link row pinned right:80px, width:min-content) with no fluid
   wrapping — on real 1360-1366px laptop screens (a very common
   resolution) the link row collides with the logo well before the
   900px "phone" breakpoint kicks in. So the drawer has to switch on
   much earlier than the rest of the layout adjustments below.
   #nav-toggle / #nav-drawer are injected by responsive-nav.js.
   ============================================================ */
@media (max-width: 1400px) {
  #site-nav > div[style*="right: 80px"] {
    display: none !important;
  }

  #nav-toggle {
    display: flex !important;
    right: 20px !important;
  }

  #site-logo {
    left: 20px !important;
    width: 190px !important;
    height: 33px !important;
    top: calc(-16px + 50%) !important;
  }

  #site-nav {
    height: 68px !important;
  }
}


/* ============================================================
   2b. ACCREDITATION STRIP (<= 900px)
   The site's own developer already wrote a media-query fallback
   for #accred-strip (column stack below 900px) — but it never
   worked, because the element carries an inline
   style="...flex-direction: row..." and an inline style always
   beats a plain stylesheet rule, media query or not. It needs
   !important to actually win. Once it does, contact info sits on
   its own line and the 6 accreditation badges get their own
   centered row with room to breathe instead of both rows'
   children wrapping into an interleaved 3+3 jumble.
   ============================================================ */
@media (max-width: 900px) {
  #accred-strip {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 10px 16px !important;
  }

  #accred-strip > div:first-child {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }

  #accred-strip > div:last-child {
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    width: 100% !important;
    overflow-x: visible !important;
  }

  #accred-strip img {
    height: 24px !important;
  }
}


/* ============================================================
   2c. ACHIEVEMENTS STAT ROW (<= 900px)
   The 4 counter cards (Years / Students / Result / etc.) sit in a
   plain flex row with no flex-wrap, each with flex-basis:200px.
   Flex items won't shrink past their own text's min-content width
   by default, so on narrow screens the row simply runs out of
   space and the last card(s) spill past the viewport edge. Wrapping
   the row into a 2-column grid fixes it cleanly.
   ============================================================ */
@media (max-width: 900px) {
  #achievements > div[style*="max-width: 1200px"] {
    flex-wrap: wrap !important;
    row-gap: 24px !important;
  }
  #achievements > div[style*="max-width: 1200px"] > div {
    flex: 1 1 45% !important;
  }
}


/* ============================================================
   2. TABLET  (<= 900px)
   Gutters shrink further and the cinematic film is swapped for a
   static poster on top of the nav-drawer switch above.
   ============================================================ */
@media (max-width: 900px) {

  /* ---- Cinematic "beat" text wrapping fix (mobile only) ----
     .beat is a flex column with align-items:center, and .inner
     (which wraps every headline/paragraph/CTA row) has no width
     rule in the site's own CSS — it relies on flexbox shrink-to-fit
     sizing plus align-items:center to both size AND horizontally
     center itself. On desktop that's fine: the inner box shrinks to
     ~900px (h1's own max-width cap) and gets centered. But on a
     narrow viewport, .beat also switches to position:relative in
     film-lite mode, which (see the grid-template-columns fix above)
     forces .beat itself to the correct viewport width — and once
     .beat is narrow, .inner's shrink-to-fit width can still exceed
     it unless we pin .inner to 100%. This MUST stay mobile-only:
     doing it unconditionally breaks desktop centering, since a
     full-width .inner has nothing left for align-items:center to
     center — the headline just snaps to the left edge instead. */
  .beat .inner {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* ---- Gutters ---- */
  [style*="padding: 80px"]                { padding: 48px 20px !important; }
  [style*="padding: 100px 80px"]          { padding: 56px 20px !important; }
  [style*="padding: 10px 80px"]           { padding: 10px 20px !important; }
  [style*="padding: 100px 80px 40px"]     { padding: 56px 20px 28px !important; }
  [style*="padding: 100px 80px 120px"]    { padding: 56px 20px 64px !important; }
  [style*="padding: 100px 80px 60px"]     { padding: 56px 20px 40px !important; }
  [style*="padding: 60px 80px 100px"]     { padding: 40px 20px 56px !important; }
  [style*="padding: 120px 80px 100px"]    { padding: 64px 20px 56px !important; }
  [style*="padding: 80px 80px 60px"]      { padding: 48px 20px 40px !important; }
  [style*="padding: 80px 0px 80px 80px"]  { padding: 48px 0 48px 20px !important; }

  /* ---- Cinematic film: swap the 114-frame / 9 MB sequence for the
     static poster. responsive-nav.js sets .film-lite on <body>, and
     the one-line guard in cinematic.js stops the preload. ---- */
  body.film-lite .beat {
    opacity: 1 !important;
    position: relative !important;
    height: auto !important;
    padding: 64px 20px !important;
    transform: none !important;
    pointer-events: auto !important;
  }
  body.film-lite .beat.left {
    padding-left: 20px !important;
    align-items: flex-start;
  }
  body.film-lite #scroll-space  { height: auto !important; }
  body.film-lite #meter,
  body.film-lite #pct,
  body.film-lite #cue,
  body.film-lite #loader        { display: none !important; }
  /* Poster must stay FIXED so it sits behind every beat as you scroll.
     With position:absolute it only covered the first 100vh, leaving all
     later beats as flat dark boxes over the white body. */
  body.film-lite #film-stage    { position: fixed !important; inset: 0 !important; height: 100vh !important; }

  /* ---- Footer: the columns are fixed-width and won't wrap ---- */
  footer > div[style*="flex-direction: row"] {
    flex-direction: column !important;
    row-gap: 40px !important;
  }
  footer div[style*="width: 420px"] {
    width: 100% !important;
  }
  footer {
    row-gap: 40px !important;
  }

  /* ---- Any hard-coded column width becomes fluid ---- */
  [style*="width: 800px"],
  [style*="width: 720px"],
  [style*="width: 640px"],
  [style*="width: 560px"],
  [style*="width: 520px"],
  [style*="width: 480px"],
  [style*="width: 420px"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* ---- Non-responsive 3-column grid ---- */
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ---- min/max-content wrappers overflow on narrow screens ---- */
  #content [style*="width: min-content"],
  footer [style*="width: min-content"] {
    width: auto !important;
    max-width: 100% !important;
  }
  [style*="width: max-content"] {
    max-width: 100% !important;
  }
}


/* ============================================================
   3. PHONE  (<= 600px)
   ============================================================ */
@media (max-width: 600px) {

  [style*="padding: 80px"]                { padding: 40px 16px !important; }
  [style*="padding: 100px 80px"]          { padding: 44px 16px !important; }
  [style*="padding: 10px 80px"]           { padding: 8px 16px !important; }
  [style*="padding: 100px 80px 40px"]     { padding: 44px 16px 24px !important; }
  [style*="padding: 100px 80px 120px"]    { padding: 44px 16px 48px !important; }
  [style*="padding: 100px 80px 60px"]     { padding: 44px 16px 32px !important; }
  [style*="padding: 60px 80px 100px"]     { padding: 32px 16px 44px !important; }
  [style*="padding: 120px 80px 100px"]    { padding: 48px 16px 44px !important; }
  [style*="padding: 80px 80px 60px"]      { padding: 40px 16px 32px !important; }
  [style*="padding: 80px 0px 80px 80px"]  { padding: 40px 0 40px 16px !important; }

  #site-logo    { left: 16px !important; width: 160px !important; height: 28px !important; }
  #nav-toggle   { right: 16px !important; }

  /* Single column everywhere */
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Cards keep a 220px flex-basis floor that forces 2-up on 375px screens */
  [style*="min-width: 220px"] {
    min-width: 100% !important;
    flex-basis: 100% !important;
  }

  /* Any two-column row stacks */
  #content div[style*="flex-direction: row"][style*="flex-wrap: wrap"] {
    row-gap: 20px !important;
  }

  /* Type scale — the inline sizes are set for desktop */
  .beat .lead                   { font-size: 17px !important; }
  .beat .chips span             { font-size: 13px !important; padding: 6px 12px !important; }
  .beat .figure-label           { font-size: 14px !important; }
  .beat .cta-row                { flex-direction: column; width: 100%; }
  .beat .btn-primary,
  .beat .btn-ghost              { width: 100%; text-align: center; }
}


/* ============================================================
   4. TOUCH TARGETS + FORMS
   Applies at every size; costs nothing on desktop.
   ============================================================ */
@media (pointer: coarse) {
  a[href^="tel:"],
  a[href^="mailto:"],
  #site-nav a,
  .dropdown-panel a,
  button,
  [role="button"] {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* iOS zooms the page if an input's font-size is under 16px */
input,
select,
textarea {
  font-size: 16px !important;
}

@media (max-width: 600px) {
  form[style*="max-width: 560px"],
  form[style*="max-width: 520px"] {
    max-width: 100% !important;
    padding: 20px !important;
  }
  form div[style*="flex-direction: row"] {
    flex-direction: column !important;
  }

  /* The two-up "Full name / Phone number" fields ship with an
     inline flex-basis:160px meant to size them as COLUMNS in a
     row. Once the row above is forced to flex-direction:column,
     that same flex-basis becomes a main-axis HEIGHT instead of a
     width — pinning each field to a 160px-tall box even though its
     label+input only need ~70px, and leaving a large empty gap
     before the next field. Resetting basis/grow lets each field
     size to its own content again. */
  form div[style*="flex-direction: row"] > div[style*="flex-basis: 160px"] {
    flex-basis: auto !important;
    flex-grow: 0 !important;
  }
}


/* ============================================================
   5. MOBILE NAV DRAWER
   Markup injected by responsive-nav.js.
   ============================================================ */
#nav-toggle {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1002;
  padding: 0;
}

#nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #091e3a;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

#nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
#nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

#nav-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(86vw, 380px);
  background: #fff;
  z-index: 1001;
  padding: 88px 24px 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -8px 0 32px rgba(9, 30, 58, 0.16);
  -webkit-overflow-scrolling: touch;
}

#nav-drawer.open { transform: translateX(0); }

#nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(9, 30, 58, 0.5);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#nav-scrim.open { opacity: 1; pointer-events: auto; }

/* Drawer links */
#nav-drawer a,
#nav-drawer .drawer-group > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 12px 4px;
  font-family: Geist, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #091e3a;
  text-decoration: none;
  border-bottom: 1px solid #e2e8f0;
  background: none;
  cursor: pointer;
  text-align: left;
}

#nav-drawer .drawer-group > button svg { transition: transform 0.25s ease; }
#nav-drawer .drawer-group.open > button svg { transform: rotate(180deg); }

#nav-drawer .drawer-sub {
  display: none;
  padding-left: 16px;
}
#nav-drawer .drawer-group.open .drawer-sub { display: block; }

#nav-drawer .drawer-sub a {
  font-size: 15px;
  font-weight: 500;
  color: #425466;
  min-height: 46px;
}

#nav-drawer a:focus-visible,
#nav-drawer button:focus-visible,
#nav-toggle:focus-visible {
  outline: 2px solid #0288d1;
  outline-offset: 2px;
}

body.drawer-open { overflow: hidden; }

@media (min-width: 1401px) {
  #nav-drawer,
  #nav-scrim,
  #nav-toggle { display: none !important; }
}


/* ============================================================
   6. REDUCED MOTION — extend the existing rules to the drawer
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  #nav-drawer,
  #nav-scrim,
  #nav-toggle span {
    transition: none !important;
  }
}


/* ============================================================
   6. MOBILE POLISH PATCH (360-430px phones)
   Fixes reported on Galaxy S8+ (360x740):
     a) hero/beat headline colliding with the film watermark
     b) accreditation logo strip too cramped
     c) top contact bar + logos + navbar stack eating the hero
     d) hero text-block contrast too low over bright frames
   ============================================================ */

/* ---- (c) Compact the top contact bar so the stack is shorter ----
   On phones the contact row and the badge row each take a full line;
   combined with the 68px nav that's ~180px of chrome before the hero
   even starts. Tighten type, padding and gaps to claw that back. */
@media (max-width: 600px) {
  #accred-strip {
    padding: 8px 12px !important;
    gap: 8px !important;
  }

  /* Contact row: smaller type, tighter icon gaps, allow it to centre */
  #accred-strip > div:first-child {
    font-size: 12px !important;
    gap: 12px !important;
    row-gap: 4px !important;
  }
  #accred-strip > div:first-child a {
    gap: 4px !important;
    min-height: 0 !important;   /* overrides the 44px coarse-pointer rule here only */
  }

  /* (b) Badge strip: give the logos real breathing room.
     Instead of 6 badges wrapping into a ragged 4+2, let them scroll
     horizontally in one clean row at a legible size. */
  #accred-strip > div:last-child {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px !important;
  }
  #accred-strip > div:last-child::-webkit-scrollbar { display: none; }

  #accred-strip > div:last-child > div {
    flex: 0 0 auto !important;
    padding: 4px 7px !important;
    border-radius: 5px !important;
  }
  #accred-strip img {
    height: 26px !important;
  }
}

/* ---- (c cont.) Nav height trim on the smallest phones ---- */
@media (max-width: 430px) {
  #site-nav {
    height: 60px !important;
  }
  #site-logo {
    width: 148px !important;
    height: 26px !important;
    top: calc(-13px + 50%) !important;
  }
}

/* ---- (a) + (d) Hero / beat text over the film ----
   In film-lite mode the beats become normal in-flow blocks stacked on
   top of a single static poster, so the poster's bright centre shows
   straight through the headline. Two fixes:
     1. give each beat its own solid-ish scrim (not just the shared
        50% wash) so text never sits on raw image
     2. push the first beat clear of the fixed nav stack */
@media (max-width: 900px) {
  /* (d) Uniform scrim per beat. A gradient here (dark-light-dark) made a
     visible horizontal seam wherever two beats met, because each beat's
     dark end butted against the next beat's dark start. A flat value
     tiles seamlessly no matter how many beats stack. */
  body.film-lite .beat::before {
    background: rgba(4, 9, 18, 0.72) !important;
  }

  /* (a) First beat clears the contact bar + nav instead of tucking under it */
  body.film-lite .beat:first-of-type .inner {
    margin-top: 0 !important;
  }
  body.film-lite #scroll-space > .beat:first-of-type {
    padding-top: 132px !important;
  }

  /* (a) Headline sizing: the clamp()'s 5vw term collapses to ~18px on a
     360px screen while the 32px floor stays — but the long words still
     ran into the watermark. Cap the line length and let it break. */
  body.film-lite .beat h1,
  body.film-lite .beat h2 {
    max-width: 100% !important;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

@media (max-width: 600px) {
  /* (d) Type scale + shadow bump for readability on small bright frames */
  body.film-lite .beat h1 { font-size: 30px !important; line-height: 1.15 !important; }
  body.film-lite .beat h2 { font-size: 26px !important; line-height: 1.18 !important; }
  body.film-lite .beat .figure { font-size: 62px !important; }
  body.film-lite .beat .kicker {
    font-size: 11px !important;
    letter-spacing: 2px !important;
    margin-bottom: 12px !important;
  }
  body.film-lite .beat h1,
  body.film-lite .beat h2 {
    text-shadow: 0 2px 8px rgba(0,0,0,.95), 0 6px 28px rgba(0,0,0,.7) !important;
  }
  body.film-lite .beat .lead {
    color: rgba(255,255,255,.96) !important;
    text-shadow: 0 2px 10px rgba(0,0,0,.9) !important;
  }

  /* Tighter vertical rhythm so beats don't feel like empty screens */
  body.film-lite .beat {
    padding: 44px 18px !important;
  }
  body.film-lite #scroll-space > .beat:first-of-type {
    padding-top: 150px !important;
    padding-bottom: 52px !important;
  }
}


/* ============================================================
   7. FLUID-WIDTH ROOT FIX
   ------------------------------------------------------------
   PROBLEM (root cause):
   Section 2 fixes hardcoded widths by ENUMERATING them:
     [style*="width: 800px"], [style*="width: 720px"], ...
   That list covers 7 values. The exported markup actually uses
   ~30 distinct pixel widths, including width:1280px (32x) and
   width:1920px (132x). Every value outside the list overflowed —
   160 of 280 page/breakpoint combinations were broken, and the
   global overflow-x:hidden in section 0 was hiding it by
   clipping content rather than reflowing it.

   Note on scoping: only index.html has #content / #scroll-space
   wrappers. Every sub-page hangs its layout off an unclassed
   <div> directly under <body>, so there is no semantic hook to
   target — the rule has to apply from <body> down, with explicit
   exemptions for the elements that are supposed to overflow.

   `max-width` is a different property from `width`, so it
   constrains an inline width with no specificity fight and no
   !important. One declaration caps every hardcoded width,
   present and future, instead of chasing individual values.

   Scoped to <=1400px so the desktop composition at 1440/1600/
   1920 is untouched.
   ============================================================ */
@media (max-width: 1400px) {

  body * {
    max-width: 100%;
  }

  /* Children of a deliberately horizontal-scrolling row must keep
     their intrinsic size, or the row has nothing to scroll. */
  #accred-strip > div:last-child > div,
  #accred-strip > div:last-child img {
    max-width: none;
  }

  /* Inline max-width:NNNpx outranks a stylesheet max-width, so the
     values actually present in the markup need an override. */
  [style*="max-width: 1920px"],
  [style*="max-width: 1440px"],
  [style*="max-width: 1280px"],
  [style*="max-width: 900px"],
  [style*="max-width: 800px"],
  [style*="max-width: 780px"],
  [style*="max-width: 760px"],
  [style*="max-width: 696px"],
  [style*="max-width: 640px"],
  [style*="max-width: 600px"] {
    max-width: 100% !important;
  }

  /* Long unbroken strings (URLs, document codes) must not be able
     to set a min-content width wider than the viewport. */
  p, span, h1, h2, h3, h4, a, li, td, th, div {
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
  }

  /* Figma exports mark text spans white-space:pre-wrap, preserving
     the source file's hard-wrapped lines. Those were authored on a
     1440px canvas and refuse to reflow on anything narrower. */
  span.text {
    white-space: normal;
  }

  /* Rows of cards/columns exported as non-wrapping flex run off the
     edge once the viewport is narrower than their min-content
     width. Wrapping is the reflow the layout was missing. The nav
     is excluded: it has its own drawer behaviour in section 2a. */
  div[style*="flex-direction: row"]:not([style*="flex-wrap"]):not(#accred-strip):not(#site-nav div) {
    flex-wrap: wrap;
    /* Turning a single-line flex row into a multi-line one activates
       align-content, which defaults to `stretch`. Any leftover height
       is then distributed across the wrapped lines, inflating each
       card with dead space — the course cards rendered ~180px of
       content inside a 900px box. Packing the lines to the start
       keeps every card the height of its own content. */
    align-content: flex-start;
  }

  /* The homepage "Campus Life" gallery pairs images two at a time
     inside its own nested row (gate photo + a 2x2 block of smaller
     shots). Those inner rows only declare grid-column-gap (for the
     side-by-side gap) and rely on the outer column's row-gap for
     spacing between pairs. The generic wrap rule above forces each
     pair to stack, but a stacked pair has no row-gap of its own, so
     the two images inside it end up touching while the gap between
     pairs (inherited from the outer column) still shows. Giving
     these rows their own row-gap fixes the touching pair without
     changing the already-correct gap between pairs. */
  div[style*="display: flex;flex-direction: row;grid-column-gap: 20px;position: relative;flex-shrink: 0;"] {
    row-gap: 20px;
  }
}


/* ------------------------------------------------------------
   7b. ACCREDITATION STRIP — 900px to 1400px band
   Section 2b stacks the strip below 900px and section 1 shrinks
   gutters below 1200px, but between 900 and 1400 it stayed a
   single non-wrapping row: contact block + six badges, combined
   min-content ~1127px. At 1024px it pushed 103px past the edge on
   every page carrying the strip.
   ------------------------------------------------------------ */
@media (min-width: 901px) and (max-width: 1400px) {
  #accred-strip {
    flex-wrap: wrap !important;
    row-gap: 8px !important;
    justify-content: center !important;
  }
  #accred-strip > div:last-child {
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
}


/* ============================================================
   7c. GRID TRACK BLOW-OUT — ALL PAGES, ALL WIDTHS
   ------------------------------------------------------------
   Every page ships <body style="display: grid"> with no
   grid-template-columns, so the single implicit column is sized
   `auto`. An auto track's minimum is content-based, so the track
   resolves to the widest min-content in the page (~1360px) and
   stretches every grid item to match, regardless of viewport.

   Because min-width/min-height:auto on a grid or flex item beats
   both `width` and `max-width` per spec, this defeated the
   max-width:100% fix in section 7 — which is why the whole DOM
   chain reported max-width:100% while still measuring 1360px.

   Section 0c already contained this fix but scoped it to
   body.film-lite, and responsive-nav.js only adds film-lite below
   900px. That left 1024px and 1280px broken on every page.
   minmax(0, 1fr) caps the track minimum at 0 so it can never
   exceed its container.
   ============================================================ */
body {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

@media (max-width: 1400px) {
  /* Neutralise the automatic minimum size ONLY on the top-level
     grid items. Applying it to every descendant (body *) also let
     deep text columns shrink toward zero, so card rows squeezed
     their titles into a ~70px ribbon and broke words mid-syllable
     instead of wrapping. Leaving min-width:auto on inner items
     means their min-content width is respected, which combines
     with flex-wrap:wrap below to make rows REFLOW onto new lines
     rather than either squeezing or overflowing. */
  body > * {
    min-width: 0;
  }

  /* Images carrying an inline max-width:NNNpx larger than their
     container (e.g. max-width:150px inside a 63px column). */
  img[style*="max-width:"] {
    max-width: 100% !important;
  }
}


/* ------------------------------------------------------------
   7d. FLEX ITEMS THAT CANNOT SHRINK BELOW THEIR BASIS
   Cards are exported as `flex-grow:1; flex-basis:380px;
   flex-shrink:0`. flex-grow:1 declares the intent "this box is
   fluid", but flex-shrink:0 stops it shrinking below 380px, so on
   a 320px viewport it stayed 380px. On mobile Chrome that widens
   the layout viewport to fit the overflow, which then inflated
   every position:fixed element (the nav measured 350px inside a
   320px viewport) — the overflow looked like a nav bug when the
   nav was only a symptom.

   Restoring flex-shrink honours the declared intent rather than
   overriding the design.
   ------------------------------------------------------------ */
@media (max-width: 1400px) {
  [style*="flex-grow: 1"][style*="flex-basis:"] {
    flex-shrink: 1 !important;
  }
}


/* ------------------------------------------------------------
   8. TOUCH TARGETS — FOOTER + TOP BAR
   Section 4 raises nav links, buttons and tel/mailto links to a
   44px minimum on coarse pointers, but footer links were not in
   that selector list and measured 19px. Section 6 then deliberately
   dropped the top-bar contact links to 14px to compact the mobile
   header, which made two of the most-tapped links on the site the
   hardest to hit.
   ------------------------------------------------------------ */
@media (pointer: coarse) {
  footer a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Keep the compact header height from section 6, but restore a
     usable hit area by padding rather than by growing line-height. */
  #accred-strip > div:first-child a {
    min-height: 32px !important;
    padding: 6px 2px !important;
  }
}


/* ------------------------------------------------------------
   8b. TOP BAR COLLAPSE HEIGHT
   index.html caps #accred-strip at max-height:90px as the "open"
   value for its collapse-on-scroll transition. Once the strip
   stacks into two rows below 900px that content needs ~96px, so
   the last row was clipped by 7px.

   Scoped with :not(.topbar-hidden) and NO !important on purpose —
   it matches the collapse rule's specificity and simply wins on
   source order (responsive.css loads after index's inline <style>),
   so the collapse-to-zero animation still works untouched.
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  #cine-nav:not(.topbar-hidden) #accred-strip {
    max-height: 140px;
  }
}


/* ------------------------------------------------------------
   8c. "FILL REMAINING SPACE" COLUMNS INSIDE NARROW ROWS
   Card rows are built as: [44px icon] [text column] [button],
   where the text column uses the fill-remaining idiom
   `flex-grow:1; flex-basis:0`.

   A flex item with flex-basis:0 has a hypothetical main size of
   zero, so it never triggers a line break even in a wrapping
   container — it just absorbs whatever space is left. At 320px
   that left 66px for the title, which then broke mid-word
   ("Undergrad / uate", "Publishe / d:").

   Giving it flex-basis:100% below 600px makes it take its own
   line, so the icon and button sit together above a full-width
   title. Scoped to direct children of a ROW container on purpose:
   flex-basis is the main-axis size, so applying this inside a
   COLUMN container would set height, not width.
   ------------------------------------------------------------ */
@media (max-width: 600px) {
  div[style*="flex-direction: row"] > div[style*="flex-basis: 0px"][style*="flex-grow: 1"] {
    flex-basis: 100% !important;
  }
}


/* ------------------------------------------------------------
   8d. ORG-CHART BRANCH CONNECTORS WHEN THE ROW WRAPS
   The governance chart joins side-by-side cards with a horizontal
   rule: a 100px-wide box holding a 2px top border, pulled tight
   with margin:-2px.

   Once section 7 lets that row wrap on tablet/mobile, the cards
   stack vertically and the horizontal rule collapses into a flush
   seam — CHAIRMAN (CDC) and SECRETARY ended up sharing an edge
   with no separation.

   Re-orient the connector to a short vertical line so it reads the
   same way as the chart's other vertical links. Desktop keeps the
   horizontal branch untouched.
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  div[style*="width: 100px"] > div[style*="border-width: 2px 0px 0px"] {
    width: 2px !important;
    height: 24px !important;
    border-width: 0 0 0 2px !important;
    margin: 0 !important;
  }
  div[style*="width: 100px"]:has(> div[style*="border-width: 2px 0px 0px"]) {
    width: 100% !important;
    height: 24px !important;
    flex-shrink: 0;
  }
}


/* ============================================================
   9. SUB-PAGE HERO TYPOGRAPHY
   ------------------------------------------------------------
   Section 3 scales the homepage .beat headings, but every
   sub-page hero carries its size as an INLINE font-size (56px on
   14 headings, plus 42/44/48/72px). Inline wins over any
   stylesheet rule, so those headings stayed at desktop size on a
   360px screen: "Internal Quality Assurance Cell" rendered at
   44px, one or two words per line, and on pages where the hero
   band has a fixed height the last line was clipped mid-word
   ("UG & PG Degree Progra...").

   clamp() gives a fluid ramp instead of a fixed step, so these
   scale smoothly from 320px up to the 900px breakpoint rather
   than snapping. Desktop is untouched above 900px.
   ============================================================ */
@media (max-width: 900px) {
  [style*="font-size: 72px"] { font-size: clamp(30px, 8.5vw, 46px) !important; line-height: 1.12 !important; }
  [style*="font-size: 56px"] { font-size: clamp(26px, 7.2vw, 38px) !important; line-height: 1.15 !important; }
  [style*="font-size: 48px"] { font-size: clamp(24px, 6.6vw, 34px) !important; line-height: 1.18 !important; }
  [style*="font-size: 44px"] { font-size: clamp(23px, 6.2vw, 32px) !important; line-height: 1.2  !important; }
  [style*="font-size: 42px"] { font-size: clamp(22px, 6vw,   30px) !important; line-height: 1.2  !important; }
  [style*="font-size: 40px"] { font-size: clamp(22px, 5.8vw, 30px) !important; line-height: 1.2  !important; }
  [style*="font-size: 36px"] { font-size: clamp(21px, 5.4vw, 28px) !important; line-height: 1.22 !important; }
  [style*="font-size: 32px"] { font-size: clamp(20px, 5vw,   26px) !important; line-height: 1.25 !important; }
}


/* ============================================================
   9b. FIXED SECTION HEIGHTS
   Layout sections were exported with the height their desktop
   composition happened to need (up to height:1750px). Once the
   content reflows into one column that number is meaningless: it
   either clips the content or leaves a screen of dead white space
   below it. Only heights of 200px+ are released — smaller ones
   are image and icon boxes that genuinely want a fixed box.
   ============================================================ */
@media (max-width: 900px) {
  [style*="height: 1750px"],
  [style*="height: 400px"],
  [style*="height: 360px"],
  [style*="height: 320px"],
  [style*="height: 280px"],
  [style*="height: 238px"],
  [style*="height: 235px"],
  [style*="height: 220px"],
  [style*="height: 213px"],
  [style*="height: 200px"] {
    height: auto !important;
    min-height: 0 !important;
  }

  /* Those boxes often hold a cover image sized height:100%, which
     would collapse once the parent is auto. Give it an aspect box
     instead so it keeps its crop. */
  [style*="height: 320px"] > img[style*="height: 100%"],
  [style*="height: 280px"] > img[style*="height: 100%"],
  [style*="height: 400px"] > img[style*="height: 100%"] {
    height: auto !important;
    aspect-ratio: 16 / 10;
    object-fit: cover;
  }

  /* The "Enquire" page's location map banner is height:320px but
     holds only a small centered pin icon (normal flow) plus an
     address card that is position:absolute; bottom:24px (removed
     from flow). The generic rule above collapses this banner to
     ~40px (the icon's own height), and since the card is taller
     than that and anchored to the bottom, it overflows upward,
     landing on top of the form/section before it. Give this one
     banner back enough height to hold the card without overlap. */
  [style*="height: 320px"][style*="background-color: #dbe4ea"] {
    height: 220px !important;
    min-height: 220px !important;
  }
}


/* ============================================================
   9c. FLOATING ACTION BUTTONS OVERLAPPING CONTENT
   #floating-actions is fixed at bottom-right with z-index 200, so
   it sits on top of whatever scrolls under it — in practice the
   last two lines of the footer and any button near the page
   bottom. Reserving space at the end of the footer keeps the
   buttons clear without moving them.
   ============================================================ */
@media (max-width: 900px) {
  footer {
    padding-bottom: 104px !important;
  }
}


/* ============================================================
   9d. height:100% ON WRAPPED FLEX ITEMS
   ------------------------------------------------------------
   Cards in a row carry inline `height: 100%` so that siblings
   match the tallest one — correct while they share a flex line.
   Once the row wraps into one card per line (section 7), that
   100% still resolves against the ROW's full height, not the
   card's own line. Three ~300px cards therefore each became
   918px, giving ~700px of dead white space inside every card.

   On a single-column mobile layout there is no sibling to match,
   so auto is both correct and what the design intends.
   ============================================================ */
@media (max-width: 900px) {
  div[style*="height: 100%"] {
    height: auto !important;
  }
}


/* ------------------------------------------------------------
   9e. HERO PADDING ON SMALL SCREENS
   Sub-page heroes use `padding: 100px 80px` (and the 80px/40px
   variants) from the 1440px canvas. On a 360px screen that is
   200px of vertical padding around three lines of text, leaving
   the hero band mostly empty. Section 1 trims the horizontal
   gutters but not the vertical ones.
   ------------------------------------------------------------ */
@media (max-width: 600px) {
  [style*="padding: 100px 80px"],
  [style*="padding: 80px 80px"] {
    padding-top: 40px !important;
    padding-bottom: 40px !important;
  }
}


/* ============================================================
   10. POSTER DETAIL COMPETING WITH HERO TEXT (mobile)
   ------------------------------------------------------------
   The poster frame is a photo of the college entrance, and the
   building's white signboard — plus the red roof band under it —
   forms a hard-edged bright rectangle that lands directly behind
   the headline and lead paragraph on a phone.

   Two problems, neither of them layout: the rectangle reads as a
   stray box or gap in the composition, and the Marathi lettering
   on the sign is legible straight through the headline, so two
   sets of text compete. No amount of spacing or scrim tuning
   fixes it, because the "box" is IN the photograph.

   A small blur dissolves the sign's edges and lettering while
   keeping the colour, depth and shape of the building, so the
   photo still reads as the campus. The scale compensates for the
   soft transparent edge blur leaves at the canvas boundary.

   Desktop is untouched: there the text column sits clear of the
   sign, so the photo stays sharp.
   ============================================================ */
@media (max-width: 900px) {
  body.film-lite #film {
    filter: blur(3px) saturate(1.05);
    transform: scale(1.08);
    transform-origin: center center;
  }

  /* With the detail softened the scrim can ease off slightly, so
     the campus is more visible than before rather than less. */
  body.film-lite .beat::before {
    background: rgba(4, 9, 18, 0.66) !important;
  }
}


/* ============================================================
   11. HERO CLEARING THE FIXED HEADER
   ------------------------------------------------------------
   #cine-nav is fixed, so the first hero section has to offset
   itself by the header's height. Sections 6 and 7 did that with a
   hardcoded padding-top (150px, and 132px at the wider end) —
   a guess. The stack actually measures 153px on phones, 161px at
   600px and 165px at 768px, so the kicker and headline sat 3px to
   33px UNDERNEATH the bar at every mobile width. That is the text
   "going up behind the nav".

   --chrome-h is published by syncChromeHeight() in
   responsive-nav.js from the element's real box, and refreshed on
   resize and once webfonts settle. The fallback covers the worst
   case if JS has not run yet, so the headline is never clipped.
   ============================================================ */
@media (max-width: 900px) {
  body.film-lite #scroll-space > .beat:first-of-type {
    padding-top: calc(var(--chrome-h, 165px) + 28px) !important;
  }
}

/* ============================================================
   12. Enquiry section — quick-contact buttons (WhatsApp / Email /
   Call us) rendered squished/uneven on phones because the generic
   "repeat(3, 1fr) -> 1fr" rule above only re-flows the CSS Grid
   track count; it doesn't guarantee the <a> children stretch to
   fill each track (anchors don't stretch by default inside a
   grid). Scoped classes here take over layout for this block only,
   so it no longer depends on the generic attribute-selector hacks.

   The Email/Call-us anchors are also caught by section 4's
   `a[href^="tel:"], a[href^="mailto:"] { display:flex; }` touch-
   target rule (WhatsApp's wa.me link isn't, since it doesn't match
   that selector) — that turns just those two anchors into a ROW
   flex container, so their single child <div> (the actual visible
   coloured box) stops stretching and shrinks to its own icon+text
   content width instead of filling the button. That's why only
   WhatsApp looked full-width while Email/Call us looked squeezed
   to the left. Forcing width:100% on that inner div, and giving
   the whole block #enquiry-scoped selectors so it always outranks
   that attribute-selector rule, fixes both anchors regardless of
   which href they carry.
   ============================================================ */
@media (max-width: 600px) {
  #enquiry .quick-contact-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  #enquiry .quick-contact-btn {
    display: flex !important;
    width: 100% !important;
  }
  #enquiry .quick-contact-btn > div {
    width: 100% !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    column-gap: 8px !important;
    row-gap: 0 !important;
    padding: 14px 16px !important;
    box-sizing: border-box !important;
  }
}

/* ============================================================
   13. UG/PG PROGRAMMES — tab toggle
   #tab-ug / #tab-pg sit side by side on desktop, so the inactive
   tab (transparent background, no border) still reads as part of
   the toggle because it's touching the active pill. Below 600px
   the row wraps into a column (see rule 4 in this file), and the
   inactive tab then floats on its own with nothing to mark it as
   a button — it looks like a stray label, not part of a toggle.
   Give both tabs a full-width pill with a visible border so the
   pair still reads as one control when stacked.
   ============================================================ */
@media (max-width: 600px) {
  #tab-ug, #tab-pg {
    width: 100% !important;
    border: 1px solid #e2e8f0 !important;
    box-sizing: border-box !important;
  }
  #tab-ug[style*="background-color: #0288d1"],
  #tab-pg[style*="background-color: #0288d1"] {
    border-color: #0288d1 !important;
  }
}
