/* Theatre Works - Complete CSS from React version */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --nav-height: 80px;
}

html {
  scrollbar-gutter: auto;
  scroll-padding-top: var(--site-nav-clearance, calc(var(--site-nav-height, 2.75rem) + 0.85rem));
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #080808;
  color: #ededed;
  line-height: 1.6;
  text-transform: lowercase;
  overflow-y: scroll;
  overflow-x: hidden;
  font-weight: 400;
  letter-spacing: -0.01em;
}

* {
  text-transform: lowercase;
}

.App {
  min-height: 100vh;
  background-color: #080808;
}

/* Navegación principal */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: rgba(10, 10, 10, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 2000;
  height: var(--nav-height);
  padding: 1.5rem 0;
  margin: 0;
  box-sizing: border-box;
  transition: opacity 500ms ease-in-out;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Nav back button (mobile modal) - hidden by default, shown when player modal active */
.nav-back-button {
  display: none;
  position: fixed;
  left: 1rem;
  top: calc(env(safe-area-inset-top) + (var(--nav-height) - 44px) / 2);
  width: 44px;
  height: 44px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  z-index: 2147483647;
  pointer-events: auto;
}

.nav-link {
  color: #999;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: 0;
  position: relative;
  text-transform: lowercase;
  margin: 0;
  box-sizing: border-box;
}

.nav-link:hover {
  color: #ffffff;
  text-transform: lowercase;
}

.nav-link.active {
  color: #ffffff;
}

.nav-link::after {
  content: none;
}

/* Desktop vs mobile nav label toggles */
.nav-link .desktop-label { display: none; }
.nav-link .mobile-label { display: inline; }

@media (min-width: 768px) {
  .nav-link .desktop-label { display: inline; }
  .nav-link .mobile-label { display: none; }
}

/* Main content */
.main-content {
  padding-top: var(--nav-height);
  min-height: calc(100vh - var(--nav-height));
  transition: padding-top 500ms ease-in-out;
}

.theatre-works {
  min-height: 100vh;
  background-color: #1a1a1a;
  color: #e0e0e0;
  position: relative;
  overflow: hidden;
}

.fixed-viewer {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background-color: #1a1a1a;
  overflow: hidden;
}

.viewer-container {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* When credits panel is hidden, let the video section use full width */
.viewer-container:not(.credits-visible) .video-section {
  width: 100%;
}

/* When credits panel is visible, shrink video section so it doesn't sit under the panel */
.viewer-container.credits-visible .video-section {
  width: calc(100% - 20%);
  padding-right: 1.5rem;
}

/* Also ensure scenes container leaves space on the right so last thumbnail isn't hidden */
.viewer-container.credits-visible .scenes-container {
  padding-right: calc(1.5rem + 20%);
}

.video-section {
  position: relative;
  width: 80vw;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 1.5rem;
  box-sizing: border-box;
  background-color: #1a1a1a;
  transition: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.video-section::-webkit-scrollbar {
  display: none;
}

.video-section.full-width {
  width: 100%;
  padding: 0 2rem;
}

.video-section.full-width:has(.any-app) {
  padding-top: 0;
  box-sizing: border-box;
}

.page-header {
  padding: 2rem;
  text-align: center;
  background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
}

.page-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #e0e0e0;
  letter-spacing: -0.02em;
}

.page-header p {
  color: #999;
  font-size: 1rem;
}

/* Scene Grid */
.scene-grid {
  overflow: visible;
  position: relative;
  height: 100%;
  width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.scene-grid::-webkit-scrollbar {
  display: none;
}

.works-container {
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* remove positive gap; use negative overlap between rows on desktop */
  gap: 0;
}

@media (min-width: 769px) {
  .work-row + .work-row {
    margin-top: -56px;
  }
}

.work-row {
  overflow: visible;
  width: 100%;
  margin-bottom: 0px !important;
  transition: all 0.3s ease;
  position: relative;
}

.work-row.visible-work {
  height: 30%;
  min-height: 250px;
  opacity: 1;
  z-index: 50;
}

/* Las flechas se posicionan relativas al work-row */
.hscroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10, 10, 10, 0.4);
  color: rgba(255, 255, 255, 0.8);
  padding: 0 1rem;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  z-index: 9999;
  transition: all 0.3s ease;
  display: none;
  align-items: center;
  justify-content: center;
  padding-right: 1rem;
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

  padding-right: calc(1rem + 20%);
.work-row:hover .hscroll-btn {
  display: flex;
}

.hscroll-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%);
}

.hscroll-btn:active {
  transform: translateY(-50%) scale(0.95);
}

/* ===== SINGLE SOURCE OF TRUTH FOR ARROW POSITIONING ===== */
/* Left arrow: always 3px from left edge */
.hscroll-left {
  left: 3px;
  z-index: 2000;
}

/* Right arrow: 8px from right when panel closed */
.hscroll-right {
  right: 8px;
  z-index: 2000;
}

/* Right arrow: shift left when credits panel is open to avoid overlap */
.viewer-container.credits-visible .hscroll-right {
  right: 8px;
  z-index: 2000;
}

/* Progressive loading styles */
.work-row.row-loading {
  pointer-events: none;
}

.work-row.row-loaded {
  pointer-events: auto;
}

.row-loading-placeholder {
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.loading-skeleton {
  width: 100%;
  display: flex;
  gap: 1.75rem;
  padding-right: 2rem;
}

.skeleton-scenes {
  display: flex;
  gap: 1.75rem;
  width: 100%;
}

.skeleton-scene {
  width: 360px;
  height: 225px;
  flex-shrink: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.scenes-container {
  display: flex;
  gap: 1.75rem;
  padding: 1rem 0;
  padding-right: 2rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  position: relative;
  justify-content: flex-start;
  scroll-snap-type: x mandatory;
  scroll-snap-stop: always;
}

/* Ensure desktop scenes container isn't hidden behind fixed nav */
@media (min-width: 769px) {
  .scenes-container {
    margin-top: calc(var(--nav-height) + 0.5rem);
  }
}

.scenes-container::-webkit-scrollbar {
  display: none;
}

.hscroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  z-index: 9999;
  transition: all 0.3s ease;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
}

.hscroll-btn.visible {
  display: none;
}

.work-row:hover .hscroll-btn.visible {
  display: flex;
}

.hscroll-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-50%) scale(1.1);
}

.hscroll-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.hscroll-left {
  left: 4px;
}

.hscroll-right {
  right: 4px;
}

.scene-item {
  position: relative;
  width: 360px;
  height: 225px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: filter 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  scroll-snap-align: start;
  box-sizing: border-box;
  border: 3px solid transparent;
}

/* Estado inicial con blur suave */
.scene-item.initial-blur video {
  filter: blur(1.2px) brightness(0.94);
}

/* Escenas de la obra actual */
.work-row.current-work .scene-item:not(.active) video {
  filter: blur(1.2px) brightness(0.94);
}

.work-row.current-work .scene-item.active video {
  filter: none;
}

.work-row.current-work .scene-item.hovered:not(.active) video {
  filter: blur(0.6px) brightness(1.02);
}

/* Escenas de las obras no actuales */
.work-row:not(.current-work) .scene-item video {
  filter: blur(1.4px) brightness(0.92);
}

.work-row:not(.current-work) .scene-item:hover video {
  filter: blur(0.7px) brightness(1.02);
}

.scene-item:hover {
  filter: brightness(1.15);
}

.scene-item.active {
  border-color: #ffffff;
  filter: brightness(1.25);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.scene-item.hovered {
  filter: brightness(1.15);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

.scene-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: none;
  -webkit-appearance: none;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.scene-item .desktop-poster-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 6;
}

.scene-item video::-webkit-media-controls-start-playback-button {
  display: none !important;
}

.scene-item video::-webkit-media-controls,
.scene-item video::-webkit-media-controls-enclosure {
  display: none !important;
}

.play-pause-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: none !important;
  color: #ffffff;
  border: none !important;
  font-size: 3rem;
  padding: 0;
  width: auto;
  height: auto;
  display: block;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.2s ease;
  z-index: 15;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  user-select: none !important;
  -webkit-user-select: none !important;
  border-radius: 0;
  box-shadow: none !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.scene-item:hover .play-pause-button {
  opacity: 1;
}

.play-pause-button:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: none !important;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
}

.play-pause-button:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
  background: none !important;
}

/* VideoPlayer styles */
.video-player-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-loading,
.video-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  background: rgba(0, 0, 0, 0.8);
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 14px;
  pointer-events: none;
}

.video-error {
  color: #ff6b6b;
}

/* VideoGrid styles for Astro islands */
.video-grid-container {
  width: 100%;
  height: calc(100vh - 200px);
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.work-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #333;
}

.work-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.scene-counter {
  font-size: 1rem;
  color: #999;
  background: #0a0a0a;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid #333;
}

/* Thumbnails row */
.thumbnails-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: #4A90E2 #1a1a1a;
}

.thumbnails-row::-webkit-scrollbar {
  height: 6px;
}

.thumbnails-row::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 3px;
}

.thumbnails-row::-webkit-scrollbar-thumb {
  background: #4A90E2;
  border-radius: 3px;
}

.thumbnail-button {
  flex-shrink: 0;
  width: 120px;
  height: 80px;
  border: 2px solid #333;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #0a0a0a;
  transition: all 0.3s ease;
  padding: 0;
}

.thumbnail-button:hover {
  border-color: #4A90E2;
  transform: translateY(-2px);
}

.thumbnail-button.active {
  border-color: #4A90E2;
  box-shadow: 0 0 12px rgba(74, 144, 226, 0.5);
}

.thumbnail-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 1.5rem;
  font-weight: bold;
}

/* Current video */
.current-video {
  width: 100%;
  height: 400px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #333;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 1.2rem;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 0;
}

@media (min-width: 1400px) {
  .current-video {
    height: 500px;
  }
}

/* Any palette overrides: keep Theatre Works layout, change only the visual tone */
:root {
  --nav-height: 80px;
  --any-bg: #ffffff;
  --any-bg-soft: #f7f3ed;
  --any-surface: rgba(255, 255, 255, 0.88);
  --any-surface-strong: rgba(247, 243, 237, 0.96);
  --any-text: #121212;
  --any-muted: #6d6d6d;
  --any-line: rgba(18, 18, 18, 0.1);
  --any-accent: #7a2131;
  --ambient-opacity: 0;
  --ambient-primary: transparent;
  --ambient-secondary: transparent;
  --ambient-accent: transparent;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--any-line, rgba(18, 18, 18, 0.12));
  background: rgba(255, 255, 255, 0.85);
  color: var(--any-text, #121212);
  font-size: 0.74rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  border-radius: 0;
  cursor: default;
}

button.tag-pill,
button.search-tag-pill {
  cursor: pointer;
}

.tag-pill--compact {
  font-size: 0.68rem;
  padding: 0.22rem 0.45rem;
}

.theatre-works,
.fixed-viewer,
.video-section {
  background-color: transparent !important;
}

.any-app {
  background: linear-gradient(
    180deg,
    var(--any-bg) 0%,
    color-mix(in srgb, var(--any-bg-soft) 88%, var(--any-bg)) 100%
  );
}

body,
.App,
.theatre-works,
.fixed-viewer,
.video-section,
.scene-grid.mobile.mobile-player-active,
.mobile-fixed-player,
.viewer-container.player-mode {
  background-color: var(--any-bg) !important;
  color: var(--any-text) !important;
  font-family: 'Manrope', sans-serif;
}

.main-nav {
  background-color: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid var(--any-line) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-link {
  color: var(--any-muted) !important;
}

.nav-link:hover,
.nav-link.active,
.project-nav:hover,
.mobile-fixed-player .project-nav-btn:hover {
  color: var(--any-accent) !important;
}

.hscroll-btn {
  background: rgba(255, 255, 255, 0.82) !important;
  color: rgba(18, 18, 18, 0.82) !important;
  border: 1px solid var(--any-line) !important;
}

.hscroll-btn:hover {
  background: rgba(247, 243, 237, 0.96) !important;
  color: var(--any-text) !important;
  border-color: rgba(122, 33, 49, 0.22) !important;
}

.scene-item {
  border-radius: 0 !important;
}

.scene-item video,
.mobile-item .mobile-video,
.scene-item .desktop-poster-overlay {
  opacity: 1;
}

.flat-scene-item {
  overflow: hidden;
}

.flat-scene-button {
  overflow: hidden;
}

.scene-item.active {
  border-color: var(--any-accent) !important;
  filter: brightness(1.03) !important;
  box-shadow: 0 0 0 1px rgba(122, 33, 49, 0.16), 0 10px 30px rgba(18, 18, 18, 0.06) !important;
}

.scene-item.hovered {
  box-shadow: 0 4px 20px rgba(18, 18, 18, 0.06) !important;
}

.play-pause-button,
.mobile-fixed-player .project-nav-btn,
.mobile-fixed-player .nav-arrow,
.modal-nav .nav-back-button {
  color: var(--any-text) !important;
}

.play-pause-button {
  filter: drop-shadow(0 2px 8px rgba(255,255,255,0.42));
}

.mobile-item,
.video-player-wrapper,
.mobile-fixed-player .video-wrapper,
.current-video,
.video-placeholder,
.project-placeholder,
.page-header {
  background: var(--any-bg-soft) !important;
  color: var(--any-text) !important;
}

.page-header p,
.scene-counter,
.mobile-scene-count,
.thumbnail-placeholder {
  color: var(--any-muted) !important;
}

.scene-counter,
.thumbnail-button,
.current-video,
.work-header {
  border-color: var(--any-line) !important;
  background: rgba(255, 255, 255, 0.92) !important;
}

.thumbnail-button.active,
.thumbnail-button:hover,
.scene-item.active {
  border-color: var(--any-accent) !important;
}

.skeleton-scene {
  background: linear-gradient(
    90deg,
    rgba(18, 18, 18, 0.04) 0%,
    rgba(18, 18, 18, 0.08) 50%,
    rgba(18, 18, 18, 0.04) 100%
  ) !important;
}

.video-loading,
.video-error {
  background: rgba(255, 255, 255, 0.94) !important;
  color: var(--any-text) !important;
  border: 1px solid var(--any-line);
}

.flat-scene-grid {
  width: 100%;
  min-height: calc(100dvh - var(--site-nav-height, 2.75rem));
  padding: 0.5rem 1.75rem 1.85rem;
  box-sizing: border-box;
  transition: padding-right 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.flat-scene-grid.panel-open {
  padding-right: calc(26% + 1.75rem);
}

.flat-scenes-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.85rem, 1.35vw, 1.35rem);
  align-items: start;
  justify-content: stretch;
  width: 100%;
}

.flat-scene-grid.panel-open .flat-scenes-container {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flat-scene-item {
  width: 100%;
  height: auto;
  position: relative;
  contain: layout style paint;
  content-visibility: auto;
  contain-intrinsic-size: auto 12rem;
  transition: opacity 0.24s cubic-bezier(0.33, 1, 0.32, 1);
  opacity: 1;
}

/* Cinematic Dimming / Foco Selectivo con Efecto Vaporoso */
.flat-scenes-container.has-focus-state .flat-scene-item {
  opacity: 0.55;
  transition: opacity 0.24s cubic-bezier(0.33, 1, 0.32, 1);
}

.flat-scenes-container.has-focus-state .flat-scene-item.playing,
.flat-scenes-container.has-focus-state .flat-scene-item.hovered {
  opacity: 1;
}

.flat-scene-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.52rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.flat-scene-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  line-height: 0;
  background: var(--any-bg-soft, #f7f3ed);
}

.flat-scene-media::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 0 rgba(122, 33, 49, 0);
  pointer-events: none;
  z-index: 12;
  transition: box-shadow 800ms ease;
}

.flat-scene-item.playing .flat-scene-media::after,
.flat-scene-item:hover .flat-scene-media::after {
  box-shadow: inset 0 0 0 1px rgba(122, 33, 49, 0.45);
}

.flat-scene-media video,
.flat-scene-video,
.flat-scene-item.active .flat-scene-video,
.flat-scene-item.playing .flat-scene-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transform: translateZ(0);
  transform-origin: center center;
}

.flat-scene-item.playing .flat-scene-video {
  will-change: transform;
}

/* Poster / video crossfade to avoid poster->first-frame jump */
.flat-scene-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transform: translateZ(0);
  transition: opacity 220ms ease;
  z-index: 8;
  background: var(--any-bg-soft, #f7f3ed);
}

.flat-scene-video {
  opacity: 0;
  transition: opacity 220ms ease;
  z-index: 10;
  background: var(--any-bg-soft, #f7f3ed);
}

.flat-scene-item.playing .flat-scene-video {
  opacity: 1 !important;
}

.flat-scene-item.playing .flat-scene-poster {
  opacity: 0.08 !important;
}

.flat-scene-caption {
  position: static;
  display: flex;
  align-items: center;
  gap: 0.68rem;
  padding: 0;
  background: transparent;
}

.flat-scene-index {
  font: 500 0.64rem/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(38, 31, 24, 0.56);
}

.flat-scene-title {
  font-weight: 400;
  font-family: inherit;
  font-size: var(--any-type-body, 0.82rem);
  line-height: 1.15;
  color: #181310;
}

.flat-scene-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.flat-scene-mobile-nav {
  display: none;
}

.flat-scene-mobile-arrow {
  appearance: none;
  border: 0;
  background: transparent;
}

.flat-scene-playing-indicator {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.12rem;
  height: 0.78rem;
  padding-top: 0.02rem;
}

.flat-scene-playing-line {
  width: 2px;
  min-height: 0.22rem;
  border-radius: 999px;
  background: rgba(122, 33, 49, 0.94);
  box-shadow: 0 0 10px rgba(122, 33, 49, 0.18);
  transform-origin: center bottom;
  animation: flat-scene-wave 0.9s ease-in-out infinite;
}

.flat-scene-playing-line:nth-child(1) {
  height: 0.3rem;
  animation-delay: -0.45s;
}

.flat-scene-playing-line:nth-child(2) {
  height: 0.74rem;
  animation-delay: -0.2s;
}

.flat-scene-playing-line:nth-child(3) {
  height: 0.5rem;
  animation-delay: -0.6s;
}

.flat-scene-playing-line:nth-child(4) {
  height: 0.66rem;
  animation-delay: -0.1s;
}

@keyframes flat-scene-wave {
  0%,
  100% {
    transform: scaleY(0.42);
    opacity: 0.42;
  }

  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}



.video-grid-empty {
  padding: calc(var(--nav-height) + 1rem) 2rem 2rem;
  color: #5c534b;
}

@media (max-width: 1180px) {
  .flat-scenes-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flat-scene-grid.panel-open .flat-scenes-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .flat-scene-grid.panel-open {
    padding-right: 1.75rem;
  }
}

.video-error {
  color: var(--any-accent) !important;
}

.mobile-item .mobile-work-title,
.work-title {
  color: var(--any-text) !important;
}

.mobile-fixed-player::before,
.mobile-fixed-player .credits-panel,
.mobile-fixed-player .video-wrapper,
.mobile-fixed-player,
body.player-mode-active .mobile-fixed-player,
body.player-mode-active .mobile-fixed-player .video-wrapper {
  background: var(--any-bg-soft) !important;
}

::-webkit-scrollbar-track {
  background: var(--any-bg-soft);
}

::-webkit-scrollbar-thumb {
  background: rgba(18, 18, 18, 0.2);
}

/* Anyways app: allow full multi-row grid (9+ pieces) to scroll on desktop */
.theatre-works:has(.any-app) {
  overflow: visible;
}

.theatre-works:has(.any-app) .fixed-viewer,
.theatre-works:has(.any-app) .viewer-container {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

.video-section.full-width:has(.any-app) {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

.video-section.full-width:has(.any-app) .scene-grid.flat-scene-grid {
  height: auto;
  overflow: visible;
}

@media (min-width: 769px) {
  .flat-scene-grid {
    padding-top: 0.85rem;
  }

  .flat-scene-item {
    scroll-margin-top: var(--site-nav-clearance, calc(var(--site-nav-height, 2.75rem) + 0.85rem));
  }

  .flat-scene-item.playing .flat-scene-video,
  .flat-scene-item.playing .flat-scene-poster {
    transform: translateZ(0);
  }

  .flat-scenes-container {
    gap: clamp(0.9rem, 1.15vw, 1.15rem);
  }

  .flat-scene-button {
    gap: 0.48rem;
  }

  .flat-scene-caption {
    gap: 0.58rem;
  }
}

@media (max-width: 768px) {
  /* Minimalist Mobile Override */
  .fixed-viewer {
    height: auto;
    overflow: visible;
  }

  .viewer-container {
    flex-direction: column;
    overflow: visible;
    height: auto;
  }

  .video-section.full-width:has(.any-app) {
    min-height: 0;
  }

  .video-section {
    position: relative;
    width: 100% !important;
    height: auto;
    overflow: visible;
    padding: 0.65rem 0.875rem 1.25rem !important;
  }

  .flat-scene-grid {
    padding: 0;
  }

  .flat-scene-grid.panel-open {
    padding: 0 0 calc(min(28dvh, 14rem) + 0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .flat-scenes-container {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  .flat-scene-button {
    gap: 0.5rem;
  }

  .flat-scene-caption {
    padding: 0;
    gap: 0.55rem;
  }

  .flat-scene-item.playing .flat-scene-caption {
    display: none;
  }

  .flat-scene-index {
    font-size: 0.72rem;
  }

  .flat-scene-title {
    font-size: 0.84rem;
  }

  .flat-scene-media {
    border-radius: 0;
  }

  .flat-scene-mobile-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    aspect-ratio: 16 / 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem;
    pointer-events: none;
    z-index: 16;
  }

  .flat-scene-mobile-arrow {
    pointer-events: auto;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(247, 243, 237, 0.78);
    color: #181310;
    font: 400 1rem/1 'IBM Plex Mono', monospace;
    box-shadow: 0 4px 18px rgba(18, 18, 18, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .flat-scene-mobile-arrow:active {
    transform: scale(0.96);
  }

  /* Disable complicated hover blurs for clean mobile experience */
  .flat-scenes-container:has(.flat-scene-item:hover, .flat-scene-item.playing) .flat-scene-item {
    opacity: 1;
    filter: none;
  }

  .flat-scene-item {
    opacity: 1 !important;
    filter: none !important;
  }
}

/* Taller credits panel on mobile when playing */
@media (max-width: 768px) {
  .flat-scene-grid.mobile-playing.panel-open {
    padding-bottom: calc(min(52dvh, 28rem) + 0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .flat-scene-grid.mobile-playing .credits-panel {
    height: min(52dvh, 28rem);
    min-height: 16rem;
  }

  .flat-scene-grid.mobile-playing .flat-scene-item:not(.playing) {
    visibility: hidden;
    height: 0;
    margin: 0;
    overflow: hidden;
  }
}
