/* ============================================================
  Tree page — scroll-driven particle morphing + diagonal cards
   ============================================================ */

#tree-video-layer {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(23, 49, 80, 0.3) 0%, rgba(4, 10, 24, 0.72) 42%, rgba(1, 4, 12, 0.98) 100%),
    #01040c;
}

#tree-video-layer.is-visible {
  visibility: visible;
}

#scroll-line.is-particle-muted {
  opacity: 0.025 !important;
  transition: opacity 0.7s ease;
}

#tree-scroll-video,
.tree-video-source {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.tree-video-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.tree-particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  filter: saturate(1.05);
}

#tree-cards-overlay {
  position: fixed;
  inset: 0;
  z-index: 32;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#tree-cards-overlay.is-visible {
  visibility: visible;
  opacity: var(--tree-zone-alpha, 1);
}

body.tree-card-fish-active,
body.tree-card-fish-active * {
  cursor: none !important;
}

/* ── Diagonal stage: top-left → center → bottom-right ─────── */
.tree-cards-stage {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.world-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86vw, 660px);
  font-family: var(--font-hero);
  pointer-events: none;
  user-select: none;
  transform-origin: center center;
  opacity: 0;
  visibility: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.world-card.is-focused .world-card__frame {
  border-color: rgba(185, 225, 255, 0.85);
  box-shadow:
    0 0 64px rgba(90, 165, 255, 0.4),
    0 0 120px rgba(70, 140, 240, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.world-card.is-focused .world-card__title {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.world-card.is-ahead .world-card__frame,
.world-card.is-behind .world-card__frame {
  border-color: rgba(130, 165, 210, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.world-card__frame {
  position: relative;
  padding: 4px;
  border-radius: 22px;
  border: 1px solid rgba(150, 195, 245, 0.5);
  background:
    radial-gradient(ellipse 85% 65% at 22% 38%, rgba(140, 185, 255, 0.1) 0%, transparent 58%),
    linear-gradient(168deg, rgba(5, 12, 28, 0.72) 0%, rgba(8, 18, 40, 0.68) 100%);
  box-shadow: 0 0 32px rgba(60, 120, 200, 0.15);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  overflow: hidden;
}

.world-card__inner {
  padding: clamp(30px, 5.5vw, 48px) clamp(33px, 6vw, 54px) clamp(27px, 5vw, 42px);
  border-radius: 18px;
  border: 1px solid rgba(150, 190, 240, 0.2);
  text-align: center;
}

.world-card__eyebrow {
  position: absolute;
  left: 50%;
  bottom: calc(100% + clamp(22px, 3.5vh, 38px));
  z-index: 4;
  width: min(88vw, 620px);
  margin: 0;
  transform: translateX(-50%);
  font-size: clamp(0.92rem, 1.8vw, 1.12rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(208, 236, 255, 0.98);
  text-shadow:
    0 0 12px rgba(150, 210, 255, 0.58),
    0 0 28px rgba(90, 165, 235, 0.34);
  filter: drop-shadow(0 0 8px rgba(130, 195, 255, 0.32));
}

.world-card__title {
  font-size: clamp(2rem, 4.8vw, 3.05rem);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: 0.025em;
  color: #ffffff;
  margin: 0 0 12px;
}

/* Hero title — no card frame, crisp standalone headline */
.world-card--title-only {
  width: auto;
  max-width: min(92vw, 720px);
  text-align: center;
}

.world-card--title-only .world-card__title--hero {
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: 0.015em;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.world-card--opening .world-card__title--hero,
.world-card--closing .world-card__title--hero {
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 600;
  line-height: 1.18;
  max-width: min(96vw, 820px);
}

.world-card--closing .world-card__title--hero {
  line-height: 1.28;
}

.world-card__opening-copy {
  display: block;
  text-align: center;
}

.world-card__opening-line {
  white-space: nowrap !important;
}

.world-card__opening-arrow {
  display: inline-block;
  white-space: nowrap !important;
  font-weight: 500;
  line-height: 1;
  opacity: 0.92;
}

.world-card__stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.08em;
  margin: 0 0.04em;
  vertical-align: baseline;
  white-space: nowrap;
}

.world-card__stat-num {
  font-size: 1.55em;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

.world-card__stat-unit {
  font-size: 1.2em;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em;
}

.world-card--title-only.is-focused .world-card__title--hero {
  color: #ffffff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 0 1px rgba(255, 255, 255, 0.6);
}

.world-card__subtitle {
  font-size: clamp(1rem, 2.1vw, 1.22rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
  text-wrap: pretty;
  color: rgba(210, 222, 245, 0.94);
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.world-card.is-focused .world-card__subtitle {
  color: rgba(225, 235, 255, 0.98);
}

.world-card__closing-copy {
  display: block;
  text-align: center;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
}

.world-card__closing-line {
  display: inline;
  white-space: nowrap !important;
  word-break: keep-all;
}

.world-card__closing-to {
  display: inline;
  font-size: 0.72em;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap !important;
}

/* ── Scroll hint ───────────────────────────────────────────── */
.tree-cards-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(40px, 8vh, 80px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.tree-cards-hint.is-visible {
  visibility: visible;
}

.tree-cards-hint__text {
  font-family: var(--font-hero);
  font-size: clamp(0.9rem, 2.1vw, 1.05rem);
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  -webkit-font-smoothing: antialiased;
}

.tree-cards-hint__arrow {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.95);
  text-shadow:
    0 0 14px rgba(120, 190, 255, 0.7),
    0 1px 3px rgba(0, 0, 0, 0.5);
  animation: tree-cards-hint-bob 1.8s ease-in-out infinite;
}

@keyframes tree-cards-hint-bob {
  0%, 100% { transform: translateY(0); opacity: 0.75; }
  50% { transform: translateY(8px); opacity: 1; }
}

@media (max-width: 768px) {
  .world-card {
    top: 58%;
  }

  .world-card--opening,
  .world-card--closing {
    top: 50% !important;
    left: 50%;
    width: auto !important;
    max-width: 100vw;
  }

  .world-card--opening .world-card__title--hero,
  .world-card--opening .world-card__opening-copy {
    font-size: clamp(2.05rem, 7.2vw, 3.4rem) !important;
    font-weight: 600 !important;
    line-height: 1.28 !important;
    max-width: 100vw !important;
    margin: 0 auto;
    text-align: center;
  }

  /* Closing — bold but not oversized */
  .world-card--closing .world-card__title--hero,
  .world-card--closing .world-card__closing-copy {
    font-size: clamp(1.45rem, 5.2vw, 2.15rem) !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    max-width: 96vw !important;
    margin: 0 auto;
    text-align: center;
  }

  .world-card--opening .world-card__opening-line,
  .world-card--opening .world-card__opening-arrow,
  .world-card--closing .world-card__closing-line,
  .world-card--closing .world-card__closing-to {
    white-space: nowrap !important;
  }
}

@media (max-width: 620px) {
  .world-card {
    width: min(92vw, 520px);
  }

  .world-card__title {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .world-card__subtitle {
    font-size: clamp(0.78rem, 3.4vw, 0.95rem);
  }

  .world-card__inner {
    padding: 24px 22px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tree-cards-hint__arrow {
    animation: none;
  }
}
