:root {
    /* Backgrounds */
    --bg-color: #FDFBF7;           /* Creamy white paper texture base */
    --card-bg: rgba(255, 255, 255, 0.65); /* Glassmorphism base */
    
    /* Typography */
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    
    /* Matisse Palette (Fauvism Accents) */
    --matisse-red: #E74C3C;
    --matisse-blue: #3498DB;
    --matisse-green: #27AE60;
    --matisse-yellow: #F1C40F;
    
    /* Effects */
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --hover-shadow: 0 15px 45px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Lato', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(231, 76, 60, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(39, 174, 96, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 50% 50%, rgba(52, 152, 219, 0.03) 0%, transparent 30%);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6, .serif-title {
    font-family: 'Playfair Display', serif;
    color: var(--matisse-blue);
    margin-top: 1.5rem;
}

h2 {
    border-bottom: 2px solid var(--matisse-red);
    padding-bottom: 0.5rem;
    display: inline-block;
}

h3 {
    color: var(--matisse-green);
}

.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
    animation: float 20s infinite ease-in-out alternate;
    width: 50vw;
    height: 50vw;
    top: -10%;
    left: -10%;
    background: #FAE5D3;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(30px, 60px) rotate(10deg); }
}

.grid-container {
    width: 90%;
    max-width: 1000px;
    margin: 2rem auto;
}

.main-header {
    text-align: center;
    margin-bottom: 3rem;
}

.main-header h1 {
    font-size: 3rem;
    color: var(--matisse-red);
    margin-bottom: 0.5rem;
}

.main-header p {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--hover-shadow);
    background: rgba(255, 255, 255, 0.8);
}

/* Base64 formula images */
.inline-math {
    vertical-align: middle;
    mix-blend-mode: multiply; /* Helps integrate white background images */
    height: 1.2em; /* Reasonable size for inline equations */
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 2rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    overflow: hidden;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

th {
    background: var(--matisse-blue);
    color: white;
    font-family: 'Playfair Display', serif;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: 'Lato', sans-serif;
    margin-top: auto;
    width: 100%;
}

footer a {
    font-weight: bold;
    transition: opacity 0.3s;
}

footer a:hover {
    opacity: 0.7;
}

html {
    scroll-behavior: smooth;
}

.top-arrow {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--matisse-red);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.3s, background 0.3s;
    z-index: 100;
}

.top-arrow:hover {
    transform: translateY(-5px);
    background: var(--matisse-blue);
}

/* JSXGraph internal styling fixes specifically for our glassmorphism */
.jxgbox {
    border-radius: 10px !important;
    overflow: hidden;
}
.jxgbox:hover {
    transform: none; /* disable lift for drawing boards */
}

/* --- MENU STYLES --- */
.menu-body {
    justify-content: center;
}

.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.menu-grid {
    display: flex;
    gap: 2rem;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    margin-top: 2rem;
}

.menu-card {
    text-decoration: none;
    color: inherit;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-top: 5px solid transparent;
}

.menu-card-lycee {
    border-top-color: var(--matisse-blue);
}

.menu-card-expert {
    border-top-color: var(--matisse-red);
}

.menu-card h2 {
    border-bottom: none;
}

.menu-card p {
    color: var(--text-muted);
}

.back-home {
    display: inline-block;
    margin-top: 1rem;
    color: var(--matisse-red);
    text-decoration: none;
    font-weight: bold;
    transition: opacity 0.3s;
}

.back-home:hover {
    opacity: 0.7;
}
