/* ===================================
   TM - Teaching Mathematics Curriculum
   Responsive Design & Global Styles
   =================================== */

/* 1. Google Fonts Integration */
@import url('https://fonts.googleapis.com/css2?family=Anuphan:wght@100..700&family=Inter:wght@100..900&family=Sarabun:wght@300;400;500;700&display=swap');

:root {
    --primary-blue: #00A9CE;
    --primary-dark-blue: #007AA3;
    --accent-yellow: #F5C400;
    --bg-light: #f0f9ff;
    --text-main: #0d2233;
    
    /* Responsive Spacing */
    --container-px: 1rem;
}

* {
    scroll-behavior: smooth;
    box-sizing: border-box;
}

body {
    font-family: 'Anuphan', 'Inter', 'Sarabun', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 2. Fluid Typography (clamp) */
h1 { font-size: clamp(2rem, 8vw, 4.5rem); } /* สำหรับ Hero */
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); } /* หัวข้อหลัก */
h3 { font-size: clamp(1.2rem, 3vw, 1.8rem); } /* หัวข้อรอง */
p { font-size: clamp(0.9rem, 2vw, 1rem); }

/* 3. Global Responsive Container */
.container-custom {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--container-px);
}

/* 4. Responsive Images & Media */
img, video {
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

.banner-img {
    aspect-ratio: 16 / 9;
    width: 100%;
}

/* 5. Navigation & Header Fixes */
header {
    transition: all 0.3s ease;
}

.logo-text h1 {
    font-size: clamp(1rem, 3vw, 1.25rem);
}

/* Hamburger Menu Icon */
.hamburger {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary-blue);
    border-radius: 3px;
    transition: 0.3s;
}

/* 6. Buttons & Interactive Elements */
button, a.btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    transition: all 0.2s ease;
    gap: 8px;
}

/* 7. Grid & Layout System (Mobile First) */
.responsive-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

/* 8. Media Queries */

/* Tablet (md): 577px - 768px */
@media (min-width: 577px) {
    :root { --container-px: 2rem; }
    .responsive-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Laptop (lg): 769px - 1024px */
@media (min-width: 769px) {
    .responsive-grid { grid-template-columns: repeat(3, 1fr); }
    .nav-links { display: flex !important; }
    .mobile-only { display: none !important; }
}

/* Desktop (xl): 1025px ขึ้นไป */
@media (min-width: 1025px) {
    .responsive-grid { grid-template-columns: repeat(4, 1fr); }
    :root { --container-px: 4rem; }
}

/* 9. Specialized Responsive Tweaks */

/* Course Cards: Force 1 col on mobile, 2 on tablet+ */
.course-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
}
@media (min-width: 577px) {
    .course-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Full width buttons on mobile */
@media (max-width: 576px) {
    .btn-mobile-full {
        width: 100% !important;
    }
    
    /* Horizontal scroll for chips/filters */
    .scroll-x-mobile {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        gap: 0.5rem;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }
    .scroll-x-mobile::-webkit-scrollbar { display: none; }
}

/* Accordion for Mobile Menu */
.mobile-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.mobile-dropdown-content.active {
    max-height: 500px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: var(--primary-blue); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark-blue); }

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fadeInUp 0.6s ease both; }
