/* Terrae Luxury 9 — differential studio finish. All assets are local and supplied. */

body[data-terrae-production] .terrae-experience__scene {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  background: #080907;
}

body[data-terrae-production] .terrae-experience__scene[hidden] { display: none; }
body[data-terrae-production] .terrae-experience__scene > main { position: absolute; inset: 0; min-height: 100%; }

.terrae-luxury9-light {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 1600ms cubic-bezier(.2,.65,.2,1);
}

.terrae--running .terrae-luxury9-light--earth { opacity: .70; }
.terrae-map--running .terrae-luxury9-light--map { opacity: .72; }
.terrae-root--running .terrae-luxury9-light--roots { opacity: .58; }
.terrae-season--running .terrae-luxury9-light--seasons { opacity: .52; mix-blend-mode: soft-light; }

.terrae-reveal__fallback,
.terrae-map__fallback,
.terrae-root__fallback,
.terrae-season__fallback { filter: contrast(1.07) brightness(1.16); }

.terrae-map__legend,
.terrae-root__depth-scale,
.terrae-territories__signature { display: none !important; }

.terrae-map__seal::before,
.terrae-map__seal::after { opacity: .12 !important; }

.terrae-map__museum-light {
  background:
    radial-gradient(ellipse at 47% 46%, rgba(244,240,232,.12), transparent 38%),
    linear-gradient(112deg, transparent 5%, rgba(142,116,88,.08) 43%, transparent 78%) !important;
}

.terrae-reveal__index,
.terrae-map__index,
.terrae-root__index,
.terrae-season__index,
.terrae-territories__index,
.terrae-reveal__kicker,
.terrae-map__kicker,
.terrae-root__kicker,
.terrae-season__kicker,
.terrae-territories__kicker,
.terrae-reveal__caption p,
.terrae-map__caption p,
.terrae-root__caption p,
.terrae-season__caption p,
.terrae-territories__caption p,
.terrae-territories__eyebrow,
.terrae-territories__lexicon,
.terrae-territories__folio,
.terrae-territories__sectors,
.terrae-experience__header p,
.terrae-experience__header span,
.terrae-experience__progress,
.terrae-experience__controls button,
.terrae-experience__controls a,
.terrae-experience__portal p,
.terrae-experience__portal a,
.terrae-experience__revelation p {
  font-size: var(--cv-typo-current-fs, clamp(10px, .74vw, 12px)) !important;
  line-height: var(--cv-typo-current-lh, 1.35);
}

.terrae-territories__sectors b { font-size: var(--cv-typo-current-fs, 10px) !important; }

.terrae-territories__chapter::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: .72;
  mix-blend-mode: multiply;
}

.terrae-territories__chapter--firenze::before {
  background-image: url("/assets/prologue-caravelli/terrae/luxury-9/scenography/firenze_folio_overlay.svg");
  mix-blend-mode: multiply;
}

.terrae-territories__chapter--napoli::before {
  background-image: url("/assets/prologue-caravelli/terrae/luxury-9/scenography/napoli_coastal_strata_overlay.svg");
  mix-blend-mode: screen;
  opacity: .62;
}

.terrae-territories__chapter--reims::before {
  background-image: url("/assets/prologue-caravelli/terrae/luxury-9/scenography/reims_vertical_chalk_overlay.svg");
  mix-blend-mode: multiply;
  opacity: .56;
}

.terrae-territories__chapter--firenze .terrae-territories__plate picture,
.terrae-territories__chapter--firenze .terrae-territories__period-overlay {
  mask-image: url("/assets/prologue-caravelli/terrae/luxury-9/scenography/firenze_aperture.svg");
  -webkit-mask-image: url("/assets/prologue-caravelli/terrae/luxury-9/scenography/firenze_aperture.svg");
}

.terrae-territories__chapter--napoli .terrae-territories__plate picture,
.terrae-territories__chapter--napoli .terrae-territories__period-overlay {
  mask-image: url("/assets/prologue-caravelli/terrae/luxury-9/scenography/napoli_aperture.svg");
  -webkit-mask-image: url("/assets/prologue-caravelli/terrae/luxury-9/scenography/napoli_aperture.svg");
}

.terrae-territories__chapter--reims .terrae-territories__plate picture,
.terrae-territories__chapter--reims .terrae-territories__period-overlay {
  mask-image: url("/assets/prologue-caravelli/terrae/luxury-9/scenography/reims_aperture.svg");
  -webkit-mask-image: url("/assets/prologue-caravelli/terrae/luxury-9/scenography/reims_aperture.svg");
}

.terrae-territories__plate {
  -webkit-mask-image: none !important;
  mask-image: none !important;
  background: transparent !important;
}

.terrae-territories__plate picture,
.terrae-territories__period-overlay {
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  mask-mode: luminance;
}

.terrae-territories__chapter--firenze .terrae-territories__plate picture { background: #dacdb5; }
.terrae-territories__chapter--napoli .terrae-territories__plate picture { background: #c9b891; }
.terrae-territories__chapter--reims .terrae-territories__plate picture { background: #e8e0d2; }

.terrae-territories__chapter--firenze .terrae-territories__plate--map { inset: 8% 6% 8%; }
.terrae-territories__chapter--napoli .terrae-territories__plate--map { inset: 13% 3% 10%; }
.terrae-territories__chapter--reims .terrae-territories__plate--map { inset: 5% 12% 5%; }

.terrae-territories__chapter--reims .terrae-territories__plate { background: #e8e0d2; }
.terrae-territories__chapter--reims .terrae-territories__plate picture img { filter: contrast(1.03) saturate(.42) sepia(.035) brightness(1.06); }
.terrae-territories__chapter--napoli .terrae-territories__plate--panorama picture img { object-position: center 57%; }

.terrae-archive-credit {
  z-index: 8 !important;
  max-width: min(360px, 76vw) !important;
  font-family: var(--cv-typo-current-ff, var(--tc-font-ui, "Inter", Arial, sans-serif)) !important;
}

/* Luxury 9 credit authority: keep archival notices compact and readable.
   The legacy flex strip is intentionally neutralised here. */
.terrae-territories__plate .terrae-archive-credit {
  top: auto !important;
  right: auto !important;
  bottom: clamp(28px, 3.2vw, 46px) !important;
  left: clamp(34px, 4.2vw, 62px) !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: end !important;
  justify-content: stretch !important;
  gap: 5px 18px !important;
  box-sizing: border-box;
  width: min(380px, calc(100% - 96px)) !important;
  max-width: calc(100% - 96px) !important;
  padding: 13px 15px 12px !important;
  overflow: hidden;
  text-align: left;
}

.terrae-territories__plate .terrae-archive-credit strong {
  grid-column: 1 / -1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.terrae-territories__plate .terrae-archive-credit span {
  grid-column: 1;
  min-width: 0;
  max-width: none !important;
  margin-top: 0;
  overflow-wrap: anywhere;
}

.terrae-territories__plate .terrae-archive-credit a {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  margin-top: 0;
  white-space: nowrap;
}

/* The Tavola Strozzi is an unusually wide panorama. Re-centre the actual
   engraving inside its matte instead of leaving a dominant empty upper field. */
.terrae-territories__chapter--napoli .terrae-territories__plate--panorama picture img {
  transform: translateY(-19%) scale(1.006);
}

.terrae-experience__maison::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    url("/assets/prologue-caravelli/terrae/luxury-9/scenography/maison_three_materials_convergence.svg") center / cover no-repeat,
    url("/assets/prologue-caravelli/terrae/luxury-9/lighting/maison_convergence_light.svg") center / cover no-repeat;
  mix-blend-mode: screen;
  opacity: .58;
}

.terrae-lighting--final,
.terrae-experience__convergence {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  opacity: .44;
  mix-blend-mode: screen;
}

.terrae-experience__convergence { opacity: .3; }
body[data-terrae-final-phase="convergence"] .terrae-lighting--final,
body[data-terrae-final-phase="reveal"] .terrae-lighting--final { opacity: .68; }
body[data-terrae-final-phase="convergence"] .terrae-experience__convergence,
body[data-terrae-final-phase="reveal"] .terrae-experience__convergence { opacity: .52; }

.terrae-experience__manifest-copy,
.terrae-experience__dimensions,
.terrae-experience__revelation { z-index: 2; }

body[data-terrae-final-phase="convergence"] .terrae-experience__maison::before,
body[data-terrae-final-phase="reveal"] .terrae-experience__maison::before { opacity: .82; }

/* Final maison polish — one optical gesture, never a decorative effect stack. */
@keyframes terraeLuxury9LightBreath {
  0%, 100% { transform: translate3d(-.35%, .15%, 0) scale(1.006); }
  50% { transform: translate3d(.45%, -.25%, 0) scale(1.018); }
}

@keyframes terraeLuxury9FolioGlint {
  0%, 18% { opacity: 0; transform: skewX(-10deg) translate3d(-185%, 0, 0); }
  42% { opacity: .13; }
  70%, 100% { opacity: 0; transform: skewX(-10deg) translate3d(520%, 0, 0); }
}

.terrae--running .terrae-luxury9-light--earth,
.terrae-map--running .terrae-luxury9-light--map,
.terrae-root--running .terrae-luxury9-light--roots,
.terrae-season--running .terrae-luxury9-light--seasons {
  animation: terraeLuxury9LightBreath 18s cubic-bezier(.37, 0, .18, 1) infinite;
  transform-origin: 50% 48%;
}

.terrae-territories__plate::after { display: none; }

.terrae-territories__plate picture::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: -12% auto -12% -38%;
  width: 34%;
  background: linear-gradient(102deg, transparent 8%, rgba(255, 251, 239, .34) 48%, transparent 91%);
  mix-blend-mode: soft-light;
  opacity: 0;
  pointer-events: none;
  transform: skewX(-10deg) translate3d(-185%, 0, 0);
  will-change: transform, opacity;
}

body[data-territory-phase="map"] .terrae-territories__plate--map picture::after,
body[data-territory-phase="sectors"] .terrae-territories__plate--map picture::after,
body[data-territory-phase="view"] .terrae-territories__plate--view picture::after {
  animation: terraeLuxury9FolioGlint 7.4s cubic-bezier(.2, .65, .2, 1) 900ms 1 both;
}

.terrae-interaction-cartouche {
  background:
    linear-gradient(118deg, rgba(142, 116, 88, .08), transparent 42%),
    rgba(8, 12, 10, .92);
  border-color: rgba(157, 128, 94, .68);
  box-shadow:
    0 18px 52px rgba(4, 7, 6, .34),
    inset 0 1px 0 rgba(244, 240, 232, .08),
    inset 3px 0 0 rgba(142, 116, 88, .11);
  backdrop-filter: blur(12px) saturate(.78);
}

.terrae-interaction-zone:is(:hover, :focus-visible, .is-active) .terrae-interaction-zone__trace {
  filter: drop-shadow(0 0 3px rgba(142, 116, 88, .34));
}

.terrae-experience__revelation h1 {
  text-shadow: 0 3px 34px rgba(232, 227, 216, .075);
  text-rendering: optimizeLegibility;
}

@media (max-width: 700px) {
  .terrae-territories__chapter--firenze .terrae-territories__plate--map,
  .terrae-territories__chapter--napoli .terrae-territories__plate--map,
  .terrae-territories__chapter--reims .terrae-territories__plate--map { inset: 13% 3% 10%; }

  .terrae-territories__chapter::before { opacity: .48; }

  /* Historical sources are 4:3 or close to it. A proportional folio removes
     dead matte, protects faces/architecture and keeps the notice in-frame. */
  .terrae-territories__chapter .terrae-territories__plate,
  .terrae-territories__chapter--firenze .terrae-territories__plate--map,
  .terrae-territories__chapter--napoli .terrae-territories__plate--map,
  .terrae-territories__chapter--reims .terrae-territories__plate--map {
    top: 50% !important;
    right: 0 !important;
    bottom: auto !important;
    left: 0 !important;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    transform: translateY(-50%);
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }

  .terrae-territories__chapter .terrae-territories__plate--panorama {
    aspect-ratio: 16 / 9;
  }

  .terrae-territories__plate picture img,
  .terrae-territories__plate--view picture img {
    transform: none !important;
    object-fit: contain;
  }

  .terrae-territories__plate--panorama picture img {
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    transform: translateY(-8%) !important;
  }

  .terrae-territories__plate .terrae-archive-credit {
    right: auto !important;
    bottom: 22px !important;
    left: 22px !important;
    gap: 4px 10px !important;
    width: calc(100% - 44px) !important;
    max-width: calc(100% - 44px) !important;
    padding: 9px 10px 8px !important;
  }

  .terrae-territories__plate .terrae-archive-credit strong {
    font-size: var(--cv-typo-current-fs, 8px);
    line-height: var(--cv-typo-current-lh, 1.25);
    letter-spacing: var(--cv-typo-current-ls, .12em);
  }

  .terrae-territories__plate .terrae-archive-credit span {
    font-size: var(--cv-typo-current-fs, 7px);
    line-height: var(--cv-typo-current-lh, 1.3);
    letter-spacing: var(--cv-typo-current-ls, .035em);
  }

  .terrae-territories__plate .terrae-archive-credit a {
    font-size: var(--cv-typo-current-fs, 7px);
    letter-spacing: var(--cv-typo-current-ls, .11em);
  }
}

@media (prefers-reduced-motion: reduce) {
  .terrae-luxury9-light { transition-duration: 200ms; }
  .terrae-territories__chapter::before { transform: none !important; animation: none !important; }
  .terrae--running .terrae-luxury9-light--earth,
  .terrae-map--running .terrae-luxury9-light--map,
  .terrae-root--running .terrae-luxury9-light--roots,
  .terrae-season--running .terrae-luxury9-light--seasons,
  .terrae-territories__plate picture::after {
    animation: none !important;
    transform: none !important;
  }
}
