/* ═══════════════════════════════════════════════════════════════════════════
   layout.css — conteneur, chapitres, hero, grilles, pellicule, plaques,
   ligne de temps, pied.

   Points de rupture, et la raison de chacun :
     480 px  — le sélecteur de langue passe au code à deux lettres
     768 px  — une colonne devient deux ; la pellicule cesse d'être un rail
     992 px  — le hero se scinde en deux colonnes ; les marges doublent
    1160 px  — la barre de navigation à huit entrées cesse de tenir, et
               bascule sur le menu. C'est le seul point de rupture ajouté par
               la refonte : marque, huit libellés, sélecteur de langue et
               bascule de thème font 1 026 px de contenu incompressible.
    1280 px  — les numéros de chapitre reviennent dans la barre (voir
               components.css) : ils coûtent 28 px par entrée.
    1200 px  — la pellicule passe du damier à cinq colonnes pleines
   ═══════════════════════════════════════════════════════════════════════════ */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--shell-pad);
}

/* ─────────────────────────────── SECTIONS ─────────────────────────────────
   Le rythme vertical n'est plus un métronome. « Projets » respire une fois et
   demie, « Loisirs » deux fois moins : la hauteur d'une section dit ce qu'elle
   vaut. Et l'alternance de fond est cassée volontairement entre 02 et 04 —
   un contraste qui revient toutes les deux sections cesse d'être un signal. */

.section {
  padding-block: var(--pad-section);
  border-block-start: 1px solid var(--line);
}
.section--alt   { background: var(--surface-alt); }
.section--major { padding-block: calc(var(--pad-section) * 1.35); }
.section--minor { padding-block: calc(var(--pad-section) * 0.7); }

.kicker {
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 0 0 var(--s-4);
}

.h-section {
  color: var(--ink-title);
  font-size: var(--step-2);
  max-width: 20ch;
  font-variation-settings: "opsz" 72, "SOFT" 20, "WONK" 0;
}
.h-display { color: var(--ink-title); font-size: var(--step-3); max-width: 16ch; }

.lede {
  font-size: var(--step-1);
  color: var(--ink-2);
  margin-block-start: var(--s-6);
  max-width: 56ch;
}

.prose p { color: var(--ink-2); }

/* Le filet de titre : se dessine de 0 à 100 % à l'entrée de la section.
   En scaleX, pas en width — voir animations.css. */
.rule {
  display: block;
  height: 1px;
  background: var(--ink);
  margin-block-start: var(--s-5);
  transform: scaleX(0);
  /* `transform-origin` n'a pas de valeur logique en CSS : `left` est physique.
     rtl.css le bascule à `right` pour que le filet se dessine dans le sens de
     lecture. C'est l'une des rares propriétés qui exige encore la bascule. */
  transform-origin: left;
  transition: transform var(--dur-slow) var(--ease);
}
.is-visible > .rule,
.is-visible .rule { transform: scaleX(1); }

/* ── En-tête de chapitre ────────────────────────────────────────────────────
   Un seul gabarit pour les huit sections : un numéro, un intitulé, un titre,
   parfois une phrase. Le numéro est ce qui transforme une page longue en
   sommaire — on sait toujours où l'on est. */

.chap { margin-block-end: var(--s-8); }
.chap__n {
  display: block;
  color: var(--ink-3);
  font-size: var(--step--2);
  letter-spacing: 0.18em;
  margin-block-end: var(--s-3);
  transition: color var(--dur) var(--ease);
}
.chap__n::after {
  content: "";
  display: inline-block;
  inline-size: 2.4em;
  block-size: 1px;
  background: currentColor;
  vertical-align: middle;
  margin-inline-start: 0.7em;
  opacity: .5;
}
/* La section qu'on est en train de lire allume son numéro. C'est le même
   signal que le filet de la navigation, à l'autre bout de l'écran. */
.section.is-here .chap__n { color: var(--accent); }
#graphics.is-here .chap__n { color: var(--warm); }

.chap .rule { margin-block-start: var(--s-6); }
.chap__d { margin-block-start: var(--s-5); }

/* ═════════════════════════════════ HERO ═══════════════════════════════════ */

.hero {
  min-block-size: calc(100svh - var(--nav-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: var(--s-9) var(--s-7);
  position: relative;
  overflow: hidden;
}

.hero__inner {
  display: grid;
  gap: var(--s-8);
  align-items: center;
}

@media (min-width: 992px) {
  .hero__inner { grid-template-columns: 7fr 5fr; gap: var(--s-9); }
}

/* Sur téléphone, imposer un plein écran pousserait les quatre chiffres —
   la seule preuve chiffrée de la page — juste sous la ligne de flottaison. */
@media (max-width: 991px) {
  .hero { min-block-size: auto; padding-block: var(--s-8) var(--s-7); }
}

.hero__kicker {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--ink-3);
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-block-end: var(--s-6);
}
.hero__kicker .dot {
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  animation: pulse-soft 2400ms ease-in-out infinite;
}

.hero__title {
  color: var(--ink-title);
  font-size: var(--step-5);
  font-weight: 300;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" var(--wonk);
  line-height: 0.94;
  letter-spacing: -0.035em;
  margin-block-end: var(--s-7);
}

/* Chaque ligne est un masque : le texte remonte depuis dessous. */
.hero__title .line {
  display: block;
  overflow: hidden;
  padding-block-end: 0.08em;
}
.hero__title .line > span {
  display: block;
  transform: translateY(105%);
  animation: line-up var(--dur-slow) var(--ease) forwards;
}
.hero__title .line:nth-child(1) > span { animation-delay: 140ms; }
.hero__title .line:nth-child(2) > span { animation-delay: 230ms; }
.hero__title .line:nth-child(3) > span { animation-delay: 320ms; }
.hero__title .line:nth-child(4) > span { animation-delay: 410ms; }

.hero__title .line:nth-child(2) > span,
.hero__title .line:nth-child(3) > span { color: var(--ink-2); }
/* En mode sombre, les quatre lignes sont blanches : c'est ce que Rayen a
   demandé, et un titre d'affiche à 90 px n'a pas besoin d'un second ton pour
   se hiérarchiser — sa taille le fait déjà. */
:root[data-theme="dark"] .hero__title .line > span { color: var(--ink-title); }

/* Le mot « designer », dans un aplat découpé et très légèrement incliné.
   C'est le **seul** élément incliné du site : c'est ce qui le fait lire comme
   un geste et non comme un tic. `box-decoration-break` garde l'aplat entier
   quand le mot passe à la ligne. */
.hero__title .cut {
  background: var(--accent);
  color: var(--bg);
  padding: 0.04em 0.2em 0.1em;
  -webkit-box-decoration-break: clone;
          box-decoration-break: clone;
  transform: rotate(calc(-1.2deg * var(--dir)));
  display: inline-block;
}
/* En mode sombre, l'aplat reste **plein**. Le premier essai le mélangeait à la
   surface pour ne pas éblouir : il en sortait un brun terne, et le seul geste
   de couleur de la page se retrouvait plus faible que la page elle-même.
   L'aplat garde donc sa teinte, et c'est le texte qui passe en sombre —
   #121210 sur #FF8A5E vaut 8,08:1, très au-dessus du seuil. */
:root[data-theme="dark"] .hero__title .cut {
  background: var(--accent);
  color: var(--bg);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  padding-block-start: var(--s-6);
  border-block-start: 1px solid var(--line);
}

/* ── Portrait ───────────────────────────────────────────────────────────────
   Posé sur un aplat décalé, comme un repère d'imprimeur. Le duotone est un
   filtre CSS : zéro octet de plus, et il se lève au survol. */

.hero__figure {
  margin: 0;
  position: relative;
  justify-self: end;
  inline-size: min(340px, 42vw);
}

/* L'aplat décalé, comme un repère d'imprimeur mal calé — volontairement.
   Il vit sur la **figure** et non sur le portrait : ce dernier porte
   `overflow: hidden` pour rogner la photo à son rayon, et rognerait donc
   aussi l'aplat qui doit déborder. Pas de `z-index` négatif non plus : le
   hero n'est pas un contexte d'empilement, et l'aplat passerait derrière le
   fond de la page au lieu de passer derrière la photo. */
.hero__figure::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  inline-size: 100%;
  aspect-ratio: 4 / 5;
  background: var(--accent);
  border-radius: var(--r-sm);
  translate: calc(18px * var(--dir)) 18px;
}

.hero__portrait {
  margin: 0;
  position: relative;
  z-index: 1;
  inline-size: 100%;
  aspect-ratio: 4 / 5;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-alt);
}
/* La photo est un portrait recadré : centré, le cadrage couperait le haut du
   visage. On remonte le point d'ancrage. */
.hero__portrait img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: 50% 14%;
  filter: grayscale(1) contrast(1.06);
  transition: filter var(--dur) var(--ease);
}
.hero:hover .hero__portrait img,
.hero:focus-within .hero__portrait img { filter: none; }

.hero__caption {
  display: block;
  color: var(--ink-3);
  font-size: var(--step--2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-block-start: var(--s-4);
}

@media (max-width: 991px) {
  .hero__figure { justify-self: start; inline-size: min(300px, 62vw); }
  .hero__figure::before { aspect-ratio: 4 / 3; translate: calc(10px * var(--dir)) 10px; }
  .hero__portrait { aspect-ratio: 4 / 3; }
}

/* ── Les quatre chiffres ────────────────────────────────────────────────────
   Calculés au montage depuis les données, jamais écrits à la main : un
   chiffre faux coûte plus cher que pas de chiffre du tout. */

.hero__proof {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-block-start: var(--s-8);
  border-block-start: 1px solid var(--line);
}
.hero__proof > div {
  padding: var(--s-5) var(--s-4) 0 0;
  min-inline-size: 0;
}
.hero__proof > div + div {
  border-inline-start: 1px solid var(--line);
  padding-inline-start: var(--s-4);
}
.hero__proof b {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 400;
  line-height: 1;
  color: var(--accent-ink);
  font-variant-numeric: lining-nums tabular-nums;
  font-variation-settings: "opsz" 72, "SOFT" 20, "WONK" 0;
}
.hero__proof span {
  display: block;
  margin-block-start: var(--s-2);
  color: var(--ink-3);
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

@media (max-width: 575px) {
  .hero__proof { grid-template-columns: repeat(2, 1fr); }
  .hero__proof > div:nth-child(3) {
    border-inline-start: 0;
    padding-inline-start: 0;
  }
  .hero__proof > div:nth-child(n+3) {
    border-block-start: 1px solid var(--line);
    margin-block-start: var(--s-5);
  }
}

/* ── Indice de défilement ─────────────────────────────────────────────────── */

.hero__scroll {
  display: none;
  position: absolute;
  inset-block-end: var(--s-6);
  inset-inline-end: var(--shell-pad);
  align-items: center;
  gap: var(--s-3);
  color: var(--ink-3);
  font-size: var(--step--2);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: opacity var(--dur) var(--ease);
}
@media (min-width: 992px) { .hero__scroll { display: flex; } }
.hero.is-scrolled .hero__scroll { opacity: 0; }

.hero__scroll i {
  display: block;
  inline-size: 1px;
  block-size: 34px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.hero__scroll i::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  block-size: 10px;
  background: var(--accent);
  animation: scroll-hint 2400ms var(--ease) infinite;
}
.hero__scroll span { writing-mode: vertical-rl; }
[dir="rtl"] .hero__scroll span { writing-mode: vertical-lr; }

/* ── Bandeau des technologies ───────────────────────────────────────────────
   Il a quitté le hero, où il ne disait rien, pour le pied de la section
   Savoir-faire, où il est la liste elle-même. */

.marquee {
  margin-block-start: var(--s-8);
  border-block: 1px solid var(--line);
  overflow: hidden;
  padding-block: var(--s-4);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
}
.marquee__track {
  display: flex;
  gap: var(--s-6);
  inline-size: max-content;
  color: var(--ink-3);
  font-size: var(--step-0);
  animation: marquee 38s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__track span {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.marquee__track span::after {
  content: "◆";
  color: var(--accent);
  font-size: 0.6em;
  margin-inline-start: var(--s-5);
  opacity: .55;
}

/* ────────────────────────────── PROFIL : 5 / 7 ────────────────────────────── */

.split { display: grid; gap: var(--s-7); }
@media (min-width: 992px) {
  .split { grid-template-columns: 5fr 7fr; gap: var(--s-9); }
  .split__aside { position: sticky; top: calc(var(--nav-h) + var(--s-7)); align-self: start; }
}

/* ──────────────────────────────── COMPÉTENCES ─────────────────────────────── */

.skills {
  margin-block-start: var(--s-8);
  display: grid;
  gap: var(--s-6);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.skillset {
  padding-block-start: var(--s-5);
  border-block-start: 1px solid var(--line);
}
.skillset h3 {
  font-size: var(--step-1);
  margin-block-end: var(--s-4);
}

.tags { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tags li {
  padding: var(--s-1) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  background: var(--surface);
  white-space: nowrap;
}

/* ───────────────────────────── GRILLE DE PROJETS ──────────────────────────── */

/* `auto-fill` donne trois colonnes au-delà de ~1140 px sans qu'un point de
   rupture soit écrit nulle part : c'est la grille qui compte, pas la fenêtre. */
.grid {
  margin-block-start: var(--s-8);
  display: grid;
  gap: var(--s-5);
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
@media (min-width: 768px) {
  .grid > .card--featured { grid-column: 1 / -1; }
}

/* ═══════════════════════════ 03 · LA PELLICULE ════════════════════════════
   Cinq formats verticaux. Au-delà de 1200 px ils tiennent tous sur une
   ligne ; les pairs descendent de 28 px pour que la rangée respire — un
   décalage **statique**, en marge et non en transformation, pour ne pas
   entrer en conflit avec la révélation au défilement ni avec le survol. */

.reels {
  margin-block-start: var(--s-8);
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

@media (min-width: 768px) and (max-width: 1199px) {
  .reels { grid-template-columns: repeat(6, 1fr); }
  .reels > .reel { grid-column: span 2; }
  .reels > .reel:nth-child(4) { grid-column: 2 / 4; }
  .reels > .reel:nth-child(5) { grid-column: 4 / 6; }
}

@media (min-width: 1200px) {
  .reels { grid-template-columns: repeat(5, 1fr); }
  .reels > .reel:nth-child(even) { margin-block-start: 28px; }
}

/* Sous 768 px : un rail. La vignette coupée par le bord annonce la suite
   mieux qu'une flèche, et le débordement hors du shell est volontaire. */
@media (max-width: 767px) {
  .reels {
    display: flex;
    grid-template-columns: none;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    gap: var(--s-3);
    margin-inline: calc(var(--shell-pad) * -1);
    padding-inline: var(--shell-pad);
    scroll-padding-inline: var(--shell-pad);
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .reels::-webkit-scrollbar { display: none; }
  .reels > .reel { flex: 0 0 64vw; scroll-snap-align: center; }
}

/* ═══════════════════════ 04 · LES PLAQUES DE LIVRAISON ═════════════════════ */

.sites {
  margin-block-start: var(--s-8);
  display: grid;
  gap: var(--s-5);
}
@media (min-width: 768px) { .sites { grid-template-columns: repeat(2, 1fr); } }

.sites__foot {
  margin-block-start: var(--s-7);
  padding-block-start: var(--s-5);
  border-block-start: 1px solid var(--line);
  color: var(--ink-3);
  text-align: center;
  font-size: var(--step--2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ─────────────────────────────── LIGNE DE TEMPS ───────────────────────────── */

.timeline__head {
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-block: var(--s-8) var(--s-5);
  font-weight: 400;
}
.timeline__head:first-of-type { margin-block-start: var(--s-8); }

.timeline { border-inline-start: 1px solid var(--line); }

.timeline li {
  display: grid;
  gap: var(--s-1) var(--s-5);
  padding-block: var(--s-5);
  padding-inline-start: var(--s-5);
  position: relative;
}
@media (min-width: 768px) {
  .timeline li { grid-template-columns: 160px 1fr; }
}

/* La pastille sur le filet. Positionnée en logique : elle passe à droite en RTL
   sans une seule règle de plus. */
.timeline li::before {
  content: "";
  position: absolute;
  inset-block-start: calc(var(--s-5) + 0.62em);
  inset-inline-start: -3px;
  inline-size: 5px; block-size: 5px;
  border-radius: 50%;
  background: var(--line);
  transition: background var(--dur) var(--ease);
}
.timeline li.is-visible::before { background: var(--accent); }

.timeline__year { color: var(--ink-3); }
.timeline strong { font-weight: 600; display: block; }
.timeline p { color: var(--ink-2); margin: 0; font-size: var(--step--1); }

/* ────────────────────────────────── LOISIRS ─────────────────────────────── */

.hobbies {
  margin-block-start: var(--s-8);
  display: grid;
  gap: var(--s-6);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.hobbies li {
  padding-block-start: var(--s-5);
  border-block-start: 1px solid var(--line);
}
.hobbies__mark {
  display: block;
  inline-size: 40px;
  margin-block-end: var(--s-4);
}
.hobbies__mark .ico { inline-size: 40px; block-size: 40px; }
.hobbies h3 { font-size: var(--step-1); margin-block-end: var(--s-3); }
.hobbies p { color: var(--ink-2); font-size: var(--step--1); margin: 0; }

/* ──────────────────────────────────  CONTACT ─────────────────────────────── */

.contact__list {
  margin-block-start: var(--s-8);
  display: grid;
  gap: var(--s-6) var(--s-5);
  /* 220 px et non 260 : à 1 104 px de contenu, les cinq informations tiennent
     sur deux rangées pleines au lieu d'en laisser une seule, orpheline, sous
     un rang de trois. */
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.contact__list > div {
  padding-block-start: var(--s-4);
  border-block-start: 1px solid var(--line);
  /* Sans cela, un élément de grille refuse de descendre sous la largeur de son
     contenu : une adresse e-mail débordait alors sur la colonne du téléphone,
     et les deux se chevauchaient. */
  min-inline-size: 0;
}
.contact__list dt {
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-block-end: var(--s-2);
}
.contact__list dd {
  /* Une taille en dessous de ce qu'elle était : à cinq informations sur
     quatre colonnes, une adresse e-mail à 25 px se coupait en plein mot —
     « rayenrh7hamdi@yaho / o.com ». À 18 px elle tient sur une ligne, et la
     coupure ci-dessous redevient ce qu'elle doit être : un filet de sécurité,
     pas le comportement normal. */
  font-size: var(--step-0);
  overflow-wrap: anywhere;
}

/* ─────────────────────────────── CV À TÉLÉCHARGER ────────────────────────── */

.cv {
  margin-block-start: var(--s-8);
  padding-block-start: var(--s-6);
  border-block-start: 1px solid var(--line);
}
.cv__row { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* Le bouton porte trois choses : une flèche, un libellé, un poids. Le poids
   compte — on clique plus volontiers quand on sait ce qu'on télécharge. */
.cv__row .btn { align-items: baseline; }
.cv__row .ico { align-self: center; }
.cv__meta {
  font-style: normal;
  opacity: .62;
  font-size: var(--step--1);
}

/* ──────────────────────────────────  PIED ────────────────────────────────── */

.foot {
  border-block-start: 1px solid var(--line);
  padding-block: var(--s-7);
  color: var(--ink-2);
}
.foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-6);
  align-items: baseline;
  justify-content: space-between;
}
.foot p { margin: 0; }
.foot__meta { color: var(--ink-3); }
.foot strong { color: var(--ink); font-weight: 600; }
