/* =========================================
   1. CONFIGURATION (VARIABLES CSS)
   ========================================= */
:root {
    /* --- THEME SOMBRE (DÉFAUT) --- */
    --bg-body: #121212;
    --bg-sidebar: #1e2329;
    --bg-card: #1e1e1e;
    --text-main: #dfe6e9;
    --text-muted: #b2bec3;
    --accent: #10ac84;      /* Vert "Matrix/Sysadmin" */
    --border: #333;
    --terminal-bg: #000;
    --watch-panel-text: #bdc3c7;
    --watch-sub-text: #7f8c8d;
    --watch-title-text: #bdc3c7;
    --watch-body-text: #9aa1a6;
    --watch-date-text: #636e72;
    --watch-chevron: #ffffff;

    /* Dimensions */
    --sidebar-width: 280px;
    --header-height: 60px;
    --spacing: 2rem;
}

/* --- THEME CLAIR (VIA CLASSE .light-mode) --- */
body.light-mode {
    --bg-body: #f8f9fa;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --border: #dfe6e9;
    --terminal-bg: #f4f7fa;
    --watch-panel-text: #2d3436;
    --watch-sub-text: #4f5b62;
    --watch-title-text: #2d3436;
    --watch-body-text: #3f4c53;
    --watch-date-text: #5f6b72;
    --watch-chevron: #2d3436;
}

/* =========================================
   2. RESET & BASES
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden; /* Évite le scroll horizontal */
    transition: background-color 0.3s ease, color 0.3s ease;
}

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: var(--accent);
    z-index: 200;
    transition: width 0.1s ease;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* =========================================
   3. LAYOUT (GRID SYSTEM)
   ========================================= */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* =========================================
   4. SIDEBAR (GAUCHE)
   ========================================= */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 50;
    transition: transform 0.3s ease;
}

/* Profil */
.profile-header { text-align: center; margin-bottom: 2rem; }
.avatar {
    width: 100px; height: 100px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    object-fit: cover;
    margin: 0 auto 1rem auto;
    background-color: #333; /* Fond gris si l'image charge mal */
}

/* Navigation */
.nav-links li { margin-bottom: 0.5rem; }
.nav-links a {
    display: block; padding: 0.8rem 1rem;
    border-radius: 8px; font-weight: 600;
    color: var(--text-muted);
}
.nav-links a:hover, .nav-links a.active {
    background-color: rgba(16, 172, 132, 0.1);
    color: var(--accent);
}

/* Footer Sidebar (Drapeaux + Switch) */
.sidebar-footer { margin-top: auto; padding-top: 1.5rem; border-top: 1px solid var(--border); }

.lang-flags { display: flex; justify-content: center; gap: 15px; margin-bottom: 1.5rem; }
.flag-icon {
    width: 32px; height: 32px;
    cursor: pointer;
    opacity: 0.4;
    filter: grayscale(100%);
    transition: 0.3s;
    border-radius: 4px;
}
.flag-icon:hover, .flag-icon.active {
    opacity: 1; filter: grayscale(0%); transform: translateY(-2px);
}

/* =========================================
   5. TOGGLE SWITCH (STYLE IOS)
   ========================================= */
.theme-switch-wrapper {
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.theme-switch {
    position: relative; display: inline-block; width: 50px; height: 26px;
}
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #333; /* Fond OFF */
    transition: .4s; border-radius: 34px;
    border: 1px solid var(--text-muted);
}
.slider:before {
    position: absolute; content: "";
    height: 18px; width: 18px;
    left: 4px; bottom: 3px;
    background-color: white;
    transition: .4s; border-radius: 50%;
}
/* État ON (Light Mode) */
input:checked + .slider { background-color: var(--accent); border-color: var(--accent); }
input:checked + .slider:before { transform: translateX(24px); }

/* =========================================
   6. MAIN CONTENT (DROITE)
   ========================================= */
.main-content {
    padding: 4rem;
    width: 100%;
}

section { margin-bottom: 5rem; scroll-margin-top: 2rem; }

h1 { font-size: 2.5rem; margin-bottom: 1rem; line-height: 1.2; }
h2.section-title {
    font-size: 1.8rem; margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--accent); display: inline-block; padding-bottom: 5px;
}
p { color: var(--text-muted); }

.hero-lead {
    font-size: 1.1rem;
    max-width: 700px;
}

.stack-intro {
    max-width: 800px;
    margin: 0.4rem 0 1.4rem 0;
    font-size: 0.95rem;
}

.skills-evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.2rem;
}

.skill-evidence-card {
    padding: 1.2rem;
}

.skill-evidence-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.45rem;
}

.skill-evidence-card h3 {
    font-size: 1.05rem;
    margin-bottom: 0;
    flex: 1;
}

.skill-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.skill-context {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.skill-proof-list {
    list-style: disc;
    margin: 0 0 0.9rem 1rem;
    color: var(--text-muted);
}

.skill-proof-list li {
    margin-bottom: 0.32rem;
    font-size: 0.9rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
}

/* Grilles & Cartes */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.card:hover { transform: translateY(-5px); border-color: var(--accent); }

.experience-timeline {
    position: relative;
    margin-top: 1rem;
    display: grid;
    gap: 1.2rem;
}

.experience-timeline::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: linear-gradient(to bottom, rgba(16, 172, 132, 0.6), rgba(16, 172, 132, 0.15));
}

.experience-item {
    position: relative;
    padding-left: 2rem;
}

.experience-marker {
    position: absolute;
    left: 2px;
    top: 1.2rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--accent);
    box-shadow: 0 0 0 4px rgba(16, 172, 132, 0.12);
}

.experience-card {
    padding: 1.2rem 1.3rem;
}

.experience-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.4rem;
}

.experience-company {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.experience-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    padding: 0.3rem;
    flex-shrink: 0;
}

.experience-role {
    color: var(--accent);
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.experience-period {
    background: rgba(16, 172, 132, 0.1);
    color: var(--accent);
    padding: 0.28rem 0.75rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.card-intro {
    font-size: 0.92rem;
    margin: 0.2rem 0 0.6rem 0;
    color: var(--text-main);
    font-weight: 600;
}

.card-details {
    margin-bottom: 1rem;
}

.card-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.86rem;
    font-weight: 600;
}

.card-details[open] summary {
    margin-bottom: 0.2rem;
}

.impact-list {
    margin: 0 0 0.9rem 1.1rem;
    color: var(--text-muted);
}

.impact-list li {
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.tech-tag {
    display: inline-block; padding: 5px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 20px; font-size: 0.85rem; font-weight: 600;
    margin: 5px 5px 0 0; border: 1px solid var(--border);
    color: var(--text-main);
}

/* Veille */
.watch-hub {
    display: grid;
    gap: 1.5rem;
}

.watch-hero,
.watch-panel {
    background: var(--terminal-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.3rem 1.4rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--watch-panel-text);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.watch-hero {
    background-image: none;
}


.watch-row {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 1.3rem;
}

.watch-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 0.6rem;
}

.watch-title {
    font-size: 1.05rem;
    color: var(--text-main);
}

.watch-sub {
    font-size: 0.75rem;
    color: var(--watch-sub-text);
}

.watch-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.watch-toggle-large {
    background: transparent;
    border: none;
    color: var(--watch-chevron);
    border-radius: 0;
    width: auto;
    height: auto;
    padding: 0;
    font-size: 2rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.watch-toggle-large[aria-pressed="true"] {
    transform: rotate(90deg);
}

.watch-title-date {
    font-weight: 600;
    color: var(--text-main);
}

.watch-hero-list {
    display: grid;
    gap: 0.85rem;
}

.watch-week-rail {
    display: grid;
    gap: 0.6rem;
    padding-right: 0;
}

.watch-week-groups {
    display: grid;
    gap: 0.7rem;
}

.watch-day-group {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    background: rgba(255,255,255,0.02);
}

.watch-day-group summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.86rem;
}

.watch-day-group summary::-webkit-details-marker {
    display: none;
}

.watch-day-group summary::after {
    content: "›";
    color: var(--watch-chevron);
    font-size: 1.2rem;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
}

.watch-day-group[open] summary::after {
    transform: rotate(90deg);
}

.watch-day-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.watch-count {
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    color: #9aa1a6;
}

.watch-day-list {
    margin-top: 0.5rem;
    display: grid;
    gap: 0.4rem;
}

.watch-item {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 0.6rem;
}

.watch-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.watch-item summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
}

.watch-item summary::-webkit-details-marker {
    display: none;
}

.watch-item summary::after {
    content: "›";
    color: var(--watch-chevron);
    font-size: 1.35rem;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
}

.watch-item[open] summary::after {
    transform: rotate(90deg);
}

.watch-title-text {
    color: var(--watch-title-text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.watch-body {
    margin-top: 0.5rem;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    color: var(--watch-body-text);
    display: grid;
    gap: 0.4rem;
}

.watch-link {
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 600;
}

.watch-date { color: var(--watch-date-text); }
.watch-tag { color: var(--accent); font-weight: bold; }

.watch-month-grid {
    display: grid;
    gap: 0.8rem;
    max-height: 360px;
    overflow: auto;
    padding-right: 0.3rem;
}

.watch-month-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 0.85rem 0.95rem;
    background: rgba(255,255,255,0.02);
    display: grid;
    gap: 0.4rem;
}

.watch-month-title {
    font-size: 0.9rem;
    color: var(--text-main);
}

.watch-month-summary {
    font-size: 0.84rem;
    color: var(--watch-body-text);
}

.back-to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(6px);
    z-index: 150;
}

.back-to-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.watch-empty {
    font-size: 0.85rem;
    color: var(--watch-sub-text);
    padding: 0.4rem 0;
}

/* =========================================
   7. RESPONSIVE (MOBILE)
   ========================================= */
.mobile-header { display: none; } /* Caché sur PC */

.toolbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-main);
}

.toolbar-logo {
    width: 34px;
    height: 34px;
    color: var(--accent);
    flex-shrink: 0;
}

.toolbar-brand-text {
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--text-main);
    letter-spacing: 0.01em;
}

.burger-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.8rem;
    cursor: pointer;
}

@media (max-width: 992px) {
    .app-layout { grid-template-columns: 1fr; }

    /* Sidebar cachée par défaut à gauche */
    .sidebar {
        position: fixed; left: -100%; top: var(--header-height);
        width: 85%; height: calc(100vh - var(--header-height));
        border-right: 1px solid var(--border);
        padding: 1.5rem;
    }
    .sidebar.open { left: 0; transform: none; }

    /* Header Mobile */
    .mobile-header {
        display: flex; align-items: center; justify-content: space-between;
        height: var(--header-height); padding: 0 1.5rem;
        background-color: var(--bg-sidebar); border-bottom: 1px solid var(--border);
        position: sticky; top: 0; z-index: 100;
    }

    .toolbar-brand-text {
        font-size: 0.98rem;
    }

    .main-content { padding: 2rem 1.5rem; }
    h1 { font-size: 1.8rem; }
    .skills-evidence-grid {
        grid-template-columns: 1fr;
    }
    .experience-head {
        flex-direction: column;
        gap: 0.45rem;
    }
    .experience-company {
        width: 100%;
    }
    .experience-period {
        align-self: flex-start;
    }

    .watch-row {
        grid-template-columns: 1fr;
    }

}
