/* SYLVA v2 — atmospheric scene deck and ray-of-light layer. */
.sylva-scene-deck {
  position: absolute;
  z-index: 3;
  inset: -6%;
  overflow: hidden;
  pointer-events: none;
  background: #091711;
}

.sylva-scene-deck::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 12, 8, .48), transparent 43%, rgba(3, 12, 8, .22)),
    linear-gradient(180deg, rgba(3, 12, 8, .16), transparent 32%, rgba(1, 8, 5, .62));
  mix-blend-mode: multiply;
}

.sylva-scene-deck::after {
  position: absolute;
  z-index: 3;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(ellipse at 67% 28%, rgba(221, 230, 202, .14), transparent 24%),
    radial-gradient(ellipse at center, transparent 42%, rgba(0, 7, 5, .42) 100%);
  mix-blend-mode: screen;
}

.sylva-scene-frame {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 5.8s cubic-bezier(.2, .7, .2, 1);
  will-change: opacity;
}

.sylva-scene-frame.is-active { opacity: 1; }

.sylva-scene-frame.is-entering img {
  animation: sylva-scene-fade-in 7.2s cubic-bezier(.2, .72, .2, 1) both;
}

.sylva-scene-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--scene-position, center center);
  filter: saturate(.72) contrast(1.08) brightness(.66);
  transform: translate3d(var(--scene-x, 0px), var(--scene-y, 0px), 0) scale(1.075);
  transition: object-position 1.6s ease;
  will-change: transform;
}

.sylva-scene-frame--a img { filter: saturate(.75) contrast(1.06) brightness(.69); }
.sylva-scene-frame--b img { filter: saturate(.62) contrast(1.10) brightness(.63); }

/* The old reference layers remain in the package for backwards compatibility,
   but the v2 scene deck is now the visual source of truth. */
.sylva-layer { opacity: 0 !important; }

.sylva-ray-system {
  position: absolute;
  z-index: 9;
  inset: -2%;
  pointer-events: none;
  opacity: .82;
  transition: opacity 1.5s ease;
  mix-blend-mode: screen;
}

.sylva-shell.is-rays-off .sylva-ray-system { opacity: 0; }

#sylva-ray-canvas {
  display: block;
  width: 100%;
  height: 100%;
  filter: blur(1px);
}

.sylva-ray-source {
  position: absolute;
  top: 13%;
  left: 68%;
  width: clamp(70px, 11vw, 170px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244, 244, 213, .36) 0%, rgba(218, 230, 194, .12) 28%, transparent 70%);
  filter: blur(8px);
  opacity: .64;
  transform: translate(-50%, -50%);
  animation: sylva-ray-source-breathe 13s ease-in-out infinite;
}

.sylva-shell.is-rays-off .sylva-ray-source { opacity: 0; }

.sylva-oxygen-field {
  position: absolute;
  z-index: 10;
  right: clamp(12%, 18vw, 27%);
  bottom: 9%;
  width: 164px;
  height: 188px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.2s ease;
}

.sylva-shell.has-entered .sylva-oxygen-field { opacity: .54; }

.sylva-oxygen-bubble {
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(231, 242, 218, .34);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, rgba(247, 250, 230, .26), rgba(210, 231, 207, .06) 42%, transparent 73%);
  box-shadow: 0 0 18px rgba(214, 236, 208, .09), inset 0 0 7px rgba(240, 246, 221, .12);
  opacity: 0;
  animation: sylva-oxygen-rise 12s cubic-bezier(.32, .05, .22, 1) infinite;
}

.sylva-oxygen-bubble--a { margin-left: -42px; width: 8px; height: 8px; animation-delay: -2.6s; }
.sylva-oxygen-bubble--b { margin-left: -12px; width: 14px; height: 14px; animation-delay: -7.4s; animation-duration: 15s; }
.sylva-oxygen-bubble--c { margin-left: 25px; width: 6px; height: 6px; animation-delay: -10.8s; animation-duration: 10s; }
.sylva-oxygen-bubble--d { margin-left: 48px; width: 11px; height: 11px; animation-delay: -5.2s; animation-duration: 17s; }

.sylva-oxygen-label {
  position: absolute;
  right: 0;
  bottom: 0;
  color: rgba(230, 240, 220, .42);
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sylva-ray-button[aria-pressed="true"] {
  border-color: rgba(232, 236, 204, .40);
  background: rgba(71, 83, 57, .42);
}

.sylva-control-icon--ray::before { content: "✧"; font-size: 14px; }

.sylva-scene-label { transition: opacity .7s ease; }

@keyframes sylva-ray-source-breathe {
  0%, 100% { opacity: .42; transform: translate(-50%, -50%) scale(.88); }
  48% { opacity: .78; transform: translate(-50%, -50%) scale(1.12); }
}

@keyframes sylva-scene-fade-in {
  0% {
    opacity: 0;
    filter: saturate(.42) contrast(1.02) brightness(.46) blur(8px);
    transform: translate3d(var(--scene-x, 0px), var(--scene-y, 0px), 0) scale(1.13);
  }
  42% {
    opacity: .72;
    filter: saturate(.58) contrast(1.04) brightness(.56) blur(2.4px);
  }
  100% {
    opacity: 1;
    filter: saturate(.72) contrast(1.08) brightness(.66) blur(0);
    transform: translate3d(var(--scene-x, 0px), var(--scene-y, 0px), 0) scale(1.075);
  }
}

@keyframes sylva-oxygen-rise {
  0% { opacity: 0; transform: translate3d(-10px, 12px, 0) scale(.68); }
  14% { opacity: .62; }
  74% { opacity: .24; transform: translate3d(11px, -126px, 0) scale(1); }
  100% { opacity: 0; transform: translate3d(21px, -176px, 0) scale(1.18); }
}

@media (max-width: 720px) {
  .sylva-ray-system { opacity: .62; }
  .sylva-ray-source { top: 17%; left: 69%; }
  .sylva-scene-frame img { transform: translate3d(var(--scene-x, 0px), var(--scene-y, 0px), 0) scale(1.11); }
  .sylva-oxygen-field { right: 12%; bottom: 15%; transform: scale(.82); transform-origin: right bottom; }
}

@media (prefers-reduced-motion: reduce) {
  .sylva-scene-frame { transition: none; }
  .sylva-scene-frame.is-entering img { animation: none; }
  .sylva-ray-source { animation: none; }
  .sylva-oxygen-bubble { animation: none; opacity: .28; }
}
