@font-face {
  font-family: "Press Start 2P";
  src: url("../fonts/press-start-2p.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}

/* ---------- Variables (clair / sombre) ---------- */
:root {
  /* Suit le thème de l'appareil ; le bouton du menu peut forcer clair ou sombre
     via <meta name="color-scheme"> (voir js/main.js). Les couleurs natives
     (barres de défilement, champs) suivent aussi. */
  color-scheme: light dark;
  &:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }
  &:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }

  /* Palette : #090712  #52446D  #966AAD  #C79ACD  #FAD8F8 */
  --c-night: #090712;
  --c-plum: #52446D;
  --c-violet: #966AAD;
  --c-lilac: #C79ACD;
  --c-blush: #FAD8F8;

  /* light-dark(clair, sombre) */
  --bg: light-dark(#fdf1fc, var(--c-night));
  --surface: light-dark(#ffffff, #14101f);
  --text: light-dark(var(--c-night), var(--c-blush));
  --muted: light-dark(var(--c-plum), var(--c-lilac));
  --border: light-dark(#ebcfe9, #2d2540);
  --accent: light-dark(var(--c-plum), var(--c-lilac));
  --accent-text: light-dark(#ffffff, var(--c-night));
  --thumb-from: light-dark(var(--c-plum), var(--c-violet));
  --thumb-to: light-dark(var(--c-lilac), var(--c-plum));
  --shadow-1: light-dark(rgba(9, 7, 18, .05), rgba(0, 0, 0, .5));
  --shadow-2: light-dark(rgba(82, 68, 109, .12), rgba(0, 0, 0, .45));
  --shadow: 0 1px 2px var(--shadow-1), 0 8px 24px var(--shadow-2);

  --radius: 14px;
  --max: 1040px;
  accent-color: var(--accent);
}

/* ---------- Transitions entre les pages (si le visiteur n'a pas réduit les animations) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }
  .site-header { view-transition-name: site-header; } /* le menu reste en place */
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.02em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); }

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

.skip-link {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: var(--accent-text);
  padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { left: 8px; }

/* ---------- En-tête / navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 64px; }

/* Onglets : pixel art + lueur (comme la date et l'heure) */
.nav-links { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; grid-column: 2; }
.nav-links a {
  display: block; padding: 10px 14px; border: 2px solid transparent;
  font-family: "Press Start 2P", ui-monospace, monospace;
  font-size: .6rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent); text-decoration: none;
  text-shadow: 0 0 4px color-mix(in srgb, var(--c-lilac) 80%, transparent), 0 0 10px color-mix(in srgb, var(--c-violet) 80%, transparent);
  transition: color .2s, text-shadow .2s, border-color .2s;
}
.nav-links a:hover {
  border-color: var(--c-violet);
  text-shadow: 0 0 6px var(--c-lilac), 0 0 16px var(--c-violet), 0 0 28px var(--c-violet);
}
.nav-links a[aria-current="page"] {
  border-color: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--c-violet) 70%, transparent), inset 0 0 8px color-mix(in srgb, var(--c-violet) 40%, transparent);
  text-shadow: 0 0 6px var(--c-lilac), 0 0 16px var(--c-violet);
}

.nav-tools { display: flex; gap: 8px; align-items: center; justify-self: end; grid-column: 3; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 1.1rem; display: grid; place-items: center;
}
.icon-btn:hover { border-color: var(--accent); }
.menu-btn { display: none; }

@media (max-width: 720px) {
  .menu-btn { display: grid; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 12px 20px 16px; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px; }
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
  text-decoration: none; font-weight: 600; border: 2px solid var(--accent);
  transition: transform .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* ---------- Sections ---------- */
.section { padding-block: 64px; }
.eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; margin-bottom: 12px; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }

.hero { padding-block: 96px 72px; }
.hero h1 em { font-style: normal; color: var(--accent); }

.page-title { padding-block: 64px 24px; }

/* ---------- Cartes ---------- */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card p { color: var(--muted); }
.card { position: relative; }
.card .card-link { margin-top: auto; font-weight: 600; text-decoration: none; }
.card .card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); } /* toute la carte est cliquable */
.card .card-link:hover { text-decoration: underline; }

.thumb {
  aspect-ratio: 16 / 9; border-radius: 10px; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--thumb-from), var(--thumb-to));
  display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 1.4rem; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; }
.tags li {
  font-size: .78rem; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
}

/* Filtres projets */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 28px; }
.filter-btn {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-weight: 500;
}
.filter-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.card[hidden] { display: none; }

/* ---------- Page « Moi » ---------- */
.about { display: grid; gap: 40px; grid-template-columns: 280px 1fr; align-items: start; }
@media (max-width: 760px) { .about { grid-template-columns: 1fr; } }

.portrait {
  aspect-ratio: 1; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center;
  color: var(--muted); font-size: .95rem; text-align: center; overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }

.skills { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.skills li { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .92rem; }

/* Page de détail d'un projet */
.back-link { display: inline-block; margin-bottom: 20px; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.project-image {
  display: block; width: 100%; max-width: 900px; height: auto;
  border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.project-detail { display: grid; gap: 40px; }
.project-detail > div { max-width: 760px; }
.feature-list { margin: 0; padding-left: 1.2em; }
.feature-list li { margin-bottom: .5em; }
.feature-list li::marker { color: var(--accent); }
.page-title .tags { margin-top: 8px; }

/* Certifications : onglets + cartes */
.tabs { display: inline-flex; gap: 8px; margin: 8px 0 24px; flex-wrap: wrap; }
.tab {
  font-family: "Press Start 2P", ui-monospace, monospace; font-size: .6rem; text-transform: uppercase;
  padding: 12px 16px; background: transparent; color: var(--accent); cursor: pointer;
  border: 2px solid var(--border);
  text-shadow: 0 0 4px color-mix(in srgb, var(--c-lilac) 80%, transparent), 0 0 10px color-mix(in srgb, var(--c-violet) 80%, transparent);
  transition: border-color .2s, box-shadow .2s;
}
.tab:hover { border-color: var(--c-violet); }
.tab[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--c-violet) 70%, transparent), inset 0 0 8px color-mix(in srgb, var(--c-violet) 40%, transparent);
}
.cert-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cert h3 { margin: 10px 0 4px; }
.cert p { margin: 0 0 6px; }
.cert .cert-meta { font-size: .85rem; margin-top: auto; padding-top: 8px; }
.cert-link {
  align-self: flex-start; margin-top: 12px; padding: 6px 14px;
  font-size: .82rem; font-weight: 600; text-decoration: none;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 999px;
  transition: background .2s, color .2s;
}
.cert-link:hover { background: var(--accent); color: var(--accent-text); }
.badge {
  align-self: flex-start; font-size: .75rem; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; background: var(--accent); color: var(--accent-text);
}
.badge.course { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.progress { height: 10px; margin: 10px 0 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--c-violet), var(--c-lilac)); border-radius: 999px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 20px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 24px 20px; }
.timeline li::before {
  content: ""; position: absolute; left: -29px; top: 8px;
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
}
.timeline .date { color: var(--accent); font-weight: 600; font-size: .85rem; }
.timeline h3 { margin: 2px 0 4px; }
.timeline p { color: var(--muted); margin: 0; }

/* ---------- Liens ---------- */
.link-list { display: grid; gap: 14px; list-style: none; padding: 0; margin: 0; }
.link-item {
  display: flex; align-items: center; gap: 16px; padding: 18px 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); transition: transform .2s, border-color .2s;
}
.link-item:hover { transform: translateX(4px); border-color: var(--accent); }
.link-item .ico {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center;
  background: #fff; border-radius: 12px; /* fond blanc : les logos restent lisibles en mode clair et sombre */
}
.link-item .ico img { width: 28px; height: 28px; display: block; }
.link-item strong { display: block; }
.link-item small { color: var(--muted); }
.link-item .arrow { margin-left: auto; color: var(--accent); }

/* ---------- Pied de page ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .92rem; }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
