/**
 * Mobile & tablet responsive overrides — sitewide
 * Loaded last. Does not alter desktop styles outside these media queries.
 * Breakpoints: tablet ≤991.98px | mobile ≤767.98px | small ≤575.98px
 */

/* ==========================================================================
   TABLET (and below) — ≤991.98px
   ========================================================================== */
@media (max-width: 991.98px) {
    :root {
        --space-section: 36px;
        --space-section-sm: 22px;
        --space-section-lg: 48px;
        --space-section-xl: 60px;
    }

    html,
    body {
        overflow-x: clip;
    }

    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Header */
    .site-header__inner {
        min-height: 64px;
        gap: 0.75rem;
    }

    .site-header__logo img {
        max-height: 58px;
    }

    .site-header__cta {
        padding: 0.45rem 0.9rem !important;
        font-size: 0.8rem;
    }

    /* Top bar */
    .top-header {
        font-size: 0.78rem;
    }

    .top-header .container {
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    /* Page hero */
    .page-hero {
        min-height: clamp(220px, 32vh, 360px) !important;
    }

    .page-hero__inner {
        padding: 1.75rem 2rem;
    }

    .page-hero__title {
        font-size: clamp(1.55rem, 3.5vw, 2.25rem);
    }

    .page-hero__lead {
        font-size: 0.98rem;
        line-height: 1.65;
    }

    .page-hero__stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .page-hero__stat {
        padding: 0.75rem 0.5rem;
    }

    /* Content shells — tighter spacing */
    .page-content__intro,
    .adm-content__intro {
        margin-bottom: 1.5rem;
        padding-left: 0;
        padding-right: 0;
    }

    .page-content__inner,
    .adm-content__inner {
        padding-left: 0;
        padding-right: 0;
    }

    .section-heading,
    .page-content__inner h2,
    .page-content__inner .display-6 {
        font-size: clamp(1.3rem, 3vw, 1.7rem);
    }

    .cp-section-title {
        font-size: 1.2rem;
    }

    /* Grids that use wide minmax — prevent horizontal overflow */
    .hub-grid,
    .cp-policy-grid,
    .student-life-grid,
    .sl-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .hub-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.75rem;
        margin-bottom: 1.75rem;
    }

    /* Panels & cards */
    .cp-panel,
    .page-panel,
    .adm-panel {
        padding: 1.25rem;
        margin-bottom: 1.15rem;
    }

    .cp-intro-grid .cp-intro-card {
        padding: 1.25rem;
    }

    .cp-icon-card {
        padding: 1rem;
        gap: 0.85rem;
    }

    /* Footer */
    .site-footer__logo img {
        max-height: 72px;
    }

    .site-footer__cta-inner {
        padding: 1.5rem 0;
        gap: 1.15rem;
    }

    .site-footer__main .row>[class*="col-"] {
        margin-bottom: 1.5rem;
    }

    .site-footer__tagline {
        max-width: none;
    }

    /* CTA band */
    .page-cta__inner,
    .adm-cta__inner {
        gap: 1.15rem;
    }

    /* Forms */
    .form-control,
    .form-select,
    textarea.form-control {
        font-size: 16px;
        /* avoid iOS zoom */
    }

    /* Images / media */
    img,
    video,
    iframe {
        max-width: 100%;
    }

    .page-feature-img,
    .adm-feature-img,
    .cp-split__img img,
    .cp-feature-img img {
        margin-bottom: 1.25rem;
    }

    /* Home — tablet */
    .page-home .hero-video-section,
    .page-home .hero-video-content {
        min-height: clamp(420px, 70vh, 720px);
    }

    .page-home .hero-video-content {
        padding: 4.5rem 0 3.5rem;
        align-items: flex-end;
    }

    .page-home .home-global-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.85rem;
    }

    .page-home .home-accreditation-bar {
        padding: 1.25rem;
        gap: 1rem 1.25rem;
        justify-content: center;
    }

    .page-home .home-deco__blob,
    .page-home .home-deco__ring,
    .page-home .home-deco__triangle,
    .page-home .home-deco__dots {
        opacity: 0.35;
        transform: scale(0.85);
    }

    /* Parents / about */
    .parents-grid {
        grid-template-columns: 1fr;
        gap: 1.15rem;
    }

    .parents-card,
    .parents-card--feature {
        grid-template-columns: 1fr;
        border-radius: 1.5rem;
    }

    .parents-card__media {
        min-height: 220px;
        max-height: 260px;
    }

    .parents-card__body {
        padding: 1.5rem;
    }

    .dl-enquiry {
        position: static;
        margin-top: 1rem;
    }

    /* Tables */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================================
   MOBILE — ≤767.98px
   ========================================================================== */
@media (max-width: 767.98px) {
    :root {
        --space-section: 28px;
        --space-section-sm: 20px;
        --space-section-lg: 36px;
        --space-section-xl: 44px;
    }

    body {
        font-size: 0.95rem;
    }

    .container,
    .container-fluid {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    /* ---- Top header ---- */
    .top-header .container>.row {
        gap: 0.25rem;
        row-gap: 0.2rem;
    }

    .top-header .d-flex.gap-4 {
        gap: 0.5rem !important;
        flex-wrap: wrap;
        justify-content: flex-start !important;
    }

    .top-header a {
        font-size: 0.7rem;
        line-height: 1.35;
    }

    .top-header .col-md-6.d-flex {
        justify-content: flex-start !important;
        width: 100%;
    }

    .top-header .btn {
        padding: 0.25rem 0.55rem;
        font-size: 0.68rem;
    }

    /* ---- Site header ---- */
    .site-header__inner {
        min-height: 56px;
        gap: 0.5rem;
    }

    .site-header__logo img {
        max-height: 48px;
    }

    .site-header__toggle {
        width: 40px;
        height: 40px;
    }

    .site-header__cta {
        display: none;
    }

    /* ---- Page hero ---- */
    .page-hero {
        min-height: clamp(200px, 28vh, 300px) !important;
        align-items: flex-end;
    }

    .page-hero__inner {
        padding: 1.25rem 1.5rem !important;
    }

    .page-hero__breadcrumb {
        margin-bottom: 0.85rem;
        font-size: 0.75rem;
        gap: 0.25rem 0.35rem;
    }

    .page-hero__eyebrow {
        margin-bottom: 0.55rem;
        padding: 0.22rem 0.65rem;
        font-size: 0.7rem;
    }

    .page-hero__title {
        font-size: clamp(1.35rem, 6vw, 1.85rem) !important;
        margin-bottom: 0.5rem;
        line-height: 1.2;
    }

    .page-hero__lead {
        font-size: 0.9rem;
        line-height: 1.6;
        max-width: none;
    }

    .page-hero__stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        margin-top: 1rem;
    }

    .page-hero__stat {
        padding: 0.75rem 0.85rem;
        text-align: left;
        display: flex;
        align-items: baseline;
        gap: 0.65rem;
    }

    .page-hero__stat-value {
        margin-bottom: 0;
        font-size: 0.9rem;
    }

    .page-hero__stat-label {
        font-size: 0.7rem;
    }

    /* ---- Content ---- */
    .space,
    .space-sm,
    .space-lg,
    .space-xl {
        padding-top: var(--space-section) !important;
        padding-bottom: var(--space-section) !important;
    }

    .space-top {
        padding-top: var(--space-section) !important;
    }

    .space-bottom {
        padding-bottom: var(--space-section) !important;
    }

    .page-content__intro,
    .adm-content__intro {
        text-align: left;
        margin: 0 0 1.25rem !important;
        max-width: none;
    }

    .page-content__intro .section-lead,
    .adm-content__intro .section-lead,
    .section-lead {
        font-size: 0.95rem;
        line-height: 1.65;
    }

    .section-heading {
        font-size: 1.35rem !important;
        line-height: 1.25;
        margin-bottom: 0.75rem;
    }

    .section-eyebrow {
        font-size: 0.7rem;
        margin-bottom: 0.55rem;
        padding: 0.22rem 0.65rem;
    }

    .cp-section-title {
        font-size: 1.15rem !important;
        margin-bottom: 0.75rem;
    }

    .page-content__inner h2,
    .page-content__inner .display-6,
    .page-content__inner h3 {
        margin-top: 0.5rem;
    }

    .page-content__inner .accent-line,
    .accent-line {
        margin-bottom: 1rem;
        width: 48px;
    }

    .page-panel,
    .adm-panel,
    .cp-panel {
        padding: 1.1rem;
        border-radius: 12px;
        margin-bottom: 1rem;
    }

    .page-panel h3,
    .adm-panel h3 {
        font-size: 1.05rem;
    }

    /* Grids → single column */
    .hub-grid,
    .cp-policy-grid {
        grid-template-columns: 1fr;
        gap: 0.95rem;
    }

    .hub-card__img img {
        height: 180px;
    }

    .hub-card__body {
        padding: 1.15rem;
    }

    .hub-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
        margin-bottom: 1.35rem;
    }

    .hub-stat {
        padding: 0.9rem 0.65rem;
    }

    .hub-stat__value {
        font-size: 1.05rem;
    }

    .hub-contact {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    /* CP components */
    .cp-flow {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: 0.65rem;
    }

    .cp-flow__line {
        display: none;
    }

    .cp-pill-row {
        justify-content: flex-start;
        margin-bottom: 1.25rem;
        gap: 0.5rem;
    }

    .cp-pill {
        padding: 0.45rem 0.85rem;
        font-size: 0.72rem;
    }

    .cp-icon-card {
        flex-direction: row;
        align-items: flex-start;
    }

    .cp-icon-card__icon {
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .cp-next-step {
        flex-direction: column;
        text-align: left;
        gap: 1rem;
    }

    .cp-next-step__img {
        width: 100%;
        flex: none;
    }

    .cp-leader-card__photo img {
        max-width: 100%;
    }

    .cp-quote {
        padding: 0.85rem 1rem 0.85rem 1.15rem;
    }

    .cp-quote p {
        font-size: 0.95rem;
    }

    .cp-legal-doc section+section {
        margin-top: 1.35rem;
        padding-top: 1.35rem;
    }

    .about-quote {
        padding: 1rem;
        margin-bottom: 1.15rem;
    }

    /* Buttons */
    .cis-btn {
        font-size: 0.875rem;
        padding: 0.7rem 1.1rem;
        width: auto;
        max-width: 100%;
    }

    .cis-btn svg {
        margin-left: 0.5rem;
    }

    /* Page / admissions CTA */
    .page-cta__inner,
    .adm-cta__inner {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        gap: 1rem;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    .page-cta__copy h2,
    .adm-cta__copy h2 {
        font-size: 1.25rem;
    }

    .page-cta__copy p,
    .adm-cta__copy p {
        font-size: 0.9rem;
        max-width: none;
    }

    .page-cta__actions,
    .adm-cta__actions {
        width: 100%;
        flex-direction: column;
    }

    .page-cta__actions .cis-btn,
    .adm-cta__actions .cis-btn {
        width: 100%;
        flex: none;
        min-width: 0;
    }

    /* Footer */
    .site-footer__cta-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 1.35rem 0;
        gap: 1rem;
    }

    .site-footer__cta-actions {
        width: 100%;
        flex-direction: column;
    }

    .site-footer__cta-actions .cis-btn {
        width: 100%;
        flex: none;
        min-width: 0;
    }

    .site-footer__logo img {
        max-height: 64px;
    }

    .site-footer__brand-title {
        font-size: 1.15rem;
    }

    .site-footer__heading {
        margin-bottom: 0.85rem;
    }

    .site-footer__links li+li {
        margin-top: 0.4rem;
    }

    .site-footer__main {
        padding-top: 1.75rem;
        padding-bottom: 0.5rem;
    }

    .site-footer__main .row>[class*="col-"] {
        margin-bottom: 1.35rem;
    }

    .site-footer__bottom-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.65rem;
        padding: 1rem 0;
    }

    .site-footer__legal {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem 0.85rem;
    }

    .site-footer__social {
        justify-content: flex-start;
    }

    .site-footer__contact-item {
        gap: 0.65rem;
    }

    .site-footer__contact-icon {
        width: 36px;
        height: 36px;
    }

    .back-to-top {
        right: 0.85rem;
        bottom: 0.85rem;
        width: 42px;
        height: 42px;
    }

    /* Contact page */
    .page-contact .col-lg-5 .page-content__intro {
        text-align: left;
    }

    .page-contact .contact-detail {
        padding: 1rem;
        gap: 0.75rem;
    }

    .page-contact .contact-detail__icon {
        width: 42px;
        height: 42px;
    }

    .page-contact .contact-actions {
        flex-direction: column;
    }

    .page-contact .contact-action-btn {
        width: 100%;
        justify-content: center;
    }

    /* Forms */
    .row.g-3,
    .row.g-4 {
        --bs-gutter-y: 0.85rem;
    }

    /* Accordion */
    .page-content .accordion-button,
    .adm-content .accordion-button {
        font-size: 0.92rem;
        padding: 0.85rem 1rem;
    }

    .page-content .accordion-body,
    .adm-content .accordion-body {
        padding: 0.85rem 1rem 1rem;
        font-size: 0.92rem;
    }

    /* Parents */
    .parents-page {
        padding-bottom: 1.5rem;
    }

    .parents-page__intro {
        margin-bottom: 1.25rem;
        text-align: left;
    }

    .parents-page__intro h2 {
        font-size: clamp(1.35rem, 5vw, 1.85rem);
        text-align: left;
    }

    .parents-page__intro p {
        font-size: 0.95rem;
        line-height: 1.65;
        text-align: left;
    }

    .parents-card {
        border-radius: 1.25rem;
    }

    .parents-card__media {
        min-height: 180px;
        max-height: 200px;
    }

    .parents-card__body {
        padding: 1.15rem;
    }

    .parents-card__body h3 {
        font-size: 1.25rem;
        margin-bottom: 0.65rem;
    }

    /* Legacy dl-hero */
    .dl-hero {
        padding: 1.75rem 0;
    }

    .dl-hero__title {
        font-size: 1.45rem;
    }

    .dl-hero__subtitle {
        font-size: 0.92rem;
    }

    .dl-page__main h2 {
        font-size: 1.25rem;
    }

    .dl-page__main h3 {
        font-size: 1.1rem;
    }

    .dl-enquiry {
        padding: 1.25rem 1rem;
    }

    /* ------------------------------------------------------------------
       HOME PAGE — remove empty space, tighten layout
       ------------------------------------------------------------------ */
    .page-home .hero-video-section {
        min-height: 0;
        background: linear-gradient(145deg, #031018 0%, #0a2840 45%, #1a66a6 100%);
    }

    .page-home .hero-video-wrapper {
        display: none;
    }

    .page-home .hero-video-content {
        min-height: 0;
        padding: 3.25rem 0 2.5rem;
        align-items: center;
    }

    .page-home .hero-video-content h1 {
        font-size: clamp(1.55rem, 7vw, 2rem);
        margin-bottom: 0.85rem;
    }

    .page-home .hero-video-content p {
        font-size: 0.95rem;
        line-height: 1.6;
        max-width: none;
    }

    .page-home .home-hero-chip {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
        margin-bottom: 0.85rem;
    }

    .page-home .hero-video-actions {
        flex-direction: column;
        margin-top: 1.35rem;
        gap: 0.65rem;
        width: 100%;
    }

    .page-home .hero-video-actions .cis-btn {
        width: 100%;
    }

    .page-home .hero-scroll-hint {
        display: none;
    }

    /* Reduce decorative clutter / empty visual space */
    .page-home .home-page-bg,
    .page-home .home-deco {
        display: none;
    }

    .page-home .section-intro {
        max-width: none;
        text-align: left;
        margin-bottom: 1.25rem;
    }

    .page-home .section-heading {
        font-size: 1.35rem !important;
    }

    .page-home .section-intro p {
        font-size: 0.92rem;
    }

    .page-home .accent-line {
        margin: 0 0 0.75rem;
    }

    .page-home .home-stats {
        padding: 1.15rem 0;
    }

    .page-home .home-stats__value {
        font-size: 1.65rem;
    }

    .page-home .home-stats__label {
        font-size: 0.68rem;
    }

    .page-home .home-stats .col-6,
    .page-home .home-stats .col-md-3 {
        margin-bottom: 0.75rem;
    }

    .page-home .home-global-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .page-home .home-global-item {
        padding: 1rem 0.55rem;
    }

    .page-home .home-global-item__value {
        font-size: 1.25rem;
    }

    .page-home .home-global-item__label {
        font-size: 0.7rem;
    }

    .page-home .home-stage-card,
    .page-home .home-feature-card {
        padding: 1rem;
        margin-bottom: 0.85rem;
    }

    .page-home .home-stage-card__body {
        padding: 1rem;
    }

      .page-home .home-stage-card__grade {
        width: 120px;
        font-size: 0.75rem;
        text-align: center;
    }

    .page-home .home-stage-card h3,
    .page-home .home-pathway-card h3 {
        font-size: 1.05rem;
    }

    .page-home .home-pathway-card__body {
        padding: 1rem;
    }

    .page-home .home-accreditation-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.85rem 1rem;
        padding: 1rem 0.75rem;
    }

    .page-home .home-accreditation-item {
        min-width: 0;
        flex: 1 1 40%;
        text-align: center;
    }

    .page-home .home-accreditation-item__badge {
        width: 56px;
        height: 56px;
        font-size: 0.72rem;
        margin-left: auto;
        margin-right: auto;
    }

    .page-home .home-cocurricular-card {
        margin-bottom: 0.85rem;
    }

    .page-home .home-cocurricular-card__overlay {
        padding: 1rem;
    }

    .page-home .home-cocurricular-card__overlay h3 {
        font-size: 1.05rem;
    }

    .page-home .home-admission-step {
        padding: 1.15rem;
        margin-bottom: 0.85rem;
    }

    .page-home .home-admission-card {
        padding: 1.15rem !important;
        border-radius: 12px;
    }

    .page-home .home-contact-box {
        padding: 1rem !important;
        margin-top: 1rem;
    }

    .page-home #inquire {
        scroll-margin-top: 80px;
    }

    .page-home .home-image-frame {
        margin-bottom: 1rem;
        border-radius: 12px;
        overflow: hidden;
    }

    /* Bootstrap utility overrides that leave gaps on mobile */
    .page-home .mb-5 {
        margin-bottom: 1.5rem !important;
    }

    .page-home .mt-5,
    .page-home .my-5 {
        margin-top: 1.5rem !important;
    }

    .page-home .py-5 {
        padding-top: 1.75rem !important;
        padding-bottom: 1.75rem !important;
    }

    .page-home .g-4,
    .page-home .gy-4 {
        --bs-gutter-y: 1rem;
    }

    /* Admissions 2026 landing extras */
    .ad26-pillars__grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .ad26-pillar-card {
        padding: 1.15rem;
    }

    /* Gallery / blog cards */
    .gallery-card,
    .blog-card,
    .premium-card {
        margin-bottom: 0.85rem;
    }

    /* Prevent horizontal scroll from wide children */
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .row>* {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    main {
        min-height: 50vh;
        overflow-x: clip;
    }

    /* iframe embeds (maps, videos) */
    iframe {
        max-width: 100%;
    }

    .ratio,
    .ratio-16x9 {
        max-width: 100%;
    }
}

/* ==========================================================================
   SMALL PHONES — ≤575.98px
   ========================================================================== */
@media (max-width: 575.98px) {
    :root {
        --space-section: 22px;
        --space-section-sm: 18px;
        --space-section-lg: 30px;
        --space-section-xl: 36px;
    }

    .container,
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .site-header__logo img {
        max-height: 42px;
    }

    .page-hero {
        min-height: clamp(180px, 26vh, 260px) !important;
    }

    .page-hero__title {
        font-size: 1.3rem !important;
    }

    .hub-stats {
        grid-template-columns: 1fr 1fr;
    }

    .page-home .hero-video-content {
        padding: 2.75rem 0 2rem;
    }

    .page-home .hero-video-content h1 {
        font-size: 1.45rem;
    }

    .page-home .home-global-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem;
    }

    .page-home .home-global-item {
        padding: 0.85rem 0.4rem;
    }

    .page-home .home-global-item__value {
        font-size: 1.15rem;
    }

    .page-home .home-accreditation-item {
        flex: 1 1 45%;
    }

   

    .cis-btn {
        padding: 0.65rem 0.95rem;
        font-size: 0.82rem;
    }

    .cp-panel,
    .page-panel,
    .adm-panel {
        padding: 0.95rem;
    }

    .parents-card__media {
        min-height: 160px;
        max-height: 180px;
    }

    .site-footer__logo img {
        max-height: 56px;
    }

    .top-header {
        display: none;
    }
}

/* ==========================================================================
   LANDSCAPE PHONES — short viewport height
   ========================================================================== */
@media (max-width: 991.98px) and (max-height: 500px) {

    .page-home .hero-video-section,
    .page-home .hero-video-content {
        min-height: 0;
    }

    .page-home .hero-video-content {
        padding: 2rem 0 1.5rem;
    }

    .page-hero {
        min-height: 160px !important;
    }
}