:root {
  --text: #6b6375;
  --text-h: #08060d;
  --bg: #fff;
  --border: #e5e4e7;
  --code-bg: #f4f3ec;
  --accent: #aa3bff;
  --accent-bg: rgba(170, 59, 255, 0.1);
  --accent-border: rgba(170, 59, 255, 0.5);
  --social-bg: rgba(244, 243, 236, 0.5);
  --tag-pos-bg: #bbf7d0;
  --tag-pos-text: #14532d;
  --tag-neg-bg: #fecaca;
  --tag-neg-text: #7f1d1d;
  --skill-green-bg: #bbf7d0;
  --skill-green-text: #14532d;
  --skill-blue-bg: #bfdbfe;
  --skill-blue-text: #1e3a8a;
  --skill-yellow-bg: #fef08a;
  --skill-yellow-text: #854d0e;
  --skill-red-bg: #fecaca;
  --skill-red-text: #991b1b;
  --shadow:
    rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;

  --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
  --heading: system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, Consolas, monospace;

  font: 18px/145% var(--sans);
  letter-spacing: 0.18px;
  color-scheme: light dark;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  @media (max-width: 1024px) {
    font-size: 16px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #9ca3af;
    --text-h: #f3f4f6;
    --bg: #16171d;
    --border: #2e303a;
    --code-bg: #1f2028;
    --accent: #c084fc;
    --accent-bg: rgba(192, 132, 252, 0.15);
    --accent-border: rgba(192, 132, 252, 0.5);
    --social-bg: rgba(47, 48, 58, 0.5);
    --tag-pos-bg: #14532d;
    --tag-pos-text: #bbf7d0;
    --tag-neg-bg: #7f1d1d;
    --tag-neg-text: #fecaca;
    --skill-green-bg: #14532d;
    --skill-green-text: #bbf7d0;
    --skill-blue-bg: #1e3a8a;
    --skill-blue-text: #bfdbfe;
    --skill-yellow-bg: #854d0e;
    --skill-yellow-text: #fef08a;
    --skill-red-bg: #991b1b;
    --skill-red-text: #fecaca;
    --shadow:
      rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
  }

  #social .button-icon {
    filter: invert(1) brightness(2);
  }
}

body {
  margin: 0;
}

#root {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

h1,
h2 {
  font-family: var(--heading);
  font-weight: 500;
  color: var(--text-h);
}

h1 {
  font-size: 56px;
  letter-spacing: -1.68px;
  margin: 32px 0;
  @media (max-width: 1024px) {
    font-size: 36px;
    margin: 20px 0;
  }
}
h2 {
  font-size: 24px;
  line-height: 118%;
  letter-spacing: -0.24px;
  margin: 0 0 8px;
  @media (max-width: 1024px) {
    font-size: 20px;
  }
}
p {
  margin: 0;
}

code,
.counter {
  font-family: var(--mono);
  display: inline-flex;
  border-radius: 4px;
  color: var(--text-h);
}

code {
  font-size: 15px;
  line-height: 135%;
  padding: 4px 8px;
  background: var(--code-bg);
}

/* ——— Mise en page site (nav + pages) ——— */
:root {
  --topnav-h: 3.25rem;
  --page-pad: clamp(0.75rem, 2vw, 1.25rem);
  --panel-radius: 12px;
}

.app-shell {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding: var(--page-pad);
  box-sizing: border-box;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--topnav-h);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topnav__inner {
  max-width: 1200px;
  margin-inline: auto;
  padding: 0.65rem var(--page-pad);
  box-sizing: border-box;
}

.topnav__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.25rem;
}

.topnav__social {
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.topnav__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--social-bg);
  color: var(--text-h);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.topnav__social-link:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent-border);
  transform: translateY(-1px);
}

.topnav__social-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.topnav__link {
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  padding: 0.35rem 0.2rem;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.topnav__link:hover {
  color: var(--text-h);
}

.topnav__link.is-active {
  color: var(--accent);
  font-weight: 600;
}

.page {
  flex: 1 1 auto;
  display: flex;
  min-height: calc(100svh - var(--topnav-h) - 2 * var(--page-pad));
  box-sizing: border-box;
}

.page--home {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: var(--page-pad);
  align-items: stretch;
}

/* Profil : pleine largeur, sans bandeau sidebar */
.page--home-profil {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
}

.page--stack-only {
  width: 100%;
}

.home-sidebar {
  border: 1px solid var(--border);
  border-radius: var(--panel-radius);
  background: color-mix(in srgb, var(--code-bg) 55%, var(--bg));
  overflow: auto;
  min-height: min(100%, calc(100svh - var(--topnav-h) - 2 * var(--page-pad)));
}

.home-sidebar__inner {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.home-sidebar__cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.home-sidebar__inner--horizontal {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}

.home-sidebar__inner--horizontal .home-sidebar__cluster {
  align-items: flex-start;
  flex: 0 1 auto;
  min-width: 0;
}

.home-sidebar__inner--horizontal .home-sidebar__extra {
  width: auto;
  flex: 0 0 auto;
  margin-left: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  border-left: 1px solid var(--border);
  padding-left: 1rem;
  align-self: center;
  display: flex;
  align-items: center;
}

.home-sidebar__inner--horizontal .home-sidebar__extra-list {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: max-content;
  max-width: min(100%, 22rem);
  margin-inline: auto;
}

/* Bandeau horizontal : même cadre carré max 300px */
.home-sidebar--horizontal .home-sidebar__photo {
  width: min(100%, 300px);
  max-width: 300px;
  max-height: 300px;
  aspect-ratio: 1;
  object-fit: cover;
  flex-shrink: 0;
  align-self: center;
}

.home-sidebar__photo {
  display: block;
  flex-shrink: 0;
  width: min(100%, 300px);
  max-width: 300px;
  max-height: 300px;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--border);
}

.home-sidebar__name {
  margin: 0;
  font-family: var(--heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-h);
  letter-spacing: -0.02em;
}

.home-sidebar__extra {
  width: 100%;
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.home-sidebar__extra-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  line-height: 1.55;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-h);
  text-align: center;
  -webkit-font-smoothing: antialiased;
}

.home-sidebar__extra-list li + li {
  margin-top: 0.45rem;
}

@media (max-width: 540px) {
  .home-sidebar__inner--horizontal {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .home-sidebar__inner--horizontal .home-sidebar__cluster {
    align-items: center;
  }

  .home-sidebar__inner--horizontal .home-sidebar__extra {
    margin-left: 0;
    width: 100%;
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    justify-content: center;
  }

  .home-sidebar__inner--horizontal .home-sidebar__extra-list {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
}

.home-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-height: calc(100svh - var(--topnav-h) - 2 * var(--page-pad));
}

.content-stack {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--page-pad);
  min-height: 0;
}

.content-stack__panel {
  box-sizing: border-box;
  flex: 1 1 0;
  min-height: 8rem;
  border: 1px solid var(--border);
  border-radius: var(--panel-radius);
  background: color-mix(in srgb, var(--code-bg) 40%, var(--bg));
}

.content-stack__panel--padded {
  padding: 1rem 1.25rem 1.25rem;
  overflow: visible;
  text-align: left;
}

/* Accueil / Profil : les deux blocs = hauteur du contenu, pas de scroll interne */
.page--home .content-stack {
  flex: 0 0 auto;
  min-height: auto;
}

.page--home .content-stack > .content-stack__panel {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}

/* Accueil : « Compétence » + « Parcours » côte à côte ; intro en dessous pleine largeur */
.page--home:not(.page--home-profil) .content-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--page-pad);
  align-items: start;
}

.page--home:not(.page--home-profil)
  .content-stack
  > .content-stack__panel:nth-child(3) {
  grid-column: 1 / -1;
}

@media (max-width: 960px) {
  /* Même seuil que le stack Compétence / Parcours : sidebar au-dessus, zone main pleine largeur */
  .page--home {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .home-sidebar {
    min-height: auto;
  }

  .home-main {
    min-height: auto;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .page--home .content-stack {
    flex: 0 0 auto;
    min-height: auto;
    width: 100%;
    min-width: 0;
  }

  .page--home .content-stack__panel {
    flex: 0 0 auto;
    min-height: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .page--home:not(.page--home-profil) .content-stack {
    display: flex;
    flex-direction: column;
  }

  .page--home:not(.page--home-profil)
    .content-stack
    > .content-stack__panel:nth-child(3) {
    grid-column: unset;
  }
}

.home-intro {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  width: 100%;
}

.home-intro__text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 155%;
  color: var(--text-h);
}

.home-intro__tags {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
}

.home-tag {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
}

.home-tag--pos {
  background: var(--tag-pos-bg);
  color: var(--tag-pos-text);
}

.home-tag--neg {
  background: var(--tag-neg-bg);
  color: var(--tag-neg-text);
}

.home-intro__section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.home-intro__heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-h);
  letter-spacing: -0.02em;
}

.home-intro--profil-box {
  width: 100%;
}

/* Carte « Compétence » seule : pas de ligne haute inutile */
.content-stack__panel--padded > .home-skills:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.home-profil-traits {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.home-profil-traits__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.home-profil-traits__row {
  display: grid;
  grid-template-columns: minmax(11rem, 16rem) minmax(0, 1fr);
  gap: 0.75rem 1.1rem;
  align-items: start;
}

.home-profil-traits__label {
  justify-self: start;
}

.home-profil-traits__desc {
  margin: 0;
  font-size: 0.92rem;
  line-height: 155%;
  color: var(--text);
}

/* Page Profil : textes de description un peu plus clairs (vers le blanc) */
.page--home-profil .home-profil-traits__desc {
  color: color-mix(in srgb, var(--text) 68%, #ffffff 32%);
}

@media (prefers-color-scheme: dark) {
  .page--home-profil .home-profil-traits__desc {
    color: color-mix(in srgb, var(--text) 52%, #ffffff 48%);
  }
}

@media (max-width: 680px) {
  .home-profil-traits__row {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }
}

.home-skills {
  margin-top: 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.home-skills__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-h);
  letter-spacing: -0.02em;
}

.home-skills__rows {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.home-skills__row-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
}

.home-skill {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
}

.home-skill--green {
  background: var(--skill-green-bg);
  color: var(--skill-green-text);
}

.home-skill--blue {
  background: var(--skill-blue-bg);
  color: var(--skill-blue-text);
}

.home-skill--yellow {
  background: var(--skill-yellow-bg);
  color: var(--skill-yellow-text);
}

.home-skill--red {
  background: var(--skill-red-bg);
  color: var(--skill-red-text);
}

.home-timeline {
  max-width: 42rem;
}

.home-timeline__heading {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-h);
  letter-spacing: -0.02em;
}

.home-timeline__list {
  margin: 0;
  padding: 0;
  list-style: none;
  position: relative;
}

.home-timeline__list::before {
  content: '';
  position: absolute;
  left: 0.4rem;
  top: 0.45rem;
  bottom: 0.85rem;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.home-timeline__item {
  position: relative;
  padding: 0 0 1.15rem 1.65rem;
}

.home-timeline__item:last-child {
  padding-bottom: 0;
}

.home-timeline__marker {
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent-border);
}

.home-timeline__item:first-child .home-timeline__marker {
  top: 0.2rem;
}

.home-timeline__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.home-timeline__period {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.home-timeline__title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 140%;
  color: var(--text-h);
  white-space: pre-line;
}

.home-timeline__desc {
  margin: 0;
  font-size: 0.85rem;
  line-height: 140%;
  color: var(--text);
}

@media (max-width: 768px) {
  .home-timeline__title {
    font-size: 0.9rem;
  }
}

/* Page Formations : frise centrée, événements gauche / droite */
.page--formations .content-stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.page--formations .content-stack__panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Page Projets : grille de cartes (max. 3 colonnes) */
.page--projets .content-stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.page--projets .content-stack__panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.projets-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.85rem, 2vw, 1.25rem);
  align-items: stretch;
}

.projets-grid__cell {
  min-width: 0;
}

.projet-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--panel-radius);
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.projet-card__media {
  aspect-ratio: 16 / 9;
  background: var(--code-bg);
  overflow: hidden;
}

.projet-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.projet-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.1rem 1.15rem;
  flex: 1 1 auto;
  min-height: 0;
}

.projet-card__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-h);
  letter-spacing: -0.02em;
}

.projet-card__skills {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
}

.projet-card__desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 150%;
  color: var(--text);
  flex: 1 1 auto;
  white-space: pre-line;
}

.projet-card__link {
  margin-top: auto;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  word-break: break-word;
}

.projet-card__link:hover {
  text-decoration: underline;
}

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

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

.formations-timeline {
  width: 100%;
  max-width: 58rem;
  margin-inline: auto;
}

.formations-timeline__rows {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0.25rem 0;
}

.formations-timeline__line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0.35rem;
  bottom: 0.35rem;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
  z-index: 0;
}

.formations-timeline__row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.25rem minmax(0, 1fr);
  gap: 0 0.75rem;
  align-items: center;
  min-height: 0;
}

.formations-timeline__cell--left {
  text-align: right;
  padding-right: 0.25rem;
}

.formations-timeline__cell--right {
  text-align: left;
  padding-left: 0.25rem;
}

.formations-timeline__node-wrap {
  display: flex;
  justify-content: center;
  padding-top: 0.35rem;
}

.formations-timeline__node {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent-border);
  flex-shrink: 0;
}

.formations-timeline__card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.35rem 0.5rem;
  border: none;
  background: transparent;
  box-shadow: none;
}

.formations-timeline__card--left {
  margin-left: auto;
  max-width: 22rem;
}

.formations-timeline__card--right {
  margin-right: auto;
  max-width: 22rem;
}

.formations-timeline__period {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--accent);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.formations-timeline__card-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 135%;
  color: var(--text-h);
  white-space: pre-line;
}

.formations-timeline__desc {
  margin: 0;
  font-size: 0.85rem;
  line-height: 140%;
  color: var(--text);
}

@media (max-width: 720px) {
  .formations-timeline__line {
    display: none;
  }

  .formations-timeline__row {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .formations-timeline__node-wrap {
    display: none;
  }

  .formations-timeline__cell--left:empty,
  .formations-timeline__cell--right:empty {
    display: none;
  }

  .formations-timeline__cell--left,
  .formations-timeline__cell--right {
    text-align: left;
    padding-left: 0;
    padding-right: 0;
  }

  .formations-timeline__card--left,
  .formations-timeline__card--right {
    margin-left: 0;
    margin-right: 0;
    max-width: none;
  }
}

.page--stack-only .content-stack {
  min-height: calc(100svh - var(--topnav-h) - 2 * var(--page-pad));
}

@media (max-width: 768px) {
  .page--stack-only .content-stack {
    min-height: min(70vh, calc(100svh - var(--topnav-h) - 2 * var(--page-pad)));
  }
}
