@font-face {
  font-family: 'AgencyFB';
  src: url('../assets/AGENCYB.TTF') format('truetype');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand-crimson: #e50914;
  --surface-bg: #0c0e11;
  --surface-elevated: #14171d;
  --surface-pill: #1a1d23;
  --surface-pill-hover: #242831;
  --border-subtle: rgba(255, 255, 255, 0.08);
}

html {
  scroll-behavior: smooth;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #0c0e11;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  background-color: #0c0e11;
  -webkit-tap-highlight-color: transparent;
}

button,
a,
select,
input {
  touch-action: manipulation;
}

@media (max-width: 640px) {
  input:not([type='range']),
  select,
  textarea {
    font-size: 16px !important;
  }
}

#publicSiteWrapper {
  font-family: 'AgencyFB', system-ui, -apple-system, sans-serif;
}

/* Subtle architectural glyph in the top bar (PIN-gated portal entry) */
.stealth-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  color: rgba(255, 255, 255, 0.22);
  background: transparent;
  border: none;
  padding: 0;
  cursor: default;
  transition: color 0.25s ease;
}

.stealth-glyph:hover,
.stealth-glyph:focus-visible {
  color: rgba(255, 255, 255, 0.45);
  outline: none;
}

/* Direct Jellyfin hotlink button in the public navbar */
.jellyfin-nav-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border-radius: 0.65rem;
  color: rgba(255, 255, 255, 0.65);
  background: transparent;
  border: 1px solid transparent;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.jellyfin-nav-glyph:hover,
.jellyfin-nav-glyph:focus-visible {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  outline: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Public Hero geometric backdrop */
.hero-grid-bg {
  background-color: #0c0e11;
  background-image:
    radial-gradient(circle at 82% 18%, rgba(229, 9, 20, 0.12), transparent 45%),
    radial-gradient(circle at 12% 85%, rgba(28, 32, 40, 0.8), transparent 55%),
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: auto, auto, 36px 36px, 36px 36px;
}

/* Elevated Dark Panels */
.surface-panel,
.glass-panel {
  background: #14171d;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.6);
}

/* Top Bar Tabs */
.top-nav-tab {
  color: #9ca3af;
  background: transparent;
}
.top-nav-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}
.top-nav-tab.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

/* Mobile Floating Bottom Dock */
.dock-nav-btn {
  color: #8b93a1;
}
.dock-nav-btn:hover {
  color: #e5e7eb;
}
.dock-nav-btn.active {
  color: #ffffff;
}

/* Pill Chips (Solid White Active, Dark Muted Inactive) */
.filter-chip {
  background: #1a1d23;
  color: #d4d4d8;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}
.filter-chip:hover {
  background: #242831;
  color: #ffffff;
}
.filter-chip.active {
  background: #ffffff !important;
  color: #0c0e11 !important;
  border-color: #ffffff !important;
  font-weight: 600;
}

/* Search Bar Quick Toggle Pills (Default / Only / Exclude / Active) */
.search-toggle-pill {
  height: 30px;
  padding: 0 0.65rem;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: #d4d4d8;
  border: 1px solid rgba(255, 255, 255, 0.09);
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.search-toggle-pill:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
}
.search-toggle-pill.is-only {
  background: #ffffff;
  color: #0c0e11;
  border-color: #ffffff;
  font-weight: 700;
}
.search-toggle-pill.is-only:hover {
  background: #e4e4e7;
  color: #0c0e11;
}
.search-toggle-pill.is-exclude {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.45);
}
.search-toggle-pill.is-exclude:hover {
  background: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}
.search-toggle-pill.is-on {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.45);
}
.search-toggle-pill.is-on:hover {
  background: rgba(16, 185, 129, 0.28);
  color: #a7f3d0;
}

select.custom-select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: none !important;
}
select.custom-select::-ms-expand {
  display: none;
}

/* Dual-Thumb Rating Range Slider */
.dual-range-wrap input.dual-range-input {
  position: absolute;
  left: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.dual-range-wrap input.dual-range-input::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: #ffffff;
  border: 2px solid #0f1115;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.dual-range-wrap input.dual-range-input::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}

.dual-range-wrap input.dual-range-input::-moz-range-thumb {
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: #ffffff;
  border: 2px solid #0f1115;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

/* Frameless Rounded 2:3 Poster Media Cards */
.media-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: transparent;
  min-width: 0;
}

.media-card .card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 1.15rem;
  overflow: hidden;
  background: #171a20;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

@media (hover: hover) {
  .media-card:hover .card-poster {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 18px 36px -12px rgba(0, 0, 0, 0.85);
  }
}

.media-card .card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s ease;
}

@media (hover: hover) {
  .media-card:hover .card-poster img {
    transform: scale(1.03);
  }
}

/* ============================================================================
   16:9 VIDEO PLAYBACK CAROUSEL CARDS (ZERO FILTER/GRADIENT OVERLAY ON VIDEO!)
   ============================================================================ */
.video-media-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: transparent;
  min-width: 0;
}

.video-card-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 1.15rem;
  overflow: hidden;
  background: #090b0e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

@media (hover: hover) {
  .video-media-card:hover .video-card-stage {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.32);
    box-shadow: 0 18px 36px -12px rgba(0, 0, 0, 0.85);
  }
}

.video-card-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
  transition: opacity 0.35s ease;
}

/* Hide static image & fade badges cleanly when 16:9 video is playing — NO gradient/filter on video */
.video-card-stage.is-video-playing img {
  opacity: 0;
}

.video-card-stage.is-video-playing .video-card-badge {
  opacity: 0;
  pointer-events: none;
}

.video-card-controls {
  transform: translateZ(0);
}

.media-card.is-hover-playing .card-badge-overlay {
  opacity: 0;
  pointer-events: none;
}

/* Quick Action Pill Overlay on Poster Bottom-Right (always visible above poster & hover trailer) */
.poster-quick-btn {
  position: absolute;
  bottom: 0.55rem;
  right: 0.55rem;
  z-index: 30;
  min-height: 30px;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  transition: transform 0.16s ease, background-color 0.18s ease, color 0.18s ease, opacity 0.25s ease;
}

.poster-quick-btn.request {
  background: rgba(18, 20, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.poster-quick-btn.request:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #0c0e11;
}

.poster-quick-btn.watch {
  background: rgba(16, 185, 129, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.poster-quick-btn.watch:hover {
  background: #10b981;
}

.poster-quick-btn.queued {
  background: rgba(24, 28, 36, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #d4d4d8;
}

/* Horizontal Curated Carousel Rail */
.shelf-rail-shell {
  min-width: 0;
  max-width: 100%;
  isolation: isolate;
}

.shelf-rail {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  padding: 0.35rem 0.1rem 0.45rem;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
  .shelf-rail {
    gap: 1.05rem;
    padding: 0.45rem 0.15rem 0.55rem;
  }
}

/* 2:3 Poster Shelf Card Widths */
.shelf-card-wrap {
  flex: 0 0 138px;
  width: 138px;
  max-width: 138px;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .shelf-card-wrap {
    flex: 0 0 168px;
    width: 168px;
    max-width: 168px;
  }
}

@media (min-width: 1024px) {
  .shelf-card-wrap {
    flex: 0 0 188px;
    width: 188px;
    max-width: 188px;
  }
}

/* 16:9 Widescreen Video Carousel Card Widths */
.shelf-video-card-wrap {
  flex: 0 0 272px;
  width: 272px;
  max-width: 272px;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .shelf-video-card-wrap {
    flex: 0 0 336px;
    width: 336px;
    max-width: 336px;
  }
}

@media (min-width: 1024px) {
  .shelf-video-card-wrap {
    flex: 0 0 384px;
    width: 384px;
    max-width: 384px;
  }
}

.shelf-arrow-btn {
  position: absolute;
  top: 34%;
  transform: translateY(-50%);
  z-index: 35;
  width: 38px;
  height: 56px;
  border-radius: 9999px;
  background: rgba(15, 17, 21, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.shelf-arrow-btn:hover {
  background: #ffffff;
  color: #0c0e11;
}

@media (min-width: 768px) {
  .shelf-arrow-btn {
    display: inline-flex;
  }
  .shelf-rail-shell:hover .shelf-arrow-btn {
    opacity: 0.95;
  }
}

/* ============================================================================
   HERO SPOTLIGHT & DETAIL HEADER: STRICT TRUE 16:9 + ZERO OVERLAY WHEN PLAYING
   ============================================================================ */
.hero-spotlight {
  position: relative;
  border-radius: 1.35rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #090b0e;
  aspect-ratio: 16 / 9;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-shadow: 0 22px 48px -18px rgba(0, 0, 0, 0.85);
}

@media (max-width: 639px) {
  .hero-spotlight:not(.is-video-playing) {
    min-height: 252px;
  }
}

.hero-spotlight.is-desc-expanded:not(.is-video-playing) {
  aspect-ratio: auto;
  min-height: 252px;
}

@media (min-width: 640px) {
  .hero-spotlight.is-desc-expanded:not(.is-video-playing) {
    min-height: 360px;
  }
}

@media (min-width: 1024px) {
  .hero-spotlight {
    border-radius: 1.5rem;
  }
  .hero-spotlight.is-desc-expanded:not(.is-video-playing) {
    min-height: 440px;
  }
}

.hero-spotlight-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  transition: opacity 0.45s ease;
  z-index: 0;
}

/* Scrim applies ONLY to static backdrop; completely removed (opacity: 0) when trailer plays! */
.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s ease;
  background:
    linear-gradient(to top, rgba(12, 14, 17, 0.88) 0%, rgba(12, 14, 17, 0.28) 38%, rgba(12, 14, 17, 0) 70%),
    linear-gradient(to right, rgba(12, 14, 17, 0.72) 0%, rgba(12, 14, 17, 0.22) 42%, rgba(12, 14, 17, 0) 70%);
}

.hero-spotlight.is-video-playing .hero-scrim,
.detail-header.is-video-playing .hero-scrim {
  opacity: 0 !important;
  background: none !important;
}

.hero-spotlight.is-video-playing .hero-spotlight-img,
.detail-header.is-video-playing img {
  opacity: 0;
}

/* Integrated background trailer (True 16:9, pure unfiltered playback) */
.bg-video-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  background: #000000;
  transition: opacity 0.45s ease;
}

.bg-video-wrap.is-playing {
  opacity: 1;
}

.detail-header {
  aspect-ratio: 16 / 9;
  width: 100%;
}

.bg-video-wrap iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  pointer-events: none;
}

.hero-title-heading {
  transform-origin: left bottom;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}

.hero-collapse-on-play {
  grid-template-rows: 1fr;
  opacity: 1;
  transition:
    grid-template-rows 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.38s ease;
}

.hero-collapse-inner {
  overflow: hidden;
  min-height: 0;
}

.hero-fade-on-play {
  transition: opacity 0.45s ease;
}

.hero-sound-btn {
  transition: opacity 0.35s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.hero-title-shadow {
  text-shadow:
    0 2px 14px rgba(0, 0, 0, 0.92),
    0 1px 4px rgba(0, 0, 0, 0.92);
}

/* Collapse text cleanly during trailer playback so 16:9 video is completely clear */
.hero-spotlight.is-video-playing .hero-collapse-on-play {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

.hero-spotlight.is-video-playing .hero-title-heading {
  transform: translateY(2px) scale(0.88);
}

.hero-spotlight.is-video-playing .hero-fade-on-play {
  opacity: 0;
  pointer-events: none;
}

.detail-header.is-video-playing .detail-overlay-text {
  opacity: 0;
  pointer-events: none;
}

@media (hover: hover) {
  .hero-spotlight.is-video-playing:hover .hero-collapse-on-play {
    grid-template-rows: 1fr;
    opacity: 1;
    pointer-events: auto;
  }
  .hero-spotlight.is-video-playing:hover .hero-title-heading {
    transform: translateY(0) scale(1);
  }
  .hero-spotlight.is-video-playing:hover .hero-fade-on-play,
  .detail-header.is-video-playing:hover .detail-overlay-text {
    opacity: 1;
    pointer-events: auto;
  }
}

.hero-spotlight.is-video-playing.controls-revealed .hero-collapse-on-play {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
}
.hero-spotlight.is-video-playing.controls-revealed .hero-title-heading {
  transform: translateY(0) scale(1);
}
.hero-spotlight.is-video-playing.controls-revealed .hero-fade-on-play {
  opacity: 1;
  pointer-events: auto;
}

.hero-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  background: rgba(15, 17, 21, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.hero-nav-arrow:hover {
  background: #ffffff;
  color: #0c0e11;
}

@media (min-width: 768px) {
  .hero-spotlight:hover .hero-nav-arrow {
    display: inline-flex;
  }
}

/* Pagination Dots Below Hero Banner */
.hero-dot-btn {
  padding: 4px 2px;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.hero-dot-indicator {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.24);
  transition: width 0.22s ease, background-color 0.22s ease, transform 0.22s ease;
}

.hero-dot-btn.active .hero-dot-indicator {
  width: 7px;
  height: 7px;
  background: #ffffff;
  transform: scale(1.1);
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================================
   3-LINE EXPANDABLE SHOW DESCRIPTION WITH BOTTOM-RIGHT "read more..."
   ============================================================================ */
.show-desc-box {
  position: relative;
  min-width: 0;
  --desc-bg: #0c0e11;
}

.show-desc-text {
  margin: 0;
  line-height: 1.45;
  word-break: break-word;
}

.show-desc-box:not(.is-expanded) .show-desc-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  max-height: calc(3 * 1.45em);
}

.show-desc-box.is-expanded .show-desc-text {
  display: block;
  -webkit-line-clamp: unset;
  max-height: none;
  overflow: visible;
}

.show-desc-toggle {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: 1.45em;
  line-height: 1.45;
  font-size: inherit;
  font-weight: 600;
  color: #f4f4f5;
  padding: 0 0 0 2.75em;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--desc-bg, #0c0e11) 22%,
    var(--desc-bg, #0c0e11) 100%
  );
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--desc-bg, #0c0e11) 0%, transparent) 0%,
    var(--desc-bg, #0c0e11) 22%,
    var(--desc-bg, #0c0e11) 100%
  );
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.show-desc-box.is-hero-desc:not(.is-expanded) .show-desc-toggle {
  padding: 0 0.35em 0 2.6em;
  border-radius: 0.35rem;
  color: #ffffff;
  text-shadow: none;
  background: linear-gradient(
    90deg,
    rgba(12, 14, 17, 0) 0%,
    rgba(12, 14, 17, 0.98) 22%,
    rgba(12, 14, 17, 1) 100%
  );
}

.show-desc-toggle:hover,
.show-desc-toggle:focus-visible {
  color: #ffffff;
  text-decoration: underline;
  outline: none;
}

.show-desc-box.is-expanded .show-desc-toggle {
  position: static;
  display: block;
  height: auto;
  margin-left: auto;
  margin-top: 0.15rem;
  padding: 0;
  background: none !important;
  color: #d4d4d8;
}

.show-desc-box.is-expanded .show-desc-toggle:hover {
  color: #ffffff;
}

.pin-dot {
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  transition: all 0.15s ease;
}

.pin-dot.filled {
  background-color: #ffffff;
  border-color: #ffffff;
  transform: scale(1.12);
}

@media print {
  header#publicTopNav,
  #pinGateModal,
  #portalAccountModal,
  #jellyfinLaunchModal,
  #filtersModal,
  #mediaPortalApp,
  .no-print {
    display: none !important;
  }
}
