:root {
  --ink: #f4f4f2;
  --ground: #0b0b0c;
  --paper: #f4f4f2;
  --gutter: clamp(16px, 4vw, 56px);
  --display: 'Michroma', 'Archivo', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ground);
}

body {
  color: var(--ink);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.7; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

#scroller {
  height: 100vh;
  height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: none;
  scrollbar-width: none;
}
#scroller::-webkit-scrollbar { display: none; }

.panel {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  container-type: size;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #000;
}

.media,
.tile > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
}

/* Le détourage se superpose exactement à l'image : même boîte, même cadrage. */
.cut { z-index: 2; pointer-events: none; }

.big {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: var(--t, 12%);
  margin: 0;
  padding-inline: var(--pad, 0);
  text-align: var(--a, center);
  white-space: nowrap;
  color: var(--c, #fff);
  font-family: var(--font, var(--display));
  font-weight: var(--w, 400);
  font-style: var(--fi, normal);
  font-stretch: var(--st, 100%);
  font-size: min(calc(var(--k, 12) * 1cqw), 34cqh);
  line-height: 1;
  letter-spacing: var(--ls, -0.02em);
  text-transform: uppercase;
}

/* Polices libres choisies pour rappeler chaque marque. */
.brand-mini { --font: 'Archivo', sans-serif; --w: 800; --st: 125%; --ls: 0.02em; }
.brand-land { --font: 'Jost', sans-serif; --w: 500; --ls: 0.04em; }
.brand-alien { --font: 'Archivo Black', sans-serif; --ls: 0.2em; }
.brand-jaguar { --font: 'Marcellus', serif; --ls: 0.08em; }
.brand-aston { --font: 'Julius Sans One', sans-serif; --ls: 0.02em; }
.brand-range { --font: 'Syncopate', sans-serif; --w: 700; --ls: 0.04em; }
.brand-alpine { --font: 'Exo 2', sans-serif; --w: 700; --fi: italic; --ls: -0.01em; }
.brand-toyota { --font: 'Manrope', sans-serif; --w: 800; --ls: 0.01em; }
.brand-nissan { --font: 'Jura', sans-serif; --w: 500; --ls: 0.08em; }
.brand-bmw { --font: 'Inter Tight', sans-serif; --w: 700; --ls: 0; }
.brand-ap { --font: 'Bodoni Moda', serif; --w: 500; --ls: 0; }
.brand-lemans { --font: 'Barlow', sans-serif; --w: 600; --fi: italic; --ls: 0; }

/* Titre d'ouverture des films : les lettres arrivent, puis repartent une à une
   en accélérant, comme une voiture qui démarre, en laissant un trait de lumière. */
.intro {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}
.intro-title {
  margin: 0 0 clamp(8px, 2cqh, 20px);
  font-family: var(--font);
  font-weight: var(--w);
  font-size: min(8cqw, 22cqh);
  line-height: 1.05;
  letter-spacing: var(--ls);
  text-transform: uppercase;
}
.word { display: inline-block; white-space: nowrap; }
.letter { display: inline-block; opacity: 0; will-change: transform, opacity, filter; }
.intro .era, .intro .model, .intro .label { opacity: 0; }
.intro::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9) 70%, #fff);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
}
.is-active .letter {
  animation:
    letter-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--i) * 30ms) forwards,
    letter-out 1s cubic-bezier(0.7, 0, 0.84, 0) calc(2500ms + var(--r) * 45ms) forwards;
}
.is-active .intro .era, .is-active .intro .model, .is-active .intro .label {
  animation:
    sub-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards,
    sub-out 0.5s cubic-bezier(0.7, 0, 0.84, 0) 2.2s forwards;
}
.is-active .intro::after { animation: light-trail 1.5s cubic-bezier(0.7, 0, 0.3, 1) 2.7s forwards; }
@keyframes letter-in {
  from { opacity: 0; transform: translateX(-0.7em) skewX(-16deg); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes letter-out {
  from { opacity: 1; transform: none; filter: blur(0); }
  to { opacity: 0; transform: translateX(80cqw) skewX(-26deg) scaleX(1.7); filter: blur(12px); }
}
@keyframes sub-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes sub-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-10px); }
}
@keyframes light-trail {
  0% { opacity: 0; transform: scaleX(0); }
  20% { opacity: 1; }
  60% { opacity: 0.8; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1); }
}

.nav {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(14px, 2.4vh, 28px) var(--gutter);
  color: #fff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
  transition: color 0.3s ease;
}
.nav-dark { color: #0b0b0c; text-shadow: none; }
.nav a { display: inline-block; padding: 8px 0; }
.nav .nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}
.nav-mark { width: 30px; height: auto; fill: currentColor; }
.nav-links { display: flex; gap: 28px; }

.meta {
  position: absolute;
  z-index: 3;
  left: var(--gutter);
  right: var(--gutter);
  bottom: clamp(20px, 5cqh, 52px);
  margin: 0;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.6);
}
.meta-dark { color: #111; text-shadow: none; }
.model {
  margin: 0;
  font-family: var(--font, var(--display));
  font-weight: var(--w, 400);
  font-style: var(--fi, normal);
  font-stretch: var(--st, 100%);
  font-size: clamp(15px, min(2.1cqw, 4.2cqh), 32px);
  line-height: 1.2;
  text-transform: uppercase;
}
.label { margin: 4px 0 0; font-size: clamp(13px, min(1.2cqw, 2.4cqh), 17px); }
/* Repère de chapitre : l'année et l'étape du parcours, au début de chaque partie de l'histoire */
.era {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  font-size: clamp(11px, min(1cqw, 2cqh), 14px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.era::before { content: ''; width: clamp(24px, 3cqw, 48px); height: 1px; background: currentColor; }
.intro .era { justify-content: center; margin-bottom: clamp(10px, 2.4cqh, 24px); }

.hero-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(26px, min(5.6cqw, 10cqh), 92px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.hero-name + .label { margin-top: 12px; }
.credit {
  position: absolute;
  z-index: 3;
  margin: 0;
  right: var(--gutter);
  bottom: clamp(20px, 5cqh, 52px);
  max-width: 24em;
  text-align: right;
  font-size: clamp(13px, 1.1cqw, 16px);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.55);
}

/* Une image survolée prend toute la section. Les zones de survol restent celles de la
   disposition d'origine : voir main.js. */
.panel-grid { display: flex; gap: 2px; background: var(--ground); cursor: pointer; }

.tile {
  position: relative;
  margin: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  container-type: size;
  flex: 1 1 0;
  background: #000;
  transition: flex-grow 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.panel-grid.has-open { gap: 0; }
/* Deux rangées de trois : la rangée de l'image ouverte prend aussi toute la hauteur. */
.panel-grid-2 { flex-direction: column; }
.grid-row { display: flex; flex: 1 1 0; gap: 2px; min-width: 0; min-height: 0; transition: flex-grow 0.85s cubic-bezier(0.22, 1, 0.36, 1); }
.has-open .grid-row { flex-grow: 0; gap: 0; }
.has-open .grid-row.row-open { flex-grow: 1; }
.has-open .tile { flex-grow: 0; }
.has-open .tile.is-open { flex-grow: 1; }
.tile .big, .tile .meta { transition: opacity 0.3s ease; }
.has-open .tile:not(.is-open) .big,
.has-open .tile:not(.is-open) .meta { opacity: 0; }
.tile .big { font-size: min(calc(var(--k, 18) * 1cqw), 42cqh); }
.tile .cut {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
}
.tile .meta { left: clamp(14px, 6cqw, 28px); right: clamp(14px, 6cqw, 28px); bottom: clamp(14px, 5cqh, 34px); }
.tile .model { font-size: clamp(14px, min(5cqw, 5cqh), 26px); }
.tile .label { font-size: clamp(12px, min(3.4cqw, 3.6cqh), 16px); }
.tile-contain { background: #fe0000; }
.tile-contain .cut { object-fit: contain; filter: drop-shadow(0 26px 22px rgba(0, 0, 0, 0.45)); }
.tile-watch > img, .tile-watch .cut { object-fit: contain; }
/* Dans la grille de six, la montre descend un peu pour laisser la place à son titre. */
.panel-grid-2 .tile-watch:not(.is-open) > img, .panel-grid-2 .tile-watch:not(.is-open) .cut { top: 20%; height: 80%; }

.panel-career {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(14px, 4cqh, 48px);
  padding: clamp(56px, 10cqh, 96px) var(--gutter) clamp(16px, 4cqh, 40px);
  background: var(--paper);
  color: #0b0b0c;
}
.career-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 32px; }
.career-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(28px, min(6cqw, 10cqh), 92px);
  line-height: 1.05;
  text-transform: uppercase;
}
.career-intro { margin: 0; max-width: 26em; font-size: clamp(15px, min(1.6cqw, 2.6cqh), 22px); }
.career-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 4cqh, 44px) clamp(16px, 3cqw, 44px);
}
.career-list h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(13px, min(1.6cqw, 2.8cqh), 24px);
  line-height: 1.2;
  text-transform: uppercase;
}
.career-list p { margin: 0; font-size: clamp(12px, min(1.2cqw, 2.1cqh), 17px); line-height: 1.35; }
.career-links { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 0; }
.career-links a { display: inline-block; padding: 6px 0; }

@media (max-aspect-ratio: 1/1) {
  .panel-grid { flex-direction: column; }
  .panel-grid-2 { flex-direction: row; }
  .panel-grid-2 .grid-row { flex-direction: column; }
  .panel-grid-2 .tile-watch:not(.is-open) > img, .panel-grid-2 .tile-watch:not(.is-open) .cut { top: 0; height: 100%; }
  .panel > .media { object-position: var(--focus-p, var(--focus, 50% 50%)); }
  .panel > .big { top: var(--tp, var(--t, 12%)); font-size: min(calc(var(--kp, var(--k, 12)) * 1cqw), 26cqh); }
  .big-wrap { white-space: normal; }
  .intro-title { font-size: min(15cqw, 16cqh); }
  .tile .big { top: var(--tp, var(--t, 12%)); font-size: min(calc(var(--kp, var(--k, 18)) * 1cqw), 42cqh); }
  .big { text-align: var(--ap, var(--a, center)); }
  .credit {
    left: var(--gutter);
    top: clamp(64px, 11cqh, 110px);
    bottom: auto;
    text-align: left;
  }
  .career-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-aspect-ratio: 1/1) and (min-width: 600px) {
  .panel > .big { top: 7%; font-size: min(calc(var(--kp, var(--k, 12)) * 0.72cqw), 20cqh); }
  .tile .big { top: 5%; font-size: min(calc(var(--kp, var(--k, 18)) * 0.62cqw), 24cqh); }
}

@media (max-height: 460px) {
  .panel > .big { top: 12%; }
  .career-list p { font-size: 11px; }
  .career-intro { display: none; }
}

@keyframes intro-fade {
  0%, 100% { opacity: 0; }
  14%, 74% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #scroller { scroll-behavior: auto; }
  .tile, .grid-row { transition: none; }
  .js .opening { display: none; }
  .meta-late { opacity: 1; }
  .intro { opacity: 0; }
  .intro::after { display: none; }
  .letter, .intro .model, .intro .label { opacity: 1; }
  .is-active .letter, .is-active .intro .era, .is-active .intro .model, .is-active .intro .label { animation: none; }
  .is-active .intro { animation: intro-fade 3.6s both; }
}

/* Lien vers la page projet */
.more {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 0;
  font-size: clamp(12px, 1.1cqw, 15px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid currentColor;
  pointer-events: auto;
}
.credit .more { margin-top: 8px; }
.tile .more { font-size: clamp(11px, 3cqw, 14px); }
.meta-late { opacity: 0; }
.is-active .meta-late { animation: sub-in 0.6s ease 3.4s forwards; }

/* Ouverture : le logo se dessine, puis le rideau remonte sur le film. */
.opening { display: none; }
.js .opening {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ground);
  color: var(--ink);
  transition: clip-path 0.9s cubic-bezier(0.7, 0, 0.2, 1);
  clip-path: inset(0 0 0 0);
}
.opening.is-done { clip-path: inset(0 0 100% 0); }
.opening-mark { display: flex; align-items: center; gap: clamp(14px, 2vw, 24px); }
.opening-mark svg { width: clamp(56px, 7vw, 96px); height: auto; fill: currentColor; overflow: visible; }
.opening .bar {
  transform: scaleX(0);
  transform-origin: left center;
  transform-box: fill-box;
  animation: bar-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.opening .bar:nth-child(2) { animation-delay: 0.12s; }
.opening .bar:nth-child(3) { animation-delay: 0.24s; }
.opening-mark span {
  font-family: var(--display);
  font-size: clamp(20px, 3vw, 40px);
  letter-spacing: 0.9em;
  text-transform: uppercase;
  opacity: 0;
  animation: word-in 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}
@keyframes bar-in { to { transform: scaleX(1); } }
@keyframes word-in { to { opacity: 1; letter-spacing: 0.26em; } }

