/* Theme & Variables */
:root {
    /* Core Palette: Blue, Purple, Yellow, White */
    --primary: #3A86FF;
    --primary-hover: #2563EB;
    --secondary: #8338EC;
    --highlight: #FFBE0B;

    /* Neutrals */
    --dark: #0f172a;
    --muted: #64748b;
    --light: #f1f5f9;
    --surface: #ffffff;
    --background: #f8fafc;

    /* Effects */
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --radius: 12px;

    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Reset & Base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    background-image:
        radial-gradient(at 0% 0%, rgba(58, 134, 255, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(131, 56, 236, 0.05) 0px, transparent 50%);
    color: var(--dark);
    line-height: 1.5;
    font-size: 16px;
}

img {
    max-width: 100%;
    display: block;
}

/* Layout */
.container {
    max-width: 1150px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    margin-bottom: 20px;
}

/* Typography */
h1,
h2,
h3,
h4,
h5 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 3rem;
    line-height: 1.1;
    margin-bottom: 24px;
}

h2 {
    font-size: 2rem;
    margin-bottom: 16px;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin: 0 0 16px 0;
    color: var(--muted);
}

hr {
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin: 30px 0;
}

/* Components */
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    color: var(--dark);
}

.brand-name {
    font-weight: 800;
}

.brand-tagline {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    box-shadow: var(--shadow-sm);
}

nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

nav a:hover {
    color: var(--primary);
    background: rgba(58, 134, 255, 0.05);
}

.nav-toggle.button {
    display: none;
}

.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(2px);
    z-index: 50;
}

html.nav-open .nav-backdrop {
    display: block;
}

html.nav-open,
html.nav-open body {
    overflow: hidden;
}

.nav-toggle::before {
    content: "☰";
    margin-right: 8px;
    line-height: 1;
}

.button-block {
    width: 100%;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(58, 134, 255, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--dark);
    border-color: rgba(0, 0, 0, 0.1);
}

.btn-ghost:hover {
    background: white;
    border-color: rgba(0, 0, 0, 0.2);
}

/* Forms */
input,
textarea,
select {
    font: inherit;
}

.field {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: white;
    box-shadow: var(--shadow-sm);
    color: var(--dark);
}

.field:focus {
    outline: 2px solid rgba(58, 134, 255, 0.25);
    border-color: rgba(58, 134, 255, 0.45);
}

textarea.field {
    min-height: 120px;
    resize: vertical;
}

.page-card {
    margin: 20px auto 0;
}

.page-card--narrow {
    max-width: 800px;
}

.page-card--wide {
    max-width: 900px;
}

.link-primary {
    color: var(--primary);
}

/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 48px;
    align-items: center;
    padding: 40px 0 60px;
}

.hero .headline {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero .sub {
    font-size: 1.125rem;
    margin-bottom: 32px;
    max-width: 540px;
}

/* Search & Topics */
.searchbar {
    display: flex;
    gap: 8px;
    background: var(--surface);
    padding: 8px;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-md);
    align-items: center;
}

.searchbar input {
    flex: 1;
    border: 0;
    outline: 0;
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
    color: var(--dark);
}

.topics {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.topic {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--dark);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.topic:hover {
    background: white;
    color: var(--primary);
    border-color: var(--primary);
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.featured-title {
    margin-bottom: 8px;
}

.featured-sub {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--muted);
}

.featured-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.featured-item {
    display: flex;
    gap: 12px;
    align-items: center;
}

.icon-box {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex: 0 0 auto;
}

.icon-box--teal {
    background: linear-gradient(135deg, #c7f9f6, #7dd3fc);
}

.icon-box--sunset {
    background: linear-gradient(135deg, #fde68a, #fca5a5);
}

.icon-box--purple {
    background: linear-gradient(135deg, #d6bcfa, #bde0fe);
}

.featured-name {
    font-weight: 700;
}

.featured-meta {
    font-size: 13px;
    color: var(--muted);
}

.section-title-spaced {
    margin-top: 28px;
}

.stats {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.stat {
    flex: 1;
    text-align: center;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.stat h3 {
    margin: 0;
    font-size: 24px;
    color: var(--primary);
}

.stat p {
    font-size: 13px;
    font-weight: 600;
}

/* Courses Grid */
.courses {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.course {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.course:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.course .thumb {
    height: 120px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--light), #e2e8f0);
    display: flex;
    align-items: flex-end;
    padding: 12px;
    font-weight: 700;
    font-size: 18px;
}

/* Specialized Thumbs */
.thumb.math {
    background: linear-gradient(135deg, #FFBE0B, #FB5607);
    color: white;
}

.thumb.code {
    background: linear-gradient(135deg, #3A86FF, #8338EC);
    color: white;
}

.thumb.science {
    background: linear-gradient(135deg, #06d6a0, #118ab2);
    color: white;
}

.course h4 {
    font-size: 18px;
}

.course .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.course .meta small {
    color: var(--muted);
}

/* Features */
.features {
    display: flex;
    gap: 24px;
    margin-top: 48px;
}

.feature {
    flex: 1;
    padding: 24px;
    border-radius: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.feature h5 {
    font-size: 18px;
    color: var(--secondary);
    margin-bottom: 8px;
}

/* Testimonials */
.testimonials {
    margin-top: 48px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* 404 */
.notfound {
    min-height: calc(100vh - 220px);
    display: grid;
    place-items: center;
    padding: 30px 0 60px;
}

.notfound .card {
    max-width: 520px;
    text-align: center;
}

.notfound h1 {
    font-size: 4rem;
    margin: 0 0 8px;
}

.notfound h2 {
    margin: 0 0 10px;
    color: var(--muted);
    font-weight: 600;
}

.notfound p {
    color: var(--muted);
    margin-bottom: 20px;
}

.notfound .icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* Meta */
.meta-error {
    min-height: calc(100vh - 220px);
    display: grid;
    place-items: center;
    padding: 20px 0 60px;
}

.meta-tip {
    margin: 16px 0 0;
    font-size: 0.95rem;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    padding: 6px 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.6);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.meta-error details {
    margin-top: 16px;
    border-top: 1px dashed rgba(0, 0, 0, 0.12);
    padding-top: 16px;
    color: var(--muted);
}

.meta-error code,
.meta-error kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.95em;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.10);
    padding: 2px 6px;
    border-radius: 6px;
}

/* Partners page */
.partner-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0 40px;
}

.partner-page .header-section {
    text-align: center;
    margin-bottom: 40px;
}

.partner-page .header-section h1 {
    color: var(--primary);
    font-size: 36px;
    margin-bottom: 10px;
}

.partner-page .header-section p {
    font-size: 18px;
    color: var(--muted);
}

.partner-page .section {
    margin-bottom: 30px;
}

.partner-page .section h2 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 28px;
}

.partner-page .section p {
    margin-bottom: 12px;
}

.partner-page .upload-card {
    max-width: 600px;
    margin: 0 auto;
}

.partner-page .dropzone {
    border: 2px dashed rgba(0, 0, 0, 0.18);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    margin-bottom: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    color: var(--muted);
}

.partner-page .dropzone.highlight {
    background: rgba(58, 134, 255, 0.05);
    border-color: var(--primary);
}

.partner-page .dropzone input {
    display: none;
}

.partner-page .progress-bar-bg {
    width: 100%;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 14px;
    height: 18px;
}

.partner-page .progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.partner-page .message {
    margin-top: 14px;
    font-size: 15px;
}

.partner-page .success {
    color: #206520;
}

.partner-page .error {
    color: #8B0000;
}

/* Footer */
footer {
    margin-top: 80px;
    padding: 40px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.footer-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-name {
    font-weight: 800;
}

.footer-copy {
    font-size: 13px;
    color: var(--muted);
    margin-top: 6px;
}

.footer-links {
    display: flex;
    gap: 18px;
    align-items: center;
}

#projects {
    margin-top: 34px;
}

#projects .courses {
    margin-top: 12px;
}

/* Mobile */
@media (max-width: 980px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .courses {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero .sub {
        margin: 0 auto 32px;
    }

    .searchbar {
        max-width: 600px;
        margin: 0 auto;
    }

    .topics {
        justify-content: center;
    }

    nav {
        display: none;
        position: fixed;
        top: 84px;
        left: 16px;
        right: 16px;
        flex-direction: column;
        gap: 6px;
        padding: 12px;
        background: rgba(255, 255, 255, 0.92);
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 16px;
        box-shadow: var(--shadow-lg);
        z-index: 60;
    }

    html.nav-open nav {
        display: flex;
    }

    nav a.button {
        width: 100%;
    }

    .nav-toggle.button {
        display: inline-flex;
        padding: 10px 14px;
    }

    /* Simplified for now, traditionally would be a hamburger */
}

@media (max-width: 600px) {

    .courses,
    .testimonials,
    .features {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}
