/* ============================================================
   Retrovibbar Cinema – Musik & film
   En levande 80/90-talsbiosalong byggd med CSS, SVG & JS
   ============================================================ */

:root {
  --cinema-bg: #05040a;
  --cinema-curtain: #6b0f1a;
  --cinema-curtain-deep: #3d0810;
  --cinema-velvet: #8b1524;
  --cinema-gold: #d4a574;
  --cinema-screen-glow: rgba(255, 220, 170, 0.18);
  --cinema-beam: rgba(255, 230, 190, 0.14);
}

/* Body mode when inside the cinema experience */
body.nvvam-cinema-mode {
  background: var(--cinema-bg);
  overflow-x: hidden;
}

body.nvvam-cinema-mode .site-header {
  background: rgba(5, 4, 10, 0.92);
  border-bottom-color: rgba(139, 21, 36, 0.55);
  position: sticky;
  top: 0;
  z-index: 100;
}

body.nvvam-cinema-mode .site-footer,
body.nvvam-cinema-mode .wp-block-template-part[data-area="footer"] {
  background: #05040a;
  border-top: 1px solid rgba(139, 21, 36, 0.4);
}

/* ---------- Cinema stage ---------- */
.nvvam-cinema {
  position: relative;
  min-height: calc(100vh - 72px);
  background:
    radial-gradient(ellipse 90% 60% at 50% 18%, rgba(80, 30, 40, 0.35) 0%, transparent 55%),
    linear-gradient(180deg, #0c0a12 0%, #08060c 40%, #05040a 100%);
  overflow: hidden;
  isolation: isolate;
}

/* Ambient vignette */
.nvvam-cinema::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at 50% 42%, transparent 30%, rgba(0, 0, 0, 0.55) 100%);
}

/* ---------- Red velvet curtains ---------- */
.nvvam-curtains {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
}

.nvvam-curtain {
  position: relative;
  width: 50%;
  height: 100%;
  background:
    repeating-linear-gradient(
      90deg,
      var(--cinema-curtain) 0px,
      var(--cinema-velvet) 14px,
      var(--cinema-curtain-deep) 28px,
      var(--cinema-velvet) 42px,
      var(--cinema-curtain) 56px
    );
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.55);
  transition: transform 1.6s cubic-bezier(0.45, 0.05, 0.25, 1);
  will-change: transform;
}

.nvvam-curtain::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  background: linear-gradient(90deg, rgba(0,0,0,0.45), transparent);
}

.nvvam-curtain-left::before { right: 0; }
.nvvam-curtain-right::before { left: 0; transform: scaleX(-1); }

/* Gold trim at bottom of curtains */
.nvvam-curtain::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  background: linear-gradient(180deg, transparent, rgba(212, 165, 116, 0.35));
  box-shadow: 0 -2px 12px rgba(212, 165, 116, 0.15);
}

body.nvvam-cinema-open .nvvam-curtain-left {
  transform: translateX(-92%);
}
body.nvvam-cinema-open .nvvam-curtain-right {
  transform: translateX(92%);
}

/* Curtain closed on first paint until JS opens */
body.nvvam-cinema-mode:not(.nvvam-cinema-open) .nvvam-curtain-left,
body.nvvam-cinema-mode:not(.nvvam-cinema-open) .nvvam-curtain-right {
  transform: translateX(0);
}

/* ---------- Projector beam ---------- */
.nvvam-projector-beam {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 50%;
  width: min(72vw, 920px);
  height: 58%;
  transform: translateX(-50%);
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 235, 200, 0.22) 0%,
    rgba(255, 220, 170, 0.11) 35%,
    rgba(255, 210, 150, 0.04) 70%,
    transparent 100%
  );
  clip-path: polygon(42% 0%, 58% 0%, 100% 100%, 0% 100%);
  opacity: 0;
  transition: opacity 1.2s ease 0.4s;
  filter: blur(0.5px);
  animation: nvvam-beam-sway 7s ease-in-out infinite;
}

body.nvvam-cinema-open .nvvam-projector-beam {
  opacity: 1;
}

@keyframes nvvam-beam-sway {
  0%, 100% { transform: translateX(-50%) skewX(0deg); }
  50% { transform: translateX(-50%) skewX(0.6deg); }
}

/* Dust motes in the beam */
.nvvam-dust {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.4s ease 0.6s;
}

body.nvvam-cinema-open .nvvam-dust {
  opacity: 1;
}

.nvvam-dust span {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255, 240, 210, 0.75);
  box-shadow: 0 0 4px rgba(255, 230, 180, 0.5);
  animation: nvvam-dust-float linear infinite;
}

@keyframes nvvam-dust-float {
  0% { transform: translateY(100%) translateX(0); opacity: 0; }
  10% { opacity: 0.85; }
  90% { opacity: 0.5; }
  100% { transform: translateY(-20%) translateX(12px); opacity: 0; }
}

/* ---------- Projector housing (top center) ---------- */
.nvvam-projector {
  position: absolute;
  z-index: 8;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 86px;
  height: 36px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease 0.3s;
}

body.nvvam-cinema-open .nvvam-projector {
  opacity: 1;
}

.nvvam-projector-body {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #2a2438 0%, #14101c 100%);
  border: 1px solid rgba(212, 165, 116, 0.35);
  border-radius: 6px 6px 10px 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255,255,255,0.06);
  position: relative;
}

.nvvam-projector-lens {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 12px;
  background: radial-gradient(circle at 50% 30%, #ffe8b8 0%, #c4883a 55%, #5a3010 100%);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 0 16px rgba(255, 200, 120, 0.55), 0 0 4px rgba(255, 220, 160, 0.8);
  animation: nvvam-lens-flicker 2.8s ease-in-out infinite;
}

@keyframes nvvam-lens-flicker {
  0%, 100% { opacity: 1; box-shadow: 0 0 16px rgba(255, 200, 120, 0.55); }
  40% { opacity: 0.92; }
  52% { opacity: 0.78; box-shadow: 0 0 8px rgba(255, 180, 100, 0.35); }
  58% { opacity: 0.95; }
  70% { opacity: 0.85; }
}

/* ---------- Screen (the content area) ---------- */
.nvvam-screen-frame {
  position: relative;
  z-index: 10;
  max-width: 980px;
  margin: 48px auto 0;
  padding: 0 18px;
}

.nvvam-screen {
  position: relative;
  background: linear-gradient(180deg, #12101a 0%, #0c0a12 100%);
  border: 3px solid #1a1520;
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(212, 165, 116, 0.22),
    0 0 40px rgba(255, 200, 140, 0.08),
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 0 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  min-height: 420px;
}

/* Subtle screen glow when open */
body.nvvam-cinema-open .nvvam-screen {
  box-shadow:
    0 0 0 1px rgba(212, 165, 116, 0.28),
    0 0 50px rgba(255, 210, 150, 0.12),
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 0 80px rgba(0, 0, 0, 0.25);
}

/* Film grain overlay on screen */
.nvvam-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200'%20xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: nvvam-grain 0.4s steps(2) infinite;
}

@keyframes nvvam-grain {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-2%, 1%); }
}

.nvvam-screen-inner {
  position: relative;
  z-index: 2;
  padding: 28px 26px 36px;
  color: var(--nvvam-text, #f7f1e8);
}

/* Content styling inside the screen */
.nvvam-screen-inner .archive-title,
.nvvam-screen-inner .cinema-title {
  font-family: 'Space Grotesk', Arial, sans-serif;
  font-weight: 800;
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: #fff;
  text-shadow: 0 0 24px rgba(255, 200, 140, 0.25);
}

.nvvam-screen-inner .cinema-kicker {
  font: 700 0.72rem/1.3 'Courier New', monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nvvam-gold, #e8b879);
  margin: 0 0 6px;
}

.nvvam-screen-inner .term-description,
.nvvam-screen-inner .cinema-intro {
  color: var(--nvvam-muted, #b8b2c8);
  max-width: 560px;
  margin: 0 0 22px;
  font-size: 0.98rem;
}

/* Post grid adapted for screen */
.nvvam-screen-inner .post-grid .wp-block-post-template,
.nvvam-screen-inner .wp-block-post-template {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.nvvam-screen-inner .post-card {
  background: rgba(16, 22, 44, 0.75) !important;
  border: 1px solid rgba(223, 101, 184, 0.35) !important;
  border-radius: 10px !important;
  padding: 14px !important;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.nvvam-screen-inner .post-card:hover {
  transform: translateY(-3px);
  border-color: rgba(232, 184, 121, 0.65) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.nvvam-screen-inner .post-card h2,
.nvvam-screen-inner .post-card .wp-block-post-title {
  font-size: 1.05rem !important;
  margin: 8px 0 4px !important;
}

.nvvam-screen-inner .post-card a {
  color: var(--nvvam-gold, #e8b879);
}

/* Single article inside screen */
.nvvam-screen-inner .single-title {
  font-size: clamp(1.6rem, 3.2vw, 2.2rem) !important;
  margin-bottom: 10px;
}

.nvvam-screen-inner .single-featured {
  border-radius: 6px;
  margin: 16px 0 22px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.nvvam-screen-inner .wp-block-post-content {
  max-width: 680px;
  line-height: 1.7;
}

/* Cinema nav chips (sub-sections) */
.nvvam-cinema-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.nvvam-cinema-nav a {
  display: inline-block;
  padding: 7px 14px;
  font: 700 0.74rem/1.2 'Courier New', monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e8d5c0;
  background: rgba(48, 32, 68, 0.65);
  border: 1px solid rgba(223, 101, 184, 0.4);
  border-radius: 999px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.nvvam-cinema-nav a:hover,
.nvvam-cinema-nav a.is-active {
  background: rgba(139, 21, 36, 0.55);
  border-color: rgba(232, 184, 121, 0.65);
  color: #fff;
  text-decoration: none;
}

/* ---------- Audience silhouettes ---------- */
.nvvam-audience {
  position: absolute;
  z-index: 12;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(40vh, 320px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s ease 0.85s;
}

body.nvvam-cinema-open .nvvam-audience {
  opacity: 1;
}

.nvvam-audience svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Each spectator group (head + shoulders) */
.nvvam-audience .spectator {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: nvvam-spectator-idle 6s ease-in-out infinite;
}

.nvvam-audience .spectator:nth-child(odd) {
  animation-duration: 7.4s;
  animation-delay: -1.6s;
}
.nvvam-audience .spectator:nth-child(3n) {
  animation-duration: 5.2s;
  animation-delay: -2.8s;
}
.nvvam-audience .spectator:nth-child(4n) {
  animation-duration: 8.1s;
  animation-delay: -0.7s;
}
.nvvam-audience .spectator:nth-child(5n) {
  animation-name: nvvam-spectator-lean;
  animation-duration: 9.5s;
  animation-delay: -3.2s;
}
.nvvam-audience .spectator:nth-child(7n) {
  animation-name: nvvam-spectator-turn;
  animation-duration: 11s;
  animation-delay: -4.5s;
}

/* Soft ambient bob */
@keyframes nvvam-spectator-idle {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  25% { transform: rotate(0.9deg) translateY(1.5px); }
  55% { transform: rotate(-0.7deg) translateY(-1px); }
  80% { transform: rotate(0.4deg) translateY(0.5px); }
}

/* Occasional lean toward the screen */
@keyframes nvvam-spectator-lean {
  0%, 100% { transform: rotate(0deg) translateY(0) scaleY(1); }
  20% { transform: rotate(0.5deg) translateY(0); }
  45% { transform: rotate(-1.2deg) translateY(3px) scaleY(1.02); }
  70% { transform: rotate(0.3deg) translateY(1px); }
}

/* Head-turn feel (skew + slight shift) */
@keyframes nvvam-spectator-turn {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  30% { transform: rotate(2.2deg) translateX(2px); }
  60% { transform: rotate(-1.5deg) translateX(-1px); }
  85% { transform: rotate(0.6deg) translateX(0); }
}

/* Row depth: back rows quieter, front rows more present */
.nvvam-audience .row-back .spectator {
  animation-duration: 8.5s;
}
.nvvam-audience .row-mid .spectator {
  animation-duration: 6.8s;
}
.nvvam-audience .row-front .spectator {
  animation-duration: 5.6s;
}

/* Flat vector audience – seats & people keep SVG fills */
.nvvam-audience .spectator .seat {
  filter: brightness(0.92);
}
.nvvam-audience .row-back .spectator .seat {
  filter: brightness(0.72);
}
.nvvam-audience .row-front .spectator .seat {
  filter: brightness(1.05);
}
.nvvam-audience .spectator .hair {
  filter: brightness(1.06);
}

/* Seat row gradient – velvet darkness under the crowd */
.nvvam-seats {
  position: absolute;
  z-index: 11;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(28vh, 210px);
  background:
    linear-gradient(180deg,
      transparent 0%,
      rgba(35, 10, 16, 0.4) 25%,
      rgba(18, 6, 10, 0.85) 70%,
      rgba(8, 3, 6, 0.96) 100%);
  pointer-events: none;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .nvvam-curtain,
  .nvvam-projector-beam,
  .nvvam-dust,
  .nvvam-projector,
  .nvvam-audience {
    transition: none !important;
    animation: none !important;
  }
  body.nvvam-cinema-mode .nvvam-curtain-left { transform: translateX(-92%); }
  body.nvvam-cinema-mode .nvvam-curtain-right { transform: translateX(92%); }
  body.nvvam-cinema-mode .nvvam-projector-beam,
  body.nvvam-cinema-mode .nvvam-dust,
  body.nvvam-cinema-mode .nvvam-projector,
  body.nvvam-cinema-mode .nvvam-audience {
    opacity: 1;
  }
  .nvvam-dust span,
  .nvvam-projector-lens,
  .nvvam-audience .spectator,
  .nvvam-screen::after {
    animation: none !important;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
  .nvvam-screen-frame {
    margin-top: 28px;
    padding: 0 10px;
  }
  .nvvam-screen-inner {
    padding: 18px 14px 28px;
  }
  .nvvam-projector {
    width: 64px;
    height: 28px;
  }
  .nvvam-audience {
    height: 26vh;
  }
  .nvvam-seats {
    height: 18vh;
  }
  .nvvam-screen-inner .post-grid .wp-block-post-template,
  .nvvam-screen-inner .wp-block-post-template {
    grid-template-columns: 1fr;
  }
  /* Curtains open further on small screens so content is visible */
  body.nvvam-cinema-open .nvvam-curtain-left {
    transform: translateX(-96%);
  }
  body.nvvam-cinema-open .nvvam-curtain-right {
    transform: translateX(96%);
  }
}

/* Hide default archive chrome when cinema is active */
body.nvvam-cinema-mode .archive-main > .archive-title,
body.nvvam-cinema-mode .archive-main > .wp-block-term-description {
  /* moved inside screen by template */
}
