/* ===================================================================
   styles.css — Portfolio de Nelson Boruchowitch
   -------------------------------------------------------------------
   Styles PROPRES à ce site. Le reset, les variables (--primary, --bg-*,
   --text-*, --border…), la police et le basculement clair/sombre sont
   fournis par le thème partagé ../assets/css/theme.css (chargé avant).
   On ne redéfinit ici que ce qui est spécifique au portfolio.

   Sommaire :
     1. Réglages globaux
     2. Accessibilité (focus, lien d'évitement, mouvement réduit)
     3. Barre de navigation
     4. Section d'introduction
     5. Section Compétences
     6. Section Projets + cartes
     7. Fenêtres modales
     8. Bouton « retour en haut »
     9. Pied de page
    10. Animations d'apparition
    11. Responsive (media queries)
   =================================================================== */

/* ============================= 1. GLOBAL ============================ */
/* Variantes vertes ACCESSIBLES (WCAG AA), locales au portfolio. --primary
   (#70BD95) est trop clair sous texte blanc (2.23:1) et illisible en thème
   clair (1.99:1). On reprend ici la même logique que composants/tokens.css. */
:root {
    --accent-solid: #2c7a56;        /* vert plein : texte blanc lisible (5.22:1) */
    --accent-solid-hover: #225c44;  /* survol/pressé (7.83:1) */
    --accent-text: var(--primary);  /* vert « texte » : déjà lisible en sombre */
}

[data-theme="light"] {
    --accent-text: #2a6e4e;         /* vert foncé lisible sur fond clair (6.11:1) */
}

body {
    overflow-x: hidden;
}

/* Scrollbar verte propre au portfolio (le thème en propose une grise). */
body::-webkit-scrollbar {
    width: 10px;
}

body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* Décale l'ancrage des sections pour tenir compte de la navbar fixe. */
section[id] {
    scroll-margin-top: 80px;
}

/* ========================= 2. ACCESSIBILITÉ ======================== */
:focus-visible {
    outline: 3px solid var(--accent-text);
    outline-offset: 2px;
    border-radius: 4px;
}

/* #contenu (cible du lien d'évitement) reçoit le focus par programmation :
   on évite l'anneau qui encadrerait toute la page après le saut. */
#contenu:focus {
    outline: none;
}

/* Lien d'évitement : visible uniquement au focus clavier. */
.skip-link {
    position: absolute;
    top: -48px;
    left: 8px;
    z-index: 2000;
    padding: 8px 16px;
    background: var(--accent-solid);
    color: #fff;
    border-radius: 4px;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 8px;
    text-decoration: none;
}

/* Respecte la préférence « réduire les animations ». */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    /* Pas seulement la durée : on annule aussi le déplacement au survol
       (sinon le saut/rotation reste, juste instantané). Cf. base.css. */
    .project-card:hover,
    .skill-item:hover,
    .composants-promo:hover,
    .intro-image:hover,
    .logo:hover {
        transform: none;
    }
}

/* ========================= 3. NAVIGATION =========================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background-color: var(--bg-sidebar);
    transition: transform 0.3s ease;
}

/* Masquée au défilement vers le bas (classe gérée en JS). */
.navbar--hidden {
    transform: translateY(-100%);
}

.logo {
    margin-right: auto;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease-in-out;
}

.logo:hover {
    transform: scale(1.1);
    text-decoration: none;
}

.logo img {
    max-width: 100px;
    height: auto;
    display: block;
}

.menu-icon {
    display: none;
    padding: 4px;
    background: none;
    border: none;
    font-size: 30px;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
}

#nav-menu {
    list-style: none;
    display: flex;
    gap: 8px;
}

#nav-menu a {
    padding: 8px 16px;
    border-radius: 4px;
    color: var(--text-dim);
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#nav-menu a:hover {
    background-color: var(--bg-panel);
    color: var(--text-light);
    text-decoration: none;
}

#nav-menu a.active {
    background-color: var(--accent-solid);
    color: #fff;
}

.navbar-toolbar {
    display: flex;
    align-items: center;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
}

/* ====================== 4. INTRODUCTION ============================ */
.intro-section {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    padding: 150px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    /* État masqué avant apparition ; révélé par .intro-fade-in (JS). */
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.intro-section.intro-fade-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.intro-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.intro-text h1 {
    margin: 0;
    font-size: 2.5em;
    color: var(--text-light);
}

.intro-text h1 .highlight {
    color: var(--accent-text);
}

.intro-text h2 {
    margin-top: 10px;
    font-size: 1.5em;
    color: var(--text-dim);
}

#animated-text {
    min-height: 1.8em; /* évite le saut vertical pendant l'effacement */
    font-weight: bold;
    color: var(--text-light);
    letter-spacing: 0.15em;
}

/* nowrap réservé au desktop : sur petit écran / zoom 200 %, le sous-titre
   doit pouvoir revenir à la ligne sinon il est coupé (overflow-x:hidden). */
@media (min-width: 600px) {
    #animated-text {
        white-space: nowrap;
    }
}

#animated-text::after {
    content: "|";
    margin-left: 5px;
    animation: blink 1s step-start infinite;
}

/* En pause (WCAG 2.2.2) : curseur figé, plus aucun clignotement. */
#animated-text[data-anim="paused"]::after {
    animation: none;
    opacity: 1;
}

/* Bouton pause/lecture de la machine à écrire (injecté en JS). */
.anim-toggle {
    margin-top: 14px;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--text-dim);
    border-radius: 50%;
    background: var(--bg-sidebar);
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.anim-toggle:hover {
    color: var(--text-light);
    border-color: var(--accent-text);
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.intro-image {
    transition: transform 0.3s ease-in-out;
}

.intro-image:hover {
    transform: scale(1.1);
}

.intro-image img {
    max-width: 200px;
    height: auto;
    margin-top: 20px;
    animation: float-img 3s ease-in-out infinite;
}

@keyframes float-img {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

#mouse-effect {
    position: absolute;
    z-index: 0;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.3) 0%, rgba(var(--primary-rgb), 0) 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#mouse-effect.visible {
    opacity: 1;
}

/* ======================== 5. COMPÉTENCES =========================== */
#skills {
    max-width: 1200px;
    margin: 0 auto 20px;
    padding: 20px 20px 30px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    justify-content: center;
}

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--shadow-color, rgba(0, 0, 0, 0.2));
}

.skill-item img {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
    object-fit: contain;
}

.skill-item p {
    margin-top: 10px;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-light);
}

.skill-item:hover {
    transform: translateY(-5px);
    animation: shadow-spin 2s infinite linear;
}

@keyframes shadow-spin {
    0%   { box-shadow: 0 8px 24px var(--shadow-color); }
    25%  { box-shadow: 8px 0 24px var(--shadow-color); }
    50%  { box-shadow: 0 -8px 24px var(--shadow-color); }
    75%  { box-shadow: -8px 0 24px var(--shadow-color); }
    100% { box-shadow: 0 8px 24px var(--shadow-color); }
}

/* Couleur d'ombre propre à chaque technologie (proche de la marque). */
.skill-item.powerapps     { --shadow-color: rgba(215, 127, 195, 0.6); }
.skill-item.powerautomate { --shadow-color: rgba(0, 153, 255, 0.6); }
.skill-item.powerbi       { --shadow-color: rgba(243, 218, 80, 0.6); }
.skill-item.javascript    { --shadow-color: rgba(255, 223, 0, 0.6); }
.skill-item.kotlin        { --shadow-color: rgba(89, 136, 255, 0.6); }
.skill-item.html5         { --shadow-color: rgba(227, 79, 38, 0.6); }
.skill-item.css3          { --shadow-color: rgba(38, 77, 228, 0.6); }
.skill-item.sharepoint    { --shadow-color: rgba(37, 120, 125, 0.6); }
.skill-item.sql           { --shadow-color: rgba(65, 189, 244, 0.6); }
.skill-item.photoshop     { --shadow-color: rgba(30, 144, 255, 0.6); }
.skill-item.access        { --shadow-color: rgba(128, 0, 0, 0.6); }
.skill-item.excel         { --shadow-color: rgba(60, 179, 113, 0.6); }
.skill-item.androidstudio { --shadow-color: rgba(60, 156, 76, 0.6); }   /* vert Android Studio */
.skill-item.datagrip      { --shadow-color: rgba(155, 98, 229, 0.6); }  /* violet DataGrip */

/* ========================== 6. PROJETS ============================= */
#projects {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 20px;
    text-align: center;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Cartes au-delà du seuil initial, révélées par « Afficher plus » (JS). */
.project-card.hidden {
    display: none;
}

.project-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--bg-sidebar);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: left;
    transition: transform 0.3s ease;
}

.project-card:hover {
    transform: rotate(2deg) scale(1.05);
}

/* L'anneau de focus entoure toute la carte quand son bouton est focalisé. */
.project-card:focus-within {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.project-card__image {
    width: 100%;
    height: auto;
    display: block;
    border-bottom: 2px solid var(--border);
}

.project-card__title {
    margin: 14px 0 0;
    padding: 0 14px;
}

.project-card__open {
    padding: 0;
    background: none;
    border: none;
    font: inherit;
    font-size: 1.15em;
    font-weight: bold;
    color: var(--text-light);
    text-align: left;
    cursor: pointer;
}

/* Rend toute la carte cliquable tout en gardant un seul bouton focusable. */
.project-card__open::after {
    content: "";
    position: absolute;
    inset: 0;
}

.project-card__open:focus-visible {
    outline: none; /* l'anneau est porté par .project-card:focus-within */
}

.techno-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0 14px;
    font-size: 16px;
}

.techno-line img {
    width: 1em;
    height: 1em;
    vertical-align: middle;
}

.project-card__summary {
    margin: 10px 14px 16px;
    font-size: 1.05em;
    font-weight: bold;
}

#show-more {
    display: block;
    margin: 20px auto 0;
    padding: 10px 20px;
    background-color: var(--accent-solid);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#show-more:hover {
    background-color: var(--accent-solid-hover);
}

#show-more[hidden] {
    display: none;
}

/* ====================== 6b. COMPOSANTS ============================= */
#composants {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 100px;
    text-align: center;
}

.composants-promo {
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 32px 36px;
    border-radius: 16px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.composants-promo:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(112, 189, 149, 0.25);
}

.composants-promo__text { flex: 1; }

.composants-promo__text h3 {
    margin-bottom: 10px;
    font-size: 1.4em;
    color: var(--text-light);
}

.composants-promo__text p {
    margin-bottom: 20px;
    color: var(--text-dim);
    line-height: 1.6;
}

/* Vert foncé volontaire : texte blanc lisible (WCAG AA), --primary serait trop clair. */
.composants-promo__btn {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 6px;
    background-color: var(--accent-solid);
    color: #fff;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.composants-promo__btn:hover {
    background-color: var(--accent-solid-hover);
    color: #fff;
    text-decoration: none;
}

.composants-promo__visual {
    font-size: 84px;
    line-height: 1;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .composants-promo {
        flex-direction: column;
        text-align: center;
        gap: 18px;
        padding: 28px 22px;
    }
    .composants-promo__visual { order: -1; font-size: 64px; }
}

/* ========================== 7. MODALES ============================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.is-open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 15vh 20px 20px;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    padding: 24px;
    border-radius: 10px;
    background-color: var(--bg-sidebar);
    color: var(--text-light);
}

.modal-content h2 {
    margin-bottom: 12px;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    padding: 0 4px;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    color: var(--text-dim);
    cursor: pointer;
    transition: color var(--tr);
}

.modal-close:hover {
    color: var(--text-light);
}

/* Empêche le défilement de l'arrière-plan quand une modale est ouverte. */
body.modal-ouverte {
    overflow: hidden;
}

/* ===================== 8. RETOUR EN HAUT =========================== */
#scroll-top {
    position: fixed;
    bottom: 20px;
    right: 14px;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    background: conic-gradient(var(--primary) 0%, var(--border) 0%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#scroll-top.is-visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top__inner {
    display: grid;
    place-items: center;
    width: calc(100% - 12px);
    height: calc(100% - 12px);
    border-radius: 50%;
    background-color: var(--bg-sidebar);
    color: var(--primary);
    font-size: 32px;
}

/* ========================= 9. PIED DE PAGE ========================= */
footer {
    padding: 10px;
    text-align: center;
    background-color: var(--bg-sidebar);
    color: var(--text-light);
}

footer p {
    margin: 0;
    font-size: 14px;
}

.copyright-symbol {
    color: var(--accent-text);
}

/* ====================== 10. APPARITIONS ============================ */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-section.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* ======================== 11. RESPONSIVE =========================== */
@media (max-width: 768px) {
    .menu-icon {
        display: block;
    }

    #nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding: 8px 0;
        background-color: var(--bg-sidebar);
    }

    #nav-menu.open {
        display: flex;
    }

    #nav-menu li {
        margin: 6px 0;
        text-align: center;
    }

    .logo img {
        max-width: 80px;
    }

    .intro-text h1 {
        font-size: 2em;
    }

    .intro-text h2 {
        font-size: 1.2em;
    }

    .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .skill-item img {
        width: 60px;
        height: 60px;
    }

    .skill-item p {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .logo img {
        max-width: 60px;
    }
}
