/*!
 * SonnRays Living Viewer — living-viewer.css
 * Full-screen Spark viewer overlay. Standalone (no site CSS required) and
 * tuned to the site's dark, gold-accented aesthetic (#0b0e16 / #f1c84b).
 * Law: no cropped heads anywhere — every portrait surface is contain.
 * Safe-area aware; 100dvh with 100vh fallback; iOS Safari first.
 */

.lv-overlay {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 10000; /* above .sr-lightbox (9999): the viewer supersedes it */
  display: flex;
  flex-direction: column;
  background: #06070c;
  color: #f5efe2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  opacity: 0;
  transition: opacity 0.28s ease;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
.lv-overlay[hidden] { display: none; }
.lv-overlay.open { opacity: 1; }
.lv-overlay * { box-sizing: border-box; }

/* ---- blurred ambience backdrop (decorative layer; the Spark itself is
        the contain-fitted media in the stage, never this layer) ---- */
.lv-bg { position: absolute; inset: 0; overflow: hidden; }
.lv-bg-img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: blur(36px) saturate(1.25) brightness(0.75);
  -webkit-filter: blur(36px) saturate(1.25) brightness(0.75);
  transform: scale(1.3);
  opacity: 0.55;
}
.lv-scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 38%, rgba(6,7,12,0.05) 0%, rgba(6,7,12,0.55) 78%),
    linear-gradient(to bottom, rgba(6,7,12,0.35), rgba(6,7,12,0.1) 30%, rgba(6,7,12,0.72) 100%);
}

/* ---- stage ---- */
.lv-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(64px + env(safe-area-inset-top, 0px))
    calc(12px + env(safe-area-inset-right, 0px))
    8px
    calc(12px + env(safe-area-inset-left, 0px));
  touch-action: none; /* the viewer owns every gesture while open */
}
.lv-media {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 860px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lv-still,
.lv-video {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* THE LAW: whole Spark, head included, always */
  border-radius: 18px;
}
.lv-still { filter: drop-shadow(0 24px 60px rgba(0, 0, 0, 0.6)); }
.lv-video {
  opacity: 0;
  transition: opacity 0.45s ease;
  background: transparent;
}
.lv-overlay.is-live .lv-video { opacity: 1; }
.lv-overlay.is-live .lv-still { opacity: 0; }
.lv-still { transition: opacity 0.45s ease; }

/* slide/fade on navigate */
@keyframes lvInNext { from { opacity: 0; transform: translateX(42px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes lvInPrev { from { opacity: 0; transform: translateX(-42px) scale(0.985); } to { opacity: 1; transform: none; } }
.lv-media.lv-anim.lv-slide-next { animation: lvInNext 0.32s cubic-bezier(0.22, 0.8, 0.3, 1); }
.lv-media.lv-anim.lv-slide-prev { animation: lvInPrev 0.32s cubic-bezier(0.22, 0.8, 0.3, 1); }

/* ---- buttons ---- */
.lv-btn {
  position: absolute;
  z-index: 3;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 11, 18, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 0 0 3px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.lv-btn:hover { background: rgba(28, 26, 18, 0.8); border-color: rgba(241, 200, 75, 0.65); }
.lv-btn:active { transform: scale(0.94); }
.lv-close {
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  font-size: 30px;
}
.lv-prev { left: calc(10px + env(safe-area-inset-left, 0px)); top: 50%; transform: translateY(-50%); }
.lv-next { right: calc(10px + env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); }
.lv-prev:active { transform: translateY(-50%) scale(0.94); }
.lv-next:active { transform: translateY(-50%) scale(0.94); }

/* ---- play affordance (reduced motion / autoplay refused) ---- */
.lv-play {
  position: absolute;
  z-index: 2;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 2px solid rgba(241, 200, 75, 0.85);
  background: rgba(8, 8, 14, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #f1c84b;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lv-play[hidden] { display: none; }
.lv-play-glyph { font-size: 30px; margin-left: 5px; }
.lv-play:active { transform: translate(-50%, -50%) scale(0.95); }

/* ---- caption / identity block ---- */
.lv-caption {
  position: relative;
  z-index: 2;
  text-align: center;
  padding:
    10px
    calc(20px + env(safe-area-inset-right, 0px))
    calc(18px + env(safe-area-inset-bottom, 0px))
    calc(20px + env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, rgba(4, 5, 9, 0.88) 55%, rgba(4, 5, 9, 0));
}
.lv-counter {
  margin: 0 0 2px;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: rgba(245, 239, 226, 0.55);
}
.lv-name { margin: 0; font-size: clamp(1.5rem, 5.4vw, 2.1rem); font-weight: 800; letter-spacing: 0.01em; }
.lv-name-link { color: #fff; text-decoration: none; }
.lv-name-link:hover { color: #f1c84b; }
.lv-hook {
  margin: 5px auto 0;
  max-width: 520px;
  font-style: italic;
  font-size: 0.98rem;
  color: rgba(245, 239, 226, 0.75);
}
.lv-meet {
  display: inline-block;
  margin-top: 14px;
  padding: 12px 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f3d189, #d9ab52);
  color: #1a1408;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(217, 171, 82, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.lv-meet:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(217, 171, 82, 0.45); }
.lv-meet:active { transform: scale(0.97); }

/* ---- focus + screen readers ---- */
.lv-overlay :focus-visible {
  outline: 2px solid #f1c84b;
  outline-offset: 3px;
}
.lv-sr-live {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- small screens: slimmer edge buttons so the Spark gets the room ---- */
@media (max-width: 520px) {
  .lv-btn { width: 44px; height: 44px; font-size: 23px; }
  .lv-close { font-size: 27px; }
  .lv-stage { padding-top: calc(58px + env(safe-area-inset-top, 0px)); }
}

/* ---- reduced motion: no slides, no fades ---- */
@media (prefers-reduced-motion: reduce) {
  .lv-overlay, .lv-video, .lv-still, .lv-btn, .lv-meet { transition: none; }
  .lv-media.lv-anim { animation: none; }
}
