/* ============================================================
   NATURE FRAME — STYLE.CSS
   Dark, minimal, distraction-free nature display
   ============================================================ */

/* ── CUSTOM PROPERTIES ──────────────────────────────────── */
:root {
  /* Timing */
  --fade-bg:    3s   ease-in-out;
  --ui-fade:    0.7s cubic-bezier(0.16, 1, 0.3, 1);
  --sp-slide:   0.45s cubic-bezier(0.16, 1, 0.3, 1);
  --interact:   180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Glass surface */
  --glass:      rgba(0, 0, 0, 0.62);
  --glass-brd:  rgba(255, 255, 255, 0.10);
  --glass-blur: blur(18px) saturate(1.6);

  /* Text */
  --txt:        rgba(255, 255, 255, 0.93);
  --txt-2:      rgba(255, 255, 255, 0.55);
  --txt-3:      rgba(255, 255, 255, 0.32);

  /* Buttons */
  --btn:        rgba(255, 255, 255, 0.07);
  --btn-hov:    rgba(255, 255, 255, 0.13);
  --btn-act:    rgba(255, 255, 255, 0.22);
  --btn-brd:    rgba(255, 255, 255, 0.12);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}
.hidden { display: none !important; }

/* ── LOADING SCREEN ──────────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1.2s ease;
}
#loading.fade-out { opacity: 0; pointer-events: none; }

.loading-inner { text-align: center; }
.loading-logo  { margin: 0 auto 18px; display: block; }
.loading-bar   {
  width: 80px; height: 2px;
  background: rgba(255,255,255,0.12);
  border-radius: 1px;
  margin: 0 auto;
  overflow: hidden;
}
.loading-progress {
  height: 100%;
  background: rgba(255,255,255,0.55);
  border-radius: 1px;
  animation: load-sweep 1.6s ease-in-out infinite;
}
@keyframes load-sweep {
  0%   { transform: translateX(-100%) scaleX(0.4); }
  50%  { transform: translateX(50%)   scaleX(0.6); }
  100% { transform: translateX(200%)  scaleX(0.4); }
}

/* ── CONTENT LAYERS (photos + video) ────────────────────── */
#content-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none; /* Never intercept clicks */
}

/* A / B crossfade layers */
.bg-layer {
  position: absolute;
  inset: 0;
  background-size:     cover;
  background-position: center center;
  background-repeat:   no-repeat;
  opacity: 0;
  transition: opacity var(--fade-bg);
  will-change: opacity;
}
#layer-a { opacity: 1; } /* starts visible */

/* YouTube cover container */
#video-wrap {
  position: absolute;
  /* Oversized to cover any aspect ratio — cropped by parent overflow:hidden */
  width:  max(100vw, calc(100vh * 1.7778)); /* 16/9 */
  height: max(100vh, calc(100vw * 0.5625)); /* 9/16 */
  top:  50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease;
}
#video-wrap.playing { opacity: 1; }

#yt-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* The iframe injected by YouTube API */
#yt-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}

/* ── VISUAL EFFECTS ──────────────────────────────────────── */
/* Vignette: draws eye to center like a real picture frame */
#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: radial-gradient(
    ellipse at 50% 50%,
    transparent 42%,
    rgba(0, 0, 0, 0.52) 100%
  );
  pointer-events: none;
  user-select: none;
}

/* Time-based tone overlay (updated by JS) */
#tone-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transition: background-color 90s ease; /* very slow, seamless */
}

/* ── UI OVERLAY ──────────────────────────────────────────── */
#ui {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  opacity: 1;
  transition: opacity var(--ui-fade);
}
#ui.ui-hidden {
  opacity: 0;
}
/* Only interactive children capture events when UI is visible */
#ui.ui-visible * { pointer-events: auto; }
#ui.ui-hidden  * { pointer-events: none !important; }

/* Cursor hide when UI is hidden */
body.hide-cursor,
body.hide-cursor * { cursor: none !important; }

/* ── TOP BAR ─────────────────────────────────────────────── */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px 48px;
  background: linear-gradient(to bottom,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0)    100%);
  pointer-events: auto;
}

#logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--txt-3);
  user-select: none;
  text-transform: uppercase;
}
#logo svg { opacity: 0.6; flex-shrink: 0; }

/* Clock */
#clock {
  text-align: right;
  user-select: none;
  font-style: normal;
}
#clock-time {
  display: block;
  font-family: 'Cormorant Garant', 'Georgia', serif;
  font-size: clamp(26px, 3.6vw, 52px);
  font-weight: 300;
  color: var(--txt);
  letter-spacing: 0.04em;
  line-height: 1;
  text-shadow: 0 2px 16px rgba(0,0,0,0.6);
}
#clock-date {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: clamp(10px, 1vw, 13px);
  font-weight: 300;
  color: var(--txt-2);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ── BOTTOM BAR ──────────────────────────────────────────── */
#bottom-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 48px 26px 22px;
  background: linear-gradient(to top,
    rgba(0,0,0,0.58) 0%,
    rgba(0,0,0,0)    100%);
  pointer-events: auto;
}

/* Content metadata */
#content-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  min-width: 0;
}
#meta-category {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--txt-3);
}
#meta-title {
  font-family: 'Cormorant Garant', 'Georgia', serif;
  font-size: clamp(15px, 1.8vw, 22px);
  font-weight: 300;
  color: rgba(255,255,255,0.68);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

/* ── CONTROLS ────────────────────────────────────────────── */
#controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ctrl-sep {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.14);
  margin: 0 3px;
}

/* Mode toggle (segmented pill) */
#mode-group {
  display: flex;
  align-items: center;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: var(--txt-2);
  transition:
    background var(--interact),
    color     var(--interact);
  white-space: nowrap;
}
.mode-btn:hover {
  background: var(--btn-hov);
  color: var(--txt);
}
.mode-btn.active {
  background: var(--btn-act);
  color: var(--txt);
}

/* Icon buttons */
#controls > button:not(.mode-btn) {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd);
  color: var(--txt-2);
  transition:
    background     var(--interact),
    color          var(--interact),
    border-color   var(--interact);
}
#controls > button:not(.mode-btn):hover {
  background: var(--btn-hov);
  color: var(--txt);
  border-color: rgba(255,255,255,0.2);
}
#controls > button[aria-pressed="true"] {
  background: var(--btn-act);
  color: var(--txt);
}

/* ── SETTINGS PANEL ──────────────────────────────────────── */
#settings-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  width: min(540px, 95vw);
  transform: translateX(-50%) translateY(calc(100% + 2px));
  background: rgba(8, 8, 8, 0.90);
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  border: 1px solid rgba(255,255,255,0.09);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  z-index: 50;
  pointer-events: auto;
  transition: transform var(--sp-slide);
  /* Prevent FOUC on load */
  visibility: hidden;
}
#settings-panel.sp-visible { visibility: visible; }
#settings-panel.sp-open    { transform: translateX(-50%) translateY(0); }

#settings-inner { padding: 10px 28px 34px; }

/* Drag handle */
.sp-handle {
  width: 34px; height: 3px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  margin: 12px auto 22px;
}

.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.sp-header h2 {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--txt);
  letter-spacing: 0.04em;
}
#btn-close-sp {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  color: var(--txt-2);
  transition: background var(--interact), color var(--interact);
}
#btn-close-sp:hover { background: rgba(255,255,255,0.14); color: var(--txt); }

/* Settings rows */
.sp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sp-row:last-of-type { border-bottom: none; }

.sp-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--txt-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
  min-width: 68px;
}
.sp-hint {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--txt-3);
}

/* Pill button groups */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--txt-2);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  transition:
    background   var(--interact),
    color        var(--interact),
    border-color var(--interact);
}
.pill:hover {
  background: rgba(255,255,255,0.12);
  color: var(--txt);
}
.pill.active {
  background: rgba(255,255,255,0.18);
  color: var(--txt);
  border-color: rgba(255,255,255,0.26);
}

/* Volume slider */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 220px;
}
#volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.88);
  cursor: pointer;
  transition: transform var(--interact), background var(--interact);
}
#volume-slider::-webkit-slider-thumb:hover {
  background: #fff;
  transform: scale(1.15);
}
#volume-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.88);
  border: none;
  cursor: pointer;
}
#volume-val {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--txt-3);
  min-width: 30px;
  text-align: right;
}

/* Settings footer hints */
.sp-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.sp-footer p {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--txt-3);
  line-height: 1.7;
  text-align: center;
  max-width: none;
}

/* ── FULLSCREEN ──────────────────────────────────────────── */
:fullscreen            { background: #000; }
:-webkit-full-screen   { background: #000; }
:-moz-full-screen      { background: #000; }

/* ── REDUCED MOTION ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .bg-layer       { transition: opacity 0.8s ease !important; }
  #ui             { transition: opacity 0.2s ease !important; }
  #settings-panel { transition: transform 0.2s ease !important; }
}

/* ── MOBILE ──────────────────────────────────────────────── */
@media (max-width: 620px) {
  .mode-btn span  { display: none; }
  #top-bar        { padding: 16px 18px 40px; }
  #bottom-bar     { padding: 40px 18px 16px; }
  #clock-time     { font-size: 30px; }
  #mode-group     { gap: 1px; }
  .mode-btn       { padding: 7px 10px; }
}
