:root {
  color-scheme: light dark;

  /* Couleurs */
  --bg: oklch(98.5% 0.002 247.839);
  --fg: oklch(13% 0.019 264.32);
  --muted: oklch(55% 0.022 261.325); /* contraste 4,65:1 sur --bg (AA) ; 64 % donnait 3,22:1 */
  --line: oklch(90% 0.01 267.36);

  /* Mise en page */
  --w: 45rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --pad: clamp(1.5rem, 4vw, 3.5rem);
  --edge: max(var(--gutter), calc(50% - var(--w) / 2)); /* bord gauche de main */

  /* Traits en pointillés */
  --dash: 6px;
  --gap: 4px;
  --dash-x: repeating-linear-gradient(90deg, var(--line) 0 var(--dash), transparent var(--dash) calc(var(--dash) + var(--gap)));
  --dash-y: repeating-linear-gradient(180deg, var(--line) 0 var(--dash), transparent var(--dash) calc(var(--dash) + var(--gap)));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(13% 0.019 264.32);
    --fg: oklch(98.5% 0.002 247.839);
    --muted: oklch(62% 0.022 261.325);
    --line: oklch(21% 0.013 264.32);
  }
}

@font-face {
  font-family: 'Chiara';
  src: url('https://cdn.jsdelivr.net/gh/gauthierniglio/chiara-font@v1.0/web/ChiaraVF.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/gh/gauthierniglio/chiara-font@v1.0/web/ChiaraVF.woff') format('woff');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: var(--gutter);
  overflow-x: clip; /* évite un défilement horizontal à cause des traits en 100vw */
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.6 'Chiara', system-ui, -apple-system, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-wrap: balance;
}

/* Structure et grille */

main {
  position: relative;
  max-width: var(--w);
  margin: clamp(2rem, 12vh, 6rem) auto;
}

section {
  position: relative;
  padding: var(--pad);
}

/* Trait horizontal entre les sections, sur toute la largeur de l'écran */
section + section::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: 100vw;
  height: 1px;
  background: var(--dash-x);
  transform: translateX(-50%);
}

/* Traits verticaux, sur les bords de main */
body::before,
body::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--dash-y);
  pointer-events: none;
}

body::before {
  left: var(--edge);
}

body::after {
  left: calc(100% - var(--edge) - 1px);
}

/* Typographie */

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 500;
}

p {
  margin: 0 0 1rem;
}

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

.role {
  margin: 0.25rem 0 1.5rem;
}

.label {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.label::before {
  content: "※ ";
  content: "※ " / ""; /* ignoré par les lecteurs d'écran quand c'est supporté */
}

/* Liens */

a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-underline-offset: 0.125em;
  transition: text-decoration-color 0.1s;
}

a:hover {
  text-decoration-style: wavy;
  text-decoration-color: var(--fg);
}

a:focus-visible,
.tip:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.link-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
}

/* Icônes (masque CSS : l'icône prend la couleur du texte) */

.icon {
  --size: 1em; /* par défaut : suit la taille du texte */
  display: inline-block;
  flex: none;
  width: var(--size);
  height: var(--size);
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* Tailles : à ajouter en plus de .icon (ex. class="icon icon-file icon-20") */
.icon-12 { --size: 0.75rem; }
.icon-16 { --size: 1rem; }
.icon-20 { --size: 1.25rem; }
.icon-24 { --size: 1.5rem; }

.icon-arrow-up-right {
  --icon: url('https://cdn.jsdelivr.net/gh/gauthierniglio/flow-icons@v1.0.3/icons/arrow-up-right.svg');
}

.icon-paperplane {
  --icon: url('https://cdn.jsdelivr.net/gh/gauthierniglio/flow-icons@v1.0.3/icons/paperplane.svg');
}

.icon-file {
  --icon: url('https://cdn.jsdelivr.net/gh/gauthierniglio/flow-icons@v1.0.3/icons/file.svg');
}

/* Listes (expérience, projets, formation) */

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rows li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: 0.5rem 0;
}

.rows li > div > span {
  display: block;
  color: var(--muted);
}

@media (max-width: 30rem) {
  .rows li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Infobulle */

.tip {
  position: relative;
  text-decoration: underline dashed var(--muted);
  text-underline-offset: 0.125em;
  cursor: help;
  transition: color 0.1s;
}

.tip::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 1;
  left: -0.75em;
  bottom: calc(100% + 0.5rem);
  width: max-content;
  max-width: min(14rem, 80vw);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.25em;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.875rem;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.25rem);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tip:hover {
  color: var(--fg);
}

.tip:hover::after,
.tip:focus::after {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    transition: none;
  }
}
