/* =========================================================================
   SCV V2 - PREMIUM DESIGN SYSTEM (2026)
   ========================================================================= */

/* --- 1. VARIABLES (Design Tokens) --- */
:root {
    /* Color Palette: Earthy, Fresh & Premium */
    --c-primary: #10b981;       /* Vibrant Emerald */
    --c-primary-hover: #059669; /* Deep Emerald */
    --c-secondary: #2ebaae;     /* Teal */
    --c-accent: #f59e0b;        /* Amber */
    
    /* Light Theme Backgrounds & Surfaces */
    --bg-body: #f9fbf9;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f1f5f9;
    
    /* Typography Colors */
    --text-main: #334155;
    --text-muted: #64748b;
    --text-heading: #0f172a;
    
    /* UI Elements */
    --border-color: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.85);
    
    /* Shadows (Apple-like soft shadows) */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 25px -3px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 40px -5px rgba(16, 185, 129, 0.1);
    --shadow-glow: 0 10px 30px rgba(16, 185, 129, 0.25);
    
    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Typography */
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-display: 'Outfit', system-ui, sans-serif;
}

/* --- 2. DARK MODE (Automatic) --- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #0f172a;
        --bg-surface: #1e293b;
        --bg-surface-alt: #334155;
        --text-main: #cbd5e1;
        --text-muted: #94a3b8;
        --text-heading: #f8fafc;
        --border-color: #334155;
        --glass-bg: rgba(15, 23, 42, 0.85);
        --shadow-md: 0 10px 25px -3px rgba(0, 0, 0, 0.4);
    }
}

/* --- 3. RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; border-radius: var(--radius-sm); }
a { color: var(--c-secondary); text-decoration: none; transition: all 0.2s ease; }
a:hover { color: var(--c-primary); }

/* --- 4. TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-heading);
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0;
    margin-bottom: 0.8em;
    letter-spacing: -0.02em;
}
h1 { font-size: 2.8rem; background: linear-gradient(135deg, var(--c-secondary) 0%, var(--c-primary) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
h2 { font-size: 2.2rem; }
h3 { font-size: 1.5rem; }
p { margin-bottom: 1.5rem; font-size: 1.125rem; }
strong, b { color: var(--text-heading); font-weight: 600; }

/* --- 5. LAYOUT (Grid & Containers) --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.grid { display: grid; gap: 30px; }
.grid-cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* --- 6. COMPONENTS --- */

/* Glassmorphism Sticky Navigation */
#nav {
    position: sticky;
    top: 20px;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px auto 40px auto;
    max-width: 1000px;
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-menu {
    display: flex;
    gap: 15px;
    list-style: none;
    margin: 0; padding: 0;
    align-items: center;
}
.nav-menu li { position: relative; }
.nav-menu li a {
    color: var(--text-heading);
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 1.05rem;
}
.nav-menu li a:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--c-primary);
}

/* Premium Surface/Cards (Replaces .box) */
.surface {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.surface-hover:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--c-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    font-family: var(--font-sans);
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    font-size: 1.05rem;
}
.btn-primary {
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    color: #fff !important;
    box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.35);
}

/* Alerts / Banners */
.alert {
    padding: 20px 25px;
    border-radius: var(--radius-md);
    margin-bottom: 30px;
    border-left: 5px solid var(--c-primary);
    background: var(--bg-surface-alt);
    font-size: 1.05rem;
}

/* Sommaire Table of Contents */
.toc {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.toc ul { list-style: none; padding-left: 0; }
.toc li { margin-bottom: 12px; position: relative; padding-left: 20px; }
.toc li::before { content: '→'; position: absolute; left: 0; color: var(--c-primary); font-weight: bold; }

/* Global Images */
.image.featured {
    display: block;
    margin-bottom: 2em;
    overflow: hidden;
    border-radius: var(--radius-md);
    text-align: center;
}
.image.featured img {
    max-width: 600px !important;
    max-height: 400px !important;
    width: 100%;
    object-fit: cover;
    margin: 0 auto;
    display: inline-block;
    box-shadow: var(--shadow-md);
}



/* --- STRUCTURAL ARCHITECTURE --- */
#page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#header {
    text-align: center;
    padding: 40px 20px 20px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}
#header p {
    margin-bottom: 0;
}

#main {
    flex: 1;
    padding: 50px 0;
}

#footer {
    background: #0f172a;
    color: #f8fafc;
    padding: 60px 0;
    margin-top: 60px;
}
#footer a {
    color: var(--c-primary);
}
#footer a:hover {
    color: #fff;
}

/* Ensure the navigation bar separates well */
#nav {
    position: sticky;
    top: 0; /* Attach to very top instead of 20px for better UX */
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-shadow: var(--shadow-sm);
    margin: 0; /* Remove margin so it acts like a full-width header bar */
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
}
#nav > ul {
    display: flex;
    gap: 20px;
    list-style: none;
    margin: 0; 
    padding: 15px 20px;
    align-items: center;
}
#nav > ul > li > a {
    color: var(--text-heading);
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.05rem;
    transition: all 0.2s;
}
#nav > ul > li:hover > a, #nav > ul > li.current > a {
    background: var(--c-primary);
    color: #fff !important;
}

/* Better content spacing */
.page-content {
    background: var(--bg-surface);
    padding: 50px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

/* Legacy Aliases (HTML5UP support during transition) */
.box {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
    border: 1px solid var(--border-color);
    margin-bottom: 2em;
}
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}
.col-12 {
    width: 100%;
    padding: 0 15px;
}

/* --- Fix Dropdown Menu (Sub-menus) --- */
nav#nav > ul > li > ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 10px;
    min-width: 250px;
    z-index: 2000;
}
nav#nav > ul > li:hover > ul {
    display: block;
}
nav#nav > ul > li > ul > li {
    display: block;
    margin-bottom: 5px;
}
nav#nav > ul > li > ul > li:last-child {
    margin-bottom: 0;
}
nav#nav > ul > li > ul > li > a {
    display: block;
    padding: 10px 15px;
    color: var(--text-main) !important;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}
nav#nav > ul > li > ul > li > a:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--c-primary) !important;
}

/* --- Fix Dropotron overrides (if JS is active) --- */
.dropotron {
    background: var(--bg-surface) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    padding: 10px !important;
    border: 1px solid var(--border-color) !important;
    margin-top: 15px !important;
}
.dropotron li a {
    color: var(--text-main) !important;
    padding: 10px 15px !important;
    display: block !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 500 !important;
}
.dropotron li a:hover {
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--c-primary) !important;
}

/* --- Fix Mobile Menu (TitleBar & NavPanel) --- */
#titleBar {
    background: var(--bg-surface);
    color: var(--text-heading);
    padding: 15px 20px;
    text-align: left;
    font-weight: bold;
    box-shadow: var(--shadow-sm);
    display: none;
}
#titleBar .toggle {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23334155"><path d="M3 6h18M3 12h18M3 18h18" stroke="%23334155" stroke-width="2" stroke-linecap="round"/></svg>') center center no-repeat;
    cursor: pointer;
}

#navPanel {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-surface);
    color: var(--text-main);
    box-shadow: 5px 0 25px rgba(0,0,0,0.1);
    padding: 20px;
    z-index: 10001;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}
body.navPanel-visible #navPanel {
    transform: translateX(0);
}
#navPanel .link {
    display: block;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-heading);
    font-weight: bold;
}

/* Responsiveness */
@media screen and (max-width: 980px) {
    #page-wrapper { padding-top: 0 !important; }
    #titleBar { display: block; }
    nav#nav { display: none !important; }
}
