/* ==========================================================================
   BIT — RESPONSIVE CORRECTIONS
   --------------------------------------------------------------------------
   What this file is: the single place where mobile/tablet layout defects are
   corrected. It is loaded LAST in <head>, after style.css AND after each
   page's own custom_css, so an equal-specificity rule here wins on source
   order and needs no !important.

   Why it exists as one file rather than 29 per-page edits: the per-page CSS
   lives in BOTH database/seeders/content/css/*.css and the pages.custom_css /
   life_at_bits.custom_css columns. Editing it in place means keeping two
   copies in step and losing the fix on the next db:seed. One stylesheet
   applies to every page, post, activity and notice — including content the
   client creates later.

   HARD RULE: every rule below is inside a max-width media query.
   Nothing here can alter rendering at >= 992px. Desktop parity with
   template/ (see the drift baseline) is therefore untouched by design.

   Breakpoints used:
     <= 991.98px  tablets and phones — structural caps (widths, gutters, nav)
     <= 767.98px  phones            — display-type scale
   ========================================================================== */


/* ==========================================================================
   1. HEADER — the site-wide 873px break
   --------------------------------------------------------------------------
   At 768-991px the brand lock-up (42px crest + 376px wordmark) plus the four
   right-hand links and the burger measured 873px inside a 720px .container,
   so EVERY page on the site overflowed on a tablet.

   The three text links (News/Notices, Apply, Login) are markup-hidden below
   768px already (`d-none d-md-block`) because they do not fit; they simply
   still do not fit at 768-991px. Extending that same treatment up to 992px
   keeps the design's own decision instead of inventing a new one. Every one
   of those destinations remains reachable from the mega menu, which is what
   phone visitors already use.

   The "Menu" trigger carries `d-md-block` WITHOUT `d-none`, so `.d-none`
   below selects exactly the three menu links and never the trigger.
   ========================================================================== */
@media (max-width: 991.98px) {
    .bit-navbar .nav-right .nav-link-top.d-none {
        display: none !important;   /* beats Bootstrap's own .d-md-block utility */
    }

    /* Keep the brand from being the next thing to overflow on a small tablet. */
    .bit-navbar .navbar-brand {
        min-width: 0;
        flex-shrink: 1;
    }

    .bit-navbar .text-logo {
        font-size: clamp(0.95rem, 2.6vw, 1.6rem);
        line-height: 1.15;
        margin-left: 0;
        overflow-wrap: break-word;
    }
}


/* --------------------------------------------------------------------------
   1b. ONE LOGO LOCK-UP AT A TIME (576-767px)
   --------------------------------------------------------------------------
   The design's two logo images carry breakpoints that do not meet: the
   desktop crest and the wordmark are `d-none d-sm-block` (shown from 576px)
   while the mobile lock-up is `d-xl-none d-md-none` (hidden only from 768px).
   Between 576 and 767 the header therefore draws BOTH - crest 247px +
   wordmark + the full mobile logo - measuring 772px inside a 576px viewport
   on every page of the site.

   Inherited from template/headers.php, so it is not a porting error, but the
   client's "fix each and every page for responsiveness" supersedes the
   earlier rule about leaving the design's own overflows alone. Below 768 the
   mobile lock-up is the design's own choice of mark, so the desktop pair is
   hidden and the phone rendering (<576, where both are already `d-none`) is
   unchanged.
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .bit-navbar .dextop_logo,
    .bit-navbar .text-logo {
        display: none !important;   /* beats Bootstrap's .d-sm-block utility */
    }
}


/* ==========================================================================
   2. GRID GUTTERS MUST NOT EXCEED THEIR CONTAINER'S PADDING
   --------------------------------------------------------------------------
   A Bootstrap .row pulls itself outwards by half its gutter. That is only
   invisible when the container pays it back with equal padding. Two shapes on
   this site break that contract and pushed the document 12px wider each side:
     * `.row.g-5` (24px pull) inside a plain `.container` (12px padding)
       -> bit-mun, careers, contact, student-support
     * any gutter row inside `.container.px-0` (0 padding)
       -> our-story
   Below 992px every column is stacked full width, so horizontal gutters draw
   nothing at all — removing the excess is visually neutral and costs no
   vertical spacing, which lives on --bs-gutter-y and is left alone.
   ========================================================================== */
@media (max-width: 991.98px) {
    .container > .row,
    .container-fluid > .row,
    .container-sm > .row,
    .container-md > .row,
    .container-lg > .row {
        --bs-gutter-x: 1.5rem;      /* 24px gutter => 12px pull == container padding */
    }

    /* No padding to pay the pull back with, so there must be no pull. */
    .container.px-0 > .row,
    .container-fluid.px-0 > .row,
    .px-0 > .row {
        --bs-gutter-x: 0;
    }
}


/* ==========================================================================
   3. MEDIA AND EMBEDS NEVER EXCEED THEIR COLUMN
   --------------------------------------------------------------------------
   Applies to imported notice bodies too (607 WordPress posts carry authored
   markup with hardcoded width/height attributes on images, PDF <object>s and
   YouTube <iframe>s that no stylesheet on this site had ever constrained).
   ========================================================================== */
@media (max-width: 991.98px) {
    img,
    svg,
    video,
    canvas {
        max-width: 100%;
        height: auto;
    }

    iframe,
    object,
    embed {
        max-width: 100%;
    }

    /* A table's intrinsic min-content width ignores its column: the academic
       calendar's key-dates table measured 201px inside a 190px column and pushed
       the document out. Capping the box lets the cells (which wrap, see §4) fit. */
    table {
        max-width: 100%;
    }

    /* Wide authored tables scroll inside themselves rather than the page. */
    .detail-body table,
    .notice-content table,
    .cal-table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .detail-body pre,
    .detail-body code {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }
}


/* ==========================================================================
   4. LONG WORDS AND URLS WRAP INSTEAD OF PUSHING THE PAGE OUT
   --------------------------------------------------------------------------
   One unbreakable token is enough to widen the whole document: the CTA word
   "extracurricular" at 58px measured 441px on a 375px phone (athletics,
   clubs), and a bare pasted URL in an imported notice measured 404px.
   `break-word` breaks only when the word cannot fit on a line of its own, so
   ordinary text is unaffected.

   ⚠ `anywhere` IS NOT AN INTERCHANGEABLE STRONGER `break-word`, and treating
   it as one broke the site chrome. It is the only one of the two that lowers
   an element's INTRINSIC MIN-CONTENT WIDTH to a single character. A flex or
   grid item sized from its min-content can then be crushed to ~one letter
   wide, and the text inside stacks vertically. This rule used to name a bare
   `a`, which reached two flex items in the header: the "Menu" trigger
   rendered M/E/N/U down the page, and the mega menu's TOUR/INQUIRE/APPLY/
   LOGIN each broke in half ("TOU R"). The page never got wider - the words
   got narrower - so no overflow or width audit could see it.

   So `anywhere` is confined to the containers that actually hold arbitrary
   imported markup, where a mid-URL break is expected and readable. Everywhere
   else, `overflow-wrap` inherits, so a link inside a `p` or heading already
   gets `break-word` from the rule above without being named here.
   Regression test: tools/nav-wrap-check.cjs.
   ========================================================================== */
@media (max-width: 991.98px) {
    h1, h2, h3, h4, h5, h6,
    p, li, dt, dd, figcaption, blockquote, th, td,
    .clous-under-foot,
    .titel_in_red,
    .titel_in_white,
    .titel_in_youllo,
    .hero-title,
    .news-title,
    .detail-title {
        overflow-wrap: break-word;
        word-break: normal;
    }

    .detail-body a,
    .notice-content a {
        overflow-wrap: anywhere;
    }

    /* Imported WordPress notice bodies contain arbitrary authored markup — a bare <strong>
       holding a 110-character rule of underscores (a typed separator line from the original
       document) measured 1209px and was the only one of 647 routes still overflowing. Listing
       tag names cannot cover content nobody has seen, so the property is set on the container
       and inherited by whatever the notice happens to contain. */
    .detail-body,
    .notice-content {
        overflow-wrap: anywhere;
    }
}


/* ==========================================================================
   5. DISPLAY TYPE SCALES DOWN ON PHONES
   --------------------------------------------------------------------------
   58px/67px headings are a desktop measurement. Wrapping alone (section 4)
   stops the overflow but leaves three-word-per-line headings on a phone, so
   the sizes are scaled with the viewport. Each clamp keeps the design's value
   as its ceiling, so nothing grows and the >=992px rendering is unreachable
   from here.
   ========================================================================== */
@media (max-width: 767.98px) {
    .clous-under-foot {
        font-size: clamp(26px, 7.4vw, 40px);
        line-height: 1.22;
        letter-spacing: -1px;
    }

    .titel_in_red,
    .titel_in_white,
    .titel_in_youllo {
        font-size: clamp(26px, 7.4vw, 42px);
        line-height: 1.25;
    }

    .hero-title {
        font-size: clamp(30px, 8.6vw, 52px);
        line-height: 1.18;
    }

    .hero-sub,
    .hero-eyebrow {
        overflow-wrap: break-word;
    }
}


/* ==========================================================================
   6. DECORATIVE PHOTOS WITH HARD PIXEL WIDTHS
   --------------------------------------------------------------------------
   The design sizes its circles and photo panels in absolute pixels, and three
   of those sizes are unshrinkable by construction:
       .difolt-round-im  clamp(150px, calc(10vw + 404px), 600px)  -> 441px @375
       .picture_one      clamp(200px, calc(10vw + 400px), 700px)  -> 437px @375
       .left-side-apply  clamp(600px, 20vw, 306px)                -> 600px always
   The last two are malformed clamps: a preferred value of "10vw + 400px"
   never drops below 400px, and a clamp whose floor exceeds its ceiling
   returns the floor. Rather than repair each per-page file (two copies each,
   see the header comment), every such photo is capped to its column here.

   `height: auto` + `aspect-ratio` keeps `object-fit: cover` cropping to the
   same proportions the design chose, so the circles stay circular instead of
   flattening into ellipses once the width is capped.

   The horizontal nudges (`right: -26%`, `right: -174px`) are desktop overlap
   choreography; on a stacked phone layout they only push content off-screen,
   so they are zeroed. Vertical nudges are left alone — they cost no width and
   preserve the intended band overlap.
   ========================================================================== */
@media (max-width: 991.98px) {
    .difolt-round-im,
    .picture_one,
    .picture_two,
    .english-photo,
    .big-round-alumnu,
    .full-costom-pho,
    .alumni-2pic,
    .thard-round,
    .right-side-apply,
    .left-side-apply {
        max-width: 100%;
        height: auto;
        float: none;
    }

    /* Circles: keep them square so border-radius:50% still draws a circle.
       The offsets need !important because several per-page mobile blocks push
       these with `right: -16% !important` of their own (duke-edinburgh), which a
       plain declaration cannot outrank however late it is loaded. Scoped to this
       group only — the .rounded_style collage below is deliberately left to the
       page's own tuning. */
    .difolt-round-im,
    .picture_one,
    .picture_two,
    .english-photo {
        width: min(78vw, 420px);
        aspect-ratio: 1 / 1;
        margin-left: auto;
        margin-right: auto;
        display: block;
        right: auto !important;
        left: auto !important;
    }

    /* Rectangular panels: cap the width, keep the design's crop ratio. */
    .big-round-alumnu { aspect-ratio: 600 / 573; width: min(88vw, 600px); margin-left: auto; margin-right: auto; display: block; }
    .full-costom-pho  { aspect-ratio: 600 / 839; width: min(88vw, 600px); }
    .alumni-2pic      { aspect-ratio: 714 / 625; width: min(92vw, 714px); }
    .thard-round      { aspect-ratio: 354 / 359; width: min(70vw, 354px); }

    /* Floated copy blocks stack instead of sitting beside a photo. */
    .right-side-apply,
    .left-side-apply {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    /* Inset copy wrapper: the design insets it with `margin: 51px 28% 0 5%` and its
       own phone block resets only the width, leaving 33% of side margin against a
       100%-wide box (facilities, arts, why-bit). */
    .this-page2 {
        width: auto;
        margin-left: 0;
        margin-right: 0;
    }
}


/* ==========================================================================
   6b. THE .rounded_style COLLAGE — TABLET BAND ONLY
   --------------------------------------------------------------------------
   Three circles absolutely positioned across each other (`right: -344px`,
   `left: 274px`). our-story ships a phone treatment that makes them relative
   and stacks them, but it stops at 767px, so at 768-991px the desktop offsets
   still applied and pushed the document to 848px.

   Scoped to `min-width: 768px` ON PURPOSE: below that the page's own CSS
   already positions this collage correctly, and a blanket rule here would
   load later and silently overwrite tuning that works.
   ========================================================================== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .rounded_style .fast-round:nth-child(1),
    .rounded_style .secend-round:nth-child(2),
    .rounded_style .thard-round:nth-child(3) {
        position: relative;
        right: auto;
        left: auto;
    }

    /* The 2nd and 3rd tuck under the photo ABOVE them, which is the collage's
       look. The 1st has no sibling above it, so its -93px pulled it out of the
       band entirely and onto the "Why Choose BIT" button in the previous
       section - found by text-cover-check at 768px once the settle was fixed,
       and confirmed by disabling this single rule in the browser.
       This defect predates 2026-08-31; the tool could not see it before. */
    .rounded_style .fast-round:nth-child(1)   { top: 0; }
    .rounded_style .secend-round:nth-child(2) { top: -67px; }
    .rounded_style .thard-round:nth-child(3)  { top: -48px; }
}


/* ==========================================================================
   6c. ACADEMIC CALENDAR KEY-DATES TABLES
   --------------------------------------------------------------------------
   The calendar nests a two-column row INSIDE a col-md-6, so at 768-991px each
   key-dates table is handed a 190px column. A table cannot be squeezed below
   its min-content width, and "Details/Activities" is one unbreakable token, so
   `max-width: 100%` alone left it 201px wide and the page 787px.

   Stacking the nested pair gives each table the full column instead of a
   192px sliver, and `table-layout: fixed` stops cell content from dictating
   the width at all.
   ========================================================================== */
@media (max-width: 991.98px) {
    /* Both levels stack: the outer `col-md-6` kept the tables in half the width
       while the legend column beside it ran out of content, leaving most of a
       tablet screen empty next to tables squeezed into 380px. */
    .page-wrap .row > [class*="col-md-"],
    .page-wrap .col-md-6 > .row > [class*="col-md-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .page-wrap .keydates-table {
        table-layout: fixed;
        width: 100%;
    }

    .page-wrap .keydates-table th,
    .page-wrap .keydates-table td {
        overflow-wrap: anywhere;
    }
}


/* ==========================================================================
   6d. CTA BUTTON ROWS WRAP
   --------------------------------------------------------------------------
   The homepage stats strip lays its calls-to-action out as `d-flex gap-3` with
   no wrap, so at 992px-and-below the buttons kept their intrinsic widths and
   ran 55px off the left and 190px off the right of a 720px container (the page
   measured 1046px at 991px wide). Buttons are the one thing that must stay
   whole, so the row wraps rather than the labels being squeezed.
   ========================================================================== */
@media (max-width: 991.98px) {
    .stats-strip .d-flex,
    .all-button-sweets .d-flex {
        flex-wrap: wrap;
    }

    .stats-strip .btn-youlow-2,
    .stats-strip .btn-style-33,
    .stats-strip .btn-apply {
        max-width: 100%;
    }
}


/* ==========================================================================
   6e. OVERLAP STACKS BECOME PLAIN STACKS ON PHONES
   --------------------------------------------------------------------------
   `bit_overlap_quote` composes a circle, a red quote box and a ringed photo by
   absolutely positioning them across each other:
       .research-box   top: 216px   left: -91px
       .english-photo  top: 170px   right: -43px
       .picture_two    top: -137px  right: 38%
   Those offsets are measured against a two-column desktop band. Once the
   columns stack, the same numbers drop the quote box off the left edge of the
   screen and park the circle on top of the body copy — which is exactly what
   /arts showed: "…develop artistic skills as well as leadership and coll" was
   covered by a photo, and the red box read "T Summer / s enjoy a wide / s-on
   art" with its left third cut off.

   This is NOT caused by the overflow work above — it is visible in a capture
   taken with this stylesheet blocked. It was masked because the page used to
   be 454px wide and the browser zoomed the whole thing out to fit.

   Absolute positioning is what makes the pieces overlap, so on a phone they
   are returned to normal flow and laid out as a centred column. The desktop
   composition is untouched.

   Scoped by CLASS, not by the .huqe wrapper: the same composition is emitted
   by three different elements and by several pages' own CSS, and only
   `bit_overlap_quote` wraps it in .huqe. /arts styles a bare `.research-box`
   from its page CSS (`top: 156px; left: -142px`), so a .huqe-scoped rule
   missed it entirely and the band stayed broken.
   ========================================================================== */
@media (max-width: 991.98px) {
    .research-box,
    .english-photo,
    .picture_one,
    .picture_two,
    .difolt-round-im {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
    }

    .research-box {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    /* Two-class selectors, so they outrank the single-class sizing in §6
       whatever the source order. */
    .huqe {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    .huqe .english-photo,
    .huqe .picture_two,
    .huqe .research-box {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
    }

    .huqe .english-photo,
    .huqe .picture_two {
        width: min(78vw, 420px);
        height: auto;
        aspect-ratio: 1 / 1;
    }

    /* The band that holds these is sized for the desktop composition and keeps
       a tall empty gap once the pieces are back in flow. */
    .section-english,
    .sec_innar_defolt {
        height: auto !important;
    }
}


/* ==========================================================================
   6f. THE THREE SCHOOL CARDS COLLAPSED TO ZERO HEIGHT ON PHONES
   --------------------------------------------------------------------------
   The homepage "Our Schools" band rendered as an EMPTY yellow box on every
   phone — all three cards (Early Years / Junior School / Senior School) were
   412x0. Two faults compound in style.css:

   1. `.school-card` gets `flex: 1 1 0` at line ~2279. At <=768px
      `.school-cards` switches to `flex-direction: column`, which makes that
      `flex-basis: 0` a HEIGHT basis; with `flex-grow: 1` inside an auto-height
      container there is no free space to grow into, so each card resolves to
      zero height and the whole band renders blank.
   2. The design's own phone rule (`width: 100%; max-width: 420px`) sits at
      line ~2380, but an unconditional `.school-card { width: 412px; height:
      412px }` is declared at line ~2473 — LATER, same specificity — so the
      responsive rule never applied and the card was 412px wide on a 375px
      screen as well.

   Restoring intrinsic sizing fixes both: the card sizes from its aspect ratio
   instead of from a flex basis, and is capped to the column.

   Pre-existing, not introduced here — a capture with this stylesheet blocked
   shows the same empty band. It was invisible to every overflow check because
   a zero-height element cannot overflow anything.

   Bounded at 768px rather than 767.98px to match the exact breakpoint where
   the design switches this container to a column.
   ========================================================================== */
@media (max-width: 768px) {
    .school-card {
        flex: 0 0 auto;
        width: 100%;
        max-width: 412px;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    /* The glass badge is a fixed 288x112 pill sized for a 412px card. Once the
       card narrows to the column it reached past both edges, and since the card
       clips (`overflow: hidden`) the badge lost the rounded corners that make it
       read as a pill. Inset it from the card instead of fixing its width. */
    .school-card .card-badge {
        width: auto;
        max-width: calc(100% - 32px);
        min-width: 0;
        padding: 0 16px;
        height: auto;
        min-height: 92px;
    }

    .school-card .badge-text {
        font-size: clamp(22px, 6.6vw, 36px);
        line-height: 1.14;
    }
}


/* ==========================================================================
   6g. PHOTO COLUMNS THAT CARRY ONLY A BACKGROUND IMAGE
   --------------------------------------------------------------------------
   The page builder lets a column hold no elements at all and act purely as a
   photo panel (a `bg_image` column setting — see the row/column settings the
   parity rebuild added). Such a column is sized by its NEIGHBOUR on desktop,
   where the row stretches both to the same height. Once the columns stack it
   has no content of its own, so it collapses to 0px and the photograph simply
   disappears — /martial-arts lost its split image this way.

   `min-height` is used rather than `height` so a column that does hold content
   is never truncated; it can only grow one that would otherwise be empty.
   `background-size: cover` is already set by the row partial.
   ========================================================================== */
@media (max-width: 991.98px) {
    .row > [class*="col-"][style*="background-image"] {
        min-height: min(62vw, 360px);
    }
}


/* ==========================================================================
   7. FULL-HEIGHT SPLIT BANDS
   --------------------------------------------------------------------------
   `.full-height` / `100vh` panels are a desktop composition. On a phone they
   leave a photo column taller than the screen with the copy pushed below the
   fold; letting them size to content is the standard responsive treatment.

   The `:not([style*="background-image"])` matters: an earlier version of this
   rule zeroed the min-height that §6g gives photo-only columns, because this
   section is later in the file and won on source order. A column with no
   content has no "size to content" to fall back on — it sizes to nothing.
   ========================================================================== */
@media (max-width: 767.98px) {
    .row.full-height,
    .row.full-height > [class*="col-"]:not([style*="background-image"]) {
        min-height: 0;
    }

    .img-box img {
        height: auto;
    }
}


/* ==========================================================================
   10. "BIT AT A GLANCE" FLIP CARDS - TEXT WAS CUT OFF, NOT OVERFLOWING
   --------------------------------------------------------------------------
   Reported by the client: "17 bigha campu", "1000" with the "+" gone,
   "Consiste / Top Universi / Placeme". The page was never wider than the
   phone and nothing was covered or collapsed, so all three earlier audit
   passes reported these pages clean - the text was CLIPPED by the card's own
   `overflow: hidden` (.glance-bit-flip-card-front).

   Arithmetic of the defect at 375px: the card is 155px, `.glance-bit-card-
   content` pays 22px of padding each side, the icon is a 36px flex item with
   `flex-shrink: 0`, and the gap is 14px - leaving 61px for the text. "campus"
   measures 61px and "1000+" measures 80px, so they simply ran past the edge.
   The desktop values are a desktop measurement; below 992 the card is a
   fraction of a phone, so the padding, icon and type scale with it.

   `min-width: 0` plus `break-word` on the text column is the backstop: these
   labels are client-editable, so a longer word must wrap rather than clip,
   whatever anyone types later. (`break-word`, NOT `anywhere` - see section 4
   for what `anywhere` did to the header.)
   Regression test: tools/clipped-text-check.cjs.
   ========================================================================== */
@media (max-width: 991.98px) {
    .glance-bit-card-content {
        padding: 14px;
        gap: 10px;
    }

    .glance-bit-card-icon svg {
        width: 30px;
        height: 30px;
    }

    /* A flex item's default min-width:auto is what pins it to its longest word. */
    .glance-bit-card-text-wrap {
        min-width: 0;
        flex: 1 1 auto;
    }

    .glance-bit-card-text-wrap .glance-bit-card-number,
    .glance-bit-card-text-wrap .glance-bit-card-label,
    .glance-bit-card-text-wrap .glance-bit-card-title {
        overflow-wrap: break-word;
    }
}

@media (max-width: 575.98px) {
    .glance-bit-card-content {
        padding: 10px;
        gap: 7px;
    }

    .glance-bit-card-icon svg {
        width: 24px;
        height: 24px;
    }

    /* The design's own floor is 28px, measured on a desktop card three times
       this wide; "1000+" alone is 80px at that size. */
    .glance-bit-card-text-wrap .glance-bit-card-number {
        font-size: clamp(20px, 6.4vw, 28px);
    }

    .glance-bit-card-text-wrap .glance-bit-card-label {
        font-size: 13px;
        letter-spacing: 0;
    }

    .glance-bit-card-text-wrap .glance-bit-card-title {
        font-size: 12px;
        line-height: 1.3;
    }
}


/* ==========================================================================
   11. HOMEPAGE "LIFE AT BIT" CARDS - FIXED 244px TEXT INSIDE A SHRINKING CARD
   --------------------------------------------------------------------------
   `.club-card .body-text` is hardcoded `width: 244px` (a "244x108 hug" in the
   design) while the card itself is `clamp(265px, 20vw, 306px)` and narrows
   further on tablets. Once the card is under ~256px the copy is wider than
   its own card and the card's `overflow: hidden` cuts the last word off.
   Same defect class as section 10, different cause: a fixed width rather than
   an unshrinkable flex item. The excerpt comes from the Life-at-BIT record,
   so its length is client-controlled and cannot be fixed by shortening text.
   ========================================================================== */
@media (max-width: 991.98px) {
    .club-card .body-text {
        width: auto;
        max-width: 100%;
        padding-inline: 14px;       /* keep the copy off the 36px rounded corner */
    }
}


/* ==========================================================================
   12. VERTICAL RHYTHM ON PHONES - "too much gap" (client, 2026-08-31)
   --------------------------------------------------------------------------
   Reported on five pages. Not one bug: every band's vertical spacing is a
   DESKTOP measurement, and on a phone the columns stack so those spacings
   stop sitting BESIDE content and start stacking on top of each other.
   Measured on /our-story between the copy and the next heading: p 16 +
   column 49 + section pb 56 + section pt 56 + column pt 32 + h3 pt 24 =
   137px of nothing. Each value is defensible on its own, which is why this
   was never visible as a single wrong number.

   The section paddings are cut roughly in half rather than removed - the
   bands still need to read as separate bands.
   Regression test: tools/vertical-gap-check.cjs.
   ========================================================================== */
@media (max-width: 767.98px) {
    .sec_innar_defolt,
    .sec_innar_defolt2,
    .sec-fast,
    .last-leg {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    /* A 50px inset written for a two-column band; stacked, it is dead height
       above and below the copy (/arts, /facilities). Second pass took it to
       8px: at 20px it still left 78px above "World-Class Education, Within
       Reach" once its own 16px margin and the next section's pt-3 were added. */
    .this-page2 {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    /* Bootstrap band padding, stacked on top of the section spacing already
       applied above; `!important` because the utility carries it. */
    section.pt-3 {
        padding-top: 8px !important;
    }
}


/* ==========================================================================
   13. THE CTA BAND - 60/60 padding plus a 50px margin, around one line
   --------------------------------------------------------------------------
   This band closes ~20 pages and was the single most common empty space on
   the site: `padding: 60px 0` + `margin-bottom: 50px` + a per-page
   `margin-top` of up to 46px, all INLINE on a class-less <section>, so
   `!important` and the data hook are both required to reach it. The element
   emits data-bit="cta-band" for exactly this purpose.
   ========================================================================== */
@media (max-width: 767.98px) {
    [data-bit="cta-band"] {
        padding-top: 28px !important;
        padding-bottom: 28px !important;
        margin-top: 0 !important;
        margin-bottom: 16px !important;
    }
}


/* ==========================================================================
   14. DESKTOP COLUMN STAGGER IS NOISE ONCE COLUMNS STACK
   --------------------------------------------------------------------------
   `.col-lg-6.pt-5` offsets the right-hand card so a two-column grid reads as
   staggered (/clubs, /pre-play). Below 992 the columns are one above the
   other, so that 48px is simply a hole between two cards - on /clubs it sat
   on top of the row's own 24px gutter, giving 72px between cards.
   Scoped to col-lg-* so a `pt-5` used deliberately elsewhere is untouched.
   ========================================================================== */
@media (max-width: 991.98px) {
    /* Bootstrap's spacing utilities are declared `!important`, so an ordinary
       rule here silently loses - measured: the column still reported pt=48px. */
    [class*="col-lg-"].pt-5 {
        padding-top: 0 !important;
    }

    [class*="col-lg-"].p-5 {
        padding-top: 16px !important;
        padding-bottom: 16px !important;
    }
}


/* ==========================================================================
   15. THE ACADEMIC CALENDAR GRID MUST FILL ITS CARD
   --------------------------------------------------------------------------
   MY OWN REGRESSION, from section 3: `.cal-table { display: block }` was
   added so wide imported tables could scroll instead of pushing the page
   out. On a real <table> that swaps table layout for block layout - the box
   goes full width but the ROWS inside collapse to their content and sit in
   the left third of the card, which is exactly what the client screenshotted.
   The month grids are 7 narrow columns and fit a 375px phone comfortably, so
   they stay a table and simply fill the card. The scroll treatment still
   applies to imported notice tables, whose widths are unknown.
   ========================================================================== */
@media (max-width: 991.98px) {
    .cal-table {
        display: table;
        width: 100%;
        table-layout: fixed;
        overflow-x: visible;
    }
}


/* ==========================================================================
   16. ROUND PHOTOS MUST BE ROUND, NOT OVAL
   --------------------------------------------------------------------------
   `border-radius: 70%` on an image whose width is fluid and whose height is
   fixed draws an ELLIPSE once the column narrows: /our-story measured
   267x320. The design's intent is a circle, so the aspect ratio is pinned
   and the photo is cropped to it rather than stretched.

   ⚠ PHONES ONLY (<=767.98). At 768-991 section 6b deliberately reproduces the
   collage's own offsets (top: -93px and friends), and squaring the images
   there makes them tall enough to sit on top of the "Why Choose BIT" button -
   caught by text-cover-check, which reported it covered by img.fast-round.
   Below 768 the collage is already stacked, so there is nothing to collide.
   ========================================================================== */
@media (max-width: 767.98px) {
    .rounded_style img,
    .difolt-round-im,
    .images_round_setting img {
        aspect-ratio: 1 / 1;
        height: auto;
        object-fit: cover;
    }
}


/* ==========================================================================
   17. LEADERSHIP PORTRAITS FILL THE CARD ON A PHONE
   --------------------------------------------------------------------------
   `144x232` is a desktop measurement, and the card is full-bleed on a phone,
   so the portrait sat as a small tile in a wide red card. It also carried
   `object-fit: fill` on the placeholder, which stretches faces. Full width,
   with the design's own 144:232 portrait ratio preserved and the photo
   cropped rather than distorted.

   ⚠ The PLACEHOLDER (a card with no photo, showing an initial) must NOT get
   the same treatment. Including it here first time round turned four cards on
   /leadership into 488px voids - a full-width empty tile is a far worse gap
   than the small one it replaced. It goes full width to stay consistent with
   the photo cards, but keeps a short fixed height.
   ========================================================================== */
@media (max-width: 991.98px) {
    /* Specificity matters here: the size lives on `.leadership-section
       .leader-img` (two classes), so a `.leader-card img` rule LOSES however
       late it is in the cascade - measured, the portrait stayed 155px wide. */
    .leadership-section .leader-img,
    .leader-card .leader-img,
    .leader-card img {
        width: 100%;
        height: auto;
        aspect-ratio: 144 / 232;
        object-fit: cover;
    }

    /* The placeholder WRAPS the photo, so it must size to it. A fixed height
       here (200px was the first attempt) leaves the taller full-width photo
       overflowing and the name and bio printed on top of it. `auto` also means
       a card whose image is missing collapses instead of drawing the 488px
       void that an aspect-ratio on this element produced. */
    .leadership-section .img-placeholder,
    .leader-card .img-placeholder {
        width: 100%;
        height: auto;
        aspect-ratio: auto;
    }

    /* The photo and the copy are a flex row on desktop; full width means the
       card stacks them. */
    .leader-card .d-flex {
        flex-direction: column;
    }
}


/* ==========================================================================
   18. HARD LINE BREAKS IN HEADINGS ARE A DESKTOP DECISION
   --------------------------------------------------------------------------
   The design writes "Begin Your<br> Application", which is a good break at
   desktop width and a needless two-line heading on a phone where the whole
   phrase fits (measured: 305px of text in 351px of column). Dropping the
   forced break lets the heading wrap only where it genuinely must.
   Headings only - a <br> inside body copy or an address block is content.
   ========================================================================== */
@media (max-width: 991.98px) {
    .titel_in_red br,
    .titel_in_white br,
    .titel_in_youllo br,
    .clous-under-foot br {
        display: none;
    }
}


/* ==========================================================================
   19. PAGE-BUILDER ROW PADDING IS CAPPED, NOT OVERRIDDEN
   --------------------------------------------------------------------------
   Row padding is stored per row and emitted INLINE, so it cannot be reached
   from a stylesheet - and a blanket `!important` would be worse than the bug,
   forcing padding onto rows that deliberately have none. blocks/row.blade.php
   therefore emits the value as a custom property as well
   (`--bit-row-pt:92px; padding-top:var(--bit-row-pt)`), which lets this cap it
   while leaving the stored value, the desktop rendering and rows without any
   padding completely alone.

   The attribute selector is the point: it matches ONLY rows that actually
   carry the variable, which is the closest CSS gets to "has this property".
   Cap is 32px - measured against /our-story, whose 92px bottom padding drew
   an empty yellow band above the footer on every phone.
   ========================================================================== */
@media (max-width: 767.98px) {
    [style*="--bit-row-pt"] {
        padding-top: min(var(--bit-row-pt), 32px);
    }

    [style*="--bit-row-pb"] {
        padding-bottom: min(var(--bit-row-pb), 32px);
    }
}


/* ==========================================================================
   20. INLINE DESKTOP OVERLAP PULLS (top / negative margins)
   --------------------------------------------------------------------------
   Three bands pull themselves upwards with an INLINE offset so they overlap
   the band above: /arts `top: -98px` on a photo, /our-story `top: -96px` with
   `margin-bottom: -100px` on the yellow band, /why-bit `margin-bottom: -60px`.
   Stacked on a phone there is nothing to overlap, so the pull just leaves the
   element's own space empty - /arts showed 141px of nothing under a photo
   that had been drawn 98px higher.

   Surveyed before writing this: exactly FIVE such declarations exist across
   all 31 pages, all of them desktop compositions, which is why an attribute
   selector is safe here rather than reckless. Section 6e does the same job
   for the overlap classes; this covers the inline cases it cannot see.
   The `top:-` variant without a space is matched too - both spellings occur.

   ⚠ PHONES ONLY (<=767.98), for the same reason as section 16: at 768-991
   section 6b reproduces the collage's compensating offsets, which are tuned
   against the band's -96px pull. Removing the pull but keeping those offsets
   dragged the photos up over the "Why Choose BIT" button - text-cover-check
   caught it at 768 and an A/B with the stylesheet blocked confirmed the cause.
   ========================================================================== */
@media (max-width: 767.98px) {
    [style*="top: -"],
    [style*="top:-"] {
        top: auto !important;
    }

    [style*="margin-bottom: -"],
    [style*="margin-bottom:-"] {
        margin-bottom: 0 !important;
    }
}

@media (max-width: 767.98px) {
    /* Paired with the -100px margin above: 92px of inline bottom padding kept
       the footer clear on desktop, and drew an empty yellow band on a phone. */
    .sec_innar_defolt2 {
        padding-bottom: 24px !important;
    }

    /* 60/128 padding around a card grid (/why-bit, /our-philosophy). */
    .values-motion {
        padding-top: 32px;
        padding-bottom: 32px;
    }

    /* Bootstrap's own 48px utilities on full bands (/clubs). */
    section.pb-5 {
        padding-bottom: 24px !important;
    }

    section.pt-5 {
        padding-top: 24px !important;
    }
}


/* ==========================================================================
   21. TWO PHONE RULES IN THE PAGE'S OWN CSS THAT OVERSPACE /our-story
   --------------------------------------------------------------------------
   These are not desktop values leaking down - they are inside the page's own
   `@media (max-width: 767px)` block, so they were written FOR phones and are
   simply too generous once every other spacing above is already stacking:
       .pl-3par { margin-bottom: 49px }
       .pe-3    { padding: 2rem !important }   (32px on all four sides)
   Together with the section paddings they made 170px of empty page between
   the intro copy and the next heading.

   The `.pe-3` override is scoped to the band rather than written bare: `.pe-3`
   is a Bootstrap padding-END utility used across the site, and redefining all
   four sides globally would add padding to every element carrying it on every
   page. The page CSS gets away with that because it is page-local; this file
   is not.
   ========================================================================== */
@media (max-width: 767.98px) {
    .pl-3par {
        margin-bottom: 16px;
    }

    .sec_innar_defolt2 .pe-3 {
        padding: 16px !important;
    }
}


/* ==========================================================================
   22. SECOND PASS ON PHONE SPACING (client, 2026-08-31)
   --------------------------------------------------------------------------
   The first pass halved the section paddings; the client still reads the band
   transitions as too loose. What is left is not section padding at all - it is
   the WRAPPER margins the page stylesheets put around a band's copy, which on
   desktop centre the text against a photo beside it:
       .defolt-why-box  margin: 45.6px 0  padding: 35px 0   (/why-bit hero band)
       .this-page2      margin: 41px 0                      (/why-bit, /arts)
   Measured at 375px: 106px between the "Explore Our Facilities" button and the
   next heading, 103px above "World-Class Education, Within Reach".

   Bootstrap's `.pt-4` on a heading is the same story: 24px designed to balance
   a column, stacked on top of the section padding that already separates them.
   ========================================================================== */
@media (max-width: 767.98px) {
    .sec_innar_defolt,
    .sec_innar_defolt2,
    .sec-fast,
    .last-leg {
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .defolt-why-box {
        margin-top: 16px;
        margin-bottom: 16px;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .this-page2 {
        margin-top: 16px;
        margin-bottom: 16px;
    }

    .pl-3par {
        margin-bottom: 8px;
    }

    .sec_innar_defolt2 .pe-3 {
        padding: 8px 16px !important;
    }

    /* Bootstrap utility, so `!important` is required to reach it. */
    h1.pt-4, h2.pt-4, h3.pt-4, h4.pt-4 {
        padding-top: 8px !important;
    }
}


/* ==========================================================================
   23. THE /our-story CIRCLE COLLAGE ON A PHONE
   --------------------------------------------------------------------------
   The page's own phone CSS positions the three circles as a collage:
       .fast-round   right: -33px  top: -93px
       .secend-round left:    4px  top: -67px
       .thard-round  left:  -10px  top: -48px   + width: 354px
   Two consequences once section 16 makes the photos square (they were drawn as
   ellipses before, so these offsets were tuned against a shorter box):
     * the FIRST circle's -93px lifts it out of its band and onto the "Why
       Choose BIT" button in the section above - the same shape as the 768-991
       defect in section 6b, and reported by the client as "overlap shown";
     * the THIRD is nudged 10px left and is 354px wide in a ~343px column, so
       it reads as left-aligned while the other two look centred.
   The circles keep their overlap with EACH OTHER (that is the collage); they
   just stop leaving their own band and stop drifting sideways.
   ========================================================================== */
@media (max-width: 767.98px) {
    .rounded_style .fast-round:nth-child(1) {
        top: 0;
        right: auto;
    }

    .rounded_style .secend-round:nth-child(2),
    .rounded_style .thard-round:nth-child(3) {
        left: auto;
        right: auto;
    }

    .rounded_style .thard-round {
        width: auto;                /* match the other two rather than overflow */
        height: auto;
    }

    /* The wrapper itself is the reason the last circle read as left-aligned:
       it is ~86% wide (295px in a 343px column) and block-level, so the whole
       collage sat left with 64px of yellow to its right. The three photos also
       carried three different widths (264 / 295 / 354). One width, centred. */
    .rounded_style {
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    .rounded_style img {
        display: block;
        width: 100%;
        height: auto;
        margin-left: auto;
        margin-right: auto;
    }
}


/* ==========================================================================
   24. THE /clubs ICON BADGES WERE EGGS, NOT CIRCLES
   --------------------------------------------------------------------------
   `.pre-play .icon-wrapper` is a fixed 52x52 flex slot, but the badge inside
   it is inline-styled `width:64px; height:64px` (written by bit-card.blade.php
   for icon-image cards). A flex item shrinks in the INLINE axis only, so the
   width was squeezed 64 -> 52 while the height stayed 64: a 52x64 ellipse with
   `border-radius: 50%`.

   Measured across widths: 61x64 at 1366 and 52x64 below 992 - so it is not
   round at ANY width, but only the mobile one is obvious. Desktop is left
   alone deliberately (nothing in this file may touch >=992px); reported to the
   client instead.

   `height: auto` + `aspect-ratio` rather than a fixed size: the width is
   whatever the flex slot allows, and the badge simply matches it, so this
   holds if the design's slot ever changes. `!important` is needed because the
   64px height is inline.
   ========================================================================== */
@media (max-width: 991.98px) {
    .icon-wrapper .ico-y0llow-round {
        height: auto !important;
        aspect-ratio: 1 / 1;
        /* The icon is an INLINE img in this markup, so its baseline descender
           added a 53rd pixel of height to an otherwise square badge. Centring
           it as a flex box removes the line box entirely. */
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
