/* --- POLICE & VARIABLES --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
    --bg-color: #f8f8f9; /* Gris ultra-clair (presque blanc) */
    --text-color: #111111; /* Noir très profond */
    --text-light: #555555; /* Gris pour le texte secondaire */
    --accent-green: #00d26a; /* Le Vert dynamique */
    --card-bg: #ffffff; /* Fond blanc pur pour les cartes */
    --nav-bg: rgba(248, 248, 249, 0.85); /* Menu transparent/flouté */
}

/* --- RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- NAVIGATION --- */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 50px;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.logo {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 35px;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-green);
}

/* --- STRUCTURE DES SECTIONS --- */
section {
    min-height: 100vh;
    padding: 120px 5%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

section h2 {
    font-size: 32px;
    font-weight: 400;
    margin-bottom: 60px;
    letter-spacing: 1px;
}

/* --- HERO SECTION (Accueil) --- */
.hero {
    text-align: left;
    align-items: flex-start;
    padding-left: 10%;
}

.hero-content h1 {
    font-size: 60px;
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 15px;
}

.hero-content h1 span {
    color: var(--accent-green);
}

.hero-content h2 {
    font-size: 22px;
    font-weight: 400;
    color: var(--text-light);
    margin-bottom: 25px;
}

.hero-content p {
    max-width: 500px;
    margin-bottom: 40px;
    color: var(--text-light);
}

.hero-buttons {
    display: flex;
    gap: 20px;
}

/* --- BOUTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background-color: var(--accent-green);
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    border-radius: 4px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--accent-green);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 210, 106, 0.2);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--text-color);
}

.btn-outline:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    box-shadow: none;
}

/* --- À PROPOS & COMPÉTENCES --- */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1000px;
    text-align: left;
}

.qualities {
    margin-top: 30px;
    font-weight: 500;
    color: var(--accent-green);
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.tag {
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
}

/* --- PARCOURS (Timeline) --- */
.timeline {
    max-width: 800px;
    text-align: left;
    border-left: 2px solid rgba(0,0,0,0.1);
    padding-left: 30px;
}

.timeline-item {
    margin-bottom: 50px;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -37px;
    top: 0;
    width: 12px;
    height: 12px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--bg-color);
}

.timeline-item .date {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-green);
    margin-bottom: 5px;
}

.timeline-item h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

/* --- PROJETS --- */
.grid-projets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1100px;
    width: 100%;
}

.carte-projet {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.carte-projet:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.carte-projet img {
    width: 100%;
    height: 180px;
    object-fit: contain; /* Garde les proportions de tes logos */
    margin-bottom: 20px;
}

.tech-stack {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-green);
    margin: 10px 0;
}

.btn-link {
    display: inline-block;
    margin-top: 15px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.3s;
}

.btn-link:hover {
    color: var(--accent-green);
}

/* --- CERTIFICATIONS --- */
.grid-certifs {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.certif-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    width: 200px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    transition: transform 0.3s;
}

.certif-card:hover {
    transform: translateY(-5px);
}

.certif-card img {
    height: 60px;
    margin-bottom: 15px;
}

/* --- VISIONNEUSE DE DOCUMENTS (CV, certifications) --- */
body.viewer-open {
    overflow: hidden;
}

.doc-viewer {
    width: min(960px, 92vw);
    height: 90vh;
    height: 90dvh;
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.doc-viewer[open] {
    display: flex;
    flex-direction: column;
    animation: viewer-in 0.25s ease-out;
}

.doc-viewer::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

@keyframes viewer-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

.doc-viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 12px 12px 20px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.doc-viewer-title {
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-viewer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.doc-viewer-btn,
.doc-viewer-close {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.doc-viewer-btn:hover,
.doc-viewer-close:hover {
    background: rgba(128, 128, 128, 0.15);
}

.doc-viewer-btn ion-icon {
    font-size: 17px;
    color: var(--accent-green);
}

.doc-viewer-close {
    padding: 8px;
    font-size: 22px;
}

.doc-viewer-btn:focus-visible,
.doc-viewer-close:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

.doc-viewer-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: #525659; /* gris du lecteur PDF, évite un flash blanc */
}

@media (max-width: 600px) {
    .doc-viewer {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }

    /* Sur petit écran on garde seulement l'icône (le texte reste lu par les lecteurs d'écran) */
    .doc-viewer-btn span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .doc-viewer[open] {
        animation: none;
    }
}

/* --- CONTACT & FOOTER --- */
.contact-links {
    display: flex;
    gap: 20px;
    margin-top: 30px;
    justify-content: center;
}

footer {
    padding: 30px;
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* --- CLASSES D'ANIMATION (Gérées par le JS) --- */
.fade-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- RESPONSIVE (Mobiles & Tablettes) --- */
@media (max-width: 768px) {
    .nav-links { display: none; } /* On cache le menu sur mobile pour l'instant */
    .hero { padding-left: 5%; text-align: center; align-items: center; }
    .about-grid { grid-template-columns: 1fr; }
    .hero-buttons { justify-content: center; }
}


/* --- DARK MODE --- */
/* On applique la classe directement sur le :root pour écraser les couleurs claires à coup sûr */
:root.dark-theme {
    --bg-color: #0c0c0c;
    --text-color: #f5f5f7;
    --text-light: #a0a0a5;
    --card-bg: #1a1a1a;
    --nav-bg: rgba(12, 12, 12, 0.85);
}

/* Style du bouton de changement de thème */
.theme-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 22px; /* Un peu plus grand pour être bien visible */
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease, color 0.3s ease;
}

.theme-btn:hover {
    color: var(--accent-green);
    transform: scale(1.1); /* Petit effet de zoom au survol */
}


/* --- CONTRÔLES (Langue & Thème) --- */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lang-select {
    background: transparent;
    border: 1px solid var(--text-light);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.lang-select option {
    background: var(--bg-color);
    color: var(--text-color);
}

/* Magie pour l'Arabe (Right-to-Left) */
html[dir="rtl"] {
    text-align: right;
}
html[dir="rtl"] .nav-links {
    flex-direction: row-reverse;
}
/* --- Statut des diplômes (Parcours) : porté par le point de la timeline --- */
.date-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.date-row .date {
    margin-bottom: 0;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
}

.status-icon {
    position: relative;
    display: inline-flex;
}

.status-icon ion-icon {
    font-size: 18px;
    color: var(--accent-green);
}

/* En cours : le sablier se retourne, marque une pause, puis recommence */
.status-current .status-icon ion-icon {
    animation: hourglass-flip 3s ease-in-out infinite;
}

@keyframes hourglass-flip {
    0%, 70%  { transform: rotate(0deg); }
    85%, 100% { transform: rotate(180deg); }
}

/* Diplômé : la toque brille et une étincelle scintille */
.status-done .status-icon ion-icon {
    animation: diploma-glow 3.2s ease-in-out infinite;
    animation-delay: var(--shine-delay, 0s);
}

.status-done .status-icon::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -6px;
    width: 9px;
    height: 9px;
    background: #ffd54a;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    opacity: 0;
    transform: scale(0);
    animation: diploma-sparkle 3.2s ease-in-out infinite;
    animation-delay: var(--shine-delay, 0s);
}

@keyframes diploma-glow {
    0%, 55%, 100% { filter: drop-shadow(0 0 0 rgba(0, 210, 106, 0)); }
    70% { filter: drop-shadow(0 0 5px rgba(0, 210, 106, 0.9)) brightness(1.15); }
}

@keyframes diploma-sparkle {
    0%, 60%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
    72% { opacity: 1; transform: scale(1.1) rotate(45deg); }
    84% { opacity: 0; transform: scale(0.4) rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
    .status-current .status-icon ion-icon,
    .status-done .status-icon ion-icon,
    .status-done .status-icon::after {
        animation: none;
    }
}

/* Progression du diplôme en cours : une case par année */
.progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -2px 0 12px;
}

.progress-track {
    display: flex;
    gap: 4px;
}

.progress-track .seg {
    width: 36px;
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 210, 106, 0.18);
}

.progress-track .seg.is-filled {
    background: var(--accent-green);
}

.progress-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
}

/* Diplômé : point plein avec une coche */
.timeline-item.is-done::before {
    left: -39px;
    top: -1px;
    width: 16px;
    height: 16px;
    background: var(--accent-green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.3 2.3 4.7-4.9' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

/* En cours : anneau vide avec un halo qui pulse */
.timeline-item.is-current::before {
    box-sizing: border-box;
    background: var(--bg-color);
    border: 2.5px solid var(--accent-green);
    animation: status-pulse 2.4s ease-out infinite;
}

@keyframes status-pulse {
    0%   { box-shadow: 0 0 0 4px var(--bg-color), 0 0 0 4px rgba(0, 210, 106, 0.45); }
    100% { box-shadow: 0 0 0 4px var(--bg-color), 0 0 0 12px rgba(0, 210, 106, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .timeline-item.is-current::before {
        animation: none;
    }
}
