/* src/styles.css */

/* --- FONTS --- */
@font-face {
    font-family: 'Open Dyslexic';
    src: url('../font/OpenDyslexic/OpenDyslexic-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Open Dyslexic';
    src: url('../font/OpenDyslexic/OpenDyslexic-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Open Dyslexic';
    src: url('../font/OpenDyslexic/OpenDyslexic-Italic.otf') format('opentype');
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

/* --- RESET & BASE --- */
html {
    overflow-x: hidden;
    max-width: 100vw;
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-base-bg);
    background-image: var(--site-bg-gradient);
    background-attachment: fixed;
    background-size: cover;
    color: var(--color-text-default);
    font-size: var(--site-font-size, 1rem);
    line-height: var(--site-line-height, 1.6);
    letter-spacing: var(--site-letter-spacing, normal);
    word-spacing: var(--site-word-spacing, normal);
    transition: background-color 0.5s, color 0.3s;
    min-height: 100vh;
    font-family: var(--site-font-family, 'Outfit'), ui-sans-serif, system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    opacity: 0;
    animation: pageReveal 0.5s ease-out forwards;
}

/* --- THEMES --- */
/* 1. Modern Clean (Light - Default) */
.light {
    --color-primary: #4f46e5; /* Indigo 600 */
    --color-secondary: #ec4899; /* Pink 500 */
    --color-accent: #06b6d4; /* Cyan 500 */
    --color-header-bg: rgba(255, 255, 255, 0.8);
    --color-link: #4338ca; /* Indigo 700 */
    --color-base-bg: #f8fafc; /* Slate 50 */
    --color-content-bg: #ffffff;
    --color-text-default: #0f172a; /* Slate 900 */
    --color-text-secondary: #64748b; /* Slate 500 */
    --site-bg-gradient: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.08);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* 2. Modern Deep (Dark) */
.dark {
    --color-primary: #818cf8; /* Indigo 400 */
    --color-secondary: #f472b6; /* Pink 400 */
    --color-accent: #22d3ee; /* Cyan 400 */
    --color-header-bg: rgba(15, 23, 42, 0.8);
    --color-base-bg: #0f172a; /* Slate 900 */
    --color-content-bg: #1e293b; /* Slate 800 */
    --color-text-default: #f1f5f9; /* Slate 100 */
    --color-text-secondary: #94a3b8; /* Slate 400 */
    --site-bg-gradient: linear-gradient(180deg, #0f172a 0%, #020617 100%);
    --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.5);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* 3. High Contrast */
.high-contrast {
    --color-primary: #ffff00;
    --color-secondary: #00ffff;
    --color-accent: #ff00ff;
    --color-header-bg: #000000;
    --color-base-bg: #000000;
    --color-content-bg: #000000;
    --color-text-default: #ffff00;
    --color-text-secondary: #ffffff;
    --site-bg-gradient: none;
    --shadow-soft: none;
    --shadow-card: 0 0 0 2px #ffff00;
}

.high-contrast a {
    text-decoration: underline;
    color: #00ffff !important;
}

/* 4. Sepia (Reading Mode) */
.sepia {
    --color-primary: #8f5902;
    --color-secondary: #a06703;
    --color-accent: #ce5c00;
    --color-header-bg: rgba(244, 236, 216, 0.95);
    --color-base-bg: #f4ecd8;
    --color-content-bg: #fdf6e3;
    --color-text-default: #433422;
    --color-text-secondary: #5c4118;
    --site-bg-gradient: linear-gradient(to bottom, #f4ecd8, #e8dbc3);
    --shadow-soft: 0 4px 6px -1px rgba(143, 89, 2, 0.1);
    --shadow-card: 0 10px 15px -3px rgba(143, 89, 2, 0.1);
}

/* 5. Midnight (Deep Blue) */
.midnight {
    --color-primary: #82aaff;
    --color-secondary: #c792ea;
    --color-accent: #89ddff;
    --color-header-bg: rgba(1, 22, 39, 0.9);
    --color-base-bg: #011627;
    --color-content-bg: #062137;
    --color-text-default: #d6deeb;
    --color-text-secondary: #9aa9bd;
    --site-bg-gradient: linear-gradient(to bottom, #011627, #01101e);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* --- ACCESSIBILITY --- */
.cursor-large,
.cursor-large * {
    cursor: -webkit-image-set(url('https://cdn-icons-png.flaticon.com/512/5759/5759160.png') 2x) 24 24, auto !important;
}

.hide-images img,
.hide-images video,
.hide-images .hide-on-no-img {
    opacity: 0 !important;
    visibility: hidden !important;
}

.teacher-only {
    display: none;
}

.teacher-mode .teacher-only {
    display: block;
    border: 2px dashed var(--color-accent);
    padding: 1rem;
    margin: 1rem 0;
    background: rgba(255, 230, 0, 0.1);
}

.focus-mode header,
.focus-mode #announcement-bar,
.focus-mode footer,
.focus-mode .fixed-tools-container {
    display: none !important;
}

.focus-mode #main-content {
    margin-top: 2rem;
}

#reading-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 50;
}

#reading-guide {
    position: absolute;
    width: 100%;
    height: 3rem;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
    border-top: 2px solid var(--color-accent);
    border-bottom: 2px solid var(--color-accent);
    cursor: row-resize;
    pointer-events: none;
}

/* --- A11y Highlights --- */
.highlight-links a {
    text-decoration: underline !important;
    background-color: var(--color-primary);
    color: white !important;
    font-weight: bold;
    padding: 0 4px;
    border-radius: 4px;
}

.highlight-headings h1,
.highlight-headings h2,
.highlight-headings h3,
.highlight-headings h4,
.highlight-headings h5,
.highlight-headings h6 {
    outline: 3px solid var(--color-accent);
    padding: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.stop-animations *, .stop-animations { 
    animation: none !important; 
    transition: none !important; 
    scroll-behavior: auto !important; 
}

body {
    text-align: var(--site-text-align, left);
}

/* --- UI COMPONENTS --- */
button,
.btn {
    border-radius: 9999px !important;
    /* Pill shape for modern look */
}

/* Glassmorphism Utilities */
.glass {
    background: rgba(255, 255, 255, 0.6);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.dark .glass {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

/* Global Soft Borders */
* {
    border-color: rgba(0, 0, 0, 0.06);
}

.dark * {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Loader */
#initial-loader {
    position: fixed;
    inset: 0;
    background: var(--color-base-bg);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--color-primary);
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pageReveal {
    to {
        opacity: 1;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--color-base-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 6px;
    border: 3px solid var(--color-base-bg);
}

/* --- PREMIUM NAVIGATION --- */
.glass-header {
    background: var(--color-header-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link-animated {
    position: relative;
    padding: 0.5rem 0;
}

.nav-link-animated::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--color-primary);
    transition: all 0.3s ease-in-out;
    transform: translateX(-50%);
}

.nav-link-animated:hover::after {
    width: 100%;
}

.nav-link-animated.active::after {
    width: 100%;
}

/* --- MODERN FOOTER --- */
.footer-modern {
    background: linear-gradient(to top, var(--color-base-bg), var(--color-content-bg));
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .footer-modern {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}