/* ==========================================================================
   Terminal — Thème "console" (ambre + cyan) et effets dynamiques
   ==========================================================================

   POURQUOI UN FICHIER SÉPARÉ ?
   Ce fichier est chargé EN DERNIER (après responsive.css). Grâce à la
   cascade CSS, ses règles remplacent celles des autres fichiers sans
   avoir à les modifier. Avantages :
     - tout le "look Terminal" est réuni au même endroit ;
     - pour revenir à l'ancien design, il suffit de retirer la ligne
       <link rel="stylesheet" href="css/terminal.css"> des pages HTML.

   CONTENU :
     1. Palette (variables) — thème clair et thème sombre
     2. Typographie monospace (JetBrains Mono)
     3. Effets "terminal" : invite ~/ et curseur clignotant sur les titres,
        grille en fond de l'accueil, chevron devant le sous-titre
     4. Interactions : cartes qui s'illuminent, apparitions en cascade,
        frise du parcours, tags bicolores
     5. Accessibilité : tout mouvement est coupé si l'utilisateur a activé
        "réduire les animations" (voir aussi animations.css)
   ========================================================================== */


/* ==========================================================================
   1. PALETTE
   ========================================================================== */

/*
 * Thème CLAIR — "papier" chaud. L'ambre et le cyan sont foncés (700) pour
 * garder un contraste suffisant sur fond clair (WCAG AA, ≥ 4.5:1).
 */
:root {
  --bg-primary: #F7F5F0;
  --bg-secondary: #EFECE4;
  --bg-card: #FFFFFF;
  --bg-elevated: #E8E4DA;
  --text-primary: #1A1C21;
  --text-secondary: #4A505B;
  --text-muted: #6E747F;
  --accent: #B45309;            /* ambre foncé */
  --accent-hover: #92400E;
  --accent-glow: rgba(180, 83, 9, 0.12);
  --text-on-accent: #FFF8EB;
  --accent-2: #0E7490;          /* cyan foncé : deuxième couleur d'accent */
  --accent-2-hover: #155E75;
  --accent-2-glow: rgba(14, 116, 144, 0.12);
  --border: rgba(26, 28, 33, 0.12);
  --grid-line: rgba(14, 116, 144, 0.08);
  --shadow-card: 0 4px 16px rgba(26, 28, 33, 0.08);

  /* Police "terminal" pour les titres, tags, dates */
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

/*
 * Thème SOMBRE — anthracite, ambre lumineux + cyan.
 * Même spécificité que themes.css mais chargé après : ces valeurs gagnent.
 */
[data-theme="dark"] {
  --bg-primary: #0E1116;
  --bg-secondary: #12161D;      /* légère alternance entre sections */
  --bg-card: #181C24;
  --bg-elevated: #1F242E;
  --text-primary: #ECE9E4;
  --text-secondary: #A3A8B1;
  --text-muted: #6B717C;
  --accent: #FBBF24;            /* ambre */
  --accent-hover: #FCD34D;
  --accent-glow: rgba(251, 191, 36, 0.16);
  --text-on-accent: #2A1D00;
  --accent-2: #22D3EE;          /* cyan */
  --accent-2-hover: #67E8F9;
  --accent-2-glow: rgba(34, 211, 238, 0.14);
  --border: rgba(148, 163, 184, 0.14);
  --grid-line: rgba(34, 211, 238, 0.06);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.45);
}

/* Les sous-titres (h3) prennent la 2e couleur : titres ambre, sous-titres cyan */
[data-theme="dark"] h3 {
  color: var(--accent-2);
}

/* Texte sélectionné à la souris aux couleurs du thème */
::selection {
  background-color: var(--accent);
  color: var(--text-on-accent);
}


/* ==========================================================================
   2. TYPOGRAPHIE MONOSPACE
   ==========================================================================
   Inter reste la police du texte courant (meilleure lisibilité).
   JetBrains Mono est réservée aux éléments "techniques" : c'est ce
   contraste qui donne l'impression de console.
   ========================================================================== */
.navbar__logo,
.preloader__logo,
.section__title,
.hero__subtitle,
.tag,
.prof-card__tag,
.projets__filter-btn,
.prof-filters__btn,
.project-card__year,
.project-detail__year,
.parcours__item-period,
.parcours__column-title,
.parcours__cert-meta,
.competences__cat-title,
.project-detail__gallery-counter {
  font-family: var(--font-mono);
}

.section__title {
  letter-spacing: -0.02em;
}


/* ==========================================================================
   3. EFFETS "TERMINAL"
   ========================================================================== */

/* ---- Logo : invite ">_" devant les initiales ---- */
.navbar__logo::before {
  content: '>';
  color: var(--accent-2);
  margin-right: 0.15em;
}

/*
 * ---- Titres de section : "~/ Projets▌" ----
 * ::before ajoute l'invite "~/" (comme un chemin de dossier dans un shell).
 * ::after remplaçait le petit trait sous le titre (layout.css) : on le
 * transforme en curseur de terminal qui clignote.
 */
.section__title::before {
  content: '~/ ';
  color: var(--accent-2);
  font-weight: 500;
}

.section__title::after {
  display: inline-block;
  width: 0.55em;
  height: 0.9em;
  margin: 0 0 0 0.15em;
  vertical-align: -0.08em;
  border-radius: 1px;
  background-color: var(--accent);
  animation: termBlink 1.1s steps(1, end) infinite;
}

/*
 * steps(1, end) : bascule franche (allumé / éteint), sans fondu,
 * exactement comme un vrai curseur de terminal.
 */
@keyframes termBlink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* ---- Sous-titre de l'accueil : "> Étudiant BUT…" ---- */
.hero__subtitle {
  font-size: clamp(1rem, 0.85rem + 0.6vw, 1.3rem);
}

.hero__subtitle::before {
  content: '> ';
  color: var(--accent-2);
}

/*
 * ---- Grille en fond de l'accueil ----
 * Deux dégradés "linéaires" de 1px dessinent les lignes horizontales et
 * verticales, répétées tous les 48px. Le mask-image (dégradé radial)
 * estompe la grille sur les bords pour qu'elle ne fasse pas "papier
 * millimétré" : elle n'est visible qu'au centre.
 */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
}

/* ---- Lien "Espace Professeur" et boutons secondaires en cyan ---- */
.navbar__link--prof,
.btn--secondary {
  color: var(--accent-2);
  border-color: var(--accent-2);
}

.navbar__link--prof:hover {
  background: var(--accent-2);
  color: var(--bg-primary);
}

.btn--secondary:hover {
  background-color: var(--accent-2-glow);
  color: var(--accent-2-hover);
}

/* Boutons principaux : léger halo ambre au survol */
.btn--primary:hover {
  box-shadow: 0 6px 20px -6px var(--accent);
}


/* ==========================================================================
   4. INTERACTIONS
   ========================================================================== */

/* ---- Tags bicolores : un sur deux en cyan ---- */
.tag:nth-child(even),
.prof-card__tag:nth-child(even) {
  color: var(--accent-2);
  background-color: var(--accent-2-glow);
}

/*
 * ---- Cartes projets : elles "s'allument" au survol ----
 * Bordure fine au repos, puis bordure ambre + halo coloré au survol.
 * Le halo utilise une ombre avec un "spread" négatif (-12px) pour rester
 * sous la carte au lieu de déborder sur les côtés.
 */
.project-card,
.prof-card {
  border: 1px solid var(--border);
  transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease, opacity 400ms ease;
}

.project-card:hover,
.prof-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 18px 40px -16px var(--accent-glow), 0 18px 40px -20px rgba(0, 0, 0, 0.5);
}

/* Le titre de la carte passe en ambre au survol */
.project-card:hover .project-card__title,
.prof-card:hover .prof-card__title {
  color: var(--accent);
}

.project-card__title,
.prof-card__title {
  transition: color var(--transition-fast);
}

/*
 * ---- Apparition en cascade des cartes projets ----
 * Les cartes sont créées par JavaScript (projects.js) : on les anime
 * directement en CSS à leur insertion dans la page.
 * animation-fill-mode "backwards" : l'état de départ (invisible) est
 * appliqué pendant le délai, mais l'animation ne "bloque" pas les
 * propriétés après sa fin — le transform du survol reste donc actif.
 */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.project-card,
.prof-card {
  animation: cardIn 500ms ease backwards;
}

.project-card:nth-child(2), .prof-card:nth-child(2) { animation-delay: 70ms; }
.project-card:nth-child(3), .prof-card:nth-child(3) { animation-delay: 140ms; }
.project-card:nth-child(4), .prof-card:nth-child(4) { animation-delay: 210ms; }
.project-card:nth-child(5), .prof-card:nth-child(5) { animation-delay: 280ms; }
.project-card:nth-child(n+6), .prof-card:nth-child(n+6) { animation-delay: 350ms; }

/* ---- Filtres de projets : forme "pilule", actif en ambre ---- */
.projets__filter-btn {
  border-radius: 9999px;
  font-size: var(--font-size-xs);
}

.projets__filter-btn::before {
  content: '#';
  color: var(--accent-2);
  margin-right: 0.15em;
}

.projets__filter-btn.is-active::before {
  color: inherit;
}

/*
 * ---- Cartes de compétences ----
 * Une barre dégradée ambre → cyan se déploie en haut de la carte au
 * survol (scaleX de 0 à 1, depuis la gauche).
 */
.competences__card {
  position: relative;
  overflow: hidden;
  text-align: left;
}

.competences__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 400ms ease;
}

.competences__card:hover::before {
  transform: scaleX(1);
}

.competences__card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 32px -14px var(--accent-glow);
}

.competences__icon {
  margin: 0 0 1rem;
  color: var(--accent-2);
  border-color: var(--accent-2);
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.competences__card:hover .competences__icon {
  background-color: var(--accent-2);
  color: var(--bg-card);
}

.competences__cat-title {
  letter-spacing: 0.02em;
  text-transform: none;
}

/*
 * ---- Frise du parcours ----
 * La ligne verticale devient un dégradé ambre → cyan, et chaque point
 * porte un halo. Au survol d'une étape, son point grossit et s'éclaire.
 */
.parcours__list::before {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.6;
}

.parcours__item::before {
  box-shadow: 0 0 0 4px var(--accent-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.parcours__item:hover::before {
  transform: translateX(-4px) scale(1.35);
  background-color: var(--accent-2);
  box-shadow: 0 0 0 6px var(--accent-2-glow);
}

.parcours__column--experiences .parcours__item::before {
  background-color: var(--accent-2);
  box-shadow: 0 0 0 4px var(--accent-2-glow);
}

.parcours__column--experiences .parcours__item:hover::before {
  background-color: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-glow);
}

.parcours__column--experiences .parcours__item-period {
  color: var(--accent-2);
}

.parcours__column-title {
  text-transform: none;
  letter-spacing: 0;
  border-bottom: 1px solid var(--border);
}

.parcours__column-title::before {
  content: '## ';
  color: var(--text-muted);
}

/* Certification : petite carte avec bordure gauche ambre */
.parcours__cert-item {
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ---- Profil : les deux blocs deviennent des cartes ---- */
.profil__section {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: border-color var(--transition-base);
}

.profil__section:hover {
  border-color: var(--accent-2);
}

/* ---- Contact : liens sociaux avec flèche qui glisse au survol ---- */
.contact__social-link::before {
  content: '→';
  color: var(--accent-2);
  display: inline-block;
  margin-right: 0.4em;
  transition: transform var(--transition-fast);
}

.contact__social-link:hover::before {
  transform: translateX(3px);
}

.contact__input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-2-glow);
}

/* ---- Bouton retour en haut ---- */
.scroll-top:hover {
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ---- Modale projet : bouton lecture vidéo en cyan ---- */
.project-detail__video-play {
  background-color: var(--accent-2);
  color: var(--bg-primary);
}


/* ==========================================================================
   5. ACCESSIBILITÉ — "Réduire les animations"
   ==========================================================================
   animations.css coupe déjà toutes les transitions. On s'assure en plus
   que les cartes ne restent pas cachées et que le curseur reste fixe.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .project-card,
  .prof-card {
    animation: none;
  }

  .section__title::after {
    animation: none;
  }

  .hero::before {
    display: none;
  }
}
