/* katec4 — « Le chantier au fil du défilement » : ardoise, sable, Space Grotesk.
   Animations pilotées par le scroll (animation-timeline) avec repli IntersectionObserver (.fx/.in). */
:root {
  --ardoise: #101720;
  --ardoise-2: #182230;
  --craie: #eef1f4;
  --brume: #9aa7b6;
  --sable: #e3c58a;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  --pad: clamp(1.25rem, 5vw, 5rem);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--ardoise); color: var(--craie); font-family: var(--body); font-size: 1.05rem; line-height: 1.6; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; line-height: 1.05; letter-spacing: -.02em; }
h2 { font-size: clamp(1.9rem, 3.6vw, 3.2rem); }
:focus-visible { outline: 3px solid var(--sable); outline-offset: 3px; }

/* Barre de progression de lecture */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: var(--sable); transform-origin: left; transform: scaleX(0); z-index: 60; }

.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; justify-content: space-between; align-items: center; padding: 1rem var(--pad); color: var(--craie); text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.25rem; text-decoration: none; letter-spacing: .04em; }
.nav-cta { font-family: var(--display); font-weight: 700; text-decoration: none; }

/* 0. Ouverture */
.hero { position: relative; height: 100vh; min-height: 560px; overflow: hidden; display: flex; align-items: flex-end; }
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16,23,32,.1), rgba(16,23,32,.85)); }
.hero-text { position: relative; padding: 0 var(--pad) 4rem; max-width: 60rem; }
.hero-kicker { color: var(--sable); font-weight: 600; margin-bottom: 1rem; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 5.5rem); }
.hero-hint { margin-top: 2rem; color: var(--brume); font-size: .95rem; }
.hero-hint::after { content: ""; display: block; width: 1px; height: 3rem; background: var(--brume); margin-top: .75rem; animation: hint 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes hint { 0%, 100% { transform: scaleY(.3); opacity: .4; } 50% { transform: scaleY(1); opacity: 1; } }

/* 1. Scène épinglée */
.scene { position: relative; }
.scene-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; background: #000; }
.scene-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity .9s ease, transform 1.6s ease; }
.scene-stage::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(16,23,32,.15), rgba(16,23,32,.55)); pointer-events: none; }
.scene[data-active="0"] .scene-img:nth-child(1),
.scene[data-active="1"] .scene-img:nth-child(2),
.scene[data-active="2"] .scene-img:nth-child(3),
.scene[data-active="3"] .scene-img:nth-child(4) { opacity: 1; transform: scale(1); }
.scene-dots { position: absolute; left: var(--pad); bottom: 2rem; margin: 0; padding: 0; list-style: none; display: flex; gap: .5rem; z-index: 2; }
.scene-dots li { width: 2.5rem; height: 3px; background: rgba(238,241,244,.3); transition: background .4s; }
.scene[data-active="0"] .scene-dots li:nth-child(1),
.scene[data-active="1"] .scene-dots li:nth-child(2),
.scene[data-active="2"] .scene-dots li:nth-child(3),
.scene[data-active="3"] .scene-dots li:nth-child(4) { background: var(--sable); }
.scene-steps { position: relative; margin-top: -100vh; z-index: 2; }
.scene-step { min-height: 100vh; display: flex; align-items: center; justify-content: flex-end; padding: 0 var(--pad); }
.card { max-width: 30rem; background: rgba(16,23,32,.82); backdrop-filter: blur(6px); border-left: 3px solid var(--sable); padding: 2rem; opacity: 0; transform: translateX(3rem); transition: opacity .7s ease, transform .7s ease; }
.scene-step.in .card { opacity: 1; transform: none; }
.card-n { color: var(--sable); font-weight: 600; margin-bottom: .5rem; }
.card p:last-child { margin-top: 1rem; color: #d4dbe3; }

/* 2. Cercle qui s'ouvre au défilement */
.iris { position: relative; min-height: 120vh; display: grid; place-items: center; padding: 6rem var(--pad); overflow: hidden; }
.iris-media { position: absolute; inset: 0; }
.iris-media img { width: 100%; height: 100%; object-fit: cover; clip-path: circle(18% at 50% 50%); }
.iris-text { position: relative; max-width: 40rem; text-align: center; background: rgba(16,23,32,.7); padding: 2.5rem; backdrop-filter: blur(4px); }
.iris-text p { margin-top: 1.25rem; color: #d4dbe3; }

/* 3. Slides horizontales */
.slides-wrap { padding: 6rem 0 5rem; background: var(--ardoise-2); }
.slides-head { display: flex; justify-content: space-between; align-items: end; padding: 0 var(--pad) 2rem; }
.slides-nav { display: flex; gap: .5rem; }
.slide-btn { background: none; border: 1px solid var(--brume); color: var(--craie); width: 3rem; height: 3rem; font-size: 1.25rem; cursor: pointer; }
.slide-btn:hover { border-color: var(--sable); color: var(--sable); }
.slides { display: flex; gap: 1.25rem; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 var(--pad) 1rem; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 min(78vw, 420px); scroll-snap-align: start; }
.slide img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.slide h3 { font-size: 1.35rem; margin-top: 1rem; }
.slide p { color: var(--brume); margin-top: .35rem; }

/* 4. Repères : la ligne se dessine, les repères apparaissent */
.marks { position: relative; padding: 7rem var(--pad); max-width: 70rem; margin: 0 auto; }
.marks-line { position: absolute; left: calc(var(--pad) + 7.5rem); top: 7rem; bottom: 7rem; width: 1px; background: var(--sable); transform-origin: top; transform: scaleY(0); }
.marks-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3rem; }
.marks-list li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 2rem; align-items: baseline; }
.marks-list strong { font-family: var(--display); font-size: clamp(1.6rem, 3vw, 2.6rem); color: var(--sable); text-align: right; line-height: 1; }
.marks-list span { position: relative; padding-left: 1.5rem; color: #d4dbe3; }
.marks-list span::before { content: ""; position: absolute; left: -5px; top: .55em; width: 11px; height: 11px; border-radius: 50%; background: var(--sable); }

/* 5. Contact */
.contact { background: var(--sable); color: var(--ardoise); padding: 7rem var(--pad); }
.contact-inner { max-width: 60rem; }
.contact h2 { font-size: clamp(2.2rem, 5vw, 4.5rem); }
.contact p { margin-top: 1.5rem; max-width: 46rem; font-size: 1.15rem; }
.contact-links { display: flex; flex-wrap: wrap; gap: .75rem 2rem; margin-top: 2rem; }
.contact-links a { font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 2.6vw, 2.2rem); text-decoration: none; border-bottom: 3px solid var(--ardoise); }
.contact-links a:hover { border-color: transparent; }
.contact-meta { font-size: .95rem !important; color: #3a3220; }

footer { padding: 1.5rem var(--pad) 3rem; color: var(--brume); font-size: .85rem; line-height: 1.6; }

/* Repli : révélation par IntersectionObserver */
.fx { opacity: 0; transform: translateY(2.5rem); transition: opacity .8s ease, transform .8s ease; }
.fx.in { opacity: 1; transform: none; }

/* Animations pilotées par le défilement, si le navigateur les gère */
@supports (animation-timeline: view()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

  .hero-media img { animation: heroZoom linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
  @keyframes heroZoom { to { transform: scale(1.18); filter: brightness(.5); } }
  .hero-text { animation: heroUp linear both; animation-timeline: view(); animation-range: exit 0% exit 70%; }
  @keyframes heroUp { to { transform: translateY(-6rem); opacity: 0; } }

  .iris-media img { animation: iris linear both; animation-timeline: view(); animation-range: entry 10% cover 55%; }
  @keyframes iris { to { clip-path: circle(80% at 50% 50%); } }

  .marks-line { animation: draw linear both; animation-timeline: view(); animation-range: entry 20% exit 20%; }
  @keyframes draw { to { transform: scaleY(1); } }

  .slide { animation: slideIn linear both; animation-timeline: view(inline); animation-range: entry 0% entry 60%; }
  @keyframes slideIn { from { opacity: .3; transform: translateX(2rem); } }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fx, .card { opacity: 1 !important; transform: none !important; transition: none !important; }
  .scene-img { transition: opacity .3s ease; transform: none; }
  .hero-hint::after { animation: none; }
  .progress, .hero-media img, .hero-text, .iris-media img, .marks-line, .slide { animation: none !important; }
  .iris-media img { clip-path: none; }
  .marks-line { transform: none; }
}

@media (max-width: 720px) {
  .scene-step { justify-content: center; }
  .card { padding: 1.5rem; }
  .marks-line { left: calc(var(--pad) + 4.75rem); }
  .marks-list li { grid-template-columns: 3.5rem 1fr; gap: 1.25rem; }
  .marks-list strong { font-size: 1.3rem; }
  .nav-cta { display: none; }
}
