/* 
==========================================================================
   SECTION -1: FUNDAMENTAL RESET & BASE STYLES
========================================================================== 
*/
*, *::before, *::after {
    box-sizing: border-box;
}

body, h1, h2, h3, p, figure, blockquote, ul, li {
    margin: 0;
    padding: 0;
}

ul {
    list-style: none;
}

button, a {
    border: none;
    outline: none;
    background-color: transparent;
    text-decoration: none;
    color: inherit;
    font-family: inherit;
    font-size: 100%;
    padding: 0;
    cursor: pointer;
    text-align: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* 
==========================================================================
   SECTION 0: VARIABLES & TOKENS
========================================================================== 
*/
:root {
    --md-sys-color-primary: #0056D2;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-secondary-container: #DCE1FF;
    --md-sys-color-on-secondary-container: #00174A;
    --md-sys-color-surface: #FDFBFF;
    --md-sys-color-on-surface: #1A1C1E;
    --md-sys-color-on-surface-variant: #43474E;
    --md-sys-color-surface-container: #F0F3F8; 
    --md-sys-color-surface-container-high: #EBEFF5; 
    --md-sys-color-outline: #73777F;
    --md-sys-color-outline-variant: #C3C7CF;

    --radius-large: 24px;
    --radius-medium: 12px; 
    --radius-pill: 9999px;

    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-6: 48px;
    --space-8: 64px;

    --motion-spring: cubic-bezier(0.3, 1.5, 0.5, 1);
    --motion-duration: 0.4s;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    overflow-x: hidden;
}

/* 
==========================================================================
   TYPOGRAPHY
========================================================================== 
*/
.display-large {
    font-size: 64px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1px;
    color: var(--md-sys-color-on-surface);
}

.headline-large {
    font-size: 32px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
}

.headline-small {
    font-size: 24px;
    font-weight: 600;
}

.body-large {
    font-size: 18px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface-variant);
}

.label-large {
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 
==========================================================================
   LAYOUT ARCHITECTURE
========================================================================== 
*/
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-3);
    width: 100%;
}

/* 
==========================================================================
   COMPONENTS
========================================================================== 
*/
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-medium);
    font-weight: 500;
    font-size: 15px;
    transition: transform 0.1s, background-color 0.2s;
    gap: var(--space-1);
    white-space: nowrap; /* Prevent text wrap on mobile */
}

.btn:active {
    transform: scale(0.95);
}

.btn-filled {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-tonal {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.btn-outlined {
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
}

.btn-icon-only {
    width: 48px;
    padding: 0;
    border-radius: 50%;
}

.chip {
    display: inline-flex;
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    background-color: var(--md-sys-color-surface-container-high);
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
    border: 1px solid transparent;
    transition: all 0.2s;
}

/* 
==========================================================================
   HEADER
========================================================================== 
*/
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(253, 251, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--md-sys-color-surface-container);
    padding: var(--space-2) 0;
}

.nav-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 22px;
    font-weight: 900;
    color: var(--md-sys-color-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links {
    display: flex;
    gap: var(--space-4);
}

.nav-item {
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 15px;
}

.nav-actions {
    display: flex;
    gap: 8px;
}

/* Mobile Menu Trigger (Hidden on Desktop) */
.mobile-menu-btn {
    display: none;
    color: var(--md-sys-color-on-surface);
}

/* 
==========================================================================
   SECTIONS
========================================================================== 
*/

/* Hero */
.hero {
    padding: var(--space-8) 0;
    min-height: 80vh;
    display: flex;
    align-items: center;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr; /* Text takes slightly more space */
    gap: var(--space-8);
    align-items: center;
    width: 100%;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    animation: slideUp var(--motion-duration) var(--motion-spring) forwards;
}

.hero-image-wrapper {
    position: relative;
    height: 550px;
    border-radius: var(--radius-large);
    overflow: hidden;
    background-color: var(--md-sys-color-surface-container);
    animation: scaleIn var(--motion-duration) var(--motion-spring) 0.2s forwards;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.05); /* Subtle border instead of shadow */
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stats-row {
    display: flex;
    gap: var(--space-6);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* Courses */
.courses-section {
    padding: var(--space-8) 0;
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.chips-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE 10+ */
}
.chips-scroll::-webkit-scrollbar { 
    display: none; /* Chrome/Safari */
}

.chip.active {
    background-color: var(--md-sys-color-on-surface);
    color: var(--md-sys-color-surface);
}

.course-grid {
    display: grid;
    /* Smart responsive grid */
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-3);
}

.course-card {
    background-color: var(--md-sys-color-surface-container);
    border-radius: var(--radius-large);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--motion-duration) var(--motion-spring);
    cursor: pointer;
}

.course-card:hover {
    transform: translateY(-8px);
    background-color: var(--md-sys-color-surface-container-high);
}

.card-image {
    height: 240px;
    background-color: #ddd;
    position: relative;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    backdrop-filter: blur(4px);
}

.card-content {
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.price-row {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price {
    font-size: 20px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
}

/* Footer */
footer {
    background-color: var(--md-sys-color-surface-container);
    padding: var(--space-8) 0;
    margin-top: var(--space-8);
    border-radius: 24px 24px 0 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-6);
}

/* 
==========================================================================
   MOBILE RESPONSIVENESS (The Fix)
   Targeting < 768px (Tablets & Phones)
========================================================================== 
*/
@media (max-width: 768px) {
    
    /* Global Spacing Reduction */
    :root {
        --space-3: 16px; /* Container Padding */
        --space-8: 48px; /* Section Spacing */
    }

    /* Typography Scaling */
    .display-large {
        font-size: 40px; /* Was 64px */
    }
    .headline-large {
        font-size: 28px;
    }

    /* Header Adjustments */
    .nav-links {
        display: none; /* Hide text links on mobile */
    }
    .mobile-menu-btn {
        display: block; /* Show hamburger */
    }
    .btn-login-text {
        display: none; /* Hide "Login" text, keep icon if needed */
    }
    .nav-actions .btn {
        padding: 0 12px; /* Smaller buttons */
    }

    /* Hero Section Fix */
    .hero {
        padding: 16px;
        padding-top: 32px;
        min-height: auto;
    }
    .hero-grid {
        grid-template-columns: 1fr; /* Stack vertically */
        gap: 32px;
    }
    .hero-content {
        order: 1; /* Text first */
    }
    .hero-image-wrapper {
        order: 2; /* Image second */
        height: 300px; /* Smaller image height for mobile */
    }

    /* Stats Row Mobile */
    .stats-row {
        justify-content: space-around;
        gap: 16px;
    }

    /* Filter Bar Fix */
    .filter-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 0 16px;
    }
    .chips-scroll {
        width: 100%;
        padding-right: 16px; /* Space for last item */
    }

    /* Grid Fix */
    .course-grid {
        /* Allow cards to be smaller than 340px on very small phones */
        grid-template-columns: 1fr;
        padding: 0 16px;
    }
    
    .card-image {
        height: 200px;
    }

    /* Footer Fix */
    .footer-grid {
        grid-template-columns: 1fr; /* Stack footer columns */
        gap: 32px;
    }
}

/* Animations */
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Material Icons Helper */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 24px;
}
.material-symbols-outlined.filled {
    font-variation-settings: 'FILL' 1;
}