@media (max-width:768px) {
    :root {
        --c-bg: #f8fafc;
        --c-txt: #1a1a1a;
        --c-pri: #2c5aa0;
        --c-card: #fff;
        --c-bor: #e5e7eb;
        --c-shadow: 0 4px 12px rgba(0, 0, 0, .08)
    }

    [data-theme="dark"] {
        --c-bg: #0f172a;
        --c-txt: #e2e8f0;
        --c-pri: #60a5fa;
        --c-card: #1e293b;
        --c-bor: #334155;
        --c-shadow: 0 4px 12px rgba(0, 0, 0, .3)
    }

    .hero {
        min-height: 60vh;
        padding: 30px 15px;
        contain: content;
        content-visibility: auto
    }

    .hero-title {
        font-size: 0.9rem;
        line-height: 1.2;
        margin: 0 0 10px
    }

    .hero-subtitle {
        font-size: 0.65rem;
        margin: 0 0 25px;
        opacity: .9
    }

    .hero-badges {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin: 0 0 25px
    }

    .badge {
        padding: 8px 16px;
        font-size: .85rem;
        background: rgba(255, 255, 255, .15);
        border-radius: 50px;
        border: 1px solid rgba(255, 255, 255, .25);
        backdrop-filter: blur(10px)
    }

    .hero-actions {
        display: flex;
        flex-direction: column;
        gap: 15px
    }

    .cta-btn {
        padding: 14px 28px;
        font-size: 1rem;
        width: 100%;
        max-width: 280px;
        border-radius: 50px;
        text-decoration: none;
        font-weight: 600;
        display: inline-block;
        transition: transform .2s
    }

    .cta-btn.primary {
        background: linear-gradient(45deg, #3b82f6, #1d4ed8);
        color: #fff;
        border: none
    }

    .cta-btn.secondary {
        background: rgba(255, 255, 255, .15);
        color: #fff;
        border: 2px solid rgba(255, 255, 255, .3)
    }

    .hero-logo {
        width: 80px;
        height: 80px;
        margin: 0 auto 20px;
        border-radius: 50%;
        background: rgba(255, 255, 255, .1);
        padding: 15px;
        backdrop-filter: blur(5px);
        border: 2px solid rgba(255, 255, 255, .2)
    }

    .section-title {
        font-size: 1rem;
        margin-bottom: 30px;
        text-align: center;
        color: var(--color-primary);
        position: relative
    }

    .news-side-container {
        gap: 20px;
        margin: 0 0 30px;
        display: flex;
        flex-direction: column
    }

    .news-side-card {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 15px;
        background: #fff;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
        border: 1px solid #e5e7eb;
        padding: 15px;
        text-decoration: none
    }

    .news-side-image {
        flex: 0 0 100px;
        width: 100px;
        height: 165px;
        border-radius: 8px;
        overflow: hidden;
        border: 0.2px solid #2c5aa0;
        aspect-ratio: 1
    }

    .news-side-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 4%;
        display: block
    }

    .news-side-content {
        flex: 1;
        padding: 0;
        display: flex;
        flex-direction: column;
        min-width: 0
    }

    .news-side-meta {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin: 0 0 10px;
        font-size: .8rem
    }

    .news-side-date {
        color: #2c5aa0;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: .75rem
    }

    .news-side-category {
        background: rgba(44, 90, 160, .1);
        color: #2c5aa0;
        padding: 3px 10px;
        border-radius: 15px;
        font-size: .7rem;
        font-weight: 600
    }

    .news-side-title {
        font-size: 1rem;
        font-weight: 700;
        margin: 0 0 8px;
        color: #1a1a1a;
        line-height: 1.3;
        display: -webkit-box;
        display: -moz-box;
        display: box;
        -webkit-line-clamp: 2;
        -moz-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        -moz-box-orient: vertical;
        box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        max-height: 2.6em
    }

    .news-side-excerpt {
        color: #4a5568;
        line-height: 1.5;
        margin: 0 0 10px;
        font-size: .85rem;
        display: -webkit-box;
        display: -moz-box;
        display: box;
        -webkit-line-clamp: 2;
        -moz-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        -moz-box-orient: vertical;
        box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        max-height: 3em
    }

    .news-side-actions {
        margin-top: auto;
        padding-top: 10px;
        border-top: 1px solid #e5e7eb
    }

    .news-side-readmore {
        color: #2c5aa0;
        font-weight: 600;
        font-size: .8rem;
        display: inline-flex;
        align-items: center;
        gap: 5px
    }

    .stats-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 0 10px;
        margin: 20px 0
    }

    .stat-card {
        background: #fff;
        padding: 12px 8px;
        border-radius: 10px;
        text-align: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
        border: 1px solid #e5e7eb
    }

    .stat-number {
        font-size: 1.3rem;
        font-weight: 800;
        color: #2c5aa0;
        margin: 0 0 4px;
        line-height: 1
    }

    .stat-label {
        font-size: .7rem;
        color: #374151;
        line-height: 1.2
    }

    .links-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        padding: 0 15px;
        margin: 20px 0
    }

    .quick-link {
        text-decoration: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 0;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        min-height: auto
    }

    .link-circle {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: linear-gradient(135deg, #e7eefa, #4f46e5);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 1px;
        box-shadow: 0 4px 10px rgba(44, 90, 160, .2);
        transition: transform .3s ease, box-shadow .3s ease
    }

    .link-icon {
        font-size: 1.8rem;
        color: #fff;
        display: block;
        margin-bottom: 0
    }

    .link-text {
        font-weight: 600;
        color: #2c5aa0;
        font-size: .75rem;
        text-align: center;
        line-height: 1.3;
        margin-top: 5px;
        max-width: 80px;
        word-wrap: break-word
    }

    .quick-link:active .link-circle {
        transform: scale(.95);
        box-shadow: 0 2px 5px rgba(44, 90, 160, .3)
    }

    [data-theme="dark"] .link-circle {
        background: linear-gradient(135deg, #cfdff3, #1e0161);
        box-shadow: 0 4px 10px rgba(96, 165, 250, .2)
    }

    [data-theme="dark"] .link-text {
        color: #d6e7fc
    }

    .gallery-preview {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 14px;
        padding: 12px 10px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .gallery-item {
        flex: 0 0 72vw;
        max-width: 300px;
        min-width: 220px;
        height: 320px;
        aspect-ratio: unset;
        border-radius: 20px;
        overflow: hidden;
        position: relative;
        display: block;
        scroll-snap-align: start;
        border: 1.5px solid rgba(255,215,0,0.18);
        box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12);
    }

    .gallery-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block
    }

    .gallery-overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(
            to top,
            rgba(5,10,25,0.92) 0%,
            rgba(5,10,25,0.55) 40%,
            rgba(5,10,25,0.08) 70%,
            transparent 100%
        );
        padding: 0 16px 18px;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: flex-start;
        gap: 6px;
    }

    .gallery-category {
        font-size: 0.62rem;
        font-weight: 700;
        letter-spacing: 1.2px;
        text-transform: uppercase;
        color: #0f172a;
        background: linear-gradient(90deg, #ffd700, #f0b429, #e8a000);
        padding: 4px 11px;
        border-radius: 30px;
        box-shadow: 0 2px 10px rgba(240,180,41,0.35);
        display: inline-block
    }

    .guru-slideshow-container {
        position: relative;
        padding: 0 15px;
        margin: 25px 0;
        overflow: hidden
    }

    .guru-slideshow-wrapper {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 15px;
        padding: 10px 0 20px;
        scrollbar-width: none
    }

    .guru-slideshow-wrapper::-webkit-scrollbar {
        display: none
    }

    .guru-card {
        flex: 0 0 auto;
        width: 280px;
        scroll-snap-align: center;
        background: #fff;
        border-radius: 16px;
        padding: 20px;
        text-align: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
        border: 2px solid #2c5aa0
    }

    .guru-photo-container {
        width: 120px;
        height: 160px;
        border-radius: 15%;
        overflow: hidden;
        margin: 0 auto 15px;
        border: 4px solid #2c5aa0;
        aspect-ratio: 3/4
    }

    .guru-photo {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block
    }

    .guru-name {
        font-weight: 700;
        font-size: 1.1rem;
        margin: 0 0 8px;
        color: #1a1a1a
    }

    .guru-jabatan {
        color: #2c5aa0;
        font-weight: 600;
        margin: 0 0 5px;
        font-size: .9rem
    }

    .guru-mapel {
        color: #374151;
        font-size: .85rem;
        margin: 0 0 15px
    }

    .guru-badge {
        background: #2c5aa0;
        color: #fff;
        padding: 6px 12px;
        border-radius: 20px;
        font-size: .8rem;
        font-weight: 600;
        display: inline-block
    }

    .sambutan-content {
        padding: 0 15px
    }

    .sambutan-header {
        text-align: center;
        margin: 0 0 25px
    }

    .sambutan-title {
        font-size: 1.5rem;
        color: #2c5aa0;
        margin: 0 0 10px
    }

    .sambutan-body {
        background: #fff;
        padding: 20px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
        border: 1px solid #e5e7eb
    }

    .kepsek-profile {
        text-align: center;
        margin: 0 0 25px
    }

    .kepsek-photo {
        max-width: 200px;
        border-radius: 12px;
        overflow: hidden;
        margin: 0 auto 20px;
        border: 3px solid #2c5aa0;
        aspect-ratio: 3/4
    }

    .kepsek-photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block
    }

    .kepsek-name {
        font-size: 1.1rem;
        font-weight: 700;
        margin: 0 0 5px;
        color: #2c5aa0
    }

    .kepsek-jabatan {
        color: #374151;
        font-size: .9rem;
        margin: 0 0 10px
    }

    .credential {
        display: inline-block;
        background: rgba(44, 90, 160, .1);
        color: #2c5aa0;
        padding: 5px 10px;
        border-radius: 15px;
        font-size: .8rem;
        font-weight: 600
    }

    .sambutan-text {
        line-height: 1.6;
        color: #1a1a1a
    }

    .sambutan-paragraph {
        margin: 0 0 1rem;
        font-size: .95rem;
        text-align: justify
    }

    .signature {
        margin-top: 20px;
        padding: 15px 0px 20px;
        border-top: 2px dashed #e5e7eb;
        text-align: center
    }

    .signature-name {
        font-weight: 700;
        color: #2c5aa0;
        font-size: .95rem;
        margin-top: 10px
    }

    .footer {
        padding: 30px 0 0;
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
        color: #e2e8f0
    }

    .footer-content {
        display: flex;
        flex-direction: column;
        gap: 25px;
        padding: 0 15px
    }

    .footer-logo {
        display: flex;
        align-items: center;
        gap: 0px;
        margin-bottom: 15px
    }

    .footer-logo-img {
        width: 50px;
        height: 50px;
        margin: 0 0 0 30px;
        border-radius: 8px;
        object-fit: contain
    }

    .footer-school-info {
        flex: 1
    }

    .school-name {
        font-size: 1.1rem;
        text-align: left;
        color: #f59e0b;
        margin: 0 0 5px
    }

    .school-motto {
        font-size: .8rem;
        text-align: left;
        color: #60a5fa;
        margin: 0
    }

    .footer-logo-img {
        width: 50px;
        height: 50px;
        border-radius: 8px;
        object-fit: contain
    }

    .school-name {
        font-size: 1.1rem;
        text-align: center;
        color: #f59e0b;
        margin: 0 0 5px
    }

    .school-motto {
        font-size: .8rem;
        text-align: center;
        color: #60a5fa;
        margin: 0
    }

    .footer-description {
        font-size: .85rem;
        text-align: center;
        color: #cbd5e1;
        margin: 10px 0 0
    }

    .footer-title {
        font-size: 1rem;
        margin: 0 0 12px;
        color: rgba(255, 255, 255, .9)
    }

    .footer-links {
        display: flex;
        flex-direction: row;
        gap: 1px
    }

    .footer-links a {
        color: rgba(255, 255, 255, .8);
        text-decoration: none;
        font-size: .85rem;
        padding: 4px 0
    }

    .contact-item {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        margin: 0 0 12px
    }

    .contact-icon {
        color: #60a5fa;
        font-size: 1rem;
        min-width: 18px
    }

    .contact-text {
        color: #cbd5e1;
        font-size: .85rem;
        line-height: 1.4
    }

    .social-links {
        display: flex;
        flex-direction: row;
        gap: 8px
    }

    .social-link {
        display: flex;
        align-items: center;
        gap: 10px;
        color: #cbd5e1;
        text-decoration: none;
        font-size: .85rem;
        padding: 4px 0
    }

    .social-icon {
        font-size: 1rem;
        min-width: 20px
    }

    .footer-bottom {
        background: #090e1a;
        border-top: 1px solid rgba(255, 255, 255, .05);
        margin-top: 25px;
        padding: 20px 15px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        text-align: center;
        font-size: .8rem;
        color: rgba(255, 255, 255, .7);
        width: 100%
    }

    .footer-bottom-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px
    }

    .footer-bottom-links a {
        color: rgba(255, 255, 255, .7);
        text-decoration: none;
        font-size: .75rem
    }

    .empty-state {
        text-align: center;
        padding: 30px 15px;
        color: #666
    }

    .empty-icon {
        font-size: 2rem;
        margin: 0 0 15px;
        opacity: .3
    }

    .empty-state h3 {
        font-size: 1.1rem;
        margin: 0 0 10px;
        color: #2c5aa0
    }

    .section-footer {
        text-align: center;
        margin-top: 20px;
        padding: 0 15px
    }

    .see-more {
        text-decoration: none;
        font-weight: 600;
        font-size: .9rem;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 15px;
        border-radius: 25px;
        background: rgba(44, 90, 160, .1);
        border: 1px solid rgba(44, 90, 160, .2)
    }

    .bg-light {
        padding: 2px 0
    }

    .pengumuman-container {
        margin-top: 20px
    }

    .pengumuman-header {
        text-align: center;
        margin: 0 0 20px
    }

    .pengumuman-title {
        font-size: 1.3rem;
        color: #2c5aa0;
        font-weight: 700
    }

    .pengumuman-list {
        display: flex;
        flex-direction: column;
        gap: 15px
    }

    .pengumuman-card {
        background: #fff;
        padding: 20px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
        border: 1px solid #e5e7eb;
        text-decoration: none;
        border-left: 4px solid #f59e0b;
        position: relative
    }

    .pengumuman-card.tinggi {
        border-left-color: #ef4444;
        background: linear-gradient(135deg, rgba(239, 68, 68, .03), #fff)
    }

    .pengumuman-card.sedang {
        border-left-color: #f59e0b
    }

    .pengumuman-card.rendah {
        border-left-color: #6b7280
    }

    .pengumuman-badge {
        position: absolute;
        top: -8px;
        right: 10px;
        background: linear-gradient(135deg, #ef4444, #dc2626);
        color: #fff;
        padding: 4px 10px;
        border-radius: 15px;
        font-size: .7rem;
        font-weight: 600
    }

    .pengumuman-badge.warning {
        background: linear-gradient(135deg, #f59e0b, #d97706)
    }

    .pengumuman-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 0 0 12px;
        font-size: .8rem
    }

    .pengumuman-date {
        color: #2c5aa0;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 5px
    }

    .pengumuman-category {
        background: rgba(44, 90, 160, .1);
        color: #2c5aa0;
        padding: 3px 10px;
        border-radius: 15px;
        font-size: .7rem;
        font-weight: 600
    }

    .pengumuman-judul {
        font-size: 1rem;
        font-weight: 700;
        margin: 0 0 10px;
        color: #1a1a1a;
        line-height: 1.3;
        display: -webkit-box;
        display: -moz-box;
        display: box;
        -webkit-line-clamp: 2;
        -moz-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        -moz-box-orient: vertical;
        box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        max-height: 2.6em
    }

    .pengumuman-isi {
        color: #4a5568;
        line-height: 1.5;
        font-size: .85rem;
        display: -webkit-box;
        display: -moz-box;
        display: box;
        -webkit-line-clamp: 2;
        -moz-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        -moz-box-orient: vertical;
        box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        max-height: 3em;
        margin: 0 0 10px
    }

    .pengumuman-footer {
        padding-top: 12px;
        border-top: 1px solid #e5e7eb
    }

    .pengumuman-readmore {
        color: #2c5aa0;
        font-weight: 600;
        font-size: .85rem;
        display: inline-flex;
        align-items: center;
        gap: 5px
    }

    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, .98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid #e5e7eb;
        z-index: 9999;
        padding: 10px 5px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, .1);
        height: 70px
    }

    .bottom-nav .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 3px;
        text-decoration: none;
        border-radius: 12px;
        transition: all .2s ease;
        min-height: 56px;
        -webkit-tap-highlight-color: transparent
    }

    .bottom-nav .nav-icon {
        font-size: 1.4rem;
        margin-bottom: 5px;
        transition: all .3s ease;
        line-height: 1;
        display: block
    }

    .bottom-nav .nav-label {
        font-size: .7rem;
        font-weight: 600;
        color: #4a5568;
        transition: all .3s ease;
        line-height: 1.2;
        text-align: center;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%
    }

    .bottom-nav .nav-item.active {
        background: rgba(44, 90, 160, .1)
    }

    .bottom-nav .nav-item.active .nav-icon {
        color: #2c5aa0;
        transform: translateY(-2px)
    }

    .bottom-nav .nav-item.active .nav-label {
        color: #2c5aa0;
        font-weight: 700
    }

    [data-theme="dark"] .bottom-nav {
        background: rgba(30, 41, 59, .98);
        border-top-color: #334155;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, .3)
    }

    [data-theme="dark"] .bottom-nav .nav-label {
        color: #cbd5e1
    }

    [data-theme="dark"] .bottom-nav .nav-item.active {
        background: rgba(96, 165, 250, .12)
    }

    [data-theme="dark"] .bottom-nav .nav-item.active .nav-icon {
        color: #60a5fa
    }

    [data-theme="dark"] .bottom-nav .nav-item.active .nav-label {
        color: #60a5fa
    }

    .theme-toggle {
        display: flex !important;
        align-items: center;
        flex-shrink: 0;
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        margin-left: auto;
        z-index: 1005
    }

    #themeToggle {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: none;
        background: rgba(44, 90, 160, 0.2);
        ;
        color: var(--c-pri);
        cursor: pointer;
        box-shadow: var(--c-shadow);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        transition: transform .2s;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation
    }

    #themeToggle:hover,
    #themeToggle:focus {
        transform: scale(1.05);
        outline: none
    }

    #themeToggle .light-icon,
    #themeToggle .dark-icon {
        position: absolute;
        transition: opacity .2s
    }

    #themeToggle .dark-icon {
        opacity: 0
    }

    [data-theme="dark"] #themeToggle .light-icon {
        opacity: 0
    }

    [data-theme="dark"] #themeToggle .dark-icon {
        opacity: 1
    }

    .floating-buttons {
        bottom: 80px !important;
        right: 15px
    }

    .main-content {
        padding-bottom: 85px !important
    }

    .desktop-header {
        display: none !important
    }

    .footer {
        padding-bottom: 0 !important
    }

    .footer-bottom {
        padding-bottom: 105px !important
    }
}

@media (max-width:768px) {

    .guru-slideshow-wrapper,
    .gallery-preview,
    .stats-grid,
    .links-grid {
        content-visibility: auto;
        contain-intrinsic-size: 300px
    }
}

.desktop-only {
    display: none !important
}

.mobile-only {
    display: flex !important;
    justify-content: center;
}