/* =========================================================
   Portfolio — Nathan THIBAULT · BTS SIO option SLAM
   Base commune : variables, thèmes, composants, impression, accessibilité
   ========================================================= */

/* ---------- 1. Variables & thèmes ---------- */
/* Thème sombre : ma chambre la nuit, éclairée par l'écran et les rubans LED */
:root {
  --bg: #221a2b;
  --bg-alt: #2c2236;
  --surface: #31263d;
  --surface-2: #3b2f49;
  --border: rgba(244, 200, 255, 0.13);
  --text: #f6eefc;
  --text-muted: #c3b0d6;
  --primary: #22d3ee;
  --secondary: #c084fc;
  --accent: #f472b6;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f43f5e;
  --gradient: linear-gradient(135deg, #22d3ee, #a855f7 55%, #f472b6);
  --shadow: 0 20px 45px -20px rgba(0, 0, 0, 0.6);
  --glow: 0 0 0 1px rgba(34, 211, 238, 0.3), 0 20px 45px -18px rgba(168, 85, 247, 0.55);
  --header-bg: rgba(34, 26, 43, 0.84);
  /* Grain léger du plâtre */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.9 0 0 0 0 1 0 0 0 0.3 -0.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  /* Mur en tasseaux : relief de chaque tasseau, veines du bois, éclairage */
  --lattes:
    radial-gradient(ellipse 60% 55% at 50% -6%, rgba(168, 85, 247, 0.36), transparent 72%),
    radial-gradient(ellipse 40% 50% at 92% 106%, rgba(34, 211, 238, 0.18), transparent 70%),
    radial-gradient(ellipse 40% 50% at 8% 106%, rgba(244, 114, 182, 0.16), transparent 70%),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.3)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='420'%3E %3Cfilter id='v'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9 0.012' numOctaves='3' stitchTiles='stitch'/%3E %3CfeColorMatrix values='0 0 0 0 0.04 0 0 0 0 0.02 0 0 0 0 0.01 0 0 0 0.9 -0.4'/%3E%3C/filter%3E %3Crect width='100%' height='100%' filter='url(%23v)'/%3E %3C/svg%3E"),
    repeating-linear-gradient(90deg, #100c13 0 9px, #2a1c14 9px 10px, #5a3b29 11.5px, #76523b 17px, #67452f 23px, #3e2a1c 28.5px, #100c13 30px);
  /* Lumière d'une fenêtre (et ombre d'une plante) sur le mur crème */
  --lumiere: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1000' height='700' viewBox='0 0 1000 700'%3E %3Cdefs%3E %3Cfilter id='f' x='-20%' y='-20%' width='140%' height='140%'%3E%3CfeGaussianBlur stdDeviation='13'/%3E%3C/filter%3E %3Cfilter id='g' x='-20%' y='-20%' width='140%' height='140%'%3E%3CfeGaussianBlur stdDeviation='5'/%3E%3C/filter%3E %3C/defs%3E %3Cg filter='url(%23f)' fill='%23aab6ff' fill-opacity='0.12'%3E %3Cpolygon points='430,40 640,10 600,250 390,280'/%3E%3Cpolygon points='662,6 872,-24 832,216 622,246'/%3E%3Cpolygon points='386,300 596,270 556,510 346,540'/%3E%3Cpolygon points='618,266 828,236 788,476 578,506'/%3E %3C/g%3E %3Cg filter='url(%23g)' fill='%2305030a' fill-opacity='0.07'%3E %3Cellipse cx='470' cy='440' rx='62' ry='20' transform='rotate(-38 470 440)'/%3E%3Cellipse cx='520' cy='395' rx='55' ry='18' transform='rotate(-12 520 395)'/%3E%3Cellipse cx='440' cy='380' rx='48' ry='16' transform='rotate(-70 440 380)'/%3E%3Cellipse cx='560' cy='470' rx='58' ry='19' transform='rotate(22 560 470)'/%3E%3Cellipse cx='500' cy='500' rx='44' ry='15' transform='rotate(-55 500 500)'/%3E%3Cellipse cx='610' cy='420' rx='40' ry='14' transform='rotate(40 610 420)'/%3E%3Cellipse cx='420' cy='470' rx='38' ry='13' transform='rotate(10 420 470)'/%3E%3Cellipse cx='540' cy='345' rx='36' ry='12' transform='rotate(-40 540 345)'/%3E %3Cpath d='M 300 640 C 380 560 430 520 470 440 M 470 440 C 500 410 520 400 540 345 M 470 440 C 520 450 545 460 560 470' fill='none' stroke='%2305030a' stroke-opacity='0.07' stroke-width='5'/%3E %3C/g%3E %3C/svg%3E");
  /* Plateau du bureau (pied de page) : chant en métal gris, bois veiné */
  --bureau: linear-gradient(180deg, #2a2830 0 7px, transparent 7px), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='160'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.6' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.03 0 0 0 0 0.02 0 0 0 0.7 -0.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"), linear-gradient(180deg, #45352d, #3a2c25);
  --bureau-texte: #dccbbd;
  --radius: 18px;
  --radius-sm: 12px;
  --font-title: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "Fira Code", Consolas, monospace;
  --header-h: 72px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Thème « chambre » (clair, par défaut) : mur crème, tasseaux de chêne, bureau en chêne clair */
[data-theme="light"] {
  --bg: #f1e9dc;
  --bg-alt: #e8dcc8;
  --surface: #fffaf2;
  --surface-2: #f7efe2;
  --border: rgba(92, 64, 38, 0.16);
  --text: #2f2219;
  --text-muted: #6a5646;
  --primary: #9a3412;
  --secondary: #0f6b63;
  --accent: #db2777;
  --success: #15803d;
  --warning: #b45309;
  --gradient: linear-gradient(135deg, #ea580c, #e11d48 55%, #be185d);
  --shadow: 0 20px 45px -25px rgba(80, 45, 18, 0.45);
  --glow: 0 0 0 1px rgba(234, 88, 12, 0.35), 0 20px 45px -22px rgba(225, 29, 72, 0.45);
  --header-bg: rgba(247, 241, 232, 0.88);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0.35 -0.14'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  /* Mur en tasseaux : relief de chaque tasseau, veines du bois, éclairage */
  --lattes:
    radial-gradient(ellipse 26% 80% at 14% -14%, rgba(255, 226, 168, 0.5), transparent 72%),
    radial-gradient(ellipse 26% 80% at 50% -14%, rgba(255, 226, 168, 0.5), transparent 72%),
    radial-gradient(ellipse 26% 80% at 86% -14%, rgba(255, 226, 168, 0.5), transparent 72%),
    linear-gradient(180deg, rgba(255, 240, 215, 0.05), rgba(55, 30, 12, 0.34)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='420'%3E %3Cfilter id='v'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9 0.012' numOctaves='3' stitchTiles='stitch'/%3E %3CfeColorMatrix values='0 0 0 0 0.32 0 0 0 0 0.18 0 0 0 0 0.07 0 0 0 0.9 -0.4'/%3E%3C/filter%3E %3Crect width='100%' height='100%' filter='url(%23v)'/%3E %3C/svg%3E"),
    repeating-linear-gradient(90deg, #2a2522 0 9px, #5e3f22 9px 10px, #b07a42 11.5px, #d6a46a 17px, #c99459 23px, #94642f 28.5px, #2a2522 30px);
  /* Lumière d'une fenêtre (et ombre d'une plante) sur le mur crème */
  --lumiere: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1000' height='700' viewBox='0 0 1000 700'%3E %3Cdefs%3E %3Cfilter id='f' x='-20%' y='-20%' width='140%' height='140%'%3E%3CfeGaussianBlur stdDeviation='13'/%3E%3C/filter%3E %3Cfilter id='g' x='-20%' y='-20%' width='140%' height='140%'%3E%3CfeGaussianBlur stdDeviation='5'/%3E%3C/filter%3E %3C/defs%3E %3Cg filter='url(%23f)' fill='%23fff6e4' fill-opacity='0.8'%3E %3Cpolygon points='430,40 640,10 600,250 390,280'/%3E%3Cpolygon points='662,6 872,-24 832,216 622,246'/%3E%3Cpolygon points='386,300 596,270 556,510 346,540'/%3E%3Cpolygon points='618,266 828,236 788,476 578,506'/%3E %3C/g%3E %3Cg filter='url(%23g)' fill='%236b4f36' fill-opacity='0.12'%3E %3Cellipse cx='470' cy='440' rx='62' ry='20' transform='rotate(-38 470 440)'/%3E%3Cellipse cx='520' cy='395' rx='55' ry='18' transform='rotate(-12 520 395)'/%3E%3Cellipse cx='440' cy='380' rx='48' ry='16' transform='rotate(-70 440 380)'/%3E%3Cellipse cx='560' cy='470' rx='58' ry='19' transform='rotate(22 560 470)'/%3E%3Cellipse cx='500' cy='500' rx='44' ry='15' transform='rotate(-55 500 500)'/%3E%3Cellipse cx='610' cy='420' rx='40' ry='14' transform='rotate(40 610 420)'/%3E%3Cellipse cx='420' cy='470' rx='38' ry='13' transform='rotate(10 420 470)'/%3E%3Cellipse cx='540' cy='345' rx='36' ry='12' transform='rotate(-40 540 345)'/%3E %3Cpath d='M 300 640 C 380 560 430 520 470 440 M 470 440 C 500 410 520 400 540 345 M 470 440 C 520 450 545 460 560 470' fill='none' stroke='%236b4f36' stroke-opacity='0.12' stroke-width='5'/%3E %3C/g%3E %3C/svg%3E");
  --bureau: linear-gradient(180deg, #3c3c40 0 7px, transparent 7px), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='160'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006 0.6' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.3 0 0 0 0 0.15 0 0 0 0.7 -0.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"), linear-gradient(180deg, #ddc8a6, #d0b892);
  --bureau-texte: #4a382b;
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  font-family: var(--font-body);
  background: var(--grain), var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

body.no-scroll { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-title); line-height: 1.2; }
sup { font-size: 0.72em; line-height: 0; }

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

::selection { background: var(--secondary); color: #fff; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted { color: var(--text-muted); }
.is-hidden { display: none !important; }
/* L'attribut hidden l'emporte toujours, même sur un élément en display: grid ou flex */
[hidden] { display: none !important; }

/* ---------- 3. Animations d'apparition ---------- */
.reveal { opacity: 0; }
.reveal.visible { animation: reveal 0.8s var(--ease) both; }
.reveal.pop { opacity: 1; animation: pop 0.45s var(--ease) both; }

@keyframes reveal {
  from { opacity: 0; translate: 0 30px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes pop {
  from { opacity: 0; scale: 0.94; }
  to   { opacity: 1; scale: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; translate: 0 16px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes spin { to { rotate: 360deg; } }
@keyframes float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -14px; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  50%      { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes wheel {
  0%   { opacity: 1; translate: -50% 0; }
  100% { opacity: 0; translate: -50% 12px; }
}

/* ---------- 4. Composants communs ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease), background-color 0.3s var(--ease);
}

.card--hover:hover {
  transform: translateY(-6px);
  box-shadow: var(--glow);
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.btn--primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent) 75%, transparent);
}
.btn--primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -12px color-mix(in srgb, var(--accent) 90%, transparent);
}
.btn--ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn--ghost:hover { transform: translateY(-3px); border-color: var(--primary); }
.btn--small { padding: 0.55rem 1.1rem; font-size: 0.85rem; }
.btn--full { width: 100%; }

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--primary); }

.tags,
.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.tags span,
.tech-list li {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.chips--lg li { padding: 0.65rem 1.1rem; font-size: 0.92rem; background: var(--surface); }
.chips--lg i { color: var(--primary); }

.pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.65rem;
  border-radius: 6px;
}
/* Texte mélangé à la couleur du texte du thème : contraste suffisant de jour comme de nuit */
.pill--vr { color: color-mix(in srgb, var(--secondary) 75%, var(--text)); background: color-mix(in srgb, var(--secondary) 15%, transparent); }
.pill--ar { color: color-mix(in srgb, var(--primary) 75%, var(--text)); background: color-mix(in srgb, var(--primary) 15%, transparent); }
.pill--mr { color: color-mix(in srgb, var(--accent) 75%, var(--text)); background: color-mix(in srgb, var(--accent) 15%, transparent); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
/* Le texte est mélangé à la couleur du texte du thème : contraste suffisant (au moins 4,5:1) de jour comme de nuit */
.status--done { color: color-mix(in srgb, var(--success) 80%, var(--text)); background: color-mix(in srgb, var(--success) 14%, transparent); }
.status--soon { color: color-mix(in srgb, var(--warning) 80%, var(--text)); background: color-mix(in srgb, var(--warning) 14%, transparent); }

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2.5rem;
}
.filters--left { justify-content: flex-start; margin-bottom: 1.5rem; }
.filter-btn {
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.filter-btn:hover { color: var(--text); border-color: var(--primary); }
.filter-btn.active { background: var(--gradient); color: #fff; border-color: transparent; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.25rem;
}

.sub-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.25rem;
  margin: 3rem 0 1.25rem;
}
.sub-title i { color: var(--primary); }
.sub-title--first { margin-top: 0; }

.card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
  margin-bottom: 1.1rem;
}
.card-title i { color: var(--primary); }

@media (max-width: 960px) {
  .grid-3,
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .card { padding: 1.3rem; }
}

/* ---------- 18. Impression / export PDF ---------- */
@media print {
  .header,
  .scroll-progress,
  .back-to-top,
  .scroll-down,
  .hero__canvas,
  .hero__glow,
  .tabs,
  .filters,
  .contact__form { display: none !important; }
  .reveal { opacity: 1 !important; animation: none !important; }
  .tab-panel { display: block !important; margin-bottom: 2rem; }
  .is-hidden { display: revert !important; }
  .hero { min-height: auto; }
  .card,
  .timeline__item,
  .news-item { break-inside: avoid; }
}

/* ---------- 19. Accessibilité : réduction des animations ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
