/* =============================================================================
   Sigillum Atelier — Level 1 forest homepage
   2.5D parallax (SVG/CSS layers). Level 2 could replace #forest-layers
   with a Three.js canvas and keep the same overlay structure and 0–1 progress.
   ============================================================================= */

:root {
  --ivory: #F6F3EC;
  --cypress: #24352A;
  --cypress-deep: #1A261F;
  --cypress-deeper: #121916;
  --moss: #6D735E;
  --charcoal: #2E2A28;
  --bronze: #A48658;
  --bronze-deep: #8F7448;
  --bronze-light: #C4A56E;
  --font-serif: "Cormorant Garamond", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --font-sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html, body {
  /* Forest ground for the whole page, so nothing after the walk flashes ivory.
     The opening veil paints its own ivory; it is not the page background. */
  background: var(--cypress-deep);
  color: var(--ivory);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--ivory);
  color: var(--charcoal);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
}
.skip-link:focus { top: 1rem; }

/* Logo: resize only — never crop, recolour, blend, or mask */
.logo-img {
  height: auto;
  background: none;
  border: 0;
  border-radius: 0;
  mix-blend-mode: normal;
  filter: none;
  object-fit: contain;
}

/* =============================================================================
   JOURNEY + PINNED FOREST SCENE
   ============================================================================= */
#journey {
  position: relative;
}

#forest-scene {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--cypress-deep);
}

html.is-animated #journey {
  height: 720vh;
}

html.is-animated #forest-scene {
  /* GSAP ScrollTrigger pins this to the viewport */
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

/* =============================================================================
   FOREST LAYERS (4–6 depths)
   transform-only animation; origin at the ground so scale feels like walking in
   ============================================================================= */
#forest-layers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.layer {
  position: absolute;
  inset: 0;
  will-change: transform;
  transform-origin: 50% 100%;
}

.layer svg {
  position: absolute;
  width: 100%;
  height: 100%;
  display: block;
}

/* Sky / atmosphere */
.layer-sky {
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(196, 165, 110, 0.14) 0%, transparent 62%),
    radial-gradient(ellipse 90% 50% at 50% 100%, rgba(46, 42, 40, 0.55) 0%, transparent 60%),
    linear-gradient(180deg, #15201A 0%, #1C2A22 28%, #24352A 58%, #2A332C 78%, #2E2A28 100%);
  z-index: 0;
}

.layer-far  { z-index: 2; }
.layer-mid  { z-index: 3; }
.layer-path { z-index: 4; }
.layer-fog-a { z-index: 5; }
.layer-near { z-index: 6; }
.layer-shafts { z-index: 7; }
.layer-fog-b { z-index: 8; }
.layer-fore { z-index: 9; }
.layer-vignette {
  z-index: 10;
  background:
    radial-gradient(ellipse 80% 75% at 50% 50%, transparent 45%, rgba(18, 25, 22, 0.45) 100%);
}

/* Soft drifting fog — CSS gradients only, very slow, low opacity */
.fog {
  position: absolute;
  inset: -10% -20%;
  pointer-events: none;
}

.fog-a {
  background:
    radial-gradient(ellipse 70% 35% at 40% 68%, rgba(246, 243, 236, 0.16) 0%, transparent 70%),
    radial-gradient(ellipse 50% 28% at 70% 58%, rgba(246, 243, 236, 0.10) 0%, transparent 70%);
  animation: fogDriftA 72s ease-in-out infinite alternate;
}

.fog-b {
  background:
    radial-gradient(ellipse 80% 30% at 55% 82%, rgba(246, 243, 236, 0.13) 0%, transparent 70%),
    radial-gradient(ellipse 40% 22% at 25% 70%, rgba(246, 243, 236, 0.08) 0%, transparent 70%);
  animation: fogDriftB 90s ease-in-out infinite alternate;
}

@keyframes fogDriftA {
  from { transform: translate3d(-5%, 0, 0); }
  to   { transform: translate3d(5%, 1%, 0); }
}
@keyframes fogDriftB {
  from { transform: translate3d(4%, 0, 0); }
  to   { transform: translate3d(-4%, -1%, 0); }
}

/* Warm light shafts — restrained, almost still */
.shaft {
  position: absolute;
  top: -15%;
  height: 130%;
  width: clamp(2.5rem, 7vw, 5.5rem);
  background: linear-gradient(
    to bottom,
    rgba(196, 165, 110, 0) 0%,
    rgba(196, 165, 110, 0.07) 24%,
    rgba(196, 165, 110, 0.04) 62%,
    rgba(196, 165, 110, 0) 100%
  );
  mix-blend-mode: soft-light;
  pointer-events: none;
  transform-origin: top center;
}
.shaft-1 { left: 28%; transform: rotate(11deg); opacity: 0.85; }
.shaft-2 { left: 46%; width: clamp(2rem, 5vw, 4rem); transform: rotate(7deg); opacity: 0.55; }
.shaft-3 { left: 61%; transform: rotate(14deg); opacity: 0.7; }

/* =============================================================================
   IVORY OPENING (logo, then a veil lifts into the forest)
   ============================================================================= */
#ivory-veil {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Logo file ivory is #F4F1EA. This veil is the only full-bleed ivory. */
  background: #F4F1EA;
  text-align: center;
  padding: 1.5rem;
}

#ivory-veil .logo-img {
  width: min(78vw, 26rem);
}

.scroll-cue {
  margin-top: 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bronze-deep);
  opacity: 0.85;
}

.scroll-cue::after {
  content: "";
  display: block;
  width: 1px;
  height: 1.75rem;
  margin: 0.65rem auto 0;
  background: var(--bronze);
  opacity: 0.6;
}

/* =============================================================================
   TEXT BEATS + DISCOVERIES (HTML overlays, driven by scroll progress)
   ============================================================================= */
#text-beats,
#discoveries {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.beat,
.clearing {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(90vw, 36rem);
  text-align: center;
  color: var(--ivory);
}

html.is-animated .beat-inner,
html.is-animated .clearing-inner {
  opacity: 0;
}

.beat h2,
.beat p {
  text-shadow: 0 1px 18px rgba(18, 25, 22, 0.45);
}

.beat-kicker {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.85rem, 5.4vw, 3.25rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
  font-style: italic;
  color: var(--ivory);
}

.beat-body {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.25rem, 3.4vw, 1.85rem);
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--ivory);
}

.beat-quiet {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: clamp(0.92rem, 2.2vw, 1.1rem);
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: rgba(246, 243, 236, 0.9);
  max-width: 28rem;
  margin: 0 auto;
}

/* Alternating clearings among the trees */
.clearing-1 { top: 50%; left: 38%; }
.clearing-2 { top: 50%; left: 62%; }
.clearing-3 { top: 50%; left: 36%; }
.clearing-4 { top: 50%; left: 64%; }
.clearing-5 { top: 50%; left: 50%; }

.piece {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(86vw, 17.5rem);
  margin: 0 auto;
}

/* Warm glow behind the jewel, then a velvet/stone plinth */
.piece-glow {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.piece-glow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: 18rem;
  height: 16rem;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(196, 165, 110, 0.46) 0%, rgba(164, 134, 88, 0.18) 36%, transparent 68%);
  pointer-events: none;
  z-index: 0;
}

.piece-svg {
  position: relative;
  z-index: 2;
  width: min(70vw, 13.5rem);
  height: auto;
  margin-bottom: -2.1rem;
  filter: drop-shadow(0 8px 16px rgba(18, 25, 22, 0.35));
}

.plinth {
  position: relative;
  z-index: 1;
  width: min(68vw, 13.5rem);
  height: 2.35rem;
  margin-top: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 80% 90% at 40% 28%, rgba(246, 243, 236, 0.32) 0%, transparent 48%),
    radial-gradient(ellipse at 50% 38%, #6A6E62 0%, #4A5048 32%, #2F352F 68%, #1E221E 100%);
  border: 1px solid rgba(164, 134, 88, 0.28);
  box-shadow:
    0 0 36px 6px rgba(196, 165, 110, 0.2),
    0 12px 24px rgba(0, 0, 0, 0.4),
    inset 0 3px 6px rgba(246, 243, 236, 0.2),
    inset 0 -4px 8px rgba(0, 0, 0, 0.42);
}

.piece-caption {
  margin-top: 1.15rem;
  color: var(--ivory);
  text-shadow: 0 1px 12px rgba(18, 25, 22, 0.5);
}

.piece-caption h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.15rem, 2.8vw, 1.45rem);
  letter-spacing: 0.03em;
  font-style: italic;
  line-height: 1.3;
}

.piece-caption p {
  margin-top: 0.2rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(196, 165, 110, 0.95);
}

/* =============================================================================
   ARRIVAL + STORY LINKS + FOOTER
   ============================================================================= */
#arrival,
#collection,
#story,
#sigillum,
#site-footer {
  position: relative;
  z-index: 40;
  width: 100%;
  /* Same ground and type colours as the forest overlays. */
  background: var(--cypress-deep);
  color: var(--ivory);
}

#arrival,
#collection,
#story,
#sigillum {
  padding: clamp(3.5rem, 10vh, 6.5rem) 1.5rem;
}

#arrival {
  text-align: center;
}

.arrival-kicker {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  /* Same bronze as the small captions inside the forest. */
  color: rgba(196, 165, 110, 0.95);
  margin-bottom: 0.75rem;
}

.arrival-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  line-height: 1.25;
  color: var(--ivory);
  margin-bottom: 2.5rem;
}

.arrival-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.arrival-nav a {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: var(--ivory);
  border-bottom: 1px solid rgba(196, 165, 110, 0.85);
  padding-bottom: 0.15rem;
  transition: border-color 0.35s ease, color 0.35s ease;
}

.arrival-nav a:hover,
.arrival-nav a:focus-visible {
  color: var(--bronze-light);
  border-bottom-color: var(--bronze-light);
}

.arrival-nav a:focus-visible {
  outline: 1px solid var(--bronze-light);
  outline-offset: 0.35rem;
}

.page-section {
  text-align: center;
}

.page-section h2,
.page-section p {
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.page-section h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  color: var(--ivory);
  margin-bottom: 1rem;
}

.page-section p {
  font-size: 0.98rem;
  font-weight: 400;
  /* Quiet ivory used for the longer lines inside the forest. */
  color: rgba(246, 243, 236, 0.9);
}

.page-section + .page-section,
#arrival + #collection {
  border-top: 1px solid rgba(164, 134, 88, 0.28);
}

#site-footer {
  border-top: 1px solid rgba(164, 134, 88, 0.28);
  padding: 2.5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
}

/* The logo file is an ivory JPEG. A small plaque of that same ivory
   keeps the repeat intentional. The image itself is not cropped,
   blended, or recolored. */
#site-footer .logo-panel {
  background: #F4F1EA;
  padding: 0.5rem;
  border: 1px solid rgba(196, 165, 110, 0.85);
  line-height: 0;
}

#site-footer .logo-img {
  width: min(42vw, 8.5rem);
}

#site-footer p {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ivory);
}

#site-footer small {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(196, 165, 110, 0.95);
}

/* =============================================================================
   MOBILE
   ============================================================================= */
@media (max-width: 700px) {
  .clearing-1,
  .clearing-2,
  .clearing-3,
  .clearing-4,
  .clearing-5 {
    left: 50%;
    top: 48%;
  }

  .piece-glow::before {
    width: 13rem;
    height: 13rem;
  }

  .shaft-2 { display: none; }
}

@media (min-width: 701px) {
  .arrival-nav {
    flex-direction: row;
    justify-content: center;
    gap: 2.25rem;
  }
}

/* =============================================================================
   REDUCED MOTION + NO-JS: static, readable fallback
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  .fog-a, .fog-b { animation: none; }

  html.is-animated #journey { height: auto; }
  html.is-animated #forest-scene {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  html.is-animated .beat,
  html.is-animated .clearing {
    opacity: 1;
  }

  #ivory-veil {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
  }

  #forest-layers {
    position: relative;
    height: 70vh;
    min-height: 22rem;
  }

  #text-beats,
  #discoveries {
    position: relative;
    inset: auto;
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
    padding: 3rem 1rem 4.5rem;
    background:
      linear-gradient(180deg, rgba(18, 25, 22, 0.15), var(--cypress-deep) 8%);
  }

  .beat,
  .clearing {
    position: relative;
    left: auto !important;
    top: auto !important;
    transform: none;
    width: min(90vw, 36rem);
    margin: 0 auto;
  }

  .layer { transform: none !important; }
}

/* No-JS: same stacked layout (is-animated is never applied) */
.no-js #ivory-veil {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

.no-js #forest-layers {
  position: relative;
  height: 70vh;
  min-height: 22rem;
}

.no-js #text-beats,
.no-js #discoveries {
  position: relative;
  inset: auto;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
  padding: 3rem 1rem 4.5rem;
  background: var(--cypress-deep);
}

.no-js .beat,
.no-js .clearing {
  position: relative;
  left: auto !important;
  top: auto !important;
  transform: none;
  width: min(90vw, 36rem);
  margin: 0 auto;
}

/* Animation inners: keep CSS centering on the wrapper, tween only the inner */
.beat-inner,
.clearing-inner {
  will-change: transform, opacity;
}
