/* ════════════════════════════════════════════════════════════
   DESIGN TOKENS
   ════════════════════════════════════════════════════════════ */
:root {
  --bg: #0f0d0b;
  --surface: #181511;
  --surface-2: #201c17;
  --text: #f1ece3;
  --muted: #e9e2da;
  --primary: #8e6df0;
  --accent: #b97df2;
  --border: #302a23;
  --radius: 14px;

  --nav-h: 66px;

  /* Fluid type scale */
  --step-sm: clamp(0.78rem, 1.8vw, 0.9rem);
  --step-0: clamp(0.92rem, 2vw, 1rem);
  --step-1: clamp(1rem, 2vw, 1.25rem);
  --step-2: clamp(1.3rem, 3vw, 1.6rem);
  --step-3: clamp(1.6rem, 4vw, 2.2rem);
  --step-hero: clamp(2.4rem, 9vw, 6.6rem);
}

/* ════════════════════════════════════════════════════════════
   RESET & BASE
   ════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Poppins", Arial, sans-serif;
  font-size: var(--step-0);
  background:
    radial-gradient(circle at 15% 10%, rgba(142, 109, 240, .15), transparent 30%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: "Bricolage Grotesque", Arial, sans-serif;
  margin: 0 0 .9rem;
  line-height: 1.1;
}

h1 {
  font-size: var(--step-hero);
  line-height: .95;
}

h2 {
  font-size: var(--step-3);
}

h3 {
  font-size: var(--step-1);
}

p {
  margin: 0 0 1rem;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ════════════════════════════════════════════════════════════
   LAYOUT UTILITIES
   ════════════════════════════════════════════════════════════ */
.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

.narrow {
  max-width: 760px;
}

.grid {
  display: grid;
  gap: 1rem;
}

.center {
  text-align: center;
}

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

.lead {
  color: var(--muted);
  font-size: var(--step-0);
  max-width: 760px;
}

.eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-weight: 600;
  font-size: var(--step-sm);
  margin-bottom: .4rem;
}

/* ════════════════════════════════════════════════════════════
   HEADER & NAV
   ════════════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(15, 13, 11, .88);
  border-bottom: 1px solid rgba(48, 42, 35, .7);
}

.nav-wrapper {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-family: "Bricolage Grotesque", Arial, sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.02em;
  flex-shrink: 0;
}

/* Desktop nav */
.main-nav {
  display: flex;
  gap: 1.6rem;
}

.main-nav a {
  color: var(--muted);
  font-size: .92rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 2px;
  transition: color .2s;
}

.main-nav a::after {
  content: "";
  position: absolute;
  inset: auto 0 -2px 0;
  height: 1px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}

.main-nav a:hover {
  color: var(--text);
}

.main-nav a:hover::after {
  transform: scaleX(1);
}

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.burger-bar {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .3s ease, opacity .3s ease;
}

.menu-toggle[aria-expanded="true"] .burger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .burger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.menu-toggle[aria-expanded="true"] .burger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ════════════════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════════════════ */
.hero {
  min-height: 92vh;
  display: flex;
  align-items: center;
  padding: 5rem 0 3rem;
  position: relative;
  z-index: 1;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.gradient {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  margin-top: 1.6rem;
}

.actions.center {
  justify-content: center;
}

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 600;
  font-size: .92rem;
  padding: .78rem 1.4rem;
  border: 1px solid transparent;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  border-color: var(--border);
  background: transparent;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .22);
  filter: brightness(1.06);
}

/* ════════════════════════════════════════════════════════════
   SECTIONS
   ════════════════════════════════════════════════════════════ */
.section {
  padding: 3rem 0;
  position: relative;
  z-index: 1;
}

.section-title {
  font-size: var(--step-2);
}

/* ════════════════════════════════════════════════════════════
   À PROPOS — 2 colonnes
   ════════════════════════════════════════════════════════════ */
.two-col {
  display: grid;
  gap: 3rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ════════════════════════════════════════════════════════════
   STATS
   ════════════════════════════════════════════════════════════ */
.stats-grid {
  margin-top: 2.4rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ════════════════════════════════════════════════════════════
   RÉSUMÉ (Expérience / Éducation / Compétences)
   ════════════════════════════════════════════════════════════ */
.resume-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1.4fr 1fr;
  /* exp+edu | compétences */
  align-items: start;
}

/* Aligne les cards Expérience & Éducation sur les mêmes lignes.
   On place les deux colonnes dans un conteneur flex/grid commun
   via un wrapper .exp-edu-wrap injecté dans le HTML. */
.exp-edu-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.exp-edu-wrap .cards-stack {
  /* Chaque cards-stack a autant de lignes que de cards,
     toutes de même hauteur grâce à align-items: stretch */
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: .75rem;
}

.exp-edu-wrap .card {
  height: 100%;
}

.skills-col {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.skill-block {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.skill-block .tags {
  align-content: flex-start;
}

/* ════════════════════════════════════════════════════════════
   PROJETS
   ════════════════════════════════════════════════════════════ */
.projects-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════ */
.cards-stack {
  display: grid;
  gap: .75rem;
}

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.card h3 {
  margin-top: 0;
}

/* Passion cards */
.passion-card-inner {
  display: flex;
  gap: 14px;
  align-items: center;
}

.passion-card-inner img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Project cards */
.project-card {
  padding: 0;
  overflow: hidden;
  display: block;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.project-card img {
  width: 100%;
  height: clamp(180px, 22vw, 280px);
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
}

.project-card-content {
  padding: 1rem;
}

.project-card h3 {
  margin-top: 0;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .32);
  border-color: rgba(185, 125, 242, .5);
}

.project-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ════════════════════════════════════════════════════════════
   TAGS
   ════════════════════════════════════════════════════════════ */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .48rem;
}

.tag {
  font-size: .78rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  line-height: 1.3;
}

.tags.small .tag {
  background: rgba(142, 109, 240, .12);
  border-color: rgba(142, 109, 240, .26);
}

/* ════════════════════════════════════════════════════════════
   LANGUAGES
   ════════════════════════════════════════════════════════════ */
.languages-list p {
  margin-bottom: .6rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lang-level {
  color: var(--muted);
  font-size: .85rem;
}

/* ════════════════════════════════════════════════════════════
   SECTION STARS (décoratifs)
   ════════════════════════════════════════════════════════════ */
.section-star {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 0 10px rgba(185, 125, 242, .2));
  animation: starFloat 10s ease-in-out infinite, starRotate 20s linear infinite;
}

.projects-star {
  width: 88px;
  top: 28px;
  right: 6%;
}

.contact-star {
  width: 102px;
  top: 38px;
  left: 8%;
}

/* ════════════════════════════════════════════════════════════
   HERO STARS (décoratifs)
   ════════════════════════════════════════════════════════════ */
.stars-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.decor-star {
  position: absolute;
  filter: drop-shadow(0 0 14px rgba(185, 125, 242, .24));
  animation: starFloat 9s ease-in-out infinite, starTwinkle 4.2s ease-in-out infinite, starRotate 18s linear infinite;
}

.star-a {
  width: 118px;
  top: 95px;
  left: 4%;
  animation-delay: 0s;
}

.star-b {
  width: 92px;
  top: 92px;
  right: 5%;
  animation-delay: .8s;
}

.star-c {
  width: 70px;
  top: 45%;
  left: 5%;
  animation-delay: 1.4s;
}

.star-d {
  width: 148px;
  top: 48%;
  right: 5%;
  animation-delay: 2s;
}

.star-e {
  width: 72px;
  bottom: 52px;
  left: 12%;
  animation-delay: 2.6s;
}

.star-f {
  width: 126px;
  bottom: 56px;
  right: 12%;
  animation-delay: 1.1s;
}

@keyframes starFloat {

  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -12px;
  }
}

@keyframes starTwinkle {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .55;
  }
}

@keyframes starRotate {
  0% {
    rotate: -4deg;
  }

  50% {
    rotate: 4deg;
  }

  100% {
    rotate: -4deg;
  }
}

/* ════════════════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.4rem 0 2rem;
  position: relative;
  z-index: 1;
}

.footer-wrap {
  display: flex;
  justify-content: space-between;
  gap: .7rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .88rem;
}

/* ════════════════════════════════════════════════════════════
   SCROLL REVEAL
   ════════════════════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .65s ease, transform .65s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ════════════════════════════════════════════════════════════
   PROJECT DETAIL PAGE
   ════════════════════════════════════════════════════════════ */
.project-hero {
  padding-top: 1.5rem;
}

.project-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  max-width: 980px;
}

.project-detail-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-highlight {
  padding: 0;
  overflow: hidden;
}

.project-highlight img {
  width: 100%;
  height: clamp(260px, 40vw, 520px);
  object-fit: cover;
}

.project-gallery-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-gallery-card {
  padding: 0;
  overflow: hidden;
}

.project-gallery-card img {
  width: 100%;
  height: 290px;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform .35s ease;
}

.project-gallery-card img:hover {
  transform: scale(1.03);
}

/* ════════════════════════════════════════════════════════════
   LIGHTBOX
   ════════════════════════════════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 1200;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: min(1200px, 94vw);
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(24, 21, 17, .92);
  color: var(--text);
  line-height: 1;
  cursor: pointer;
  transition: background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close,
.lightbox-nav:hover {
  background: rgba(40, 36, 30, .98);
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  font-size: 1.4rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  font-size: 1.8rem;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET  (601–900px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {

  .hero {
    min-height: 75vh;
  }

  /* Empile exp+edu au-dessus des compétences */
  .resume-grid {
    grid-template-columns: 1fr;
  }

  /* Exp & Édu restent côte à côte sur tablette */
  .exp-edu-wrap {
    grid-template-columns: 1fr 1fr;
  }

  .skills-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .skills-col .skill-block:first-child {
    grid-column: 1 / -1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Étoiles — remontées au-dessus du texte hero */
  .star-a {
    width: 60px;
    left: 2%;
    top: 14px;
    opacity: 0.7;
  }

  .star-b {
    width: 52px;
    right: 2%;
    top: 14px;
    opacity: 0.7;
  }

  .star-c,
  .star-d,
  .star-e,
  .star-f {
    display: none;
  }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE  (≤ 640px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .hero {
    min-height: unset;
    padding: 6rem 0 3rem;
  }

  .section {
    padding: 3rem 0;
  }

  /* Navigation mobile */
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: rgba(24, 21, 17, .98);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: .8rem 4% 1.2rem;
    gap: .2rem;
    /* Animation d'ouverture */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .35s ease, opacity .3s ease;
  }

  .main-nav.open {
    max-height: 300px;
    opacity: 1;
  }

  .main-nav a {
    padding: .6rem 0;
    font-size: 1rem;
    border-bottom: 1px solid rgba(48, 42, 35, .4);
  }

  .main-nav a:last-child {
    border-bottom: none;
  }

  /* Layouts */
  .two-col,
  .resume-grid,
  .exp-edu-wrap,
  .projects-grid,
  .project-detail-layout,
  .project-gallery-grid {
    grid-template-columns: 1fr;
  }

  .exp-edu-wrap .cards-stack {
    grid-template-rows: auto;
    /* annule les lignes forcées sur mobile */
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skills-col {
    grid-template-columns: 1fr;
  }

  .skills-col .skill-block:first-child {
    grid-column: auto;
  }

  /* Stars mobile — seules star-a et star-b restent visibles,
     les autres masquées pour ne pas empiéter sur le texte */
  .star-a {
    width: 48px;
    left: 2%;
    top: 14px;
    opacity: 0.65;
  }

  .star-b {
    width: 40px;
    right: 2%;
    top: 14px;
    opacity: 0.65;
  }

  .star-c,
  .star-d,
  .star-e,
  .star-f {
    display: none;
  }

  .projects-star {
    width: 60px;
    right: 3%;
    top: 16px;
  }

  .contact-star {
    width: 68px;
    left: 3%;
    top: 20px;
  }

  /* Lightbox */
  .lightbox {
    padding: .75rem;
  }

  .lightbox img {
    max-width: 94vw;
    max-height: 78vh;
  }

  .lightbox-close {
    top: .6rem;
    right: .6rem;
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
  }

  .lightbox-nav {
    width: 36px;
    height: 36px;
    font-size: 1.35rem;
  }

  .lightbox-prev {
    left: .4rem;
  }

  .lightbox-next {
    right: .4rem;
  }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — LARGE  (> 1200px)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 1200px) {
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}