/* static/viewer.css */

:root{
  --bg0: #050b1a;
  --bg1: #07122b;
  --panel: rgba(10, 22, 54, 0.82);
  --panel2: rgba(10, 22, 54, 0.55);
  --line: rgba(255,255,255,0.10);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.72);

  --btn-bg: rgba(255,255,255,0.08);
  --btn-bg-hover: rgba(255,255,255,0.13);
  --btn-line: rgba(255,255,255,0.14);

  --radius: 16px;
  --topbar-h: 72px;
  --banner-gap: 10px;
}

*{ box-sizing: border-box; }

html, body{
  height: 100%;
}

body{
  margin: 0;
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% 10%, #0b1b44 0%, transparent 60%),
              radial-gradient(900px 700px at 85% 20%, #0a254a 0%, transparent 55%),
              linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 100%);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  overflow-x: hidden;
}

/* Top bar */
#topbar{
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;

  background: var(--panel);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#topbar .name{
  font-weight: 800;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}

#topbar .hint{
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}

/* Festive banner */
#festiveBanner{
  position: fixed;
  top: calc(var(--topbar-h) + var(--banner-gap));
  left: 12px;
  right: 12px;
  z-index: 95;

  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.16);
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.06) 70%);
  box-shadow: 0 10px 40px rgba(0,0,0,0.30);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  font-weight: 800;
  letter-spacing: 0.2px;
  text-align: center;
}

/* Buttons */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  user-select: none;

  font-weight: 700;
  font-size: 13px;

  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn:hover{
  background: var(--btn-bg-hover);
  border-color: rgba(255,255,255,0.22);
}

.btn:active{
  transform: translateY(1px);
}

/* Stage / media */
.stage{
  position: relative;                 /* required for overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 100vh;

  /* leave space for topbar (+ optional banner) */
  padding-top: calc(var(--topbar-h) + 22px);
}

/* If banner exists, add extra space (JS toggles body.hasBanner if you want,
   but we can keep it simple by just giving a little headroom always). */
@media (min-width: 600px){
  .stage{
    padding-top: calc(var(--topbar-h) + 34px);
  }
}

/* Media element */
#media{
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - var(--topbar-h) - 32px);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 18px 70px rgba(0,0,0,0.45);
  background: rgba(0,0,0,0.25);

  object-fit: contain;
  cursor: zoom-in;
}

/* Better default sizing for video/audio */
video#media{
  background: #000;
}

audio#media{
  width: min(720px, calc(100vw - 40px));
  max-height: none;
  border-radius: 16px;
  cursor: default;
}

.audioWrap{
  width: min(760px, calc(100vw - 40px));
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  box-shadow: 0 18px 70px rgba(0,0,0,0.35);
}

/* Zoom mode (viewer.js toggles body.zoomed) */
body.zoomed{
  overflow: hidden;
}

body.zoomed #topbar,
body.zoomed #festiveBanner{
  display: none;
}

body.zoomed .stage{
  padding: 0;
}

body.zoomed #media{
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  border: none;
  box-shadow: none;
  cursor: zoom-out;
}

/* Click-to-unmute overlay (video only) */
.unmuteOverlay{
  position: absolute;
  inset: 0;
  display: none;              /* shown by JS while muted */
  align-items: center;
  justify-content: center;
  pointer-events: none;       /* let clicks pass through except the button */
}

.unmuteOverlay .btn{
  pointer-events: auto;       /* button remains clickable */
  border-radius: 18px;
  padding: 12px 16px;
  font-weight: 900;
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.26);
  box-shadow: 0 14px 60px rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Mobile tweaks */
@media (max-width: 520px){
  #topbar{
    height: 86px;
    padding: 10px 12px;
    align-items: flex-start;
  }
  :root{ --topbar-h: 86px; }
  #topbar .name, #topbar .hint{ max-width: 74vw; }
  #media{
    max-height: calc(100vh - var(--topbar-h) - 22px);
  }
}
