/* Ethan Lagrain — prototype scroll cinématique
   Modes : html[data-mode="webgl"] (scène + scroll scrubé) ou html:not([data-mode="webgl"]). */

@font-face {
  font-family: 'Bodoni Moda';
  src: url('../assets/fonts/bodoni-moda.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Cinzel';
  src: url('../assets/fonts/cinzel.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('../assets/fonts/manrope.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}

:root {
  --ink: #0c0b0a;
  --charcoal: #15120f;
  --warm: #23180f;
  --ivory: #efe6d4;
  --ivory-soft: #c9bfae;
  --gold: #c9a24a;
  --gold-gradient: linear-gradient(100deg, #7a5a1e 0%, #c9a24a 22%, #f3dc94 42%, #b8860b 62%, #e2c06a 80%, #7a5a1e 100%);
  --display: 'Bodoni Moda', 'Times New Roman', serif;
  --text: 'Manrope', system-ui, sans-serif;
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; background: var(--ink); color: var(--ivory); }
body {
  font-family: var(--text);
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ol { margin: 0; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 2px; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 10;
  padding: .6rem 1rem; background: var(--ink); color: var(--ivory);
}
.skip:focus { top: 1rem; }

/* --- Fond, canvas ------------------------------------------------------- */
.backdrop {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(60% 70% at 62% 38%, #241d16 0%, transparent 70%),
    radial-gradient(120% 90% at 50% 100%, #050404 0%, transparent 60%),
    var(--charcoal);
}
.backdrop__warm {
  position: absolute; inset: 0; opacity: 0;
  background:
    radial-gradient(55% 65% at 30% 45%, #3a2615 0%, transparent 72%),
    var(--warm);
}
.scene {
  position: fixed; inset: 0; z-index: 1;
  width: 100%; height: 100vh; height: 100lvh;
  pointer-events: none;
}
#smooth-wrapper { position: relative; z-index: 2; }

/* --- Scène pinnée ------------------------------------------------------- */
.stage { position: relative; height: 100vh; height: 100svh; overflow: hidden; }
.panel { position: absolute; inset: 0; }
.panel__media { display: none; }
.panel--arrivee .panel__text { position: absolute; inset: 0; }
.panel--proposer { visibility: hidden; }
/* Le texte de lecture n'apparaît qu'au scroll : caché jusqu'à ce que la timeline en prenne la main. */
html[data-mode="webgl"]:not(.is-ready) .hero-intro { visibility: hidden; }

/* Vignette théâtrale par-dessus le canvas, sous le texte. */
.stage::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(5, 4, 3, .75) 100%);
}

/* --- Section 1 ---------------------------------------------------------- */
.hero-title {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 7vh;
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--display); font-weight: 500;
  font-size: clamp(3.4rem, 10.2vw, 12rem);
  line-height: .86; letter-spacing: -.015em; text-transform: uppercase;
  transform-origin: 50% 100%;
  text-shadow: 0 .04em .4em rgba(0, 0, 0, .55);
}
.hero-title__line { display: block; }

.hero-intro {
  position: absolute; left: var(--gutter); top: 50%; transform: translateY(-50%);
  max-width: 42rem;
}
.hero-tagline {
  font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ivory);
}
.dot {
  display: inline-block; width: .42em; height: .42em; margin: 0 .55em .12em;
  border-radius: 50%; background: var(--gold-gradient);
}
.hero-place {
  margin-top: 1.4rem; padding-top: 1.4rem;
  font-family: var(--display); font-size: clamp(2rem, 3.4vw, 3.2rem); line-height: 1; letter-spacing: .04em;
  position: relative;
}
.hero-place::before {
  content: ''; position: absolute; top: 0; left: 0; width: 6rem; height: 1px; background: var(--gold-gradient);
}
.cta { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2.2rem; }

/* --- Boutons ------------------------------------------------------------ */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.1rem; padding: .85rem 1.6rem; overflow: hidden;
  font: 600 .78rem/1 var(--text); letter-spacing: .16em; text-transform: uppercase;
  color: var(--ivory); text-decoration: none;
  border: 1px solid rgba(239, 230, 212, .38);
  background: rgba(12, 11, 10, .55);
  transition: border-color .4s var(--ease-out), background-color .4s var(--ease-out);
}
.btn:hover { border-color: var(--ivory); }
.btn--gold {
  border: 1px solid transparent;
  background: linear-gradient(var(--charcoal), var(--charcoal)) padding-box, var(--gold-gradient) border-box;
}
/* Reflet qui traverse, comme la lumière qui glisse sur le cadre. */
.btn--gold::after {
  content: ''; position: absolute; inset: -1px; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 236, 180, .0) 38%, rgba(255, 236, 180, .38) 50%, rgba(255, 236, 180, 0) 62%, transparent 70%);
  transform: translateX(-120%);
}
.btn--gold:hover::after, .btn--gold:focus-visible::after {
  transform: translateX(120%);
  transition: transform .9s var(--ease-out);
}

/* --- Section 2 ---------------------------------------------------------- */
.panel--proposer .panel__text {
  position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%);
  width: min(36rem, 46vw);
}
/* Ombre portée : le texte passe parfois sur le pichet ou sur le fond clair de l'horloge. */
.panel--proposer .panel__text { text-shadow: 0 1px 2px rgba(0, 0, 0, .7), 0 0 1.4em rgba(0, 0, 0, .6); }
.panel--proposer .section-title { text-shadow: 0 .03em .08em rgba(0, 0, 0, .8), 0 0 .5em rgba(0, 0, 0, .75); }
.panel--proposer .step__num, .panel--proposer .btn { text-shadow: none; }
.eyebrow { font-size: .75rem; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
.section-title {
  margin-top: 1rem;
  font-family: var(--display); font-weight: 500;
  font-size: clamp(2.2rem, 4.4vw, 4.6rem); line-height: 1; letter-spacing: -.01em;
}
.lede { margin-top: 1.2rem; color: var(--ivory-soft); max-width: 32rem; }
.steps { list-style: none; padding: 0; margin: 2rem 0 2.2rem; display: grid; gap: 1.1rem; }
.step { display: grid; grid-template-columns: 3rem 1fr; column-gap: .6rem; }
.step__num {
  grid-row: span 2; padding-top: .2rem;
  font-family: var(--display); font-size: 1.4rem; line-height: 1;
  background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.step__title { font-family: var(--display); font-weight: 500; font-size: 1.45rem; line-height: 1.2; }
.step p { color: var(--ivory-soft); font-size: .95rem; }

.tbc { color: #e8b04a; font-size: .85em; }

/* --- Pied de page ------------------------------------------------------- */
.site-footer {
  position: relative; z-index: 3;
  padding: 5rem var(--gutter) 4rem;
  background: var(--ink);
  border-top: 1px solid rgba(201, 162, 74, .3);
  display: grid; gap: .4rem;
  color: var(--ivory-soft);
}
.site-footer__name { font-family: var(--display); font-size: 2rem; color: var(--ivory); }
.site-footer__address { font-style: normal; }
.site-footer__rdv { margin-top: 1.2rem; color: var(--ivory); }
.contact-links { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .7rem; }
.site-footer__legal { margin-top: 1.2rem; font-size: .8rem; }
.tel { color: var(--ivory); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: .22em; }
.tel:hover { text-decoration-thickness: 2px; }

/* --- Titre en capitales romaines (par défaut ; ?titre=bodoni pour l'ancienne version) ---
   Cinzel s'inspire des inscriptions lapidaires romaines (colonne Trajane) :
   lettres plus larges, approche aérée, point médian doré comme les interponctions
   gravées, léger effet de taille dans la pierre. */
html[data-titre="romain"] .hero-title,
html[data-titre="romain"] .hero-place,
html[data-titre="romain"] .site-footer__name {
  font-family: 'Cinzel', var(--display);
}
html[data-titre="romain"] .hero-title {
  justify-content: center; gap: .32em;
  font-weight: 500; font-size: clamp(3rem, 9.6vw, 11.5rem); letter-spacing: .05em;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .85), 0 1px 0 rgba(255, 240, 210, .12), 0 .04em .4em rgba(0, 0, 0, .55);
}
/* Point médian : une vraie pastille dorée (un glyphe en dégradé laissait passer l'ombre du titre). */
html[data-titre="romain"] .hero-title__line:first-child::after {
  content: ''; display: inline-block;
  width: .13em; height: .13em; margin-left: .32em; vertical-align: .3em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c8 0%, #e2bd62 38%, #b8892f 70%, #6e4f17 100%);
  box-shadow: 0 0 .12em rgba(226, 189, 98, .45);
}
html[data-titre="romain"] .hero-title__line { white-space: nowrap; }
html[data-titre="romain"] .hero-place { letter-spacing: .12em; }

/* --- Mobile (< 768 px), mode WebGL ------------------------------------- */
@media (max-width: 767px) {
  .hero-title {
    flex-direction: column; align-items: flex-start;
    font-size: 19vw; line-height: .88; bottom: 6vh;
  }
  .hero-title__line:last-child { align-self: flex-end; }
  html[data-titre="romain"] .hero-title { font-size: 15.5vw; gap: 0; }
  html[data-titre="romain"] .hero-title__line:first-child::after { content: none; }
  .hero-intro { top: auto; bottom: 7vh; transform: none; right: var(--gutter); }
  .hero-tagline { font-size: .66rem; letter-spacing: .16em; }
  .hero-place { font-size: 2.2rem; }
  .cta { margin-top: 1.4rem; gap: .6rem; }
  .btn { min-height: 2.9rem; padding: .8rem 1.1rem; font-size: .7rem; }

  .panel--proposer::before {
    content: ''; position: absolute; inset: 22% 0 0; pointer-events: none;
    background: linear-gradient(to top, rgba(12, 11, 10, .96) 62%, rgba(12, 11, 10, .7) 82%, transparent);
  }
  .panel--proposer .panel__text {
    left: var(--gutter); right: var(--gutter); width: auto;
    top: auto; bottom: 4vh; transform: none;
  }
  .section-title { font-size: 2.1rem; }
  .lede { font-size: .9rem; margin-top: .8rem; }
  .steps { margin: 1.1rem 0 1.3rem; gap: .55rem; }
  .step { grid-template-columns: 2.2rem 1fr; }
  .step__title { font-size: 1.15rem; }
  .step p { font-size: .82rem; line-height: 1.45; }
}

/* --- Mode statique : reduced-motion ou WebGL absent ---------------------- */
/* Sections empilées, images en <img> superposées dans une perspective CSS
   (profondeur minimale, sans aucune animation). */
html:not([data-mode="webgl"]) .scene,
html:not([data-mode="webgl"]) .backdrop__warm,
html:not([data-mode="webgl"]) .stage::before { display: none; }
html:not([data-mode="webgl"]) .stage { height: auto; overflow: visible; }
html:not([data-mode="webgl"]) .panel { position: relative; min-height: 100vh; min-height: 100svh; visibility: visible; overflow: hidden; }
html:not([data-mode="webgl"]) .panel--proposer {
  background: radial-gradient(55% 65% at 30% 45%, #3a2615 0%, transparent 72%), var(--warm);
}
html:not([data-mode="webgl"]) .panel__media {
  display: block; position: absolute; inset: 0; pointer-events: none;
  perspective: 1200px; perspective-origin: 60% 40%; transform-style: preserve-3d;
}
html:not([data-mode="webgl"]) .layer { position: absolute; width: auto; max-width: none; }
html:not([data-mode="webgl"]) .panel--arrivee .layer--far {
  right: 24vw; top: 6vh; height: 60vh;
  transform: translateZ(-400px) scale(1.33); filter: brightness(.55);
}
html:not([data-mode="webgl"]) .panel--arrivee .layer--mid { right: 5vw; top: 10vh; height: 72vh; transform: translateZ(0); }
html:not([data-mode="webgl"]) .panel--proposer .layer--far {
  inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: translateZ(-600px) scale(1.5); filter: brightness(.42);
}
html:not([data-mode="webgl"]) .panel--proposer .layer--mid { left: 9vw; top: 14vh; height: 70vh; transform: translateZ(0); }
html:not([data-mode="webgl"]) .btn--gold::after { transition: none; }

@media (max-width: 767px) {
  html:not([data-mode="webgl"]) .panel--arrivee .layer--far { right: auto; left: 2vw; top: 3vh; height: 36vh; }
  html:not([data-mode="webgl"]) .panel--arrivee .layer--mid { right: 50%; top: 5vh; height: 46vh; transform: translateX(50%); }
  html:not([data-mode="webgl"]) .panel--proposer { display: flex; flex-direction: column; justify-content: flex-end; }
  html:not([data-mode="webgl"]) .panel--proposer .layer--mid { left: 50%; top: 4vh; height: 38vh; transform: translateX(-50%); }
  html:not([data-mode="webgl"]) .panel--proposer .panel__text { position: relative; inset: auto; padding: 44vh var(--gutter) 3rem; }
  html:not([data-mode="webgl"]) .panel--arrivee { display: flex; flex-direction: column; justify-content: flex-end; }
  html:not([data-mode="webgl"]) .panel--arrivee .panel__text {
    position: relative; inset: auto; padding: 50vh var(--gutter) 2.5rem;
    display: flex; flex-direction: column; gap: 2.2rem;
  }
  html:not([data-mode="webgl"]) .hero-intro,
  html:not([data-mode="webgl"]) .hero-title { position: static; transform: none; }
  html:not([data-mode="webgl"]) .panel--proposer::before { inset: 30% 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .btn--gold::after { transition: none !important; }
}

/* --- Debug -------------------------------------------------------------- */
.debug {
  position: fixed; right: .75rem; bottom: .75rem; z-index: 50;
  padding: .6rem .8rem; white-space: pre;
  font: 12px/1.45 ui-monospace, monospace; color: #9f9; background: rgba(0, 0, 0, .78);
  pointer-events: none;
}
