@font-face {
    font-family: 'Angsana New';
    src: url('../fonts/Angsana%20New.woff2') format('woff2'),
         url('../fonts/Angsana%20New.woff') format('woff'),
         url('../fonts/Angsana%20New.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Base Colors */
    --bg-color: #F8FAFC;
    --text-main: #1E293B;
    --text-muted: #64748B;
    
    /* Subject Accents - More Saturated */
    --math-color: #2563EB;
    --math-light: #DBEAFE;
    --math-glow: rgba(37, 99, 235, 0.5);

    --chem-color: #D946EF;
    --chem-light: #FAE8FF;
    --chem-glow: rgba(217, 70, 239, 0.5);

    --physics-color: #FACC15;
    --physics-light: #FEF9C3;
    --physics-glow: rgba(250, 204, 21, 0.5);

    --bio-color: #22C55E;
    --bio-light: #DCFCE7;
    --bio-glow: rgba(34, 197, 94, 0.5);

    /* UI elements */
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(255, 255, 255, 1);
    --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.08);
    --shadow-hover: 0 20px 40px -10px rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Angsana New', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1.5rem; /* Increased significantly for Angsana New */
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Moving Sky Background */
.sky-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: linear-gradient(to bottom, #74b9ff, #a29bfe);
    overflow: hidden;
}

.sun {
    position: absolute;
    top: 10%;
    right: 15%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, #fff9c4 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.8;
    animation: sunGlow 10s ease-in-out infinite alternate;
}

@keyframes sunGlow {
    from { transform: scale(1); opacity: 0.6; }
    to { transform: scale(1.2); opacity: 0.9; }
}

.clouds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cloud {
    position: absolute;
    background: white;
    border-radius: 100px;
    opacity: 0.4;
    filter: blur(40px);
    animation: moveClouds linear infinite;
}

@keyframes moveClouds {
    from { transform: translateX(-200px); }
    to { transform: translateX(110vw); }
}

.cloud-1 { width: 400px; height: 120px; top: 15%; animation-duration: 60s; opacity: 0.3; }
.cloud-2 { width: 300px; height: 100px; top: 40%; animation-duration: 80s; opacity: 0.25; animation-delay: -20s; }
.cloud-3 { width: 500px; height: 150px; top: 65%; animation-duration: 100s; opacity: 0.2; animation-delay: -45s; }
.cloud-4 { width: 250px; height: 80px; top: 80%; animation-duration: 45s; opacity: 0.35; animation-delay: -10s; }

/* Refined UI for Sky theme */
:root {
    --bg-color: #f1f2f6;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.8);
    --text-main: #2f3542;
}

.top-nav {
    display: flex;
    justify-content: flex-end;
    padding: 0;
    margin-bottom: 1rem;
}

.brand-container {
    display: flex;
    justify-content: center;
    padding-top: 0;
    margin-bottom: 0.5rem;
}

.brand-box {
    position: relative;
    padding: 1rem 3.5rem;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 
        0 15px 45px -10px rgba(116, 185, 255, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.5);
    animation: 
        brandEntrance 1.2s cubic-bezier(0.23, 1, 0.32, 1), 
        brandFloat 5s ease-in-out infinite alternate;
    overflow: hidden;
}

/* Shimmer Animation Element */
.brand-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent
    );
    transform: skewX(-20deg);
    animation: shimmer 6s infinite;
}

@keyframes shimmer {
    0% { left: -150%; }
    20%, 100% { left: 150%; }
}

.brand-text {
    font-family: 'Angsana New', sans-serif;
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #0984e3, #6c5ce7, #00cec9);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    position: relative;
    z-index: 1;
    text-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

@keyframes brandEntrance {
    from { opacity: 0; transform: scale(0.9) translateY(-30px); filter: blur(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

@keyframes brandFloat {
    0% { transform: translateY(0); box-shadow: 0 10px 30px rgba(116, 185, 255, 0.2); }
    100% { transform: translateY(-15px); box-shadow: 0 25px 50px rgba(116, 185, 255, 0.4); }
}

.lang-switcher {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.lang-btn {
    background: none;
    border: none;
    font-family: 'Angsana New', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.lang-btn.active {
    color: var(--math-color);
}

.lang-btn:hover:not(.active) {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.5);
}

.divider {
    color: var(--text-muted);
    opacity: 0.5;
}

.badge {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
}

.hero-title {
    font-family: 'Angsana New', sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 5px rgba(255, 255, 255, 0.5);
    opacity: 0.9;
}

.hero-title-main {
    font-size: clamp(3rem, 6vw, 5.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 2rem;
}

.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 1rem 1rem;
    margin-bottom: 1rem;
    animation: fadeInDown 0.8s ease-out forwards;
}

.badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: white;
    color: var(--text-main);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.hero-title {
    font-family: 'Angsana New', sans-serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.highlight {
    background: linear-gradient(135deg, var(--math-color), var(--chem-color), var(--physics-color), var(--bio-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: shine 5s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto;
}

/* Subjects Grid */
.subjects-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

/* Cards */
.subject-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Ensure no text decoration globally for anchor tags used as cards */
a.subject-card:hover, a.subject-card:visited, a.subject-card:active {
    color: var(--text-main);
    text-decoration: none;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--card-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.subject-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover), 0 0 40px var(--card-glow);
    border-color: rgba(255, 255, 255, 0.5);
}

.subject-card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-light);
    color: var(--card-accent);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.subject-card:hover .card-icon {
    transform: scale(1.15) rotate(5deg);
    background: var(--card-accent);
    color: white;
}

.card-content h2 {
    font-family: 'Angsana New', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.en-title {
    display: block;
    font-family: 'Angsana New', sans-serif;
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
}

.card-arrow {
    margin-top: auto;
    padding-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    color: var(--card-accent);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.subject-card:hover .card-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Specific Card Themes */
.card-math {
    --card-accent: var(--math-color);
    --card-light: var(--math-light);
    --card-glow: var(--math-glow);
}

.card-chem {
    --card-accent: var(--chem-color);
    --card-light: var(--chem-light);
    --card-glow: var(--chem-glow);
}

.card-physics {
    --card-accent: var(--physics-color);
    --card-light: var(--physics-light);
    --card-glow: var(--physics-glow);
}

.card-bio {
    --card-accent: var(--bio-color);
    --card-light: var(--bio-light);
    --card-glow: var(--bio-glow);
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 0 1rem 0;
    color: var(--text-muted);
    font-size: 1.125rem;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive constraints */
@media (max-width: 768px) {
    .subjects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .page-wrapper {
        padding: 1rem;
    }
    .hero-section {
        padding: 2rem 1rem;
    }
}
