:root {
  /* Couleur 2 — palette sombre active. */
  --color-background: #0f1020;
  --color-text: #f7f3ff;
  --color-muted: #b8b7d0;
  --color-surface: #1b1d35;
  --color-surface-hover: #292c4a;
  --color-accent: #ff4fa3;
  --color-accent-soft: #55213e;
  --color-line: #34385b;
  --color-blue: #7180ff;
  --color-coral: #ff7068;
  --color-yellow: #ffda4a;
  --color-turquoise: #32e2cf;
  --color-purple: #b482ff;
  --color-green: #82e87c;
  --color-on-vivid: #13162f;
  --card-pink: #3a2034;
  --card-purple: #2d2547;
  --card-yellow: #3b351d;
  --card-coral: #402624;
  --card-blue: #222c49;
  --card-turquoise: #173b39;
  --education-current: #202b52;
  --contact-surface: #153b3b;
  --tag-surface: rgb(255 255 255 / 10%);

  --font-display: "Playwrite US Modern", "Comic Sans MS", cursive;
  --font-body: "Manrope", Arial, sans-serif;
  --page-width: 880px;
  /* Échelle d'espacement commune à toute la page. */
  --space-xs: 0.5rem;
  --space-sm: 0.875rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: clamp(4.5rem, 8vw, 6rem);
  --section-space: var(--space-xl);
  --transition: 180ms ease;
}

/* Couleur 1 — palette claire, vive et joyeuse conservée en mémoire. */
html[data-theme="color-1"] {
  --color-background: #fff8e8;
  --color-text: #172052;
  --color-muted: #596080;
  --color-surface: #ffffff;
  --color-surface-hover: #fff0bf;
  --color-accent: #ff3d8d;
  --color-accent-soft: #ffc9e1;
  --color-line: #cbd0ed;
  --color-blue: #3757ff;
  --color-coral: #ff5c53;
  --color-yellow: #ffd43b;
  --color-turquoise: #25d9c7;
  --color-purple: #a56eff;
  --color-green: #78df72;
  --color-on-vivid: #172052;
  --card-pink: #ffdce9;
  --card-purple: #e3ddff;
  --card-yellow: #fff0ac;
  --card-coral: #ffd9c2;
  --card-blue: #dce5ff;
  --card-turquoise: #d4fff2;
  --education-current: #e6eaff;
  --contact-surface: #d9fff8;
  --tag-surface: rgb(255 255 255 / 68%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.page-shell {
  width: min(var(--page-width), calc(100% - 2.5rem));
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6rem) 0 var(--space-lg);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.055em;
  font-family: var(--font-display);
}

h1,
h2,
.project-category__heading h3,
.info-line,
footer p {
  display: flex;
  align-items: center;
}

h1,
h2 {
  gap: 0.65rem;
}

h1 > svg,
h2 > svg {
  width: 0.9em;
  height: 0.9em;
  flex: none;
  color: var(--color-accent);
  stroke-width: 1.6;
}

h2 {
  margin-bottom: var(--space-md);
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-weight: 350;
  line-height: 1.4;
  letter-spacing: -0.04em;
  font-family: var(--font-display);
}

.hero {
  max-width: 100%;
}

.hero__topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-sm);
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-bottom: 0.25rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.language-switcher > svg {
  width: 14px;
  height: 14px;
  margin-right: 0.15rem;
  color: var(--color-accent);
  stroke-width: 1.8;
}

.language-button {
  padding: 0.15rem 0.1rem;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
}

.language-button:hover,
.language-button:focus-visible,
.language-button.is-active {
  border-bottom-color: var(--color-accent);
  color: var(--color-text);
  outline: none;
}

.cv-button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  border: 0;
  background: var(--color-text);
  color: var(--color-background);
  font-size: 0.68rem;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--transition), transform var(--transition);
}

.cv-button svg {
  width: 14px;
  height: 14px;
}

.cv-button:hover,
.cv-button:focus-visible {
  background: var(--color-accent);
  color: var(--color-on-vivid);
  outline: none;
  transform: translateY(-2px);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: var(--space-xs) 0 var(--space-md);
}

.tags span {
  padding: 0.05rem 0.7rem;
  background: var(--color-surface);
  color: var(--color-muted);
  font-family: var(--font-display);
  font-size: 0.66rem;
  line-height: 1.6;
}

.tags span:first-child {
  background: var(--color-yellow);
  color: var(--color-on-vivid);
}

.tags span:last-child {
  background: var(--color-turquoise);
  color: var(--color-on-vivid);
}

.introduction {
  max-width: 650px;
  margin-bottom: 0;
  font-size: clamp(0.94rem, 1.7vw, 1rem);
  line-height: 1.75;
}

.hero__content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 155px;
  gap: var(--space-lg);
  align-items: start;
}

.portrait {
  position: relative;
  margin: -2.5rem 0 0;
}

.portrait::before {
  position: absolute;
  inset: 8px -8px -8px 8px;
  z-index: -1;
  background: var(--color-turquoise);
  content: "";
}

.portrait picture {
  display: block;
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  border: 3px solid var(--color-text);
  object-fit: cover;
  object-position: center 35%;
}

.introduction strong {
  color: var(--color-accent);
  font-weight: 700;
}

.section {
  margin-top: var(--section-space);
}

.education-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(150px, 0.7fr);
  gap: var(--space-md);
  align-items: start;
}

.timeline {
  display: grid;
}

.education-card,
.contact-card {
  padding: var(--space-md);
  background: var(--color-surface);
  font-size: 0.82rem;
  line-height: 1.75;
  box-shadow: 5px 5px 0 var(--color-line);
}

.education-card--current {
  background: var(--education-current);
  box-shadow: 5px 5px 0 var(--color-blue);
}

.contact-card {
  background: var(--contact-surface);
  box-shadow: 5px 5px 0 var(--color-turquoise);
}

.education-card p,
.contact-card p {
  margin-bottom: 0.15rem;
}

.info-line {
  align-items: flex-start;
  gap: 0.5rem;
}

.info-line > svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 0.27rem;
  color: var(--color-accent);
  stroke-width: 1.8;
}

.education-card a {
  text-underline-offset: 0.2em;
}

.timeline__arrow {
  height: 2rem;
  padding-left: 48%;
  font-family: sans-serif;
  font-size: 1.25rem;
  line-height: 2rem;
}

.contact-card a {
  text-underline-offset: 0.2em;
}

.experience-card {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  background: var(--card-yellow);
  box-shadow: 6px 6px 0 var(--color-yellow);
}

.experience-card__logo {
  display: grid;
  min-height: 245px;
  place-items: center;
  padding: var(--space-md);
  background: var(--color-surface);
}

.experience-card__logo img {
  display: block;
  width: 100%;
  height: auto;
}

.experience-card__content {
  padding: var(--space-lg);
}

.experience-card__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.experience-card__heading h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
}

.experience-card__heading > a {
  color: var(--color-muted);
  font-size: 0.7rem;
  text-underline-offset: 0.25em;
}

.experience-card__type {
  margin-bottom: 0.2rem;
  color: var(--color-muted);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.experience-card__description {
  margin-bottom: var(--space-md);
  color: var(--color-muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

.experience-card__skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 var(--space-md);
  padding: 0;
  list-style: none;
}

.experience-card__skills li {
  padding: 0.16rem 0.45rem;
  background: var(--tag-surface);
  font-size: 0.58rem;
  font-weight: 600;
}

.recommendation-link {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  background: var(--color-text);
  color: var(--color-background);
  font-size: 0.68rem;
  text-decoration: none;
}

.recommendation-link svg {
  width: 14px;
  height: 14px;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skill-card {
  display: flex;
  min-height: 108px;
  align-items: center;
  gap: var(--space-sm);
  padding: 1.15rem;
  background: var(--color-surface);
  transition:
    background-color var(--transition),
    transform var(--transition);
}

.skill-card:nth-child(1) { background: var(--card-pink); }
.skill-card:nth-child(2) { background: var(--card-purple); }
.skill-card:nth-child(3) { background: var(--card-yellow); }
.skill-card:nth-child(4) { background: var(--card-coral); }
.skill-card:nth-child(5) { background: var(--card-blue); }
.skill-card:nth-child(6) { background: var(--card-turquoise); }

.skill-card:hover {
  z-index: 1;
  background: var(--color-surface);
  box-shadow: 4px 4px 0 var(--color-accent);
  transform: translate(-2px, -2px);
}

.skill-card img {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  object-fit: contain;
  filter: saturate(0.72);
  transition: filter var(--transition), transform var(--transition);
}

.skill-card:hover img {
  filter: saturate(1);
  transform: scale(1.05);
}

.skill-card div {
  min-width: 0;
}

.skill-card strong,
.skill-card span {
  display: block;
}

.skill-card strong {
  margin-bottom: 0.15rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.5;
}

.skill-card span {
  color: var(--color-muted);
  font-size: 0.67rem;
  line-height: 1.5;
}

.skill-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
}

.skill-tools li {
  padding: 0.12rem 0.4rem;
  background: var(--tag-surface);
  color: var(--color-text);
  font-size: 0.55rem;
  font-weight: 600;
  line-height: 1.45;
}

.projects__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.projects__heading h2 {
  margin-bottom: 0;
}

.github-link {
  color: var(--color-muted);
  font-size: 0.78rem;
  text-underline-offset: 0.25em;
}

.project-category + .project-category {
  margin-top: var(--space-lg);
}

.project-category__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-line);
}

.project-category:nth-of-type(2) .project-category__heading {
  border-bottom-color: var(--color-blue);
}

.project-category:nth-of-type(3) .project-category__heading {
  border-bottom-color: var(--color-accent);
}

.project-category__heading h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  gap: 0.45rem;
}

.project-category__heading h3 svg {
  width: 15px;
  height: 15px;
  color: var(--color-accent);
  stroke-width: 1.8;
}

.project-category__heading span {
  color: var(--color-muted);
  font-family: var(--font-display);
  font-size: 0.65rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xs);
}

.project-card {
  position: relative;
  display: flex;
  min-height: 180px;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  overflow: hidden;
  background: var(--color-surface);
  color: var(--color-muted);
  border: 0;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
}

#autonomy-projects .project-card:nth-child(4n + 1) { background: var(--card-blue); }
#autonomy-projects .project-card:nth-child(4n + 2) { background: var(--card-turquoise); }
#autonomy-projects .project-card:nth-child(4n + 3) { background: var(--card-yellow); }
#autonomy-projects .project-card:nth-child(4n + 4) { background: var(--card-purple); }
#vibe-projects .project-card:nth-child(3n + 1) { background: var(--card-pink); }
#vibe-projects .project-card:nth-child(3n + 2) { background: var(--card-coral); }
#vibe-projects .project-card:nth-child(3n + 3) { background: var(--contact-surface); }

.project-card::after {
  position: absolute;
  right: 1rem;
  bottom: 0.8rem;
  content: "+";
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity var(--transition), transform var(--transition);
}

.project-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.project-card h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.project-card__language {
  flex: none;
  padding: 0.15rem 0.5rem;
  background: var(--color-background);
  color: var(--color-muted);
  font-size: 0.62rem;
  line-height: 1.5;
}

.project-card__description {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

.project-card__meta {
  display: flex;
  gap: var(--space-sm);
  margin-top: auto;
  color: var(--color-muted);
  font-size: 0.65rem;
}

.projects-status {
  grid-column: 1 / -1;
  margin: 0;
  padding: var(--space-md);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 0.75rem;
}

.project-modal {
  width: min(600px, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border: 0;
  background: var(--color-background);
  color: var(--color-text);
  box-shadow: 10px 10px 0 var(--color-blue), 0 24px 80px rgb(23 32 82 / 22%);
}

.project-modal::backdrop {
  background: rgb(37 35 32 / 35%);
  backdrop-filter: blur(3px);
}

.project-modal[open] {
  animation: modal-in 180ms ease-out;
}

.project-modal__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.project-modal__category {
  color: var(--color-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-modal__close {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.project-modal h3 {
  margin: 0 0 var(--space-md);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  font-weight: 400;
  overflow-wrap: anywhere;
}

.project-modal__description {
  margin-bottom: var(--space-lg);
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.8;
}

.project-modal__details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xs);
  margin: 0 0 var(--space-md);
}

.project-modal__details div {
  padding: var(--space-sm);
  background: var(--color-surface);
}

.project-modal__details dt {
  margin-bottom: 0.2rem;
  color: var(--color-muted);
  font-size: 0.62rem;
}

.project-modal__details dd {
  margin: 0;
  font-size: 0.78rem;
}

.project-modal__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
}

.project-modal__link {
  display: block;
  padding: 0.8rem 1rem;
  background: var(--color-text);
  color: var(--color-background);
  font-size: 0.75rem;
  text-align: center;
  text-decoration: none;
}

.project-modal__link--demo {
  background: var(--color-accent);
  color: var(--color-on-vivid);
}

.project-modal__link[hidden] {
  display: none;
}

.contact__intro {
  max-width: 560px;
  margin-bottom: var(--space-md);
  color: var(--color-muted);
  font-size: 0.86rem;
}

.contact__links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
}

.contact__links a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-surface);
  font-size: 0.78rem;
  text-decoration: none;
  transition: background-color var(--transition), transform var(--transition);
}

.contact__links a:first-child { background: var(--card-pink); }
.contact__links a:nth-child(2) { background: var(--contact-surface); }

.contact__links a:nth-child(3) {
  background: var(--card-blue);
}

.contact__links a:nth-child(4) {
  background: var(--card-purple);
}

.contact__links a:hover,
.contact__links a:focus-visible {
  background: var(--color-surface);
  box-shadow: 5px 5px 0 var(--color-accent);
  outline: none;
  transform: translateY(-2px);
}

.contact__links svg {
  width: 18px;
  height: 18px;
  color: var(--color-accent);
  stroke-width: 1.7;
}

.contact__links span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.contact__links small {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--color-muted);
  font-size: 0.6rem;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

.project-card:hover,
.project-card:focus-visible {
  z-index: 1;
  background: var(--color-surface);
  box-shadow: 5px 5px 0 var(--color-accent);
  outline: none;
  transform: translateY(-2px);
}

.project-card:hover::after,
.project-card:focus-visible::after {
  opacity: 1;
  transform: translate(0, 0);
}

footer {
  margin-top: var(--section-space);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-line);
  color: var(--color-muted);
  font-size: 0.75rem;
}

footer p {
  margin-bottom: 0;
  gap: 0.35rem;
}

footer svg {
  width: 13px;
  height: 13px;
  stroke-width: 1.7;
}

@media (max-width: 760px) {
  :root {
    --space-xl: clamp(3.75rem, 14vw, 5rem);
  }

  .page-shell {
    width: min(100% - 2rem, var(--page-width));
  }

  .hero__topline {
    display: grid;
    gap: var(--space-md);
  }

  .header-actions {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .hero__content {
    grid-template-columns: minmax(0, 1fr) 135px;
    gap: var(--space-md);
  }

  .portrait {
    margin-top: 0;
  }

  .education-layout {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .contact-card {
    width: 100%;
  }

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

  .experience-card__logo {
    min-height: 140px;
  }

  .experience-card__logo img {
    width: min(230px, 80%);
  }

  .experience-card__content {
    padding: var(--space-md);
  }

  .projects__heading {
    display: block;
    margin-bottom: var(--space-md);
  }

  .projects__heading h2 {
    margin-bottom: var(--space-xs);
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

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

  .contact__links {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero__content {
    grid-template-columns: 1fr;
  }

  .portrait {
    grid-row: 1;
    width: 145px;
    margin: 0 0 var(--space-sm);
  }

  .project-modal__actions,
  .project-modal__details {
    grid-template-columns: 1fr;
  }

  .project-modal {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
    padding: var(--space-md);
  }

  .experience-card__heading {
    display: block;
  }

  .experience-card__heading > a {
    display: inline-block;
    margin-top: var(--space-xs);
  }

  .recommendation-link {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 430px) {
  .page-shell {
    width: calc(100% - 1.5rem);
    padding-top: 2.5rem;
  }

  .header-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .cv-button {
    width: 100%;
    justify-content: center;
  }

  .skill-grid {
    grid-template-columns: 1fr;
  }

  .skill-card {
    min-height: 90px;
    gap: 0.7rem;
    padding: 0.9rem;
  }

  .skill-card img {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .skill-card strong {
    font-size: 0.78rem;
  }

  .project-card {
    min-height: 165px;
  }

  .project-category__heading h3 {
    font-size: 0.7rem;
  }

  .contact__links a {
    gap: 0.7rem;
    padding: 1rem;
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
