/* css/utilities/mobile-styles.css
   Mobile-first overrides and responsive tweaks for index/gallery pages.
   Applies to max-width: 768px devices (phones / small tablets).
*/

@media (max-width: 768px) {
    :root {
        --site-padding: 14px;
        --section-radius: 12px;
        --card-gap: 12px;
        --primary-color: #007bff;
        --muted-color: #6b7280;
        --heading-size: 22px;
        --lead-size: 15px;
        --feature-icon-size: 20px;
    }

    html, body {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }

    /* Header adjustments */
    .logo img { height: 72px; width: auto; }
    .school-name { display: none; }
    .mobile-only { display: block; font-size: 1.25rem; margin-left: 6px; color: #2c3e50; }
    .mobile-menu-button { display: block; }

    .navbar {
        padding: 8px var(--site-padding);
    }
    .navbar ul { display: none; flex-direction: column; width: 100%; }
    .navbar ul.active { display: flex; }
    .navbar ul li { margin: 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
    .navbar ul li a { padding: 12px 10px; display: block; text-align: left; font-size: 15px; }

    /* Main content padding */
    .main-content { padding: 18px var(--site-padding); }

    /* Hero / slider */
    .slider { border-radius: var(--section-radius); overflow: hidden; box-shadow: 0 6px 18px rgba(16,24,40,0.06); }
    .slider img { width: 100%; height: auto; display: block; object-fit: cover; }

    /* Section style: stacked on mobile, image below text for better reading */
    .section { margin-bottom: 18px; }
    .section > .section-content { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
    .section .text-content, .section .image-content { width: 100%; }
    .section .text-content h2 { font-size: var(--heading-size); margin: 12px 0 8px; text-align: center; color: #1f2937; }
    .section .text-content p { font-size: var(--lead-size); line-height: 1.55; color: var(--muted-color); text-align: center; padding: 0 6px; }

    /* Image sizing inside sections */
    .section .image-content img { width: 100%; height: auto; display: block; border-radius: 10px; box-shadow: 0 6px 18px rgba(16,24,40,0.06); }

    /* Staff layout: stack hero cards and show other staff as small boxes (rectangular) in a row */
    .staff-container { display:flex; flex-direction:column; gap:12px; align-items:center; }
    .staff-heroes { width:100%; display:block; margin-bottom:10px; }
    .staff-hero { width:100%; background:#fff; border-radius:12px; box-shadow:0 6px 18px rgba(16,24,40,0.04); overflow:hidden; margin-bottom:10px; padding:12px; display:flex; gap:12px; align-items:center; }
    .staff-hero .hero-image { flex:0 0 92px; width:92px; height:92px; border-radius:50%; overflow:hidden; }
    .staff-hero .hero-image img { width:100%; height:100%; object-fit:cover; display:block; }
    .staff-hero .meta { flex:1; }
    .staff-hero h3 { margin:0; font-size:1.05rem; color:#0f172a; }
    .staff-hero p { margin:4px 0 0; color:var(--muted-color); }

    /* other staff: smaller rectangular cards in a single horizontal row */
    .staff-row { display:flex; gap:10px; overflow-x:auto; -webkit-overflow-scrolling:touch; padding:8px 0; scroll-snap-type:x proximity; }
    .staff-card {
        flex: 0 0 auto;
        min-width: 140px;
        max-width: 160px;
        background:#fff;
        border-radius:10px;
        padding:10px;
        box-shadow:0 6px 18px rgba(16,24,40,0.04);
        display:flex;
        gap:10px;
        align-items:center;
        scroll-snap-align:center;
    }
    .staff-card .avatar {
        width:56px;
        height:56px;
        border-radius:8px; /* rectangular with slight radius */
        overflow:hidden;
        flex: 0 0 56px;
    }
    .staff-card img { width:100%; height:100%; object-fit:cover; display:block; }
    .staff-card .meta { display:flex; flex-direction:column; gap:2px; }
    .staff-card h4 { margin:0; font-size:0.95rem; color:#1f2937; }
    .staff-card p.role { margin:0; font-size:0.88rem; color:var(--muted-color); }

    /* Full staff image */
    .full-staff-section img { width:100%; height:auto; border-radius:10px; box-shadow:0 6px 18px rgba(16,24,40,0.04); }

    /* Features / highlights layout: stack but look like three cards in one row on wider phones */
    .features-row { display:flex; gap:12px; flex-wrap:wrap; justify-content:center; padding:6px 0; }
    .feature-card {
        flex: 0 0 calc(100% - 40px); /* single column default */
        max-width: 520px;
        background:#fff;
        border-radius:10px;
        padding:12px;
        box-shadow:0 6px 18px rgba(16,24,40,0.04);
        text-align:left;
        display:flex;
        gap:12px;
        align-items:flex-start;
    }
    .feature-card i { font-size:var(--feature-icon-size); color:var(--primary-color); min-width:36px; margin-top:6px; }
    .feature-card .fc-body { flex:1; }
    .feature-card h3 { margin:0 0 6px; font-size:1.05rem; color:#0f172a; }
    .feature-card p { margin:0; color:var(--muted-color); font-size:0.95rem; line-height:1.4; }

    /* make features three-in-row on larger mobile widths (like phablets) */
    @media (min-width:560px) {
        .feature-card { flex: 0 0 calc(33.33% - 12px); max-width: none; text-align:center; flex-direction:column; align-items:center; padding:16px; }
        .feature-card i { margin-top:0; }
        .feature-card .fc-body { text-align:center; }
    }

    /* Parents Feedback slider */
    .feedback-container { padding: 8px 0; }
    .feedback-item { padding: 12px; border-radius: 10px; box-shadow: 0 6px 18px rgba(16,24,40,0.04); background:#fff; }

    /* Gallery: circular horizontal scroller on mobile (left-to-right) */
    .gallery-container { padding: 6px 0; }
    .gallery-row {
        display:flex;
        gap:12px;
        align-items:center;
        overflow-x:auto;
        -webkit-overflow-scrolling:touch;
        padding:8px 6px;
        scroll-snap-type:x proximity;
        scroll-behavior: smooth;
        -ms-overflow-style: -ms-autohiding-scrollbar;
    }
    .gallery-thumb {
        flex: 0 0 auto;
        width:96px;
        height:96px;
        border-radius:50%;
        overflow:hidden;
        display:flex;
        align-items:center;
        justify-content:center;
        background:#fff;
        box-shadow:0 8px 20px rgba(16,24,40,0.06);
        scroll-snap-align:center;
        cursor:pointer;
        position:relative;
        transition: transform .18s ease, box-shadow .18s ease;
    }
    .gallery-thumb img {
        width:100%;
        height:100%;
        object-fit:cover;
        display:block;
    }
    .gallery-thumb:hover, .gallery-thumb:focus { transform: translateY(-6px) scale(1.02); box-shadow:0 16px 36px rgba(16,24,40,0.12); }
    .gallery-thumb .cap { display:none; } /* hide caption on mobile circular thumbs */

    /* center gallery when items are few (JS toggles .center class) */
    .gallery-row.center { justify-content:center; padding-left:12px; padding-right:12px; }

    /* for category header and view-all button */
    .index-gallery-header { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:8px; padding:0 6px; }
    .index-gallery-category { font-weight:700; color:#0f172a; font-size:16px; }
    .view-all-btn { font-size:13px; padding:6px 10px; background:var(--primary-color); color:#fff; border-radius:6px; text-decoration:none; }

    /* When thumbnails are few: center them */
    .gallery-row.center { justify-content:center; }

    /* Quick links: stack cards */
    .quick-links { display:flex; flex-direction:column; gap:12px; padding: 6px 0; }
    .link-card { display:flex; gap:12px; align-items:center; padding:12px; border-radius:12px; background:#fff; box-shadow:0 6px 18px rgba(16,24,40,0.04); }
    .link-card .icon { flex:0 0 44px; font-size:22px; color:var(--primary-color); }
    .link-card h3 { margin:0; font-size:1rem; color:#1f2937; }
    .link-card p { margin:4px 0 0; color:var(--muted-color); font-size:0.95rem; }

    /* Buttons */
    .btn, .view-all-btn {
        display:inline-block; padding:8px 12px; border-radius:8px; text-decoration:none; font-weight:600; font-size:0.95rem;
    }
    .view-all-btn { background:var(--primary-color); color:#fff; }

    /* Popup adjustments */
    #popup-overlay { align-items:flex-start; padding-top:28px; }
    #popup-content { width: calc(100% - 30px); max-width:480px; padding:12px; border-radius:12px; }
    #popup-content img { width:100%; height:auto; border-radius:8px; }

    /* Accessibility: focus outlines */
    a:focus, button:focus { outline: 3px solid rgba(0,123,255,0.18); outline-offset:3px; }

    /* Smaller typography for very small devices */
    @media (max-width: 420px) {
        :root { --heading-size: 20px; --lead-size: 14px; --feature-icon-size:18px; }
        .gallery-thumb { width:84px; height:84px; }
        .staff-card { min-width:120px; max-width:140px; }
        .staff-card .avatar { width:48px; height:48px; }
        .feature-card h3 { font-size:1rem; }
    }
}
