:root {
    --text-primary: #1f2937; /* dark slate */
    --text-secondary: #f59e0b; /* amber */
    --text-muted: #4b5563; /* gray-600 */
    --text-strong: #111827; /* nearly black */
    --accent: #0284c7; /* sky-600 */
}

body {
    color: var(--text-primary);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-strong);
}

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }

.bg-primary { background-color: #0f172a !important; }
.bg-secondary { background-color: #f59e0b !important; }

/* hero text contrast improvements */
#home h1 { color: #f8fafc; text-shadow: 0 3px 15px rgba(15, 23, 42, 0.35); }
#home p { color: #e2e8f0; }

/* section headings */
#courses h2,
#teachers h2,
#achievers h2,
#about h2,
#careers h2 { color: #0f172a; }

/* card text tweak */
.teacher-card h3, .achiever-card h3 { color: #1d4ed8; }
.teacher-card p, .achiever-card p { color: #475569; }

/* footer */
footer { color: #cbd5e1; }
footer a { color: #93c5fd; }
footer a:hover { color: #bfdbfe; }

@keyframes fadeSlide {
    0%, 25% { opacity: 1; visibility: visible; }
    33%, 100% { opacity: 0; visibility: hidden; }
}
.slide-1 { animation: fadeSlide 12s infinite; }
.slide-2 { animation: fadeSlide 12s infinite 4s; opacity: 0; }
.slide-3 { animation: fadeSlide 12s infinite 8s; opacity: 0; }
@keyframes scrollLeft {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.animate-scroll-left {
    animation: scrollLeft 35s linear infinite;
    transform: translateZ(0);
    will-change: transform;
}
/* Mobile/animation enhancements */
.fade-on-scroll { opacity: 0; transform: translateY(16px); transition: opacity .65s ease, transform .65s ease; }
.fade-on-scroll.visible { opacity: 1; transform: translateY(0); }
.teacher-card, .achiever-card { transition: transform .25s ease, box-shadow .25s ease; }
.teacher-card:hover, .achiever-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(15,23,42,.16); }
@media (max-width: 767px) {
    .teacher-card { min-width: 220px; max-width: 220px; }
    .achiever-card { min-width: 180px; max-width: 180px; }
}

/* mobile fixes for hero section */
@media (max-width: 767px) {
    #home {
        padding-top: 15rem;
        padding-bottom: 6rem;
    }
    #home h1 { font-size: 2rem; line-height: 2.5rem; }
    #home p { font-size: 0.95rem; }

    /* center all content and avoid slanted right shift */
    .max-w-7xl { padding-left: 0.75rem; padding-right: 0.75rem; }
    .grid, .flex { justify-content: center; }

    #mobileNav {
        top: 70px;
        left: 0.5rem;
        right: 0.5rem;
    }

    #mobileNavToggle {
        padding: 0.5rem;
    }
}

/* mobile fix for iframe forms and maps */
#contact iframe {
    width: 100% !important;
    min-height: 520px;
    max-height: 760px;
}
@media (max-width: 767px) {
    #contact .max-w-7xl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    #contact .grid {
        grid-template-columns: 1fr !important;
    }
    #contact .bg-gray-50 {
        padding: 1.2rem !important;
    }
    #contact iframe {
        min-height: 700px !important;
    }
}

/* map container sizing */
#contact .map-container {
    width: 100%;
    max-width: 100%;
    min-height: 220px;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #d1d5db;
}
#contact .map-container iframe {
    width: 100%;
    height: 360px;
    min-height: 260px;
    border: 0;
}

@media (max-width: 767px) {
    #contact .map-container iframe {
        height: 250px;
        min-height: 220px;
    }
}

/* small screen normalization */
@media (max-width: 767px) {
    html, body { min-width: 0; overflow-x: hidden; }
    body { font-size: 14px; }

    .max-w-7xl { width: 100%; padding-left: 0.8rem; padding-right: 0.8rem; }

    #navbar { padding: 0.5rem 0; }
    #navbar .h-20 { min-height: 56px; }
    #navbar .py-4, #navbar .px-4 { padding: .35rem; }

    #mobileNavToggle { padding: 0.55rem; }
    #mobileNav { width: calc(100% - 1rem); left: 0.5rem; right: 0.5rem; top: 56px; }

    #home { padding-top: 13rem; padding-bottom: 5rem; }
    #home h1 { font-size: 2rem; line-height: 2.4rem; }
    #home p, #home .text-lg { font-size: 0.94rem; }
    #home .mt-4 { margin-top: 1rem; }

    #courses h2, #teachers h2, #achievers h2, #about h2, #careers h2 {
        font-size: 1.75rem;
    }

    #courses .grid, #about .flex, #careers .grid, #contact .grid { gap: 0.75rem; }

    #teacherViewport, #achieverViewport {
        min-height: 200px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .teacher-card { min-width: 200px; max-width: 220px; padding: 0.85rem; }
    .teacher-card img { height: 150px; }
    .achiever-card { min-width: 170px; max-width: 190px; padding: 0.75rem; }
    .achiever-card img { height: 140px; }

    .bg-primary .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
    .bg-primary > .max-w-7xl > .grid > div { padding: .75rem; }

    #contact iframe { min-height: 560px !important; }
    .map-container iframe { height: 220px; }
    .map-container { min-height: 220px; }
}

/* ensure headings don't overflow on small devices */
h1, h2, h3, p, a, span {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#teacherViewport::-webkit-scrollbar { display: none; }
#teacherViewport { -ms-overflow-style: none; scrollbar-width: none; }
.teacher-card { min-width: 280px; max-width: 280px; }
.teacher-card img { height: 180px; }
#teacherViewport { touch-action: pan-y; } /* allow horizontal drag on touch */
#teacherTrack { will-change: transform; }
.teacher-set { flex-shrink: 0; }
.achiever-card { min-width: 220px; max-width: 220px; }
.achiever-card img { height: 160px; }

.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(26px); }
    to { opacity: 1; transform: translateY(0); }
}
#careers {
    background: linear-gradient(128deg, #0f172a 0%, #1e3a8a 45%, #2563eb 100%);
}
#careers .career-card {
    opacity: 0;
    transform: translateY(24px);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.32);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    transition: transform 0.28s ease, box-shadow 0.28s ease, opacity 0.35s ease;
}
#careers.active .career-card {
    animation: fadeUp 0.75s ease-out forwards;
}
#careers.active .career-card:nth-child(1) { animation-delay: 0.12s; }
#careers.active .career-card:nth-child(2) { animation-delay: 0.24s; }
#careers.active .career-card:nth-child(3) { animation-delay: 0.36s; }
#careers .career-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
}
#careers .career-card h3 { color: #f8fafc; }
#careers .career-card p { color: rgba(247, 250, 255, 0.88); }
@media (max-width: 640px) {
    #careers .career-card { border-radius: 1.75rem; }
}