/* ==========================================================================
   DOSE.FM — Main Stylesheet
   Table of contents:
     1. Root variables & safe-area insets
     2. Global reset & layout
     3. Shared utilities
     4. Video background
     5. Top controls (fixed header)
     6. Buttons (unified base + variants)
     7. About (logo, tooltip, overlay)
     8. Contribute overlay
     9. Archives dropdown
    10. Mini player (sticky bottom)
    11. Archive timeline / scrubber
    12. Connecting spinner
    13. Live indicator
    14. Large-screen tweaks
    15. Page layout (subpage wrappers and cards)
   ========================================================================== */


/* ==========================================================================
   1) Root variables & safe-area insets
   ========================================================================== */

:root {
  /* Safe-area (iOS notch / Dynamic Island) */
  --safe-top:    env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left:   env(safe-area-inset-left);
  --safe-right:  env(safe-area-inset-right);

  /* App viewport height (set by JS, fallback to 100vh) */
  --app-height: 100vh;
  --vh: 1vh;

  /* Colour palette */
  --bg-top:    #000;
  --bg-bottom: #1b1b1b;
  --text-main: #fff;
  --text-muted: rgba(255, 255, 255, 0.6);
  --muted:      rgba(255, 255, 255, 0.56);
  --accent:     rgba(255, 255, 255, 0.6);
  --live-accent: #ff0040;

  /* Surfaces */
  --glass-bg:       rgba(0, 0, 0, 0.04);
  --glass-bg-hover: rgba(0, 0, 0, 0.2);
  --glass-border:   rgba(255, 255, 255, 0.05);
  --glass-blur:     blur(4px);
  --overlay-bg:     rgba(0, 0, 0, 0.48);
  --dropdown-bg:    rgba(0, 0, 0, 0.56);
  --card-bg:        rgba(9, 9, 9, 0.1);

  /* Button tokens */
  --btn-bg:     rgba(9, 9, 9, 0.0);
  --btn-border: rgba(255, 255, 255, 0.04);
  --btn-text:   #fff;

  /* Video background */
  --hydra-opacity: 0.9;
  --hydra-blend:   screen;
  --bg-video-opacity: 0.9;
  --bg-video-blend:   add;
  --bg-poster-opacity: 0.9;
  --bg-poster-blend:   add;

  /* Typography */
  --font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, "Helvetica Neue", Arial;
  --font-sm:   0.88rem;
  --font-base: 0.95rem;
  --btn-font-size: 14px;
  --about-text-size:    0.95rem;
  --about-heading-size: 1.3rem;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:  10px;
  --radius-xl:  12px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.6);

  /* Motion */
  --transition:      180ms cubic-bezier(.2, .9, .2, 1);
  --transition-fast: 160ms ease;
  --transition-open: 220ms ease;
  --transition-card: 240ms cubic-bezier(.2, .9, .2, 1);

  /* Interaction */
  --tap-scale:    0.985;
  --min-tap-size: 44px;
  --focus-ring:   3px solid rgba(255, 255, 255, 0.07);

}


/* ==========================================================================
   2) Global reset & layout
   ========================================================================== */

html {
  background-color: #000;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  inset: 0;
  background: linear-gradient(to bottom, var(--bg-top), var(--bg-bottom));
  color: var(--btn-text);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-color: #000;
  z-index: 99999; /* Stays above all other elements */
  pointer-events: auto; /* Blocks clicks while loading */
  /* Adjust the 1.5s here to change the fade duration */
  transition: opacity 0.3s ease-in-out, visibility 0.3s;
}

/* This class is applied by Leptos once the app has mounted */
body.app-loaded::after {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#root {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
}

#root canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: cover;
}


/* ==========================================================================
   3) Shared utilities
   ========================================================================== */

/* Non-selectable / non-draggable (applied to interactive UI surfaces) */
.top-logo-wrap,
.brand-logo,
.top-nav {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}


/* ==========================================================================
   4) Background layers (poster + video + hydra)
   ========================================================================== */

/* Shared base for both poster img and video */
.bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(100% + 100px);
  height: calc(100% + 100px);
  margin: -50px;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-transform: translate3d(0, 0, 0);
}

/* Poster image — always visible behind video */
.bg-poster {
  z-index: 0;
  opacity: var(--bg-poster-opacity);
  mix-blend-mode: var(--bg-poster-blend);
}

/* Video player — hidden by default, fades in when audio plays */
.bg-player {
  z-index: 1;
  opacity: 0;
  transition: opacity 400ms ease;
}

.bg-player.bg-video--playing {
  opacity: var(--bg-video-opacity);
  mix-blend-mode: var(--bg-video-blend);
}

#page-bg-hydra {
  opacity: var(--hydra-opacity);
  mix-blend-mode: var(--hydra-blend);
  transition: opacity var(--transition);
}

/* ==========================================================================
   5) Top controls (fixed header bar)
   ========================================================================== */

.top-controls {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  transform: translateZ(0);
  padding-top: calc(var(--space-xl) + var(--safe-top));
  padding-left: calc(4vw + var(--safe-left));
  padding-right: calc(4vw + var(--safe-right));
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-md);
  pointer-events: none;
  z-index: 1000;
}

.top-logo-wrap {
  pointer-events: auto;
  position: relative;
  flex-shrink: 0;
}

.top-logo-wrap a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.top-spacer { flex: 1; }

.top-nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 var(--space-md);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: var(--btn-font-size);
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

/* leptos_router <A> auto-adds aria-current="page" on active route */
.top-nav a[aria-current="page"] {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}

@media (hover: hover) {
  .top-nav a:hover {
    /* box-shadow: var(--shadow-md); */
    border-color: var(--accent);
  }
}

/* — Top controls: mobile — */

@media (max-width: 768px) {
  .top-controls {
    padding-left: calc(4vw + var(--safe-left));
    padding-right: calc(4vw + var(--safe-right));
    padding-top: calc(2vw + var(--space-sm) + var(--safe-top));
    gap: var(--space-sm);
  }

  .top-nav {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px;
  }

  .top-nav a {
    height: var(--min-tap-size);
    padding: 0 5px;
    font-size: 13px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .top-controls {
    padding-top: calc(var(--space-xl) + var(--safe-top));
  }
}


/* ==========================================================================
   6) Buttons — unified base + variants
   ========================================================================== */

/* Shared button reset */
.mini-pause,
.back-live,
.archives-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  touch-action: manipulation;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* SVG icons inside buttons */
button svg,
.archives-play svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  fill: currentColor;
  display: inline-block;
}

/* Hover / focus / active — shared */
@media (hover: hover) {
  .archives-play:hover,
  .mini-pause:hover,
  .back-live:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
  }
}

.archives-play:active,
.mini-pause:active,
.back-live:active {
  transform: scale(var(--tap-scale));
  opacity: 0.98;
}

/* Disabled state — all buttons */
button[disabled],
.mini-pause[disabled],
.back-live[disabled],
.archives-play[disabled] {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

/* ── mini-pause / back-live (player controls) ── */

.mini-pause,
.back-live {
  padding: var(--space-sm) var(--space-md);
  height: 36px;
  min-width: 40px;
}

/* ── archives-play (play button in dropdown) ── */

.archives-play {
  padding: 6px var(--space-sm);
  border-radius: var(--radius-sm);
  height: 36px;
  min-width: 40px;
}

/* — Buttons: mobile — */

@media (max-width: 768px) {
  .archives-play,
  .mini-pause,
  .back-live {
    min-inline-size: var(--min-tap-size);
    min-block-size: var(--min-tap-size);
  }
}


/* ==========================================================================
   7) About — logo, tooltip, overlay
   ========================================================================== */

/* ── Logo wrapper ── */

.brand-logo {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 420ms cubic-bezier(.2, .9, .2, 1), box-shadow 420ms ease;
}

/* ── Short tooltip ── */

.about-tooltip {
  position: absolute;
  top: 50%;
  left: calc(100% + var(--space-sm));
  transform: translateY(-50%);
  min-width: 260px;
  max-width: 42vw;
  padding: 10px var(--space-md);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--btn-border);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.3;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 1100;
}

.about-tooltip.open {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(-50%) translateX(4px) !important;
}

/* ==========================================================================
   8) Unified Overlay System (About + Contribute)
   ========================================================================== */

/* Scroll Hint */
.uni-scroll-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10060;
  pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.uni-scroll-hint.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
}

/* ==========================================================================
   9) Archives dropdown
   ========================================================================== */

.archives-group {
  padding: 6px var(--space-xs);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.archives-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--btn-text);
  font-size: var(--font-base);
  background: transparent;
}

.archives-item:not(:last-child) { margin-bottom: 6px; }

@media (hover: hover) {
  .archives-item:hover { background: rgba(255, 255, 255, 0.02); }
}

/* — Archives: mobile — */

@media (max-height: 500px) and (orientation: landscape) {
  .archives-item { font-size: 0.8rem; }
}


/* ==========================================================================
   10) Mini player — three-state (idle / minimal / expanded)
   ========================================================================== */

/* Idle state — always-visible circular play button */
.mini-player-idle {
  position: fixed;
  left: calc(4vw + var(--safe-left) + 13px);
  bottom: calc(4vw + var(--safe-bottom) + 9px);
  z-index: 1400;
}

.mini-play-idle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: auto;
  min-width: 40px;
  height: 36px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: var(--btn-font-size);
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

@media (hover: hover) {
  .mini-play-idle:hover {
    border-color: var(--accent);
  }
}

/* Minimal state — one-line bar */
.mini-player--minimal {
  position: fixed;
  left: calc(4vw + var(--safe-left));
  bottom: calc(4vw + var(--safe-bottom));
  width: 360px;
  height: 60px;
  box-sizing: border-box;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: 1px solid var(--btn-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-xl);
  z-index: 1400;
  animation: mini-expand-width 0.3s cubic-bezier(0.2, 0.9, 0.2, 1);
  transform-origin: bottom left;
}

.mini-minimal-content-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.mini-player--minimal.reducing {
  animation: mini-collapse-height 0.35s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
  transform-origin: bottom left;
  display: flex;
  align-items: flex-end;
}

.mini-player--minimal.reducing .mini-minimal-content-wrapper {
  height: 60px;
  flex-shrink: 0;
}

.mini-player--minimal.stabilized {
  animation: none;
}

@keyframes mini-collapse-height {
  from {
    height: var(--collapse-from, 400px);
    width: 360px;
    opacity: 1;
  }
  to {
    height: 60px;
    width: 360px;
    opacity: 1;
  }
}

.mini-title--minimal {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.mini-progress-thin {
  flex: 1;
  min-width: 30%;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.mini-progress-thin-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  background: var(--live-accent);
  transition: width 100ms linear;
}

.mini-progress-thin-fill.live {
  background: rgba(255, 255, 255, 0.4);
}

/* Expanded state — panel with schedule + controls */
.mini-player--expanded {
  position: fixed;
  left: calc(4vw + var(--safe-left));
  bottom: calc(4vw + var(--safe-bottom));
  width: 360px;
  box-sizing: border-box;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--btn-border);
  box-shadow: var(--shadow-xl);
  z-index: 1400;
  overflow: hidden;
  animation: mini-expand-height 0.3s cubic-bezier(0.2, 0.9, 0.2, 1);
  transform-origin: bottom left;
}

.mini-player--expanded .mini-expanded-schedule,
.mini-player--expanded .mini-expanded-meta {
  opacity: 0;
  animation: mini-content-fade 0.35s ease forwards;
}

@keyframes mini-content-fade {
  0%, 50% { opacity: 0; }
  100% { opacity: 1; }
}

.mini-expanded-schedule {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mini-expanded-meta {
  flex-shrink: 0;
  padding: 4px var(--space-md) var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.mini-expanded-controls {
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.mini-title {
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-sub {
  font-size: var(--font-sm);
  color: var(--muted);
}

.mini-schedule-slot {
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.79rem;
  opacity: 0.65;
}

.mini-schedule-slot--now {
  opacity: 1;
  background: rgba(255, 0, 64, 0.08);
  border-left: 2px solid var(--live-accent);
  padding-left: 8px;
}

.mini-schedule-slot-time {
  font-size: 0.73rem;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.mini-schedule-separator {
  font-size: 0.7rem;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin: 2px 0;
  padding-left: 2px;
}

.mini-schedule-slot--now-title {
  display: block;
  font-size: 0.79rem;
  padding: 1px 0;
}

.mini-schedule-slot--now-title + .mini-schedule-slot--now-title {
  opacity: 0.65;
  font-style: italic;
}

.mini-reduce-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: var(--btn-font-size);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), border-color var(--transition);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

@media (hover: hover) {
  .mini-reduce-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow-md);
  }
}

.mini-reduce-btn:active {
  transform: scale(var(--tap-scale));
  opacity: 0.98;
}

@keyframes mini-expand-width {
  from { width: 60px; opacity: 0; }
  to { width: 360px; opacity: 1; }
}

@keyframes mini-expand-height {
  from { max-height: 60px; opacity: 0; }
  to { max-height: 75vh; opacity: 1; }
}

/* Mobile overrides */
@media (max-width: 768px) {
  .mini-player-idle {
    left: calc(4vw + var(--safe-left) + 13px);
    bottom: calc(4vw + var(--safe-bottom) + 12px);
  }

  .mini-player--minimal,
  .mini-player--expanded {
    left: calc(4vw + var(--safe-left));
    width: calc(92vw - var(--safe-right));
    bottom: calc(4vw + var(--safe-bottom));
    max-width: none;
  }
}

/* ==========================================================================
   11) Archive timeline / scrubber
   ========================================================================== */

.archive-timeline-wrapper {
  position: relative;
  flex: 1;
  height: 10px;
  display: flex;
  align-items: center;
  margin-top: 2px;
}

.archive-track {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-xs, 4px);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--btn-border);
  box-sizing: border-box;
  padding: 2px;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

.archive-progress {
  height: 100%;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255, 0, 64, 0.9), rgba(255, 0, 64, 0.6));
  transition: width 100ms linear;
}

.archive-click-catcher {
  position: absolute;
  width: 100%;
  height: 20px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 10;
  outline: none;
  touch-action: none;
}


/* ==========================================================================
   12) Connecting spinner
   ========================================================================== */

.connecting-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  height: 36px;
}

.connecting-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  transform-origin: center;
  animation: spin 1s linear infinite;
  color: var(--btn-text);
  opacity: 0.95;
}

.connecting-text {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 700;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* — Spinner: mobile — */

@media (max-width: 768px) {
  .connecting-wrap { height: var(--min-tap-size); }
}


/* ==========================================================================
   13) Live indicator
   ========================================================================== */

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--live-accent);
}

.live-dot {
  width: 10px;
  height: 10px;
  background: var(--live-accent);
  border-radius: 50%;
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.6; }
}


/* ==========================================================================
   14) Large-screen tweaks
   ========================================================================== */

@media (min-width: 900px) {
  .brand-logo { width: 64px; height: 64px; }
}

@media (min-width: 1200px) {
  .brand-logo { width: 72px; height: 72px; }
}


/* ==========================================================================
   15) Page layout — subpage wrappers and cards
   ========================================================================== */

.page-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: calc(91px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
  padding-left: calc(4vw + var(--safe-left));
  padding-right: calc(4vw + var(--safe-right));
  pointer-events: none;
  z-index: 900;
}

.page-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: var(--dynamic-card-width, min(860px, 100%));
  max-height: calc(100% - calc(var(--space-md) + var(--safe-bottom) + 28px));
  border-radius: var(--radius-xl);
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--btn-border);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.page-card-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 12px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  background: rgba(0, 0, 0, 0.1);
  gap: var(--space-md);
}

.page-card-header h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
}

.page-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: inherit;
  text-decoration: none;
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 150ms;
}
.page-close-btn:hover { opacity: 1; }

.page-card-body {
  flex-grow: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 22px 22px 22px;
  scroll-behavior: smooth;
}

.page-card-body--overflow {
  -webkit-mask-image: linear-gradient(
    to top,
    transparent 0px,
    black 48px,
    black calc(100% - 48px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0px,
    black 48px,
    black calc(100% - 48px),
    transparent 100%
  );
}

/* Reuse overlay body typography for page card content */
.page-card-body p,
.page-card-body ul,
.page-card-body li {
  color: var(--muted);
  font-size: var(--about-text-size);
  line-height: 1.55;
  margin-bottom: 14px;
}

.page-card-body h3 {
  margin: 24px 0 12px 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--btn-text);
}

.page-card-body a {
  color: #fff;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.page-card-body a:hover {
  color: var(--live-accent);
}

/* Schedule-specific */
.schedule-page .page-card-header {
  justify-content: center;
}

/* Scroll wrapper: contains the grid and clips the right-edge gradient hint */
.schedule-grid-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Fade the text opacity on both the left and right edges */
.schedule-grid-wrap--overflow {
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0px,
    black 48px,
    black calc(100% - 48px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0px,
    black 48px,
    black calc(100% - 48px),
    transparent 100%
  );
}

/* Multi-column schedule grid — always 7 columns.
   Scrolls horizontally when columns don't all fit the card width,
   and vertically when content exceeds the card height.
   Both axes scroll together so the whole week moves as one unit. */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(max-content, 1fr));
  gap: 0;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  align-items: start; /* columns take their natural content height, not the card height */
  position: relative;
  scroll-behavior: smooth;
}

.schedule-column {
  padding: var(--space-sm) var(--space-md);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  min-width: 0;
  /* No per-column overflow — full content shown; the grid scrolls as a unit */
}

.schedule-column:last-child {
  border-right: none;
}

.schedule-column-header {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 4px;
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.schedule-column .schedule-slot {
  padding: 4px 0;
  border-bottom: none;
}

.schedule-column .schedule-slot-time {
  font-size: 0.72rem;
  min-width: auto;
}

.schedule-column .schedule-slot-title {
  font-size: 0.78rem;
}

.schedule-slot {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.schedule-slot--now .schedule-slot-time {
  font-weight: 0.79rem;
  opacity: 1
}

.schedule-slot--now .schedule-slot-title {
  color: var(--text-main);
  opacity: 1;
}

.schedule-slot-time {
  flex-shrink: 0;
  min-width: 110px;
  font-variant-numeric: tabular-nums;
  font-size: var(--font-sm);
  opacity: 0.7;
}

.schedule-slot-title {
  font-size: var(--font-sm);
  color: var(--muted);
}

.schedule-empty {
  padding: var(--space-xl);
  text-align: center;
  opacity: 0.6;
  font-size: var(--font-sm);
}

.schedule-loading {
  padding: var(--space-xl) 0;
  display: flex;
  justify-content: center;
}

/* Spinner — reuses @keyframes spin defined above */
.schedule-spinner {
  display: block;
  width: 22px;
  height: 22px;
  color: var(--muted);
  animation: spin 0.9s linear infinite;
  opacity: 0.55;
}

/* Mobile */
@media (max-width: 768px) {
  .page-wrapper {
    padding-top: calc(75px + var(--safe-top));
    align-items: flex-start;
    justify-content: flex-end;
  }

  .page-card {
    width: 100%;
    max-height: calc(100% - var(--dynamic-player-height) + 10px);;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .page-wrapper {
    padding-top: calc(60px + var(--safe-top));
  }
}


/* ==========================================================================
   16. Reduced-motion (accessibility + performance)
   ========================================================================== */

/* When the OS "Reduce Motion" accessibility setting is enabled:
   - Disable all CSS transitions and animations (prevents motion sickness,
     improves battery life on low-power devices).
   - Hide background video/poster entirely.  Combined with preload="none" on
     the <video> element, this guarantees the ~1.6 MB video is never fetched
     at all for users with reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .bg-video,
  .bg-poster {
    display: none;
  }
}
