/* Terrae Caravelli — Earth Reveal vertical prototype. Strictly isolated. */

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(ellipse at 46% 48%, #111510 0%, #0c100d 54%, #080907 100%);
}

body {
  overflow: hidden;
  color: var(--tc-craie, #e8e3d8);
  font-family: var(--cv-typo-current-ff, var(--tc-font-ui, Arial, sans-serif));
  font-synthesis: var(--cv-typo-synthesis, none);
}

.terrae-reveal,
.terrae-reveal * {
  box-sizing: border-box;
}

.terrae-reveal {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 420px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 46% 48%, #111510 0%, #0c100d 54%, #080907 100%);
}

.terrae-reveal__canvas,
.terrae-reveal__fallback,
.terrae-reveal__raking-light,
.terrae-reveal__vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.terrae-reveal__canvas {
  z-index: 1;
  display: block;
  opacity: 0;
  transition: opacity 1200ms var(--tc-ease, cubic-bezier(.2, .65, .2, 1));
}

.terrae--webgl .terrae-reveal__canvas {
  opacity: 1;
}

.terrae-reveal__fallback {
  z-index: 0;
  overflow: hidden;
  opacity: 0;
  background: #0c100d;
}

.terrae-reveal__fallback-material {
  position: absolute;
  inset: -4%;
  background-color: var(--tc-terra-ombra, #2b211a);
  background-image:
    linear-gradient(116deg, rgba(10, 15, 13, .9) 4%, rgba(43, 33, 26, .62) 42%, rgba(142, 116, 88, .16) 62%, rgba(10, 15, 13, .88) 91%),
    url("/assets/prologue-caravelli/terrae/03_PATTERNS/TC_Texture_Brume_1800.jpg"),
    url("/assets/prologue-caravelli/terrae/03_PATTERNS/TC_Texture_Terre_1800.jpg");
  background-position: center;
  background-size: cover;
  background-blend-mode: multiply, soft-light, normal;
  filter: contrast(1.13) saturate(.55) brightness(.57);
  transform: scale(1.04);
}

.terrae-reveal__fallback-topography {
  position: absolute;
  inset: -12% -8%;
  width: 116%;
  height: 124%;
  object-fit: cover;
  opacity: 0;
  mix-blend-mode: screen;
  filter: sepia(.18) brightness(.72);
  transform: scale(1.025) translate3d(0, 1.5%, 0);
}

.no-js .terrae-reveal__fallback,
.terrae--fallback .terrae-reveal__fallback {
  opacity: 1;
}

.no-js .terrae-reveal__fallback-material,
.terrae--fallback.terrae--running .terrae-reveal__fallback-material {
  animation: terraeFallbackMatter 12s var(--tc-ease, cubic-bezier(.2, .65, .2, 1)) both;
}

.no-js .terrae-reveal__fallback-topography,
.terrae--fallback.terrae--running .terrae-reveal__fallback-topography {
  animation: terraeFallbackTopography 10s var(--tc-ease, cubic-bezier(.2, .65, .2, 1)) 3.2s both;
}

.terrae-reveal__raking-light {
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(111deg,
      transparent 17%,
      rgba(232, 227, 216, .018) 32%,
      rgba(142, 116, 88, .145) 48%,
      rgba(232, 227, 216, .052) 57%,
      transparent 72%);
  transform: translate3d(-32%, 0, 0);
  mix-blend-mode: screen;
}

.terrae--running .terrae-reveal__raking-light {
  animation: terraeRakingLight 14s var(--tc-ease, cubic-bezier(.2, .65, .2, 1)) 1.2s both;
}

.terrae-reveal__vignette {
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 52% 48%, transparent 23%, rgba(8, 9, 7, .14) 61%, rgba(8, 9, 7, .78) 100%),
    linear-gradient(180deg, rgba(8, 9, 7, .42), transparent 24%, transparent 75%, rgba(8, 9, 7, .64));
}

.terrae-reveal__header {
  position: absolute;
  z-index: 6;
  top: max(28px, env(safe-area-inset-top));
  right: max(30px, env(safe-area-inset-right));
  left: max(30px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(232, 227, 216, .16);
  opacity: 0;
  transform: translateY(-6px);
}

.terrae--running .terrae-reveal__header,
.no-js .terrae-reveal__header {
  animation: terraeInterfaceIn 1200ms var(--tc-ease, cubic-bezier(.2, .65, .2, 1)) 600ms both;
}

.terrae--complete .terrae-reveal__header {
  opacity: 1;
  transform: translateY(0);
}

.terrae-reveal__kicker,
.terrae-reveal__index {
  margin: 0;
  color: rgba(232, 227, 216, .73);
  font-size: var(--cv-typo-current-fs, 10px);
  font-weight: var(--cv-typo-current-fw, 500);
  line-height: var(--cv-typo-current-lh, 1);
  letter-spacing: var(--cv-typo-current-ls, .31em);
  text-transform: var(--cv-typo-current-tt, uppercase);
}

.terrae-reveal__index {
  color: rgba(232, 227, 216, .82);
  font-size: var(--cv-typo-current-fs, 9px);
  letter-spacing: var(--cv-typo-current-ls, .25em);
}

.terrae-reveal__mark {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  pointer-events: none;
}

.terrae-reveal__monogram {
  width: clamp(176px, 24vw, 356px);
  height: auto;
  opacity: 0;
  clip-path: circle(0% at 50% 52%);
  filter:
    sepia(.08)
    saturate(.82)
    drop-shadow(0 1px 0 rgba(142, 116, 88, .28))
    drop-shadow(0 20px 42px rgba(8, 9, 7, .48));
  transform: scale(.992);
}

.terrae--running .terrae-reveal__monogram,
.no-js .terrae-reveal__monogram {
  animation: terraeMonogramReveal 6500ms var(--tc-ease, cubic-bezier(.2, .65, .2, 1)) 7800ms both;
}

.terrae--complete .terrae-reveal__monogram {
  opacity: .92;
  clip-path: circle(76% at 50% 52%);
  transform: scale(1);
}

.terrae-reveal__caption {
  position: absolute;
  right: max(30px, env(safe-area-inset-right));
  bottom: max(40px, calc(env(safe-area-inset-bottom) + 24px));
  left: max(30px, env(safe-area-inset-left));
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
}

.terrae--running .terrae-reveal__caption,
.no-js .terrae-reveal__caption {
  animation: terraeCaptionIn 1800ms var(--tc-ease, cubic-bezier(.2, .65, .2, 1)) 12500ms both;
}

.terrae--complete .terrae-reveal__caption {
  opacity: 1;
  transform: translateY(0);
}

.terrae-reveal__caption h1 {
  margin: 0;
  color: rgba(232, 227, 216, .86);
  font-family: var(--cv-typo-current-ff, var(--tc-font-editorial, Georgia, serif));
  font-size: var(--cv-typo-current-fs, clamp(20px, 2.15vw, 31px));
  font-style: var(--cv-typo-current-fst, normal);
  font-weight: var(--cv-typo-current-fw, 400);
  line-height: var(--cv-typo-current-lh, 1.2);
  letter-spacing: var(--cv-typo-current-ls, .025em);
  text-shadow:
    0 1px 0 rgba(43, 33, 26, .5),
    0 8px 28px rgba(8, 9, 7, .62);
}

.terrae-reveal__caption p {
  margin: 11px 0 0;
  color: rgba(142, 116, 88, .85);
  font-size: var(--cv-typo-current-fs, 9px);
  font-weight: var(--cv-typo-current-fw, 500);
  line-height: var(--cv-typo-current-lh, 1.4);
  letter-spacing: var(--cv-typo-current-ls, .35em);
  text-transform: var(--cv-typo-current-tt, uppercase);
}

.terrae-reveal__status {
  position: absolute;
  z-index: 6;
  bottom: max(32px, calc(env(safe-area-inset-bottom) + 18px));
  left: max(30px, env(safe-area-inset-left));
  overflow: hidden;
  pointer-events: none;
}

.terrae-reveal__status-text {
  display: block;
  color: rgba(232, 227, 216, .5);
  font-size: var(--cv-typo-current-fs, 9px);
  line-height: var(--cv-typo-current-lh, 1);
  letter-spacing: var(--cv-typo-current-ls, .25em);
  text-transform: var(--cv-typo-current-tt, uppercase);
  opacity: 0;
  transform: translateY(100%);
}

.terrae--running .terrae-reveal__status-text {
  animation: terraeStatus 4200ms var(--tc-ease, cubic-bezier(.2, .65, .2, 1)) 1200ms both;
}

.terrae-reveal__replay {
  position: absolute;
  z-index: 8;
  right: max(30px, env(safe-area-inset-right));
  bottom: max(31px, calc(env(safe-area-inset-bottom) + 17px));
  min-width: 48px;
  min-height: 44px;
  padding: 12px 0 10px 22px;
  border: 0;
  border-left: 1px solid rgba(142, 116, 88, .6);
  background: transparent;
  color: rgba(232, 227, 216, .68);
  font: var(--cv-typo-current-font, 500 9px/1 var(--tc-font-ui, Arial, sans-serif));
  letter-spacing: var(--cv-typo-current-ls, .24em);
  text-transform: var(--cv-typo-current-tt, uppercase);
  cursor: pointer;
  opacity: 0;
  transition: color 280ms var(--tc-ease, cubic-bezier(.2, .65, .2, 1)), opacity 700ms var(--tc-ease, cubic-bezier(.2, .65, .2, 1));
}

.terrae-reveal__replay:not([hidden]) {
  opacity: 1;
}

.terrae-reveal__replay:hover,
.terrae-reveal__replay:focus-visible {
  color: var(--tc-craie, #e8e3d8);
}

.terrae-reveal__replay:focus-visible {
  outline: 1px solid var(--tc-bronzo-secco, #8e7458);
  outline-offset: 7px;
}

@keyframes terraeFallbackMatter {
  0% { opacity: .14; filter: contrast(1.16) saturate(.44) brightness(.18); transform: scale(1.04); }
  42% { opacity: .92; filter: contrast(1.14) saturate(.5) brightness(.45); }
  100% { opacity: 1; filter: contrast(1.13) saturate(.55) brightness(.57); transform: scale(1); }
}

@keyframes terraeFallbackTopography {
  0% { opacity: 0; transform: scale(1.025) translate3d(0, 1.5%, 0); }
  100% { opacity: .23; transform: scale(1) translate3d(0, 0, 0); }
}

@keyframes terraeRakingLight {
  0% { opacity: 0; transform: translate3d(-32%, 0, 0); }
  28% { opacity: .55; }
  72% { opacity: .28; }
  100% { opacity: .18; transform: translate3d(34%, 0, 0); }
}

@keyframes terraeInterfaceIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes terraeMonogramReveal {
  0% { opacity: 0; clip-path: circle(0% at 50% 52%); transform: scale(.992); }
  68% { opacity: .86; }
  100% { opacity: .92; clip-path: circle(76% at 50% 52%); transform: scale(1); }
}

@keyframes terraeCaptionIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes terraeStatus {
  0% { opacity: 0; transform: translateY(100%); }
  18%, 72% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-100%); }
}

@media (max-width: 700px) {
  .terrae-reveal__header {
    top: max(22px, env(safe-area-inset-top));
    right: max(20px, env(safe-area-inset-right));
    left: max(20px, env(safe-area-inset-left));
    padding-bottom: 12px;
  }

  .terrae-reveal__kicker {
    font-size: var(--cv-typo-current-fs, 9px);
    letter-spacing: var(--cv-typo-current-ls, .27em);
  }

  .terrae-reveal__index {
    max-width: 118px;
    font-size: var(--cv-typo-current-fs, 8px);
    line-height: var(--cv-typo-current-lh, 1.35);
    text-align: right;
  }

  .terrae-reveal__monogram {
    width: min(56vw, 236px);
  }

  .terrae-reveal__caption {
    right: max(20px, env(safe-area-inset-right));
    bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));
    left: max(20px, env(safe-area-inset-left));
  }

  .terrae-reveal__caption h1 {
    font-size: var(--cv-typo-current-fs, clamp(20px, 6.1vw, 25px));
  }

  .terrae-reveal__status {
    bottom: max(29px, calc(env(safe-area-inset-bottom) + 16px));
    left: max(20px, env(safe-area-inset-left));
  }

  .terrae-reveal__replay {
    right: max(20px, env(safe-area-inset-right));
    bottom: max(17px, calc(env(safe-area-inset-bottom) + 7px));
    max-width: 150px;
    padding-left: 14px;
    line-height: var(--cv-typo-current-lh, 1.35);
    text-align: right;
  }
}

@media (prefers-reduced-motion: reduce) {
  .terrae-reveal *,
  .terrae-reveal *::before,
  .terrae-reveal *::after {
    animation-duration: 200ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 200ms !important;
    scroll-behavior: auto !important;
  }

  .terrae-reveal__fallback,
  .terrae-reveal__fallback-material,
  .terrae-reveal__fallback-topography,
  .terrae-reveal__header,
  .terrae-reveal__monogram,
  .terrae-reveal__caption {
    opacity: 1;
    transform: none;
  }

  .terrae-reveal__monogram {
    clip-path: circle(76% at 50% 52%);
  }

  .terrae-reveal__raking-light,
  .terrae-reveal__status {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════════════════════════
   ÉLÉVATION DU 19/09/2026 — la terre devient un paysage. Le terrain est rendu par le moteur (relief
   réellement éclairé) ; la page lui laisse la place : la phrase se pose dans la réserve calme,
   au-dessus de l'horizon ; le grand monogramme est réservé à la finale du récit ; les lumières
   peintes en CSS (bande diagonale, halo) ne doublent plus la lumière du moteur.
   ═══════════════════════════════════════════════════════════════════════════════════════════════════ */

.terrae--webgl .terrae-reveal__raking-light,
.terrae--webgl .terrae-luxury9-light--earth { display: none; }

.terrae--webgl .terrae-reveal__vignette {
  background:
    radial-gradient(ellipse 62% 40% at 12% 12%, rgba(8, 9, 7, .50), transparent 70%),
    linear-gradient(180deg, rgba(8, 9, 7, .40), transparent 17%, transparent 80%, rgba(8, 9, 7, .58));
}

.terrae--webgl .terrae-reveal__monogram { display: none; }

.terrae--webgl .terrae-reveal__mark { place-items: start; }

.terrae--webgl .terrae-reveal__caption {
  top: clamp(84px, 11.5vh, 132px);
  right: auto;
  bottom: auto;
  left: max(30px, env(safe-area-inset-left));
  width: min(640px, 44vw);
  text-align: left;
}

.terrae--webgl .terrae-reveal__caption { --terrae-phrase: 8600ms; }
.terrae--webgl.terrae--story .terrae-reveal__caption { --terrae-phrase: 3300ms; }

.terrae--webgl.terrae--running .terrae-reveal__caption {
  animation-delay: var(--terrae-phrase);   /* la matière se lit d'abord ; la phrase vient ensuite, puis ne bouge plus */
  animation-duration: 900ms;
}

/* Dans le récit (8,5 s) : la matière d'abord, la phrase à 3,3 s, tenue ensuite jusqu'au raccord. */
.terrae--story.terrae--running .terrae-reveal__header { animation-delay: 300ms; }

.terrae--webgl .terrae-reveal__caption h1 {
  font-family: var(--cv-typo-current-ff, "Cormorant Garamond", var(--tc-font-editorial, Georgia, serif));   /* fonte réellement chargée par Terrae ; « EB Garamond » n'a aucun fichier */
  font-size: var(--cv-typo-current-fs, clamp(32px, 3.8vw, 62px));
  line-height: var(--cv-typo-current-lh, 1.08);
  letter-spacing: var(--cv-typo-current-ls, .012em);
  color: rgba(244, 240, 232, .94);
  text-shadow: 0 10px 38px rgba(8, 9, 7, .55);
  word-break: normal;
  overflow-wrap: normal;
  -webkit-hyphens: none;
  hyphens: none;
  text-wrap: balance;
}

.terrae--webgl .terrae-reveal__caption p {
  margin-top: clamp(16px, 2.2vh, 26px);
  padding-top: clamp(14px, 1.9vh, 22px);
  display: inline-block;
  color: rgba(200, 178, 146, .92);
  letter-spacing: var(--cv-typo-current-ls, .34em);
  word-break: normal;
  overflow-wrap: normal;
  -webkit-hyphens: none;
  hyphens: none;
}

/* La phrase se révèle comme un titre de film : les lettres se mettent au point, le filet d'or se trace, la ligne basse suit. */
.terrae--webgl.terrae--running .terrae-reveal__caption h1 { animation: terraeRevealTitre 2600ms cubic-bezier(.16, .7, .2, 1) var(--terrae-phrase, 0ms) both; }
.terrae--webgl .terrae-reveal__caption p { position: relative; border-top: 0; }
.terrae--webgl .terrae-reveal__caption p::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 1px; background: linear-gradient(90deg, rgba(200, 178, 146, .85), rgba(142, 116, 88, .35)); transform-origin: 0 50%; }
.terrae--webgl.terrae--running .terrae-reveal__caption p::before { animation: terraeRevealFilet 1800ms cubic-bezier(.3, .6, .2, 1) calc(var(--terrae-phrase, 0ms) + 700ms) both; }
.terrae--webgl.terrae--running .terrae-reveal__caption p { animation: terraeRevealBasse 1600ms ease-out calc(var(--terrae-phrase, 0ms) + 1300ms) both; }

@keyframes terraeRevealTitre {
  from { opacity: 0; filter: blur(9px); transform: translateY(6px); }
  55% { opacity: 1; }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }   /* ni interlettrage ni largeur animés : la phrase ne se recompose jamais */
}
@keyframes terraeRevealFilet { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes terraeRevealBasse { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .terrae--webgl.terrae--running .terrae-reveal__caption h1,
  .terrae--webgl.terrae--running .terrae-reveal__caption p,
  .terrae--webgl.terrae--running .terrae-reveal__caption p::before { animation: none; }
}

@media (max-width: 700px) {
  .terrae--webgl .terrae-reveal__caption {
    top: clamp(84px, 13vh, 132px);
    left: max(20px, env(safe-area-inset-left));
    width: min(72vw, 300px);   /* la phrase tient en deux lignes équilibrées et laisse libre la commande du son */
  }

  .terrae--webgl .terrae-reveal__vignette {
    background: linear-gradient(180deg, rgba(8, 9, 7, .62), rgba(8, 9, 7, .30) 22%, transparent 40%, transparent 80%, rgba(8, 9, 7, .58));
  }

  .terrae--webgl .terrae-reveal__caption h1 { font-size: var(--cv-typo-current-fs, clamp(27px, 7.6vw, 36px)); line-height: var(--cv-typo-current-lh, 1.1); }
  .terrae--webgl .terrae-reveal__caption p { letter-spacing: var(--cv-typo-current-ls, .28em); }
}

@media (max-height: 520px) {
  .terrae--webgl .terrae-reveal__caption { top: 66px; width: min(52vw, 420px); }
  .terrae--webgl .terrae-reveal__caption h1 { font-size: var(--cv-typo-current-fs, clamp(22px, 3.4vw, 32px)); }
}

/* Téléphone couché (arbitrage du 19/09) : dans le récit, le plancher de 420 px de la scène coupait le bas de la matière sous un écran de 390 px ; il est levé. */
@media (max-height: 480px) and (min-aspect-ratio: 1/1) {
  body[data-terrae-production] .terrae-reveal { min-height: 0; }
}

/* Le secours CSS ne charge ses deux textures (0,86 Mo) que s'il sert : sans script, sans WebGL2, ou contexte perdu.
   Avant, elles étaient aussi celles du moteur ; le moteur a maintenant ses cartes de relief. */
.terrae-reveal__fallback-material { background-image: none; }

.terrae--fallback .terrae-reveal__fallback-material {
  background-image:
    linear-gradient(116deg, rgba(10, 15, 13, .9) 4%, rgba(43, 33, 26, .62) 42%, rgba(142, 116, 88, .16) 62%, rgba(10, 15, 13, .88) 91%),
    url("/assets/prologue-caravelli/terrae/03_PATTERNS/TC_Texture_Brume_1800.jpg"),
    url("/assets/prologue-caravelli/terrae/03_PATTERNS/TC_Texture_Terre_1800.jpg");
}

/* Sans script : la classe « no-js » est encore là à la première peinture, même quand le script arrive ; la requête d'état la remplace. */
@media (scripting: none) {
  .terrae-reveal__fallback-material {
    background-image:
      linear-gradient(116deg, rgba(10, 15, 13, .9) 4%, rgba(43, 33, 26, .62) 42%, rgba(142, 116, 88, .16) 62%, rgba(10, 15, 13, .88) 91%),
      url("/assets/prologue-caravelli/terrae/03_PATTERNS/TC_Texture_Brume_1800.jpg"),
      url("/assets/prologue-caravelli/terrae/03_PATTERNS/TC_Texture_Terre_1800.jpg");
  }
}
