/* ==========================================================================
   Axel Leclercq — CV one-page
   Esthétique « terminal / hacker » : fond sombre, monospace, scanlines CRT.
   Aucune dépendance externe : polices système uniquement.
   ========================================================================== */

/* ---------- Variables ---------- */
:root {
  --bg: #0a0d11;
  --bg-elev: #10151c;          /* fenêtres, cartes */
  --bg-elev-2: #151b24;        /* tags, survols */
  --border: #222b37;
  --text: #d8dde6;
  --muted: #8f99a8;            /* contraste ≈ 6.6:1 sur --bg */
  --red: #ff6b6b;
  --yellow: #f7c66b;
  --cyan: #4ecdc4;

  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --maxw: 60rem;
  --radius: 6px;
}

/* ---------- Reset léger ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;    /* compense la barre de navigation sticky */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

a {
  color: var(--cyan);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--red);
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--cyan);
  color: var(--bg);
}

/* ---------- Utilitaires ---------- */
.accent-red  { color: var(--red); }
.accent-cyan { color: var(--cyan); }
.muted       { color: var(--muted); }

/* Lien d'évitement (visible uniquement au focus clavier) */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 1000;
  padding: 0.5rem 0.75rem;
  background: var(--cyan);
  color: var(--bg);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* ==========================================================================
   Scanlines CRT : overlay fixe, non interactif, au-dessus de tout.
   Volontairement STATIQUE : aucune animation, aucun balayage lumineux.
   ========================================================================== */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background:
    /* fines lignes horizontales */
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.22) 3px,
      rgba(0, 0, 0, 0) 4px
    ),
    /* léger vignettage façon tube cathodique */
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.35) 100%);
}

/* ==========================================================================
   Header : barre de fenêtre de terminal + navigation
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(16, 21, 28, 0.94);   /* --bg-elev translucide */
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

/* Pastilles + titre de la fenêtre */
.topbar__window {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot--red    { background: var(--red); }
.dot--yellow { background: var(--yellow); }
.dot--green  { background: var(--cyan); }

.topbar__title {
  margin-left: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Navigation + bascule de langue, alignées à droite */
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem 1.25rem;
}

/* Liens de navigation */
.nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-size: 0.875rem;
}

.nav__list a {
  color: var(--muted);
  text-decoration: none;
}

/* Préfixe « ./ » affiché au survol, comme un chemin relatif */
.nav__list a::before {
  content: "./";
  color: var(--red);
  opacity: 0;
  transition: opacity 0.15s;
}

.nav__list a:hover,
.nav__list a:focus-visible {
  color: var(--cyan);
}

.nav__list a:hover::before,
.nav__list a:focus-visible::before {
  opacity: 1;
}

/* Bascule de langue (EN / FR) : petit bouton encadré façon touche */
.lang-switch {
  flex-shrink: 0;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.lang-switch:hover,
.lang-switch:focus-visible {
  border-color: var(--red);
  color: var(--red);
}

/* ==========================================================================
   Mise en page générale
   ========================================================================== */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 4rem 0 1rem;
}

/* Ligne de commande introduisant chaque section */
.prompt {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  word-break: break-word;
}

.prompt__path { color: var(--cyan); }
.prompt__sign { color: var(--red); margin: 0 0.15em; }

.section__title {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.hash {
  color: var(--red);
}

/* Curseur bloc clignotant */
.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  margin-left: 0.1em;
  vertical-align: text-bottom;
  background: var(--cyan);
  animation: blink 1.05s steps(1) infinite;
}

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

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  min-height: calc(100vh - 3.5rem);
  min-height: calc(100svh - 3.5rem);
  display: flex;
  align-items: center;
  padding: 3rem 0;
}

/* Fenêtre de terminal */
.window {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px rgba(78, 205, 196, 0.04), 0 24px 60px rgba(0, 0, 0, 0.45);
}

.window__body {
  padding: clamp(1.5rem, 5vw, 3rem);
}

.hero__prompt {
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  color: var(--text);
  margin-bottom: 1.5rem;
}

.hero__name {
  font-size: clamp(2.2rem, 8vw, 4.25rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  text-shadow: 0 0 18px rgba(78, 205, 196, 0.25);
}

.hero__title {
  margin-top: 0.75rem;
  font-size: clamp(1rem, 2.6vw, 1.3rem);
  color: var(--cyan);
}

.hero__location {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Liens / boutons */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--bg-elev-2);
}

/* Bouton de téléchargement du CV (sous GitHub / LinkedIn) */
.download {
  margin-top: 0.75rem;
}

.btn--download {
  border-color: rgba(78, 205, 196, 0.45);
}

/* --- États de l'animation du hero (uniquement si JS actif) --- */
.js .hero__output {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.js .hero__output.is-pending {
  opacity: 0;
  transform: translateY(6px);
  visibility: hidden;
}

/* ==========================================================================
   À propos
   ========================================================================== */
.about {
  max-width: 48rem;
  padding-left: 1rem;
  border-left: 2px solid var(--red);
}

/* ==========================================================================
   Compétences
   ========================================================================== */
.skills {
  display: grid;
  gap: 1.5rem;
}

.skills__group {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.5rem 1.25rem;
  align-items: start;
}

.skills__label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cyan);
  padding-top: 0.3rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  padding: 0.25rem 0.65rem;
  font-size: 0.85rem;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.15s, color 0.15s;
}

.tag:hover {
  border-color: var(--red);
  color: #fff;
}

/* ==========================================================================
   Expériences — timeline
   ========================================================================== */
.timeline {
  position: relative;
  display: grid;
  gap: 2.25rem;
  padding-left: 1.5rem;
  border-left: 1px dashed var(--border);
}

.job {
  position: relative;
}

/* Puce de commit sur la timeline */
.job::before {
  content: "";
  position: absolute;
  left: calc(-1.5rem - 5px);
  top: 0.45rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--cyan);
}

/* Poste actuel (HEAD) mis en avant */
.job:first-child::before {
  background: var(--red);
  border-color: var(--red);
}

.job__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.job__date {
  color: var(--red);
}

.job__title {
  margin-top: 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.job__company {
  color: var(--cyan);
}

.bullets {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.35rem;
}

.bullets li {
  position: relative;
  padding-left: 1.4rem;
  font-size: 0.95rem;
}

.bullets li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--red);
}

.stack-label {
  color: var(--muted);
}

/* ==========================================================================
   Formation
   ========================================================================== */
.education {
  display: grid;
  gap: 1rem;
}

.education__item {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.25rem 1.25rem;
}

.education__school {
  font-weight: 700;
  color: var(--cyan);
}

.education__year {
  color: var(--red);
}

/* ==========================================================================
   Projets — cartes
   ========================================================================== */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.15rem 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover,
.card:focus-within {
  border-color: var(--cyan);
  transform: translateY(-2px);
}

.card__name {
  font-size: 1.05rem;
  font-weight: 700;
}

.card__name::before {
  content: "./";
  color: var(--red);
}

.card__desc {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
}

.card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
}

.card__lang {
  color: var(--muted);
}

/* Pastille de couleur devant le langage */
.card__lang::before {
  content: "●";
  margin-right: 0.4em;
  color: var(--cyan);
}

.card__links {
  display: flex;
  gap: 1rem;
  margin-left: auto;
}

/* Liens entre crochets : [GitHub] [Site] */
.card__links a::before {
  content: "[";
  color: var(--muted);
}

.card__links a::after {
  content: "]";
  color: var(--muted);
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact {
  display: grid;
  gap: 0.6rem;
}

.contact li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.contact__key {
  min-width: 6rem;
  color: var(--muted);
}

/* Typographie : espace avant les deux-points en français, pas en anglais */
.contact__key::after {
  content: " :";
}

html[lang="en"] .contact__key::after {
  content: ":";
}

.prompt--end {
  margin-top: 2.5rem;
}

/* ==========================================================================
   Pied de page
   ========================================================================== */
.footer {
  max-width: var(--maxw);
  margin: 4rem auto 0;
  padding: 1.5rem 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ==========================================================================
   Toast « CV aussi disponible dans l'autre langue »
   Position fixe : n'affecte pas la mise en page. Sous les scanlines (999),
   qui ne captent pas les clics.
   ========================================================================== */
.toast-region {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  max-width: min(24rem, calc(100vw - 2.5rem));
}

.toast {
  position: relative;
  padding: 0.85rem 2.75rem 0.85rem 1rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Entrée / sortie : légère translation + fondu */
.toast.is-hidden {
  opacity: 0;
  transform: translateY(8px);
}

.toast__msg {
  color: var(--text);
}

.toast__msg::before {
  content: "$ ";
  color: var(--red);
}

.toast__link {
  display: inline-block;
  margin-top: 0.3rem;
}

.toast__close {
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.toast__close:hover,
.toast__close:focus-visible {
  color: var(--red);
  background: var(--bg-elev-2);
}

/* ==========================================================================
   Révélation au scroll (uniquement si JS actif — sinon tout est visible)
   ========================================================================== */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 760px) {
  html {
    scroll-padding-top: 7rem;   /* header sur deux lignes */
  }

  .topbar__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
  }

  .topbar__actions {
    width: 100%;
    justify-content: space-between;
    align-items: flex-start;
  }

  .nav__list {
    gap: 0.15rem 0.85rem;
    font-size: 0.8rem;
  }

  main {
    padding: 0 1rem;
  }

  .hero {
    min-height: auto;
    padding: 2rem 0;
  }

  .section {
    padding-top: 3rem;
  }

  .skills__group,
  .education__item {
    grid-template-columns: 1fr;
  }

  .skills__label {
    padding-top: 0;
  }

  .timeline {
    padding-left: 1.1rem;
  }

  .job::before {
    left: calc(-1.1rem - 5px);
  }

  /* Toast pleine largeur en bas de l'écran */
  .toast-region {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}

/* ==========================================================================
   Accessibilité : réduction des animations
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  /* Tout le contenu est affiché immédiatement */
  .js .reveal,
  .js .hero__output.is-pending {
    opacity: 1;
    transform: none;
    visibility: visible;
  }

  .card:hover,
  .card:focus-within {
    transform: none;
  }
}
