/* Grumpy's Movies — 1980s CRT / VHS living-room theme (logo-matched) */
@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600;700&family=Limelight&family=Share+Tech+Mono&display=swap");

:root {
  --bg: #100c0a;
  --bg-2: #1a1210;
  --panel: #221814;
  --panel-2: #2c1c16;
  --text: #f0e6d4;
  --muted: #a89880;
  --accent: #c4783a;
  --accent-2: #e8b86d;
  --accent-deep: #8a4520;
  --ring: rgba(196, 120, 58, 0.45);
  --border: rgba(240, 230, 212, 0.12);
  --phosphor: #e8b86d;
  --crt-glow: rgba(232, 184, 109, 0.14);
  --radius: 4px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  --font-display: "Limelight", "Courier New", serif;
  --font-ui: "Chakra Petch", "Segoe UI", sans-serif;
  --font-mono: "Share Tech Mono", "Consolas", monospace;
}

html {
  color-scheme: dark;
}

body.theme-crt,
html.theme-crt body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

/* Warm room light + CRT vignette */
body.theme-crt::before,
.theme-crt-root::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 520px at 18% 0%, rgba(196, 120, 58, 0.20), transparent 58%),
    radial-gradient(700px 480px at 92% 12%, rgba(232, 184, 109, 0.10), transparent 55%),
    radial-gradient(120% 90% at 50% 40%, transparent 40%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(180deg, #1a100c 0%, var(--bg) 35%, #0a0706 100%);
  pointer-events: none;
  z-index: 0;
}

/* Scanlines */
body.theme-crt::after,
.theme-crt-root::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.18) 0px,
      rgba(0, 0, 0, 0.18) 1px,
      transparent 1px,
      transparent 3px
    );
  opacity: 0.35;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: multiply;
  animation: crt-scan-drift 12s linear infinite;
}

@keyframes crt-scan-drift {
  from { background-position: 0 0; }
  to { background-position: 0 12px; }
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.92; }
  94% { opacity: 1; }
  97% { opacity: 0.96; }
}

@keyframes phosphor-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 184, 109, 0.0), 0 10px 28px rgba(138, 69, 32, 0.35); }
  50% { box-shadow: 0 0 18px 2px rgba(232, 184, 109, 0.22), 0 12px 32px rgba(138, 69, 32, 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  body.theme-crt::after,
  .theme-crt-root::after {
    animation: none;
  }
}

/* Keep page content above the CRT vignette (fixed ::before at z-index 0).
   Without this, shells like .room-page paint underneath and look blank.
   Do NOT apply to fixed overlays (player) — relative would pin them in document flow. */
.theme-crt .wrap,
.theme-crt .app-shell,
.theme-crt .party-page,
.theme-crt .tv-app,
.theme-crt .room-page,
.theme-crt .app {
  position: relative;
  z-index: 1;
}

body.theme-crt > *:not(script):not(style):not(.player-overlay):not(.site-banner-ad):not(.pwa-install-banner):not(.fm-modal):not(.site-modal-overlay) {
  position: relative;
  z-index: 1;
}

/* Fullscreen player must stay fixed over the CRT chrome */
.theme-crt .player-overlay,
body.theme-crt > .player-overlay {
  position: fixed !important;
  inset: 0;
  z-index: 10000 !important;
}

.theme-crt h1,
.theme-crt h2,
.theme-crt .brand-title,
.theme-crt .display-font {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-weight: 400;
}

.theme-crt .mono,
.theme-crt code,
.theme-crt .ver,
.theme-crt .eyebrow {
  font-family: var(--font-mono);
}

.theme-crt .btn.primary,
.theme-crt button.primary {
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 48%, var(--accent-deep) 100%);
  color: #1a100c;
  border: 1px solid rgba(240, 230, 212, 0.35);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: phosphor-pulse 3.6s ease-in-out infinite;
}

.theme-crt .btn.primary:hover,
.theme-crt button.primary:hover {
  filter: brightness(1.06);
}

/* Brand mark — real logo art (not a letter chip) */
.theme-crt .brand {
  gap: 10px;
}

.theme-crt .brand-mark,
.theme-crt img.logo,
.theme-crt .logo.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
  flex: 0 0 auto;
  background: #0a0706 !important;
  box-shadow:
    0 0 0 1px rgba(232, 184, 109, 0.35),
    0 0 14px rgba(196, 120, 58, 0.35) !important;
  color: transparent !important;
  font-size: 0 !important;
}

.theme-crt .brand-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--text);
}

.theme-crt .brand-wordmark em {
  font-style: normal;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.14em;
}

.theme-crt .brand-wordmark .domain {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: lowercase;
  margin-top: 2px;
}

/* ── Shared video-store / broadcast-console system ───────────── */
:root {
  --shelf: #1c1410;
  --bezel: #3a2a20;
  --ticket: #f0e6d4;
  --led-live: #d4542a;
  --led-ok: #7a9e5a;
  --focus-ring: 0 0 0 2px #100c0a, 0 0 0 5px var(--accent-2);
  --radius-sm: 2px;
  --radius-lg: 6px;
}

@keyframes crt-power-on {
  0% { opacity: 0; filter: brightness(0.4) contrast(1.4); }
  18% { opacity: 1; filter: brightness(1.15) contrast(1.05); }
  100% { opacity: 1; filter: none; }
}

@keyframes store-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(212, 84, 42, 0.22), 0 0 10px #d4542a; }
  50% { opacity: 0.55; box-shadow: 0 0 0 5px rgba(212, 84, 42, 0.08), 0 0 4px #d4542a; }
}

@keyframes channel-tune {
  0% { box-shadow: inset 0 0 0 0 rgba(232, 184, 109, 0); }
  40% { box-shadow: inset 0 0 18px rgba(232, 184, 109, 0.28); }
  100% { box-shadow: inset 0 0 0 0 rgba(232, 184, 109, 0); }
}

body.theme-crt {
  animation: crt-power-on 0.55s ease-out 1;
}

.shelf-label,
[data-shelf]::before {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  text-shadow: 0 0 10px rgba(232, 184, 109, 0.25);
}

[data-shelf]::before {
  content: attr(data-shelf);
  display: block;
  margin-bottom: 6px;
}

.console-panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.4);
}

.vhs-card,
.ticket-card {
  position: relative;
  background: linear-gradient(180deg, var(--panel), var(--shelf));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.vhs-card::before,
.ticket-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 6px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent-deep));
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.vhs-card:hover,
.ticket-card:hover {
  transform: translateY(-3px);
  border-color: rgba(232, 184, 109, 0.4);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 18px rgba(196, 120, 58, 0.16);
}

.led-readout {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: #0a0706;
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 12px rgba(232, 184, 109, 0.12);
}

.on-air,
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--led-live);
  box-shadow: 0 0 0 3px rgba(212, 84, 42, 0.22), 0 0 10px #d4542a;
  animation: led-pulse 1.6s ease-in-out infinite;
}

.store-ticker {
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0a0706;
  margin: 0 0 28px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.store-ticker__track {
  display: inline-flex;
  gap: 48px;
  padding: 8px 0;
  animation: store-ticker 28s linear infinite;
}

.store-ticker__track span { padding: 0 24px; }

/* Shared focus contract — TV remote + keyboard */
.theme-crt a:focus-visible,
.theme-crt button:focus-visible,
.theme-crt input:focus-visible,
.theme-crt select:focus-visible,
.theme-crt textarea:focus-visible,
.theme-crt summary:focus-visible,
.theme-crt [tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  body.theme-crt {
    animation: none;
  }

  .theme-crt .btn.primary,
  .theme-crt button.primary,
  .on-air,
  .live-dot,
  .store-ticker__track {
    animation: none !important;
  }

  .vhs-card:hover,
  .ticket-card:hover,
  .theme-crt .btn:hover {
    transform: none;
  }
}
