/* ============================================================
   Seroscape — dark calm swipe feed styles
   Mobile-first, dark theme, Ken Burns animations
   ============================================================ */

/* === Reset + Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  color: #eee;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}

/* === CSS Variables === */
:root {
  --accent: #d4a017;
  --bg: #0a0a0a;
  --surface: rgba(10,10,10,0.85);
  --bar-h: 56px;
  --text: #eee;
  --muted: #888;
  --radius: 16px;
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
#splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  cursor: pointer;
}

#splash.hidden {
  animation: splash-fade-out 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes splash-fade-out {
  to { opacity: 0; transform: scale(1.04); }
}

.splash-logo-box {
  width: min(260px, 70vw);
  background: rgba(255,255,255,0.04);
  border-radius: 24px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}

.splash-logo-box img {
  width: 100%;
  max-width: 180px;
  border-radius: 12px;
  object-fit: contain;
  background: #0a0a0a;
}

.splash-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #eee;
}

.splash-tap {
  font-size: 15px;
  color: var(--muted);
  animation: pulse-gentle 2s ease-in-out infinite;
}

@keyframes pulse-gentle {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ============================================================
   FEED — full-screen vertical swipe container
   ============================================================ */
#feed-container {
  position: fixed;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--bar-h);
}
#feed-container::-webkit-scrollbar { display: none; }

/* ============================================================
   SCENE CARD
   ============================================================ */
.scene-card {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #0a0a0a;
  flex-shrink: 0;
}

/* Image layer — will fill card, Ken Burns animates this */
.scene-image-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0a0a0a;
}

.scene-image {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  object-fit: cover;
  /* Ken Burns: transform-origin center, animation applied by JS */
  will-change: transform;
  transform-origin: center center;
}

/* Loading state: blurred thumbnail + pulse */
.scene-card.loading .scene-image {
  filter: blur(24px) brightness(0.7);
  animation: image-loading-pulse 1.5s ease-in-out infinite;
}
.scene-card.loaded .scene-image {
  filter: none;
  transition: filter 0.6s ease;
}

@keyframes image-loading-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 0.9; }
}

/* Bottom gradient overlay */
.scene-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 80px 20px calc(var(--bar-h) + 16px);
  background: linear-gradient(transparent, rgba(0,0,0,0.78) 40%, rgba(0,0,0,0.92) 100%);
  pointer-events: none;
}

.scene-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 6px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.scene-description {
  font-size: 14px;
  color: rgba(238,238,238,0.8);
  line-height: 1.5;
  margin-bottom: 10px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

.scene-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scene-tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.12);
  color: rgba(238,238,238,0.7);
  backdrop-filter: blur(4px);
}

/* ============================================================
   BOTTOM CONTROL BAR — fixed, shared across all scenes
   ============================================================ */
.control-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.07);
  gap: 0;
}

.ctrl-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  background: none;
  border: none;
  color: rgba(238,238,238,0.85);
  font-size: 22px;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.auth-initial {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #d4a017;
  color: #0a0a0a;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-width: 0;
}
.ctrl-btn:active { background: rgba(255,255,255,0.1); color: #fff; }
.ctrl-btn.active { color: var(--accent); }
.ctrl-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Volume control (shown on volume btn long-press / tap) */
.volume-wrap {
  position: absolute;
  bottom: calc(var(--bar-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,10,10,0.9);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(12px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.volume-wrap.visible { opacity: 1; pointer-events: auto; }

.volume-label { font-size: 12px; color: var(--muted); }

#vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
#vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
#vol-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* ============================================================
   SLEEP TIMER MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.sleep-modal {
  background: #141414;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 36px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}
.modal-backdrop.visible .sleep-modal {
  transform: translateY(0);
}

.sleep-modal h3 {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

.sleep-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.sleep-opt {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 14px 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.sleep-opt:hover, .sleep-opt:active { background: rgba(212,160,23,0.15); border-color: var(--accent); color: var(--accent); }
.sleep-opt.active { background: rgba(212,160,23,0.2); border-color: var(--accent); color: var(--accent); }

.sleep-cancel {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  padding: 8px;
  text-align: center;
}

/* Sleep countdown badge (shown in bottom bar when timer running) */
.sleep-badge {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}

/* ============================================================
   GOODNIGHT SCREEN
   ============================================================ */
#goodnight {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 3s ease;
  cursor: pointer;
}
#goodnight.visible {
  opacity: 1;
  pointer-events: auto;
}
#goodnight h2 {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: rgba(238,238,238,0.6);
}
#goodnight p {
  font-size: 14px;
  color: rgba(238,238,238,0.3);
}

/* ============================================================
   AUTH BUTTON (bottom-right corner)
   ============================================================ */
#auth-btn {
  position: fixed;
  bottom: calc(var(--bar-h) + 12px);
  right: 12px;
  z-index: 100;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(20,20,20,0.85);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
#auth-btn:hover { color: var(--text); background: rgba(40,40,40,0.9); }
#auth-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
   KEN BURNS @keyframes
   ============================================================ */

/* 0 — ZOOM_IN: very slow, subtle zoom in and back */
@keyframes kb-zoom-in {
  0%   { transform: scale(1.0); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1.0); }
}

/* 1 — ZOOM_OUT: start slightly zoomed, ease out and back */
@keyframes kb-zoom-out {
  0%   { transform: scale(1.08); }
  50%  { transform: scale(1.0); }
  100% { transform: scale(1.08); }
}

/* 2 — PAN_LEFT: gentle drift left and back */
@keyframes kb-pan-left {
  0%   { transform: scale(1.04) translate(2%, 0%); }
  50%  { transform: scale(1.04) translate(-2%, 0%); }
  100% { transform: scale(1.04) translate(2%, 0%); }
}

/* 3 — PAN_RIGHT: gentle drift right and back */
@keyframes kb-pan-right {
  0%   { transform: scale(1.04) translate(-2%, 0%); }
  50%  { transform: scale(1.04) translate(2%, 0%); }
  100% { transform: scale(1.04) translate(-2%, 0%); }
}

/* 4 — DRIFT_DIAGONAL: barely perceptible diagonal float */
@keyframes kb-drift-diagonal {
  0%   { transform: scale(1.02) translate(1.5%, 1%); }
  50%  { transform: scale(1.06) translate(-1.5%, -1%); }
  100% { transform: scale(1.02) translate(1.5%, 1%); }
}

/* 5 — ZOOM_PAN_COMBO: slow compound drift */
@keyframes kb-zoom-pan-combo {
  0%   { transform: scale(1.0) translate(0%, 0%); }
  33%  { transform: scale(1.05) translate(-1.5%, -1%); }
  66%  { transform: scale(1.08) translate(1%, 0.5%); }
  100% { transform: scale(1.0) translate(0%, 0%); }
}

/* Ken Burns CSS classes (applied to .scene-image) */
.kb-zoom-in          { animation: kb-zoom-in          var(--kb-duration, 30s) ease-in-out infinite; }
.kb-zoom-out         { animation: kb-zoom-out         var(--kb-duration, 30s) ease-in-out infinite; }
.kb-pan-left         { animation: kb-pan-left         var(--kb-duration, 30s) ease-in-out infinite; }
.kb-pan-right        { animation: kb-pan-right        var(--kb-duration, 30s) ease-in-out infinite; }
.kb-drift-diagonal   { animation: kb-drift-diagonal   var(--kb-duration, 30s) ease-in-out infinite; }
.kb-zoom-pan-combo   { animation: kb-zoom-pan-combo   var(--kb-duration, 30s) ease-in-out infinite; }

/* Paused state */
.kb-paused { animation-play-state: paused !important; }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
#toast {
  position: fixed;
  bottom: calc(var(--bar-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,0.95);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 14px;
  z-index: 800;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
}
#toast.show { opacity: 1; }

/* ============================================================
   MISC
   ============================================================ */

/* Accent tint overlay (optional — applied per scene via JS) */
.scene-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity 0.5s;
}

/* Favorite animation: quick heart pop */
@keyframes heart-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.5); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.ctrl-btn.heart-pop { animation: heart-pop 0.35s ease; }

/* Desktop: no layout changes needed — same full-viewport as mobile */

/* ============================================================
   Desktop nav arrows — visible only on non-touch devices
   ============================================================ */
.nav-arrow {
  display: none;
  position: fixed;
  z-index: 200;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  color: #ccc;
  font-size: 24px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  align-items: center;
  justify-content: center;
}
.nav-arrow:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.nav-arrow-up { top: 16px; }
.nav-arrow-down { bottom: 80px; }

@media (min-width: 769px) {
  .nav-arrow { display: flex; }
}
