/*
 * BGPM Mobile Responsive Stylesheet v2
 *
 * Master responsive stylesheet for D.A.V. Boys Senior Secondary School website.
 * Loaded last via common_header_elements.html to override all existing styles.
 *
 * School Colors:
 *   Maroon: #58151C
 *   Gold:   #FFC107
 *
 * Sections:
 *   1. Global Base Resets (all viewports)
 *   2. Navigation Fixes (all viewports)
 *   3. Hamburger Menu Styles
 *   4. Tablet (max-width: 991.98px)
 *   5. Small Tablet (max-width: 767.98px)
 *   6. Phone Portrait (max-width: 575.98px)
 *   7. Accessibility & Print
 */

/* ==========================================================================
   Section 1 — Global Base Resets (all viewports)
   Override destructive rules from about-us-modal.css:
     img { height: 300px; width: 400px }
   ========================================================================== */

img {
  max-width: 100% !important;
  height: auto !important;
}

iframe,
video,
embed,
object {
  max-width: 100%;
}

table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

thead,
tbody,
tfoot,
tr,
td,
th {
  display: revert;
}

html,
body {
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}


/* --- Hide "Made by Team DARVIS" ticker bar on all viewports --- */
div[style*="width: 100%"][style*="display: flex"]>div[style*="height: 60px"][style*="width: fit-content"] {
  display: none !important;
}

div[style*="width: 100%"][style*="display: flex"]>div>marquee {
  display: none !important;
}

/* Target the parent flex container holding the DARVIS ticker + marquee */
div[style*="width: 100%"][style*="display: flex"]:has(> div[style*="width: fit-content"] > h6[style*="background-color: #58151c"]) {
  display: none !important;
}


/* --- Fix broken chatbot toggle button image — replace with CSS icon --- */
#chatbot-toggle-btn img {
  display: none !important;
}

#chatbot-toggle-btn {
  width: 50px !important;
  height: 50px !important;
  border-radius: 50% !important;
  background-color: #58151C !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#chatbot-toggle-btn::after {
  content: "\f075";
  /* FontAwesome comment icon */
  font-family: "Font Awesome 5 Pro", "Font Awesome 5 Free", "FontAwesome";
  font-weight: 900;
  font-size: 22px;
  color: #FFC107;
}


/* ==========================================================================
   Section 2 — Navigation Fixes (all viewports)
   Override dav-bootstrap.min.css broken 5px font-size media query
   and base_theme.css 13px nav font-size
   ========================================================================== */

.navbar .nav-link {
  font-size: 14px !important;
  padding: 0px 12px !important;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.navbar .dropdown-item {
  font-size: 14px !important;
  padding: 8px 16px !important;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.navbar .container-fluid .collapse .navbar-nav .nav-item .nav-link {
  font-size: 14px !important;
}


/* ==========================================================================
   Section 3 — Hamburger Menu Styles
   Maroon/gold school-branded mobile navigation
   ========================================================================== */

.navbar-toggler {
  border: 2px solid #58151C !important;
  padding: 6px 10px;
  background-color: transparent;
  border-radius: 4px;
}

.navbar-toggler .fas.fa-bars {
  color: #58151C;
  font-size: 20px;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 3px rgba(88, 21, 28, 0.3);
  outline: none;
}

/* Mobile nav panel when collapsed */
@media (max-width: 991.98px) {

  /* --- Compact the navbar bar itself --- */
  .navbar.sticky-top {
    padding: 4px 0 !important;
    min-height: auto !important;
  }

  .navbar .container-fluid {
    padding: 0 8px !important;
    justify-content: flex-end !important;
  }

  /* Kill the empty navbar-brand anchor that wastes space */
  .navbar-brand.d-block.d-sm-block {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Kill leftover Eshiksha mb-3 margin */
  .navbar .d-none.d-xl-block {
    display: none !important;
    margin: 0 !important;
  }

  /* Hamburger button tight to right */
  .navbar-toggler {
    margin: 4px 0 !important;
    padding: 5px 9px !important;
  }

  /* --- Navbar needs relative positioning for overlay child --- */
  .navbar.sticky-top .container-fluid {
    position: relative;
  }

  /* --- Opened nav panel: OVERLAY on top of content --- */
  .navbar-collapse {
    position: absolute !important;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background-color: #FFC107;
    border-radius: 0 0 12px 12px;
    padding: 4px 0;
    margin-top: 0;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }

  .navbar-collapse .navbar-nav {
    padding: 0;
  }

  .navbar-collapse .navbar-nav .nav-item {
    border-bottom: 1px solid rgba(88, 21, 28, 0.12);
  }

  .navbar-collapse .navbar-nav .nav-item:last-child {
    border-bottom: none;
  }

  .navbar-collapse .navbar-nav .nav-link {
    color: #58151C !important;
    font-size: 15px !important;
    font-weight: 600;
    padding: 10px 16px !important;
    min-height: 44px;
  }

  .navbar-collapse .navbar-nav .nav-link:hover,
  .navbar-collapse .navbar-nav .nav-link:active {
    background-color: #58151C;
    color: #FFC107 !important;
  }

  .navbar-collapse .dropdown-menu {
    background-color: rgba(88, 21, 28, 0.08);
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
  }

  .navbar-collapse .dropdown-item {
    color: #58151C !important;
    font-size: 14px !important;
    padding: 8px 28px !important;
    min-height: 40px;
  }

  .navbar-collapse .dropdown-item:hover,
  .navbar-collapse .dropdown-item:active {
    background-color: #58151C;
    color: #FFC107 !important;
  }
}


/* ==========================================================================
   Section 4 — Tablet (max-width: 991.98px)
   Carousel, sidebar, counters, activities, footer, chatbot, modals, forms
   ========================================================================== */

@media (max-width: 991.98px) {

  /* --- Header banner: balanced layout --- */
  .custom-bar-container {
    height: auto !important;
    padding: 10px 12px !important;
    flex-wrap: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
  }

  .custom-emblem-container {
    width: auto !important;
    height: auto !important;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .custom-name-container {
    font-size: 16px !important;
    flex: 1 1 auto !important;
    width: auto !important;
    text-align: center !important;
    padding: 0 4px !important;
  }

  .custom-logo-container {
    width: auto !important;
    height: auto !important;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .emblem {
    height: 55px !important;
    width: 44px !important;
    margin-bottom: 0 !important;
  }

  .custom-logo-container img {
    height: 50px !important;
    width: 46px !important;
  }

  /* --- Carousel: edge-to-edge, no gaps --- */
  #carouselExampleControls,
  #dav-carousel-main-top,
  .carousel {
    height: auto !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .carousel-item {
    height: auto !important;
  }

  .carousel-item>img {
    position: relative !important;
    height: auto !important;
    min-width: 100%;
    width: 100%;
    object-fit: cover;
  }

  .desktop-version-carousel {
    width: 100% !important;
  }

  /* --- Index page: carousel parent flex container --- */
  /* The flex parent wrapping carousel + sidebar needs to go full-width, no gaps */
  div[style*="display: flex"]>#dav-carousel-main-top,
  div[style*="display: flex"]>.desktop-version-carousel {
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  /* --- Index page sidebar (hidden at <800px via inline styles, reinforce) --- */
  #carousel-side-card-container {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }

  /* Marquee/Ticker bar — hidden via global rule above */

  /* --- Counters: compact horizontal row --- */
  .home-counters {
    height: auto !important;
    padding: 15px 10px !important;
  }

  .home-counters .home-container {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px;
    padding: 10px;
  }

  .home-counters .home-container>div {
    padding: 8px 4px !important;
  }

  .home-counters .home-container>div:nth-of-type(1),
  .home-counters .home-container>div:nth-of-type(2) {
    padding-bottom: 8px !important;
  }

  /* --- Activities grid boxes --- */
  .grid-container {
    padding: 10px;
    gap: 10px;
  }

  .grid-box {
    width: 45% !important;
    min-width: 140px;
    max-width: 230px;
    margin: 5px;
  }

  .grid-box-three {
    width: 100% !important;
    max-width: 400px;
    height: auto !important;
    margin: 8px auto;
  }

  .grid-box-four {
    width: 100% !important;
    max-width: 420px;
    height: auto !important;
    margin: 8px auto;
  }

  .grid-box-sport {
    width: 100% !important;
    max-width: 500px;
    height: auto !important;
    margin: 8px auto;
  }

  .sports-slider {
    width: 100% !important;
    height: auto !important;
    min-height: 250px;
    background-size: contain !important;
  }

  /* --- NCC / Scouts images --- */
  .ncc-img,
  .scouts-img {
    width: 100% !important;
    max-width: 100%;
    height: 220px;
    background-size: cover !important;
  }

  .ncc-container,
  .scouts-container {
    flex-direction: column;
    align-items: center;
    padding: 10px;
  }

  .ncc-text,
  .scouts-text {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px;
  }

  /* --- Footer: clean mobile layout --- */
  footer.footer {
    padding: 24px 12px 16px !important;
  }

  #footer-row-spl {
    flex-direction: column !important;
    align-items: center;
    text-align: center;
    gap: 0;
  }

  #footer-row-spl>div,
  #footer-row-spl>section,
  #footer-row-spl>.col-sm-6 {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 0;
    height: auto !important;
  }

  /* "Developed by DARVIS" — de-emphasize */
  footer h5[style*="font-size:26px"] {
    font-size: 13px !important;
    padding-bottom: 4px !important;
    margin-bottom: 4px !important;
    opacity: 0.8;
  }

  footer h5 a[style*="font-size:30px"] {
    font-size: 16px !important;
  }

  /* School list headings */
  footer h4 {
    font-size: 15px !important;
    font-weight: 700;
    margin: 10px 0 6px !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  /* School list text — compact, two-column where possible */
  footer span[style*="font-size:19px"] {
    font-size: 12px !important;
    line-height: 1.6 !important;
    display: block;
  }

  /* Footer section headings */
  footer h5 {
    font-size: 14px !important;
    padding-bottom: 4px !important;
    margin-bottom: 6px !important;
  }

  footer h6 {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  /* HR separators — thinner, subtle */
  footer hr {
    margin: 10px auto !important;
    opacity: 0.3;
    width: 80%;
  }

  /* Map — full-width, reasonable height */
  footer iframe {
    width: 100% !important;
    height: 150px !important;
    border-radius: 6px;
  }

  footer .embed-responsive {
    width: 100% !important;
  }

  /* "Reach Us Here!" map container */
  footer div[style*="width:400px"] {
    width: 100% !important;
  }

  /* Contact buttons — stack vertically, uniform */
  footer .contact-btns {
    width: 100%;
  }

  footer .contact-btns>div {
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px;
  }

  footer .contact-btns .btn {
    font-size: 13px !important;
    padding: 8px 16px !important;
    margin: 0 !important;
    width: 80%;
    max-width: 280px;
    display: block;
    border-radius: 6px;
    white-space: nowrap;
  }

  /* Footer rows */
  footer .row {
    flex-direction: column;
    align-items: center;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Copyright row */
  footer .row:last-child {
    margin-top: 8px !important;
  }

  footer .row:last-child .col-sm-6 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  footer .row:last-child p {
    margin-bottom: 2px !important;
    font-size: 11px !important;
  }

  /* Override chatbot style that forces body height */
  body {
    height: auto !important;
    min-height: 100vh;
  }

  /* --- Gallery carousel: full-width on mobile --- */
  .sc-center {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 16px 12px !important;
    gap: 0 !important;
  }

  .gallery-container {
    width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
    overflow: hidden;
  }

  .gallery-container .carousel-inner {
    width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
  }

  .gallery-container .carousel-item img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 0 !important;
  }

  /* --- Message Cards Section --- */
  #specialRow {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 10px !important;
  }

  /* #secretaryCard,
  #directorCard,
  #principalCard {
    padding-left: 10px !important;
    padding-right: 10px !important;
  } */

  #principalpic {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
  }

  #principalpic img {
    width: 100% !important;
    max-width: 300px !important;
    margin: 0 auto 15px auto !important;
  }

  #princquote p {
    max-width: 100% !important;
    text-align: center !important;
  }

  /* --- Social channels (#socialchannels on index.html) --- */
  #socialchannels {
    height: auto !important;
    overflow: visible !important;
    padding: 20px 16px 24px !important;
  }

  #socialchannels br {
    display: none;
  }

  #socialchannels .sc-h1 {
    font-size: 1.15em !important;
    margin-bottom: 16px !important;
    letter-spacing: 0.5px;
    color: #FFC107;
  }

  #socialchannels .sc-btn {
    display: flex !important;
    align-items: center;
    width: 70%;
    max-width: 220px;
    margin: 8px auto !important;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  #socialchannels .sc-btn:active {
    transform: scale(0.97);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  }

  #socialchannels .sc-btn>i {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.15em;
    float: none !important;
    padding: 0 !important;
    background: #3a0a0f !important;
    color: #FFC107 !important;
  }

  #socialchannels .sc-btn>span {
    flex: 1;
    padding: 11px 14px !important;
    font-size: 14px;
    font-weight: 600;
    color: #58151C !important;
    background: #FFC107 !important;
    text-align: center;
    float: none !important;
  }

  /* --- Chatbot --- */
  df-messenger {
    width: calc(100% - 30px) !important;
    max-width: 380px !important;
  }

  /* --- Curriculum --- */
  .paper {
    width: 95% !important;
    max-width: 95% !important;
    height: auto !important;
    margin: 20px auto !important;
  }

  .paper:hover {
    transform: none !important;
  }

  /* Curriculum body has padding: 8em 0 — way too much on mobile.
     Also curriculum.css sets body min-height via padding. Override both. */
  body {
    padding: 0 !important;
  }

  /* --- Publications slider --- */
  .subjects {
    height: auto !important;
    min-height: auto !important;
    padding: 20px 0 !important;
  }

  .slider {
    width: 92% !important;
    height: auto !important;
    min-height: 280px;
    padding: 15px !important;
  }

  .slides-container {
    height: auto !important;
  }

  .slide {
    flex-direction: column !important;
    padding: 15px !important;
    height: auto !important;
    align-items: flex-start !important;
  }

  .slide-description,
  .slide-picture {
    flex: none !important;
    width: 100%;
  }

  .slide-picture {
    text-align: center;
    margin-top: 10px;
    max-height: 200px;
    overflow: hidden;
  }

  .slide-description p {
    font-size: 1.2rem !important;
  }

  .slide-description h2 {
    font-size: 1.5rem !important;
    margin-bottom: 10px !important;
  }

  .prev {
    left: 2% !important;
  }

  .next {
    right: 2% !important;
  }

  /* --- Publication cards --- */
  .cards-wrapper {
    grid-template-columns: 1fr 1fr !important;
    grid-gap: 1.5rem !important;
    padding: 1.5rem !important;
    width: auto !important;
  }

  /* --- Modals --- */
  .modal-dialog {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto !important;
  }

  .modal-body {
    max-height: 80vh !important;
    overflow-y: auto !important;
  }

  /* --- Onload admission popup: full-width image on mobile --- */
  #admissionModal .modal-dialog {
    width: calc(100% - 16px) !important;
    max-width: 100% !important;
    margin: 8px !important;
  }

  #admissionModal .modal-content {
    border: none;
    border-radius: 8px;
    overflow: hidden;
  }

  #admissionModal .modal-body {
    padding: 0 !important;
    max-height: 90vh !important;
  }

  #admissionModal .modal-body img {
    width: 100% !important;
    height: auto !important;
    display: block;
  }

  /* --- Forms --- */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important;
    /* Prevents iOS zoom on focus */
    width: 100% !important;
    max-width: 100%;
    min-height: 44px;
  }

  /* --- Featurette headings --- */
  .featurette-heading {
    font-size: 28px !important;
    margin-top: 2rem !important;
  }

  /* --- Director/Principal message cards: consistent styling --- */
  #directorCard,
  #principalCard {
    width: 100% !important;
    max-width: 100% !important;
    margin: 10px auto !important;
    padding: 0 8px;
  }

  /* Principal quote text — wrap in card-like styling to match Director */
  #principalCard #princquote {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 16px;
    margin: 10px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  #principalCard #princquote p {
    color: #333 !important;
    max-width: 100% !important;
  }

  /* Principal "Read More" button — pull inside the card area */
  #principalCard #readMorethree {
    padding: 0 8px 10px 8px;
  }

  /* Principal photo container — stack vertically on mobile */
  #principalCard #principalpic {
    flex-direction: column !important;
    align-items: center !important;
  }

  /* Both cards' images — constrain width */
  /* #directorCard img.card-img-top,
  #principalCard img.card-img-top {
    max-width: 60% !important;
  } */

  /* --- Flip cards (if present) --- */
  .flip-card {
    width: 100% !important;
    max-width: 350px;
    margin: 10px auto;
  }

  /* --- About us gallery --- */
  #gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 8px;
  }

  #gallery img {
    width: calc(50% - 8px) !important;
    height: auto !important;
    padding-bottom: 0 !important;
  }
}


/* ==========================================================================
   Section 5 — Small Tablet (max-width: 767.98px)
   Headings, social buttons, gallery, NCC images, flip cards
   ========================================================================== */

@media (max-width: 767.98px) {

  /* --- Hide "Visit DAV Group" button --- */
  .custom-logo-container .btn {
    display: none !important;
  }

  /* --- Header banner tighter --- */
  .custom-bar-container {
    padding: 6px 4px !important;
  }

  .custom-name-container {
    font-size: 14px !important;
  }

  .custom-navbar-name {
    font-size: 14px !important;
    line-height: 1.3;
  }

  /* --- Heading overrides --- */
  h1 {
    font-size: 24px !important;
    margin: 0.8rem 0 !important;
  }

  h2 {
    font-size: 20px !important;
  }

  h3 {
    font-size: 17px !important;
  }

  h4,
  h5,
  h6 {
    font-size: 15px !important;
  }

  /* --- Social buttons --- */
  .social-btn,
  .social-button,
  [class*="social"] a.btn {
    display: block !important;
    width: 80% !important;
    margin: 5px auto !important;
    text-align: center;
  }

  /* --- Gallery images --- */
  #gallery img {
    width: calc(50% - 6px) !important;
    height: auto !important;
  }

  .my-img a {
    width: calc(50% - 20px);
    margin: 5px !important;
  }

  .my-img a img {
    width: 100% !important;
    height: auto !important;
  }

  /* --- NCC/Activities images smaller --- */
  .ncc-img,
  .scouts-img {
    height: 180px !important;
  }

  /* --- Flip cards --- */
  .flip-card-inner {
    min-height: 300px;
  }

  /* --- Publication cards --- */
  .cards-wrapper {
    grid-template-columns: 1fr !important;
    grid-gap: 1.2rem !important;
    padding: 1rem !important;
  }

  .card {
    width: 100% !important;

    margin: 0 auto;
  }

  /* --- Curriculum tables --- */
  .paper table {
    font-size: 13px;
  }

  .paper table td,
  .paper table th {
    padding: 8px !important;
  }

  /* --- Slider prev/next buttons --- */
  .prev,
  .next {
    width: 34px !important;
    height: 34px !important;
    font-size: 14px !important;
  }

  /* --- Container padding (tighter but not crushed) --- */
  .container,
  .container-fluid {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* --- Grid boxes: equalize in 2-col --- */
  .grid-container {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 8px !important;
  }

  .grid-box {
    width: calc(50% - 12px) !important;
    min-width: 130px;
    max-width: none !important;
    margin: 4px !important;
  }

  .grid-box .grid-image img {
    width: 60px !important;
    height: 55px !important;
  }
}


/* ==========================================================================
   Section 6 — Phone Portrait (max-width: 575.98px)
   Header, carousel, counters, rules, flip cards, footer, chatbot
   ========================================================================== */

@media (max-width: 575.98px) {

  /* --- Header: phone compact but well-proportioned --- */
  .custom-bar-container {
    padding: 8px 8px !important;
    gap: 6px;
  }

  .custom-name-container {
    font-size: 13px !important;
  }

  .custom-navbar-name {
    font-size: 13px !important;
    line-height: 1.25;
    font-weight: 700;
    text-align: left;
  }

  .emblem {
    height: 93px !important;
    width: 92px !important;
  }

  .custom-logo-container img {
    height: 40px !important;
    width: 37px !important;
  }

  /* --- Carousel: hide captions, tighten indicators --- */
  .carousel-caption {
    display: none !important;
  }

  .carousel-indicators {
    bottom: 5px;
    margin-bottom: 0;
  }

  .carousel-indicators button,
  .carousel-indicators [data-bs-target] {
    width: 8px !important;
    height: 8px !important;
  }

  /* --- Counters: horizontal scrolling strip --- */
  .home-counters {
    height: auto !important;
    padding: 12px 0 !important;
    overflow: hidden;
  }

  .home-counters .home-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 0 !important;
    padding: 8px 0 !important;
    /* Hide scrollbar but keep scroll */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .home-counters .home-container::-webkit-scrollbar {
    display: none;
  }

  .home-counters .home-container>div {
    flex: 0 0 auto !important;
    width: 140px !important;
    min-width: 140px;
    scroll-snap-align: center;
    padding: 8px 10px !important;
    text-align: center;
  }

  /* Animate: auto-scroll via CSS marquee effect */
  @keyframes counter-scroll {
    0% {
      transform: translateX(0);
    }

    100% {
      transform: translateX(-50%);
    }
  }

  .home-counters .home-container {
    animation: counter-scroll 12s linear infinite;
    width: max-content;
  }

  .home-counters .home-container:hover,
  .home-counters .home-container:active {
    animation-play-state: paused;
  }

  .home-counters i {
    font-size: 24px !important;
  }

  .home-counter {
    font-size: 22px !important;
    margin: 5px 0 !important;
  }

  .home-counters h3 {
    font-size: 13px !important;
    margin: 0 !important;
  }

  .home-counters .home-text {
    font-size: 18px !important;
    margin: 5px 0 !important;
  }

  /* Marquee/Ticker — hidden via global rule */

  /* --- Rules page: disable 3D perspective --- */
  #wrapper {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    -webkit-transform: none !important;
    -moz-transform: none !important;
    transform-style: flat !important;
    -webkit-transform-style: flat !important;
    margin: 20px auto;
  }

  #wrapper:hover {
    transform: none !important;
    -webkit-transform: none !important;
  }

  #front,
  #back,
  #p1,
  #p2 {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 200px;
    transform: none !important;
    -webkit-transform: none !important;
    margin-bottom: 15px;
  }

  #p1:hover,
  #p2:hover {
    transform: none !important;
    -webkit-transform: none !important;
  }

  article {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto;
    padding: 15px !important;
  }

  /* --- Flip cards: disable flip, show stacked --- */
  .flip-card {
    perspective: none !important;
  }

  .flip-card-inner {
    transform: none !important;
    transition: none !important;
    transform-style: flat !important;
  }

  .flip-card:hover .flip-card-inner {
    transform: none !important;
  }

  .flip-card-front,
  .flip-card-back {
    position: relative !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
    transform: none !important;
  }

  /* --- Social buttons --- */
  .social-btn,
  .social-button,
  [class*="social"] a.btn {
    width: 95% !important;
  }

  /* --- Social channels: phone compact --- */
  #socialchannels {
    padding: 14px 10px 20px !important;
  }

  #socialchannels .sc-h1 {
    font-size: 1em !important;
    margin-bottom: 12px !important;
  }

  #socialchannels .sc-btn {
    width: 80%;
    max-width: 200px;
    margin: 6px auto !important;
  }

  #socialchannels .sc-btn>i {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
  }

  #socialchannels .sc-btn>span {
    font-size: 13px;
    padding: 9px 12px !important;
  }

  /* Gallery: tighter on phone */
  .sc-center {
    padding: 10px 0px !important;
  }

  /* --- Footer: phone-compact --- */
  footer {
    font-size: 11px !important;
    padding: 16px 8px 12px !important;
  }

  footer .copyright,
  footer small {
    font-size: 10px !important;
  }

  /* Footer school lists — even smaller on phone */
  footer span[style*="font-size:19px"] {
    font-size: 11px !important;
    line-height: 1.5 !important;
  }

  /* "Developed by" — minimal on phone */
  footer h5[style*="font-size:26px"] {
    font-size: 11px !important;
  }

  footer h5 a[style*="font-size:30px"] {
    font-size: 14px !important;
  }

  footer h4 {
    font-size: 13px !important;
  }

  /* Map smaller on phone */
  footer iframe {
    height: 120px !important;
  }

  /* Contact buttons full-width on phone */
  footer .contact-btns .btn {
    width: 90% !important;
    max-width: none !important;
    font-size: 12px !important;
    white-space: nowrap;
  }

  /* --- Tables --- */
  table {
    font-size: 12px !important;
  }

  td,
  th {
    padding: 5px !important;
  }

  /* --- Chatbot --- */
  df-messenger {
    bottom: 65px !important;
    right: 10px !important;
    width: calc(100% - 20px) !important;
    max-width: none !important;
  }

  /* --- Publications slider --- */
  .slider {
    width: 95% !important;
    min-height: 220px;
    padding: 12px !important;
  }

  .slide {
    padding: 0px !important;
  }

  .slide-description h2 {
    font-size: 1.2rem !important;
    margin-bottom: 8px !important;
  }

  .slide-description p {
    font-size: 0.95rem !important;
  }

  .sliderbtn {
    padding: 10px 28px !important;
    font-size: 14px !important;
  }

  .col-right img {
    max-height: 120px !important;
    height: auto !important;
  }

  /* --- Grid boxes: single column on tiny phones --- */
  .grid-box {
    width: 100% !important;
    max-width: 260px !important;
    margin: 5px auto !important;
  }

  .grid-box-three,
  .grid-box-four,
  .grid-box-sport {
    max-width: 100% !important;
  }

  /* --- NCC/Activities images --- */
  .ncc-img,
  .scouts-img {
    height: 150px !important;
  }

  /* --- Subjects section (publications) --- */
  .subjects {
    height: auto !important;
    min-height: auto !important;
    padding: 15px 0 !important;
  }

  /* --- General text readability --- */
  p,
  li {
    font-size: 14px !important;
    line-height: 1.5 !important;
    word-spacing: normal !important;
  }

  /* --- Modals --- */
  .modal-dialog {
    margin: 5px !important;
    width: calc(100% - 10px) !important;
  }

  .modal-body {
    padding: 10px !important;
  }

  /* Admission popup: edge-to-edge on small phones */
  #admissionModal .modal-dialog {
    width: calc(100% - 8px) !important;
    margin: 4px !important;
  }

  /* --- Headings even smaller on phones --- */
  h1 {
    font-size: 20px !important;
  }

  h2 {
    font-size: 18px !important;
  }

  h3 {
    font-size: 16px !important;
  }

  h4,
  h5,
  h6 {
    font-size: 14px !important;
  }
}


/* ==========================================================================
   Section 7 — Accessibility & Print
   ========================================================================== */

/* Remove 300ms tap delay on interactive elements */
a,
button,
input,
select,
textarea,
.nav-link,
.dropdown-item,
.btn,
[role="button"] {
  touch-action: manipulation;
}

/* Focus visible outlines in school maroon */
:focus-visible {
  outline: 2px solid #58151C !important;
  outline-offset: 2px;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .carousel {
    transition: none !important;
  }

  .carousel-item {
    transition: none !important;
  }

  .ncc-img,
  .scouts-img,
  .sports-slider {
    animation: none !important;
  }
}

/* Print stylesheet */
@media print {

  /* Hide non-essential elements */
  .navbar,
  .navbar-toggler,
  .custom-bar-container,
  df-messenger,
  .social-channels,
  .social-channel-container,
  footer,
  .carousel-indicators,
  .carousel-control-prev,
  .carousel-control-next,
  .prev,
  .next,
  .btn,
  iframe {
    display: none !important;
  }

  /* Show link URLs */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  a[href^="#"]::after,
  a[href^="javascript"]::after {
    content: "";
  }

  /* Reset backgrounds for ink saving */
  body {
    background: white !important;
    color: black !important;
  }

  .paper {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    width: 100% !important;
  }

  /* Ensure images print well */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  table {
    page-break-inside: avoid;
  }
}

@media (max-width: 576px) {
  #principalpic img {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
  }
}