/* =========================================================
   style.css
   Les styles de base du site. Les couleurs viennent de variables.css
   ========================================================= */

/* ---------- 1. Remise a zero ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--cyan);
    text-decoration: none;
}

/* ---------- 2. Conteneur centre ---------- */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- 3. Papier millimetre (blueprint) ---------- */
.blueprint {
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ---------- 4. Petits textes techniques ---------- */
.mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.repere {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--amber);
}

/* =========================================================
   ETAPE 3 : BOUTONS, NAVBAR, HERO
   ========================================================= */

/* ---------- 5. Boutons ---------- */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    transition: background-color var(--transition), border-color var(--transition), transform var(--transition);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background-color: var(--cyan);
    color: var(--cyan-dark);
}

.btn-primary:hover {
    background-color: #67e8f9;
}

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

.btn-outline:hover {
    border-color: var(--cyan);
}

/* ---------- 6. Navbar ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 1000;
    background-color: rgba(6, 17, 28, 0.6);
    backdrop-filter: blur(10px);          /* floute ce qui passe derriere */
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition), background-color var(--transition);
}

/* Ajoutee par main.js quand on descend dans la page */
.navbar.scrolled {
    background-color: rgba(6, 17, 28, 0.9);
    border-bottom-color: var(--border);
}

.navbar-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.nav-links {
    display: flex;
    gap: 8px;
    margin-inline-start: auto;   /* pousse les liens vers la fin (droite en DE, gauche en AR) */
}

.nav-links a {
    color: var(--text-soft);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: color var(--transition), background-color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
    background-color: var(--bg-panel-2);
}

/* Le petit "-X1" devant chaque lien = numero de borne */
.nav-x {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--cyan);
}

/* --- Choix de la langue --- */
.lang-switch {
    position: relative;
}

.lang-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius);
    cursor: pointer;
}

.lang-btn:hover {
    border-color: var(--cyan);
}

.lang-menu {
    display: none;
    position: absolute;
    inset-inline-end: 0;          /* colle au bord de fin (droite en DE, gauche en AR) */
    top: calc(100% + 8px);
    list-style: none;
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    min-width: 140px;
}

/* Ajoutee par main.js quand on clique sur le bouton */
.lang-menu.open {
    display: block;
}

.lang-menu button {
    width: 100%;
    text-align: start;            /* gauche en DE, droite en AR */
    background: none;
    border: none;
    color: var(--text-soft);
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.9rem;
}

.lang-menu button:hover {
    background-color: var(--bg-panel-2);
    color: var(--text);
}

/* --- Bouton hamburger (cache sur grand ecran) --- */
.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.burger span {
    width: 24px;
    height: 2px;
    background-color: var(--text);
    transition: transform var(--transition), opacity var(--transition);
}

/* Les 3 traits deviennent une croix quand le menu est ouvert */
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 7. Hero ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

/* La grille blueprint, visible au centre et qui disparait vers les bords */
.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 32px 32px;
    -webkit-mask-image: radial-gradient(circle at 50% 50%, black 0%, transparent 65%);
    mask-image: radial-gradient(circle at 50% 50%, black 0%, transparent 65%);
}

/* La lumiere bleue tres douce derriere le titre */
.hero-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 700px;
    height: 700px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(34, 211, 238, 0.12) 0%, transparent 60%);
    pointer-events: none;   /* on peut cliquer "a travers" */
}

.hero-content {
    position: relative;     /* passe au-dessus de la grille et de la lumiere */
    z-index: 1;
}

.hero-eyebrow {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin: 12px 0 16px;
}

.hero-title {
    font-size: clamp(2.5rem, 7vw, 5rem);   /* min, ideal, max */
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    color: var(--cyan);
    font-size: 1.1rem;
    margin: 20px 0 32px;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* La LED verte "Verfuegbar" */
.status {
    margin-top: 28px;
    color: var(--text-soft);
}

.led {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--green);
    margin-inline-end: 8px;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* La souris qui invite a descendre */
.scroll-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 38px;
    border: 2px solid var(--border-strong);
    border-radius: 12px;
}

.scroll-hint span {
    position: absolute;
    left: 50%;
    top: 6px;
    width: 4px;
    height: 8px;
    margin-left: -2px;
    border-radius: 2px;
    background-color: var(--cyan);
    animation: scroll-dot 1.8s infinite;
}

@keyframes scroll-dot {
    0%   { transform: translateY(0);    opacity: 1; }
    100% { transform: translateY(14px); opacity: 0; }
}

/* Apparition en douceur, element par element */
.fade-up {
    opacity: 0;
    animation: fade-up 0.8s ease forwards;
}

.fade-up:nth-child(2) { animation-delay: 0.1s; }
.fade-up:nth-child(3) { animation-delay: 0.2s; }
.fade-up:nth-child(4) { animation-delay: 0.3s; }
.fade-up:nth-child(5) { animation-delay: 0.4s; }
.fade-up:nth-child(6) { animation-delay: 0.5s; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 8. Mobile (ecrans de moins de 768px) ---------- */
@media (max-width: 768px) {
    .burger {
        display: flex;
    }

    .lang-switch {
        margin-inline-start: auto;   /* sur mobile, la langue va vers la fin */
    }

    /* Le menu devient un panneau qui descend sous la navbar */
    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        width: 100%;
        flex-direction: column;
        padding: 16px 20px;
        background-color: var(--bg-panel);
        border-bottom: 1px solid var(--border);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 12px;
    }
}

/* ---------- 9. Accessibilite : moins d'animations si l'utilisateur le demande ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    .fade-up {
        opacity: 1;
    }
}

/* =========================================================
   ETAPE 4 : ARABE (RTL)
   ========================================================= */

/* ---------- 10. Police arabe ---------- */
/* Space Grotesk n'a pas de lettres arabes : on utilise IBM Plex Sans Arabic */
html[lang="ar"] body {
    font-family: "IBM Plex Sans Arabic", var(--font-main);
}

/* En arabe, les lettres sont attachees : l'espacement entre lettres les casse */
html[lang="ar"] .hero-title,
html[lang="ar"] .hero-eyebrow {
    letter-spacing: 0;
}

html[lang="ar"] .hero-title {
    line-height: 1.3;     /* l'arabe a besoin de plus de hauteur */
}

/* Les reperes techniques (=A1, -X1) restent toujours de gauche a droite,
   sinon en arabe "=A1" devient "A1=" */
.repere,
.nav-x {
    direction: ltr;
    unicode-bidi: isolate;
}

/* JetBrains Mono n'a pas de lettres arabes : on garde la police arabe */
html[lang="ar"] .status,
html[lang="ar"] .hero-eyebrow {
    font-family: inherit;
}

/* =========================================================
   ETAPE 5 : SECTIONS DE LA PAGE D'ACCUEIL
   ========================================================= */

/* ---------- 11. Structure commune des sections ---------- */
.section {
    padding: 100px 0;
    scroll-margin-top: var(--nav-height);   /* le lien #about ne cache pas le titre sous la navbar */
}

/* Une section sur deux a un fond un peu different + la grille */
.section-alt {
    background-color: var(--bg-panel);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 24px 24px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* Le titre de section : "01  =A2 +ABOUT" puis le h2 */
.section-head {
    margin-bottom: 48px;
}

.section-num {
    color: var(--cyan);
    margin-inline-end: 12px;
}

.section-head h2 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.2;
    margin-top: 8px;
}

.amber {
    color: var(--amber);
}

/* ---------- 12. A propos ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 300px 1fr;   /* colonne photo fixe, texte prend le reste */
    gap: 60px;
    align-items: start;
}

.about-photo img {
    width: 260px;
    height: 260px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--cyan);
    outline: 1px dashed var(--border-strong);   /* le cercle pointille autour, comme le logo */
    outline-offset: 8px;
    margin: 10px auto 32px;
}

/* Le cartouche = le tableau en bas a droite de chaque plan technique */
.cartouche {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-soft);
}

.cartouche td {
    border: 1px solid var(--border);
    padding: 6px 10px;
}

.cartouche td:last-child {
    color: var(--text);
}

.about-text p {
    color: var(--text-soft);
    font-size: 1.05rem;
    margin-bottom: 18px;
}

/* Les chiffres */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 36px;
}

.stat {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 14px;
    background-color: var(--bg-panel);
}

.stat-num {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--cyan);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---------- 13. Competences ---------- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));   /* autant de colonnes que possible, min 280px */
    gap: 20px;
}

.skill-card {
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color var(--transition), transform var(--transition);
}

.skill-card:hover {
    border-color: var(--cyan);
    transform: translateY(-4px);
}

.skill-icon {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: var(--cyan);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-bottom: 14px;
}

.skill-card h3 {
    font-size: 1.1rem;
    margin-bottom: 14px;
}

/* Les petites etiquettes (TIA Portal, ROS2...) */
.tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags li {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
}

/* ---------- 14. Experience = schema a contacts (Kontaktplan / Ladder) ---------- */
/* Les deux rails d'alimentation = les bordures gauche et droite */
.ladder {
    border-inline-start: 3px solid var(--cyan);
    border-inline-end: 3px solid var(--cyan);
    padding: 12px 0;
}

/* Une ligne (rung) = contact + boite + bobine, reliees par un fil */
.rung {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
}

/* Le fil horizontal qui traverse toute la ligne, DERRIERE la boite */
.rung::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background-color: var(--border-strong);
    z-index: 0;
}

/* Le contact  --| |--  : un carre avec seulement les bords gauche et droit */
.contact {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 14px;
    height: 22px;
    margin-inline-start: 28px;
    background-color: var(--bg);
    border-left: 2px solid var(--amber);
    border-right: 2px solid var(--amber);
}

/* La bobine  --( )--  : un cercle */
.coil {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-inline-end: 28px;
    border-radius: 50%;
    background-color: var(--bg);
    border: 2px solid var(--green);
}

/* Pour la formation, la bobine est ambre */
.rung-edu .coil {
    border-color: var(--amber);
}

.rung-box {
    position: relative;
    z-index: 1;
    flex: 1;
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: border-color var(--transition);
}

.rung:hover .rung-box {
    border-color: var(--cyan);
}

.rung-date {
    color: var(--amber);
}

.rung-box h3 {
    font-size: 1.05rem;
    margin: 4px 0 6px;
}

.rung-box p:last-child {
    color: var(--text-soft);
    font-size: 0.95rem;
}

/* ---------- 15. Apparition au scroll (classe "visible" ajoutee par main.js) ---------- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 16. Mobile pour l'etape 5 ---------- */
@media (max-width: 900px) {
    .about-grid {
        grid-template-columns: 1fr;   /* une seule colonne : photo au-dessus du texte */
        gap: 32px;
    }

    .about-photo {
        max-width: 320px;
        margin: 0 auto;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .section {
        padding: 70px 0;
    }

    /* Sur petit ecran : pas de bobine, et le contact colle au rail */
    .coil {
        display: none;
    }

    .ladder {
        border-inline-end: none;
    }

    .contact {
        margin-inline-start: 10px;
    }

    .rung-box {
        margin-inline-end: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* En arabe : "C++" devenait "++C". plaintext = chaque etiquette choisit son sens selon son contenu */
.tags li {
    unicode-bidi: plaintext;
}

/* =========================================================
   ETAPE 6 : PROJETS, CONTACT, FOOTER
   ========================================================= */

.center {
    text-align: center;
    margin-top: 40px;
}

/* ---------- 17. Projets = fiches techniques (Datenblatt) ---------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));   /* auto-fill : une seule carte ne prend pas toute la largeur */
    gap: 24px;
}

.datasheet {
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;          /* l'image ne depasse pas des coins arrondis */
    transition: border-color var(--transition), transform var(--transition);
}

.datasheet:hover {
    border-color: var(--cyan);
    transform: translateY(-4px);
}

.datasheet img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;     /* toutes les images ont la meme forme */
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.datasheet-body {
    padding: 20px;
}

.datasheet-ref {
    color: var(--amber);
    text-transform: uppercase;
}

.datasheet h3 {
    font-size: 1.2rem;
    margin: 6px 0 8px;
}

.datasheet-body > p:not(.datasheet-ref) {
    color: var(--text-soft);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

/* ---------- 18. Contact ---------- */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 60px;
    align-items: start;
}

.contact-info > p {
    color: var(--text-soft);
    font-size: 1.05rem;
    margin-bottom: 28px;
}

.contact-links {
    list-style: none;
}

.contact-links li {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.contact-links .mono {
    color: var(--text-muted);
    min-width: 80px;
}

.contact-links a:hover {
    text-decoration: underline;
}

.contact-form {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.form-row {
    margin-bottom: 18px;
}

.form-row label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.form-row input,
.form-row textarea {
    width: 100%;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--text);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border-color var(--transition);
}

.form-row textarea {
    resize: vertical;          /* on peut agrandir en hauteur seulement */
}

.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--cyan);
}

/* Champ invalide (classe ajoutee par main.js) */
.form-row .invalid {
    border-color: #f87171;
}

.contact-form button {
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
}

.contact-form button:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Le piege a robots : invisible mais present (pas display:none, certains robots le detectent).
   On ne le pousse pas avec left:-9999px : en arabe (RTL) ca creerait un scroll horizontal */
.hp {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.form-status {
    margin-top: 14px;
    font-size: 0.95rem;
    min-height: 1.5em;
}

.form-status.ok    { color: var(--green); }
.form-status.error { color: #f87171; }

/* ---------- 19. Footer ---------- */
.footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
    background-color: var(--bg-panel);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-soft);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--cyan);
}

.footer-copy {
    color: var(--text-muted);
}

/* ---------- 20. Mobile pour l'etape 6 ---------- */
@media (max-width: 900px) {
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }
}

@media (max-width: 600px) {
    .contact-form {
        padding: 20px;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* =========================================================
   ETAPE 9 : PAGES PROJETS ET ARTICLES
   ========================================================= */

/* L'attribut HTML "hidden" doit TOUJOURS cacher, meme si une autre regle
   dit display:block (ex : img { display: block } plus haut) */
[hidden] {
    display: none !important;
}

/* ---------- 21. Haut des pages interieures ---------- */
.page-top {
    padding-top: calc(var(--nav-height) + 60px);
    min-height: 80vh;
}

.page-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.15;
    margin-top: 8px;
}

.page-intro {
    color: var(--text-soft);
    font-size: 1.1rem;
    margin-top: 12px;
    max-width: 700px;
}

.narrow {
    max-width: 780px;
}

.back-link {
    display: inline-block;
    color: var(--text-soft);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.back-link:hover {
    color: var(--cyan);
}

.empty-message {
    color: var(--text-muted);
    padding: 40px 0;
}

.not-found {
    padding: 60px 0;
}

/* ---------- 22. Cartes cliquables ---------- */
/* Le lien couvre toute la carte et garde les couleurs normales du texte */
.card-link {
    display: block;
    color: inherit;
    height: 100%;
}

.card-link:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

.datasheet-text {
    color: var(--text-soft);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

/* ---------- 23. Filtres ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.filter-btn {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: none;
    color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), background-color var(--transition);
}

.filter-btn:hover {
    border-color: var(--cyan);
    color: var(--text);
}

.filter-btn.active {
    background-color: var(--cyan);
    border-color: var(--cyan);
    color: var(--cyan-dark);
}

/* ---------- 24. Page d'un projet ---------- */
.detail-head {
    margin-bottom: 40px;
}

.detail-head .tags {
    margin-top: 18px;
}

.detail-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 0 0 40px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 48px;
    align-items: start;
}

.detail-section {
    margin-bottom: 36px;
}

.detail-section h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.detail-section p {
    color: var(--text-soft);
    margin-bottom: 14px;
}

.detail-side {
    position: sticky;                  /* reste visible quand on descend */
    top: calc(var(--nav-height) + 20px);
}

.detail-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.detail-links .btn {
    text-align: center;
}

.detail-links video {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.side-title {
    font-size: 1rem;
    margin: 28px 0 12px;
}

.file-list {
    list-style: none;
}

.file-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.file-list a {
    word-break: break-all;   /* les noms de fichiers tres longs passent a la ligne */
}

.file-size {
    color: var(--text-muted);
    white-space: nowrap;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.gallery img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.gallery a:hover img {
    border-color: var(--cyan);
}

/* ---------- 25. Articles ---------- */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.article-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
}

.article-card:hover {
    border-color: var(--cyan);
    transform: translateY(-4px);
}

.article-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.article-card-body {
    padding: 20px;
}

.article-meta {
    color: var(--amber);
}

.article-card h3 {
    font-size: 1.2rem;
    margin: 6px 0 8px;
}

.article-excerpt {
    color: var(--text-soft);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.read-more {
    color: var(--cyan);
    font-size: 0.9rem;
}

/* Le texte d'un article */
.prose {
    color: var(--text-soft);
    font-size: 1.08rem;
    line-height: 1.8;
}

.prose h2,
.prose h3 {
    color: var(--text);
    line-height: 1.3;
    margin: 36px 0 12px;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre {
    margin-bottom: 18px;
}

.prose ul,
.prose ol {
    padding-inline-start: 24px;
}

.prose a {
    text-decoration: underline;
}

.prose blockquote {
    border-inline-start: 3px solid var(--amber);
    padding-inline-start: 16px;
    color: var(--text);
}

.prose code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--bg-panel-2);
    padding: 2px 6px;
    border-radius: 4px;
}

.prose pre {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    overflow-x: auto;        /* le code long defile DANS le bloc, pas toute la page */
    direction: ltr;
}

.prose pre code {
    background: none;
    padding: 0;
}

.prose img {
    border-radius: var(--radius);
    margin: 24px 0;
}

/* ---------- 26. Mobile pour l'etape 9 ---------- */
@media (max-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .detail-side {
        position: static;
    }
}

@media (max-width: 600px) {
    .articles-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 27. Pas encore de photo / pas de video ---------- */
.img-placeholder {
    aspect-ratio: 16 / 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-panel);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* "Foto folgt" : le petit logo ne doit PAS prendre les regles des photos (.datasheet img) */
.datasheet .img-placeholder img {
    width: 56px;
    height: 56px;
    aspect-ratio: auto;
    border: none;
    opacity: 0.6;
}

.video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

.video-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    font-size: 0.9rem;
}

/* ---------- 28. Pages legales (Impressum, Datenschutz) ---------- */
.legal-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    border-inline-start: 3px solid var(--amber);
    padding-inline-start: 12px;
    margin: 16px 0 36px;
}

/* Les textes juridiques sont en allemand : toujours de gauche a droite, meme en arabe */
.legal {
    text-align: left;
}

.legal h2 {
    font-size: 1.25rem;
}

/* Les longues adresses e-mail coupent la ligne au lieu de depasser sur telephone */
.legal a {
    overflow-wrap: anywhere;
}

.legal-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 40px;
}

/* ---------- 29. Page 404 ---------- */
.error-page {
    padding-block: 40px;
}

.error-code {
    font-size: clamp(5rem, 18vw, 9rem);
    line-height: 1;
    color: var(--cyan);
    opacity: 0.25;
    margin-top: 16px;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}
