/*
  Palette globale du portfolio de Said.
  Les couleurs principales demandées sont bleu, rouge et blanc.
  Pour changer rapidement l'identité visuelle :
  - --blue contrôle les boutons, titres et éléments forts.
  - --red contrôle les accents et les détails dynamiques.
  - --white contrôle les cartes et les zones de respiration.
*/
:root {
  --ink: #172033;
  --muted: #5b6475;
  --line: #dce5f5;
  --paper: #f4f8ff;
  --white: #ffffff;
  --blue: #2457d6;
  --blue-dark: #12347f;
  --blue-soft: #eaf1ff;
  --red: #d72638;
  --red-dark: #981b2a;
  --cyan: #18c7ff;
  --shadow: 0 18px 50px rgba(18, 52, 127, 0.14);

  --page-max: 1200px;
  --page-gutter: clamp(1rem, 4vw, 2.5rem);
  --section-space: clamp(3.5rem, 7vw, 6rem);
  --card-radius: 1rem;
  --radius: var(--card-radius);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  min-width: 0;
  overflow-wrap: break-word;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

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

img,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

/*
  Conteneur commun :
  limite la largeur du contenu et garde une marge latérale sur tous les écrans.
*/
.container {
  width: min(calc(100% - 2 * var(--page-gutter)), var(--page-max));
  margin-inline: auto;
}

/*
  Header fixe :
  sticky garde la navigation en haut pendant le scroll.
  Le fond blanc translucide garde le style léger du portfolio.
*/
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(220, 229, 245, 0.95);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.site-header:hover {
  border-color: rgba(36, 87, 214, 0.28);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 34px rgba(18, 52, 127, 0.08);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 2vw, 24px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.brand:hover {
  color: var(--blue);
  transform: translateY(-1px);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(215, 38, 56, 0.12);
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.brand:hover .brand-mark {
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(36, 87, 214, 0.13);
  transform: rotate(-6deg) scale(1.05);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
  font-size: 0.95rem;
  color: var(--muted);
}

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

.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--red));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

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

.nav-action,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.nav-action,
.btn-primary {
  color: var(--white);
  background: var(--blue);
}

.nav-action:hover,
.btn-primary:hover {
  background: var(--red);
  box-shadow: 0 12px 26px rgba(215, 38, 56, 0.22);
}

.btn-secondary {
  color: var(--blue-dark);
  border-color: var(--blue);
  background: var(--white);
}

.btn-secondary:hover {
  color: var(--white);
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

.btn-secondary:focus-visible {
  outline-color: var(--red);
}

.nav-action:hover,
.btn:hover {
  transform: translateY(-2px);
}

#theme-toggle {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--blue-dark);
  background: var(--white);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(18, 52, 127, 0.08);
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

#theme-toggle:hover {
  color: var(--white);
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 12px 26px rgba(36, 87, 214, 0.2);
  transform: translateY(-2px);
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font-size: 1.25rem;
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.menu-toggle:hover {
  color: var(--red);
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(18, 52, 127, 0.12);
  transform: translateY(-1px);
}

/*
  Hero avec photo en arrière-plan :
  - La photo est appelée ici avec url("said cv.jpg").
  - Le premier calque est un dégradé blanc/bleu très clair qui protège la lisibilité du texte.
  - Le deuxième calque est la photo.
  - L'ordre compte : le dégradé est écrit avant l'image, donc il se place au-dessus.
  - "right center" met le portrait à droite sur ordinateur.
  - "min(45vw, 540px)" rend la photo responsive sans devenir trop grande.
  Pour refaire cet effet : placer l'image dans background avec un linear-gradient devant.
*/
.hero {
  min-height: clamp(560px, calc(100vh - 72px), 860px);
  display: grid;
  align-items: center;
  padding-block: clamp(3rem, 6vw, 4.5rem);
  background:
    linear-gradient(
      90deg,
      rgba(244, 248, 255, 0.98) 0%,
      rgba(244, 248, 255, 0.9) 46%,
      rgba(244, 248, 255, 0.22) 100%
    ),
    url("said cv.jpg") right center / min(45vw, 540px) auto no-repeat;
}

/*
  Le texte du hero est limité en largeur pour laisser respirer la photo à droite.
*/
.hero-content {
  max-width: 700px;
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin-bottom: 18px;
  color: var(--red);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.25rem, 5vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: 0;
  text-wrap: balance;
  margin-bottom: 20px;
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 3rem);
  line-height: 1.15;
  letter-spacing: 0;
  text-wrap: balance;
}

h3 {
  line-height: 1.3;
}

p {
  line-height: 1.7;
}

.hero-lead {
  max-width: 630px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  margin-bottom: 28px;
}

.section-text {
  max-width: 65ch;
}

.hero-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/*
  Grille des informations rapides :
  le fond bleu clair sert de séparateur entre les cases blanches.
*/
.quick-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow);
}

.fact {
  min-width: 0;
  padding: 18px;
  background: var(--white);
}

.fact strong {
  display: block;
  color: var(--blue-dark);
  font-size: 1.1rem;
}

.fact span {
  color: var(--muted);
  font-size: 0.92rem;
}

section {
  padding-block: var(--section-space);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(0, 1.28fr);
  gap: 42px;
  align-items: start;
  margin-bottom: 34px;
}

.section-label {
  color: var(--red);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.section-text {
  color: var(--muted);
  font-size: 1.05rem;
  margin-top: 12px;
}

/* Profil sans photo : carte principale + cartes secondaires. */
.profile-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.profile-main-card,
.profile-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 12px 34px rgba(18, 52, 127, 0.08);
}

.profile-main-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 34px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(36, 87, 214, 0.08), rgba(215, 38, 56, 0.06)),
    var(--white);
}

.profile-main-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--blue), var(--red));
}

.profile-main-card > * {
  position: relative;
  z-index: 1;
}

.profile-badge {
  width: fit-content;
  padding: 9px 13px;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--red);
  font-size: 0.86rem;
  font-weight: 900;
}

.profile-main-card h3 {
  max-width: 760px;
  color: var(--blue-dark);
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
  line-height: 1.16;
}

.profile-main-card p,
.profile-card p {
  color: var(--muted);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.stat-box {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
}

.stat-box strong {
  display: block;
  color: var(--blue-dark);
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 900;
}

.stat-box span {
  color: var(--muted);
  font-size: 0.92rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.profile-grid .profile-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 24px;
  overflow: hidden;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.profile-grid .profile-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--red));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.profile-grid .profile-card:hover {
  transform: translateY(-5px);
  border-color: rgba(36, 87, 214, 0.32);
  box-shadow: 0 18px 44px rgba(18, 52, 127, 0.14);
}

.profile-grid .profile-card:hover::after {
  transform: scaleX(1);
}

.profile-card h3 {
  color: var(--blue-dark);
  font-size: 1.08rem;
  line-height: 1.3;
  margin-top: 0;
}

.card-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--blue);
  font-weight: 900;
  box-shadow: 0 0 0 5px rgba(215, 38, 56, 0.12);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
}

.tag {
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-weight: 800;
  font-size: 0.9rem;
}

.quality-card {
  background:
    linear-gradient(145deg, rgba(36, 87, 214, 0.08), rgba(215, 38, 56, 0.05)),
    var(--white);
}

.quality-list {
  display: grid;
  gap: 10px;
  list-style: none;
}

.quality-list li {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 13px 14px 13px 42px;
  border: 1px solid rgba(36, 87, 214, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.quality-list li::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 15px;
  width: 12px;
  height: 12px;
  border: 3px solid rgba(36, 87, 214, 0.18);
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(215, 38, 56, 0.08);
}

.quality-list strong {
  color: var(--blue-dark);
  font-size: 0.98rem;
  line-height: 1.25;
}

.quality-list span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

/*
  Grilles de cartes :
  minmax(0, 1fr) évite les débordements quand une phrase est longue.
*/
.skills-grid,
.projects-grid,
.contact-grid {
  display: grid;
  gap: 18px;
}

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

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

.skill-group,
.project,
.education-card,
.contact-card,
.experience-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 12px 34px rgba(18, 52, 127, 0.08);
}

.skill-group,
.project {
  padding: 24px;
}

.skill-group h3,
.project h3,
.education-card h3,
.experience-card h3 {
  font-size: 1.1rem;
  line-height: 1.28;
  margin-bottom: 10px;
}

.skill-group ul,
.experience-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  list-style: none;
}

.skill-group li::before,
.experience-list li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--red);
  vertical-align: middle;
}

.project {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease,
    border-color 0.24s ease;
}

.project:hover {
  transform: translateY(-8px);
  border-color: transparent;
  box-shadow: 0 22px 52px rgba(18, 52, 127, 0.18);
}

.project:hover .project-num {
  background: var(--red);
  transform: rotate(-6deg) scale(1.06);
  box-shadow: 0 0 0 7px rgba(36, 87, 214, 0.12);
}

.project:hover h3 {
  color: var(--blue);
}

.project:hover .project-link {
  color: var(--blue);
  transform: translateX(4px);
}

.project > * {
  position: relative;
  z-index: 2;
}

.project-num {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 50%;
  color: var(--white);
  background: var(--blue);
  font-weight: 900;
  box-shadow: 0 0 0 5px rgba(215, 38, 56, 0.12);
}

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

.project-link {
  width: fit-content;
  margin-top: 16px;
  color: var(--red);
  font-weight: 900;
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.project-link:hover {
  color: var(--blue);
}

.project-stack {
  margin-top: auto;
  padding-top: 12px;
  color: var(--blue-dark) !important;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.skill-group li,
.experience-list li,
.education-content p {
  overflow-wrap: anywhere;
}

/*
  Sous-blocs Projets :
  - .projects-terminated présente les projets terminés.
  - .projects-ongoing présente les projets en cours (plus discret).
*/
.projects-terminated,
.projects-ongoing {
  display: grid;
  gap: 16px;
}

.projects-ongoing {
  margin-top: 40px;
}

.projects-subtitle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
}

.projects-subtitle > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--white);
  font-weight: 900;
}

.projects-terminated .projects-subtitle > span {
  background: var(--blue);
}

.projects-ongoing .projects-subtitle > span {
  background: var(--red);
}

/* Badge "En cours" - l'information ne dépend pas uniquement de
   la couleur : le texte est lu par les lecteurs d'écran. */
.project-badge {
  width: fit-content;
  margin-left: 10px;
  padding: 4px 10px;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--red);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  vertical-align: middle;
}

.project-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Carte "en cours" : superposition discrète (bordure pointillée) */
.project.project-ongoing {
  border-style: dashed;
  opacity: 0.92;
}

.project.project-ongoing:hover {
  opacity: 1;
}

/* État d'avancement d'un projet en cours */
.project-progress {
  width: fit-content;
  margin-top: 14px;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--blue-dark) !important;
  background: var(--blue-soft);
  font-size: 0.84rem;
  font-weight: 800;
}

/*
  Carte expérience :
  le haut de carte sépare le nom de l'entreprise et la période.
*/
.experience-card {
  padding: 28px;
}

.experience-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.experience-top > div {
  min-width: 0;
}

.experience-top p {
  color: var(--muted);
}

.experience-top span {
  align-self: start;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--red);
  font-weight: 900;
  white-space: nowrap;
}

/*
  Formations :
  les diplômes sont présentés comme des cartes premium.
  .education-card-featured occupe toute la largeur pour mettre en avant la formation actuelle.
*/
.education-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.education-card {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 18px;
  padding: 24px;
  overflow: hidden;
}

.education-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 5px;
  background: linear-gradient(90deg, var(--blue), var(--red));
}

.education-card-featured {
  grid-column: 1 / -1;
  background:
    linear-gradient(135deg, rgba(36, 87, 214, 0.08), rgba(215, 38, 56, 0.08)),
    var(--white);
}

.education-marker {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--blue);
  font-weight: 900;
  box-shadow: 0 0 0 5px rgba(215, 38, 56, 0.12);
}

.education-content {
  display: grid;
  align-content: start;
  gap: 8px;
}

.education-date {
  color: var(--red);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.education-place,
.education-card p {
  color: var(--muted);
}

.education-place {
  font-weight: 800;
}

.education-badge {
  width: fit-content;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-weight: 900;
  font-size: 0.88rem;
}

.education-badge-validated {
  color: #1a7a3a;
  background: #d4edda;
}

.contact-band {
  color: var(--white);
  background: var(--blue-dark);
}

.contact-band .section-label {
  color: #ffb5bd;
}

.contact-band .section-text {
  color: #dbe7ff;
}

.contact-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 34px;
}

.contact-card {
  padding: 20px;
  color: var(--ink);
}

.contact-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--blue-dark);
}

.contact-card p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.contact-form {
  margin-top: 34px;
  padding: 28px;
  border: 1px solid rgba(220, 229, 245, 0.28);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.16);
}

.contact-form form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.form-group label {
  color: var(--blue-dark);
  font-weight: 900;
  font-size: 0.92rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #f9fbff;
  font: inherit;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--blue);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(36, 87, 214, 0.12);
}

.form-group input:focus-visible,
.form-group textarea:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #697386;
}

.form-group:has(textarea) {
  grid-column: 1 / -1;
}

.contact-form button {
  grid-column: 1 / -1;
  justify-self: end;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--red);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.contact-form button:hover {
  background: var(--blue);
  box-shadow: 0 12px 26px rgba(36, 87, 214, 0.24);
  transform: translateY(-2px);
}

.contact-form button:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

.site-footer {
  padding: 26px 0;
  color: var(--muted);
  background: var(--white);
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--white);
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  font-size: 1.4rem;
  line-height: 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease,
    transform 0.3s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-3px);
}

/*
  Responsive :
  les paliers gardent la navigation, le hero et les grilles lisibles.
*/
@media (max-width: 1180px) {
  .nav {
    gap: 16px;
  }

  .nav-links {
    gap: 14px;
    font-size: 0.9rem;
  }

  .nav-action,
  .btn {
    padding: 0 15px;
  }

  .hero {
    background:
      linear-gradient(
        90deg,
        rgba(244, 248, 255, 0.98) 0%,
        rgba(244, 248, 255, 0.92) 52%,
        rgba(244, 248, 255, 0.42) 100%
      ),
      url("said cv.jpg") right center / min(42vw, 430px) auto no-repeat;
  }

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

@media (max-width: 1023px) {
  .skills-grid,
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .nav {
    min-height: 66px;
  }

  .brand span:last-child {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-toggle {
    display: inline-grid;
    place-items: center;
    order: 4;
  }

  #theme-toggle {
    order: 3;
    min-height: 44px;
    padding: 0 12px;
    font-size: 0.84rem;
  }

  .nav-links,
  .nav-action {
    display: none;
  }

  .nav-links.is-open {
    position: absolute;
    left: var(--page-gutter);
    right: var(--page-gutter);
    top: calc(100% + 8px);
    display: grid;
    gap: 4px;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
  }

  .nav-links.is-open a {
    display: block;
    min-height: 44px;
    padding: 10px 12px;
  }

  .nav-links.is-open a::after {
    display: none;
  }

  .nav-links.is-open a:hover {
    color: var(--muted);
  }

  .nav-links.is-open a:focus-visible,
  .nav-links.is-open a:active {
    color: var(--red);
  }

  .hero {
    min-height: auto;
    padding-top: 410px;
    background:
      linear-gradient(
        180deg,
        rgba(244, 248, 255, 0.04) 0%,
        rgba(244, 248, 255, 0.2) 305px,
        var(--paper) 405px
      ),
      url("said cv.jpg") top center / min(82vw, 350px) auto no-repeat;
  }

  .section-head,
  .profile-wrapper {
    grid-template-columns: 1fr;
    gap: 24px;
  }

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

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

@media (max-width: 767px) {
  .hero {
    padding-top: 380px;
  }

  .quick-facts,
  .skills-grid,
  .projects-grid,
  .profile-grid,
  .profile-stats,
  .education-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .profile-wrapper {
    gap: 18px;
  }

  .education-card,
  .education-card-featured {
    grid-column: auto;
  }

  .education-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .experience-top {
    display: grid;
  }

  .contact-form form {
    grid-template-columns: 1fr;
  }

  .contact-form button {
    justify-self: stretch;
    width: 100%;
  }

  .hero-actions .btn,
  .contact-actions .btn {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .brand span:last-child {
    max-width: 132px;
  }

  #theme-toggle {
    width: 42px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  #theme-toggle::before {
    content: "\263e";
    font-size: 1rem;
  }

  body.dark-mode #theme-toggle::before {
    content: "\2600";
  }

  .hero {
    padding-top: 350px;
  }

  .profile-main-card,
  .profile-grid .profile-card,
  .skill-group,
  .project,
  .experience-card,
  .education-card,
  .contact-card,
  .contact-form {
    padding: 22px;
  }

  .education-card {
    grid-template-columns: 1fr;
  }

  .education-marker {
    width: 48px;
    height: 48px;
  }

  .footer-inner {
    display: grid;
  }
}

@media (max-width: 420px) {
  .nav {
    gap: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 0.86rem;
  }

  .brand span:last-child {
    max-width: 104px;
    font-size: 0.88rem;
  }

  .hero {
    padding-top: 315px;
    background:
      linear-gradient(
        180deg,
        rgba(244, 248, 255, 0.04) 0%,
        rgba(244, 248, 255, 0.2) 245px,
        var(--paper) 315px
      ),
      url("said cv.jpg") top center / min(84vw, 285px) auto no-repeat;
  }
}

/* =========================================
   DARK MODE
========================================= */

body.dark-mode {
  --ink: #f6f8ff;
  --muted: #b8c3d9;
  --line: #26324c;
  --paper: #0b1020;
  --white: #141c31;
  --blue: #6da0ff;
  --blue-dark: #dce8ff;
  --blue-soft: #1b2a49;
  --red: #ff5f73;
  --red-dark: #ff8d9b;
  --cyan: #62dfff;
  --shadow: 0 20px 56px rgba(0, 0, 0, 0.42);

  background:
    radial-gradient(
      circle at 15% 8%,
      rgba(109, 160, 255, 0.18),
      transparent 28rem
    ),
    radial-gradient(
      circle at 92% 18%,
      rgba(255, 95, 115, 0.13),
      transparent 24rem
    ),
    linear-gradient(180deg, #0b1020 0%, #0f1628 48%, #0b1020 100%);
  color: var(--ink);
}

body.dark-mode .site-header {
  background: rgba(9, 14, 27, 0.86);
  border-bottom-color: rgba(129, 161, 214, 0.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
}

body.dark-mode .site-header:hover {
  background: rgba(11, 16, 32, 0.96);
  border-color: rgba(109, 160, 255, 0.38);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

body.dark-mode .brand {
  color: var(--ink);
}

body.dark-mode .brand:hover {
  color: var(--cyan);
}

body.dark-mode .brand-mark,
body.dark-mode .card-number,
body.dark-mode .project-num,
body.dark-mode .education-marker {
  color: #081020;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 0 0 5px rgba(255, 95, 115, 0.12);
}

body.dark-mode .brand:hover .brand-mark,
body.dark-mode .project:hover .project-num {
  color: #ffffff;
  background: linear-gradient(135deg, var(--red), #ff8d9b);
  box-shadow: 0 0 0 7px rgba(98, 223, 255, 0.14);
}

body.dark-mode .hero {
  background:
    linear-gradient(
      90deg,
      rgba(11, 16, 32, 0.98) 0%,
      rgba(11, 16, 32, 0.9) 45%,
      rgba(11, 16, 32, 0.38) 100%
    ),
    url("said cv.jpg") right center / min(45vw, 540px) auto no-repeat;
}

body.dark-mode .eyebrow,
body.dark-mode .section-label,
body.dark-mode .education-date,
body.dark-mode .project-link {
  color: var(--red);
}

body.dark-mode .fact,
body.dark-mode .skill-group,
body.dark-mode .project,
body.dark-mode .profile-main-card,
body.dark-mode .profile-card,
body.dark-mode .education-card,
body.dark-mode .contact-card,
body.dark-mode .experience-card,
body.dark-mode .contact-form,
body.dark-mode .site-footer {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(20, 28, 49, 0.94);
  border-color: rgba(129, 161, 214, 0.22);
  box-shadow: var(--shadow);
}

body.dark-mode .profile-main-card,
body.dark-mode .education-card-featured {
  background:
    linear-gradient(
      135deg,
      rgba(109, 160, 255, 0.16),
      rgba(255, 95, 115, 0.09)
    ),
    rgba(20, 28, 49, 0.95);
}

body.dark-mode .profile-main-card::before,
body.dark-mode .profile-grid .profile-card::after,
body.dark-mode .education-card::after,
body.dark-mode .nav-links a::after {
  background: linear-gradient(90deg, var(--cyan), var(--red));
}

body.dark-mode .profile-grid .profile-card:hover,
body.dark-mode .project:hover {
  border-color: rgba(98, 223, 255, 0.42);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

body.dark-mode .project:hover h3,
body.dark-mode .project:hover .project-link,
body.dark-mode .project-link:hover,
body.dark-mode .nav-links a:hover {
  color: var(--cyan);
}

body.dark-mode .projects-subtitle {
  color: var(--ink);
}

body.dark-mode .project-badge {
  color: #081020;
  background: var(--red);
}

body.dark-mode .project-progress {
  color: var(--ink);
  background: rgba(109, 160, 255, 0.13);
}

body.dark-mode .projects-ongoing .projects-subtitle > span {
  background: var(--red);
  color: #081020;
}

body.dark-mode .quick-facts {
  background: rgba(129, 161, 214, 0.24);
  border-color: rgba(129, 161, 214, 0.24);
  box-shadow: var(--shadow);
}

body.dark-mode .stat-box,
body.dark-mode .tag,
body.dark-mode .quality-list li,
body.dark-mode .education-badge {
  background: rgba(109, 160, 255, 0.13);
  border-color: rgba(129, 161, 214, 0.2);
  color: var(--ink);
}

body.dark-mode .education-badge-validated {
  background: rgba(46, 160, 67, 0.22);
  color: #7ee787;
}

body.dark-mode .quality-card {
  background:
    linear-gradient(
      145deg,
      rgba(109, 160, 255, 0.14),
      rgba(255, 95, 115, 0.08)
    ),
    rgba(20, 28, 49, 0.94);
}

body.dark-mode .quality-list li::before {
  border-color: rgba(98, 223, 255, 0.22);
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(98, 223, 255, 0.1);
}

body.dark-mode .profile-badge,
body.dark-mode .experience-top span,
body.dark-mode .contact-form button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--red), #d72638);
}

body.dark-mode .contact-band {
  background:
    linear-gradient(
      135deg,
      rgba(109, 160, 255, 0.18),
      rgba(255, 95, 115, 0.12)
    ),
    #081020;
}

body.dark-mode .contact-band .section-label {
  color: #ffb3bd;
}

body.dark-mode .contact-band .section-text {
  color: #dbe6fb;
}

body.dark-mode .experience-top {
  border-bottom-color: rgba(129, 161, 214, 0.22);
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
  background: rgba(8, 16, 32, 0.9);
  border-color: rgba(129, 161, 214, 0.28);
  color: var(--ink);
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group textarea:focus {
  background: #10192d;
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(98, 223, 255, 0.14);
}

body.dark-mode .form-group input::placeholder,
body.dark-mode .form-group textarea::placeholder {
  color: #7f8aa3;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode strong,
body.dark-mode .brand,
body.dark-mode .project-stack,
body.dark-mode .education-badge,
body.dark-mode .contact-card strong {
  color: var(--ink);
}

body.dark-mode p,
body.dark-mode span,
body.dark-mode li,
body.dark-mode .section-text,
body.dark-mode .hero-lead,
body.dark-mode .education-place,
body.dark-mode .contact-card p {
  color: var(--muted);
}

body.dark-mode .nav-links a {
  color: #dce6fa;
}

body.dark-mode .nav-action,
body.dark-mode .btn-primary {
  color: #081020;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 14px 30px rgba(109, 160, 255, 0.18);
}

body.dark-mode .nav-action:hover,
body.dark-mode .btn-primary:hover,
body.dark-mode .contact-form button:hover {
  color: #ffffff;
  background: linear-gradient(135deg, var(--red), #d72638);
  box-shadow: 0 14px 32px rgba(255, 95, 115, 0.22);
}

body.dark-mode .btn-secondary,
body.dark-mode #theme-toggle,
body.dark-mode .menu-toggle {
  color: var(--ink);
  background: rgba(20, 28, 49, 0.92);
  border-color: rgba(129, 161, 214, 0.28);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

body.dark-mode .btn-secondary:hover,
body.dark-mode #theme-toggle:hover,
body.dark-mode .menu-toggle:hover {
  color: #081020;
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 14px 32px rgba(98, 223, 255, 0.18);
}

body.dark-mode .nav-links.is-open {
  background: rgba(20, 28, 49, 0.98);
  border-color: rgba(129, 161, 214, 0.28);
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  body.dark-mode .nav-links.is-open a:hover {
    color: #dce6fa;
  }

  body.dark-mode .nav-links.is-open a:focus-visible,
  body.dark-mode .nav-links.is-open a:active {
    color: var(--cyan);
  }
}

body.dark-mode .site-footer {
  border-top-color: rgba(129, 161, 214, 0.22);
}

@media (max-width: 1180px) {
  body.dark-mode .hero {
    background:
      linear-gradient(
        90deg,
        rgba(11, 16, 32, 0.98) 0%,
        rgba(11, 16, 32, 0.92) 52%,
        rgba(11, 16, 32, 0.44) 100%
      ),
      url("said cv.jpg") right center / min(42vw, 430px) auto no-repeat;
  }
}

@media (max-width: 980px) {
  body.dark-mode .hero {
    background:
      linear-gradient(
        180deg,
        rgba(11, 16, 32, 0.04) 0%,
        rgba(11, 16, 32, 0.28) 310px,
        var(--paper) 420px
      ),
      url("said cv.jpg") top center / min(86vw, 360px) auto no-repeat;
  }
}

@media (max-width: 620px) {
  body.dark-mode .hero {
    background:
      linear-gradient(
        180deg,
        rgba(11, 16, 32, 0.04) 0%,
        rgba(11, 16, 32, 0.28) 275px,
        var(--paper) 365px
      ),
      url("said cv.jpg") top center / min(86vw, 330px) auto no-repeat;
  }
}

@media (max-width: 420px) {
  body.dark-mode .hero {
    background:
      linear-gradient(
        180deg,
        rgba(11, 16, 32, 0.04) 0%,
        rgba(11, 16, 32, 0.28) 245px,
        var(--paper) 315px
      ),
      url("said cv.jpg") top center / min(84vw, 285px) auto no-repeat;
  }
}

/* =========================================
   GRANDS ÉCRANS
========================================= */

@media (min-width: 1440px) {
  :root {
    --page-max: 1280px;
    --section-space: 5.75rem;
  }

  .hero {
    padding-block: 4.75rem;
  }

  .section-head {
    gap: 54px;
    margin-bottom: 44px;
  }

  .quick-facts,
  .contact-grid {
    margin-top: 48px;
  }

  .skills-grid,
  .projects-grid,
  .education-grid,
  .contact-grid,
  .profile-grid {
    gap: 24px;
  }

  .skill-group,
  .project,
  .education-card,
  .contact-card,
  .profile-grid .profile-card {
    padding: 30px;
  }

  .profile-main-card,
  .experience-card,
  .contact-form {
    padding: 38px;
  }

  .nav {
    min-height: 80px;
  }

  .nav-links {
    gap: 26px;
  }
}

@media (min-width: 1800px) {
  :root {
    --page-max: 1440px;
    --section-space: 7rem;
  }

  .hero {
    padding-block: 6rem;
    background:
      linear-gradient(
        90deg,
        rgba(244, 248, 255, 0.98) 0%,
        rgba(244, 248, 255, 0.9) 48%,
        rgba(244, 248, 255, 0.18) 100%
      ),
      url("said cv.jpg") right center / min(40vw, 610px) auto no-repeat;
  }

  .hero-content {
    max-width: 820px;
  }

  h1 {
    max-width: 820px;
  }

  .hero-lead {
    max-width: 720px;
    font-size: 1.28rem;
  }

  .fact {
    padding: 24px;
  }

  .contact-form form {
    gap: 24px;
  }
}

@media (min-width: 2400px) {
  :root {
    --page-max: 1580px;
    --section-space: 8.25rem;
  }

  .hero {
    padding-block: 7.25rem;
  }

  .hero-content {
    max-width: 960px;
  }

  h1 {
    font-size: clamp(3.25rem, 3.6vw, 5rem);
  }

  .hero-lead {
    font-size: 1.42rem;
  }

  h2 {
    font-size: clamp(2.4rem, 2.8vw, 3.5rem);
  }

  .skills-grid,
  .projects-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* =========================================
   ARTICLES
========================================= */

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.container > p {
  color: var(--muted);
  text-align: center;
  margin-top: 12px;
}

.article-card {
  position: relative;
  display: flex;
  flex-direction: column;

  min-height: 280px;
  padding: 24px;

  overflow: hidden;

  border: 1px solid var(--line);
  border-radius: var(--radius);

  background: var(--white);

  box-shadow: 0 12px 34px rgba(18, 52, 127, 0.08);

  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease,
    border-color 0.24s ease;
}

.article-card:hover {
  transform: translateY(-8px);

  border-color: transparent;

  box-shadow: 0 22px 52px rgba(18, 52, 127, 0.18);
}

.article-card::after {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  bottom: 0;

  height: 5px;

  background: linear-gradient(90deg, var(--blue), var(--red));

  transform: scaleX(0);

  transform-origin: left;

  transition: transform 0.25s ease;
}

.article-card:hover::after {
  transform: scaleX(1);
}

.article-card h3 {
  color: var(--blue-dark);

  font-size: 1.1rem;

  line-height: 1.35;

  margin-bottom: 12px;

  transition: color 0.2s ease;
}

.article-card:hover h3 {
  color: var(--blue);
}

.article-card p {
  color: var(--muted);

  flex: 1;
}

.article-card a {
  width: fit-content;

  margin-top: 18px;

  color: var(--red);

  font-weight: 900;

  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.article-card:hover a {
  color: var(--blue);

  transform: translateX(4px);
}

.article-tag {
  width: fit-content;

  margin-bottom: 14px;

  padding: 8px 12px;

  border-radius: var(--radius);

  background: var(--blue-soft);

  color: var(--blue-dark);

  font-size: 0.82rem;

  font-weight: 900;

  text-transform: uppercase;
}


/* =========================================
   ACCESSIBILITE : CONTRASTE DU FOCUS
========================================= */

.contact-band :focus-visible {
  outline-color: var(--cyan);
}

/* =========================================
   MOUVEMENT REDUIT
========================================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .btn:hover,
  .nav-action:hover,
  .back-to-top:hover,
  .project:hover,
  .profile-grid .profile-card:hover,
  .article-card:hover {
    transform: none;
  }
}
