/* ==========================================================================
   ECRIN - Feuille de style principale
   Palette : fond nuit #081A15, or #C9A463, ivoire #F3EEE3, sauge #9FB6A9
   ========================================================================== */

:root {
  --color-bg: #081A15;
  --color-bg-soft: #0d241d;
  --color-gold: #C9A463;
  --color-gold-soft: rgba(201, 164, 99, 0.35);
  --color-ivory: #F3EEE3;
  --color-sage: #9FB6A9;

  --font-display: 'Cormorant Garamond', serif;
  --font-product: 'Petit Formal Script', cursive;
  --font-accent: 'Mrs Saint Delafield', cursive;
  --font-mono: 'Space Mono', monospace;
  --font-body: 'Jost', sans-serif;

  --header-height: 88px;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------------------
   Reset et fondations
   -------------------------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: var(--color-bg);
  color-scheme: dark;
}

html.lenis,
html.lenis body {
  height: auto;
}

body {
  background: var(--color-bg);
  color: var(--color-ivory);
  font-family: var(--font-body);
  font-weight: 300;
  overflow-x: hidden;
  cursor: none;
}

/* Le curseur natif reste visible sur les appareils tactiles / sans souris fine */
@media (hover: none), (pointer: coarse) {
  body {
    cursor: auto;
  }
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--color-gold);
  color: var(--color-bg);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--color-gold);
}

/* --------------------------------------------------------------------------
   Curseur personnalise
   -------------------------------------------------------------------------- */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--color-gold);
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
}

.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  margin-top: -20px;
  border-radius: 50%;
  border: 1px solid var(--color-gold-soft);
  pointer-events: none;
  z-index: 9998;
  will-change: transform;
  transition: width 0.3s var(--ease-soft), height 0.3s var(--ease-soft),
    margin 0.3s var(--ease-soft), border-color 0.3s var(--ease-soft), opacity 0.3s;
}

.cursor-ring.is-hovering {
  width: 76px;
  height: 76px;
  margin-left: -38px;
  margin-top: -38px;
  border-color: var(--color-gold);
  background: rgba(201, 164, 99, 0.08);
}

@media (hover: none), (pointer: coarse) {
  .cursor,
  .cursor-ring {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.5rem, 5vw, 4rem);
  background: linear-gradient(180deg, rgba(8, 26, 21, 0.75), rgba(8, 26, 21, 0));
  backdrop-filter: blur(2px);
}

.header-nav {
  display: flex;
  gap: clamp(1.5rem, 3vw, 3rem);
  flex: 1;
}

.header-nav.header-nav--right {
  justify-content: flex-end;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-ivory);
  opacity: 0.85;
  position: relative;
  padding-bottom: 4px;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--color-gold);
  transition: width 0.4s var(--ease-soft);
}

.nav-link:hover::after {
  width: 100%;
}

.header-logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  color: var(--color-ivory);
  text-align: center;
  flex: 1;
}

.header-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 26px;
  z-index: 210;
}

.header-menu-btn span {
  display: block;
  height: 1px;
  width: 100%;
  background: var(--color-ivory);
  transition: transform 0.3s var(--ease-soft), opacity 0.3s var(--ease-soft);
}

/* Menu mobile plein ecran */
.mobile-nav {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 195;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.4s var(--ease-soft), transform 0.4s var(--ease-soft), visibility 0.4s;
}

.mobile-nav.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mobile-nav a {
  font-family: var(--font-display);
  font-size: 2rem;
}

/* --------------------------------------------------------------------------
   Fond de scene fixe (crossfade pilote par ScrollTrigger)
   -------------------------------------------------------------------------- */
.bg-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--color-bg);
}

.bg-layer {
  position: absolute;
  inset: -10%;
  opacity: 0;
  overflow: hidden;
}

.bg-layer[data-active="true"] {
  opacity: 1;
}

.bg-layer-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transform: scale(1.15);
  will-change: transform;
}

.bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 26, 21, 0.35) 0%, rgba(8, 26, 21, 0.55) 55%, rgba(8, 26, 21, 0.92) 100%);
}

/* Degrades placeholders par chapitre */
.bg-layer[data-chapter="hero"] .bg-layer-image {
  background: radial-gradient(circle at 50% 30%, #0f3a2c 0%, #081A15 70%);
}
.bg-layer[data-chapter="01"] .bg-layer-image {
  background: linear-gradient(135deg, #0c3327 0%, #12523d 45%, #0a2118 100%);
}
.bg-layer[data-chapter="02"] .bg-layer-image {
  background: linear-gradient(135deg, #16302a 0%, #3a4b3d 55%, #0e2119 100%);
}
.bg-layer[data-chapter="03"] .bg-layer-image {
  background: linear-gradient(135deg, #1c2e26 0%, #4a3d28 55%, #0a1f17 100%);
}
.bg-layer[data-chapter="04"] .bg-layer-image {
  background: linear-gradient(135deg, #0d2921 0%, #2b3b34 50%, #091a14 100%);
}
.bg-layer[data-chapter="05"] .bg-layer-image {
  background: linear-gradient(135deg, #16362c 0%, #9FB6A9 130%, #0a1f17 100%);
}
.bg-layer[data-chapter="outro"] .bg-layer-image {
  background: radial-gradient(circle at 50% 60%, #12382c 0%, #081A15 75%);
}

/* --------------------------------------------------------------------------
   Structure generale
   -------------------------------------------------------------------------- */
main {
  position: relative;
  z-index: 1;
}

section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: clamp(6rem, 10vh, 8rem) clamp(1.5rem, 8vw, 6rem);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hero-eyebrow {
  opacity: 0;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(4.5rem, 16vw, 11rem);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--color-ivory);
}

.hero-title .letter {
  display: inline-block;
  will-change: transform, opacity;
}

.hero-subtitle {
  font-family: var(--font-accent);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  color: var(--color-gold);
  opacity: 0;
}

.hero-scroll-cue {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  opacity: 0;
}

.hero-scroll-cue span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-sage);
}

.hero-scroll-line {
  width: 1px;
  height: 46px;
  background: linear-gradient(180deg, var(--color-gold), transparent);
  animation: scrollLinePulse 2.2s ease-in-out infinite;
}

@keyframes scrollLinePulse {
  0%, 100% { transform: scaleY(0.6); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Chapitres
   -------------------------------------------------------------------------- */
.chapter {
  align-items: center;
}

.chapter-grid {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.chapter:nth-child(even) .chapter-grid {
  direction: rtl;
}

.chapter:nth-child(even) .chapter-grid > * {
  direction: ltr;
}

.chapter-text-col {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.chapter-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.chapter-eyebrow::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--color-gold);
}

.chapter-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 1.05;
  color: var(--color-ivory);
}

.chapter-title .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.08em;
}

.chapter-title .word-inner {
  display: inline-block;
  will-change: transform;
}

.product-name {
  font-family: var(--font-product);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--color-gold);
  line-height: 1;
}

.product-volume {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--color-sage);
  text-transform: uppercase;
}

.chapter-description {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--color-ivory);
  opacity: 0.85;
  max-width: 46ch;
}

.ingredient-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.ingredient-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--color-gold-soft);
  border-radius: 999px;
  color: var(--color-sage);
  opacity: 0;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Poignee glisser-reveler
   -------------------------------------------------------------------------- */
.reveal-col {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-items: center;
}

.reveal-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-width: 380px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
}

.reveal-window {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(243, 238, 227, 0.12);
}

.reveal-texture {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

/* Textures placeholder par chapitre (grain de produit stylise) */
.reveal-texture[data-chapter="01"] {
  background: radial-gradient(circle at 30% 20%, #2f7a5c, #0c3327 70%);
}
.reveal-texture[data-chapter="02"] {
  background: radial-gradient(circle at 30% 20%, #d8cdb8, #6b5a3f 75%);
}
.reveal-texture[data-chapter="03"] {
  background: radial-gradient(circle at 30% 20%, #caa356, #3a2c14 75%);
}
.reveal-texture[data-chapter="04"] {
  background: radial-gradient(circle at 30% 20%, #7ea393, #12291f 75%);
}
.reveal-texture[data-chapter="05"] {
  background: radial-gradient(circle at 30% 20%, #e7f1ea, #9FB6A9 80%);
}

.reveal-veil {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 18%;
  background: rgba(8, 26, 21, 0.55);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  border-left: 1px solid var(--color-gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reveal-veil::before {
  content: 'ECRIN';
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.4em;
  color: rgba(243, 238, 227, 0.35);
}

.reveal-handle {
  position: absolute;
  top: 50%;
  left: 18%;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  margin-top: -23px;
  border-radius: 50%;
  background: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.reveal-handle:active {
  cursor: grabbing;
}

.reveal-handle-grip {
  display: flex;
  gap: 3px;
}

.reveal-handle-grip span {
  width: 2px;
  height: 16px;
  background: var(--color-bg);
  opacity: 0.7;
}

.reveal-caption {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-sage);
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Outro
   -------------------------------------------------------------------------- */
.outro {
  flex-direction: column;
  text-align: center;
  justify-content: center;
  gap: 2rem;
}

.outro-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.8rem, 7vw, 5rem);
  max-width: 16ch;
  position: relative;
  z-index: 2;
}

.cta-button {
  position: relative;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-bg);
  background: var(--color-gold);
  padding: 1.2rem 2.6rem;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.cta-button span {
  position: relative;
  z-index: 1;
}

.cta-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-ivory);
  transform: translateY(100%);
  transition: transform 0.45s var(--ease-soft);
}

.cta-button:hover::before {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 2;
  background: var(--color-bg);
  padding: 3rem clamp(1.5rem, 8vw, 6rem) 2.2rem;
  border-top: 1px solid rgba(243, 238, 227, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}

.footer-credit {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--color-sage);
}

.footer-credit a {
  color: var(--color-gold);
}

.footer-disclaimer {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: rgba(243, 238, 227, 0.45);
  max-width: 60ch;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .chapter:nth-child(even) .chapter-grid {
    direction: ltr;
  }

  .reveal-col {
    order: -1;
  }

  .reveal-frame {
    max-width: 320px;
    margin: 0 auto;
  }
}

@media (max-width: 720px) {
  .header-nav {
    display: none;
  }

  .header-menu-btn {
    display: flex;
  }

  .header-logo {
    flex: none;
    margin: 0 auto;
  }

  .site-header {
    justify-content: space-between;
  }

  section {
    padding: 5rem 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-scroll-line {
    animation: none;
  }
}
