:root {
  --doc-primary: #1a2ac6;
  --doc-primary-hover: #1422a5;
  --doc-primary-soft: #eff1ff;
  --doc-bg: #f4f6fb;
  --doc-card: #ffffff;
  --doc-border: #dce0ec;
  --doc-text: #202536;
  --doc-muted: #667085;
  --doc-shadow: 0 18px 50px rgba(26, 42, 198, 0.1);
  --doc-radius: 20px;
  --doc-hero-height: clamp(480px, 68vh, 690px);
}

html[data-theme="dark"] {
  --doc-primary: #7986cb;
  --doc-primary-hover: #6674bd;
  --doc-primary-soft: #292d48;
  --doc-bg: #121212;
  --doc-card: #1d1f27;
  --doc-border: #353845;
  --doc-text: #f2f3f7;
  --doc-muted: #b3b7c3;
  --doc-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body.documentary-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--doc-bg);
  color: var(--doc-text);
  font-family: "IBM Plex Sans Arabic", sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.documentary-main {
  flex: 1;
  min-height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 10px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--doc-primary);
  color: #fff;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.button:hover {
  background: var(--doc-primary-hover);
  box-shadow: 0 10px 24px rgba(26, 42, 198, 0.26);
  transform: translateY(-2px);
}

.button:focus-visible,
.hero-arrow:focus-visible,
.hero-dot:focus-visible,
.movie-card:focus-visible {
  outline: 3px solid rgba(255, 204, 0, 0.9);
  outline-offset: 3px;
}

.button-secondary {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  backdrop-filter: blur(10px);
}

.button-secondary:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.doc-hero {
  position: relative;
  isolation: isolate;
  container-type: size;
  height: var(--doc-hero-height);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background: #10131f;
  color: #fff;
}

.hero-backdrop {
  position: absolute;
  z-index: -3;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity 0.45s ease, transform 7s ease;
}

.doc-hero.is-ready .hero-backdrop {
  opacity: 1;
}

.doc-hero.is-changing .hero-backdrop {
  opacity: 0;
  transform: scale(1.045);
}

.hero-overlay {
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 7, 18, 0.86), rgba(5, 7, 18, 0.35) 48%, rgba(5, 7, 18, 0.62)),
    linear-gradient(0deg, rgba(5, 7, 18, 0.78), transparent 55%);
}

.hero-content {
  width: min(1160px, calc(100% - 40px));
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-inline: auto;
  padding: 30px 0 84px;
  padding-block: clamp(16px, 4cqh, 30px) clamp(52px, 13cqh, 84px);
  overflow: hidden;
  text-align: center;
}

.hero-content > * {
  flex: 0 0 auto;
}

.hero-kicker {
  position: absolute;
  z-index: 3;
  top: clamp(16px, 4cqh, 28px);
  right: clamp(18px, 4vw, 54px);
  display: -webkit-box;
  max-width: calc(100% - 36px);
  padding: 7px 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  backdrop-filter: blur(10px);
}

.hero-logo {
  display: block;
  width: min(260px, 56vw);
  max-height: 180px;
  max-height: min(180px, 30cqh);
  margin: 0 auto 14px;
  object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 12px 24px rgba(0, 0, 0, 0.55));
}

.hero-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip-path: inset(50%);
}

.hero-title.is-visible {
  position: static;
  display: -webkit-box;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0;
  overflow: hidden;
  white-space: normal;
  clip-path: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  color: #fff;
  font-family: "Thmanyah Serif Text", "IBM Plex Sans Arabic", sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 900;
  line-height: 1.35;
  text-wrap: balance;
}

.hero-description {
  width: min(720px, 100%);
  min-height: 0;
  display: -webkit-box;
  flex: 0 1 auto;
  margin: 14px auto 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(0.95rem, 1.5vw, 1.16rem);
  line-height: 1.9;
}

.hero-content:not(:has(.hero-title.is-visible)) .hero-description {
  margin-top: 6px;
}

.hero-actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.hero-share-status {
  width: 100%;
  min-height: 1.5em;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.84rem;
  font-weight: 700;
}

.hero-arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(10, 12, 25, 0.42);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transform: translateY(-50%);
  backdrop-filter: blur(12px);
  transition: background-color 0.25s ease, transform 0.25s ease;
}

.hero-arrow:hover {
  background: var(--doc-primary);
  transform: translateY(-50%) scale(1.06);
}

.hero-prev {
  right: clamp(18px, 4vw, 54px);
}

.hero-next {
  left: clamp(18px, 4vw, 54px);
}

.hero-dots {
  position: absolute;
  z-index: 3;
  right: 50%;
  bottom: 30px;
  display: flex;
  align-items: center;
  gap: 9px;
  transform: translateX(50%);
}

.hero-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  cursor: pointer;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.hero-dot.active {
  width: 30px;
  background: #ffcc00;
}

.movies-section {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 44px;
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0;
  color: var(--doc-text);
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.4;
}

.movies-track {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 20px;
}

.movie-card {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  background: #161a29;
  color: #fff;
  text-decoration: none;
  box-shadow: var(--doc-shadow);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.movie-card:hover {
  border-color: var(--doc-primary);
  box-shadow: 0 24px 56px rgba(26, 42, 198, 0.2);
  transform: translateY(-6px);
}

.movie-card-backdrop {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.movie-card:hover .movie-card-backdrop {
  transform: scale(1.055);
}

.movie-card::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(0deg, rgba(7, 9, 18, 0.94), rgba(7, 9, 18, 0.1) 75%);
}

.movie-card-content {
  width: 100%;
  padding: clamp(12px, 4%, 22px);
}

.movie-card-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  line-height: 1.5;
  text-wrap: balance;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.movie-card-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  color: #ffcc00;
  font-size: 0.82rem;
  font-weight: 700;
}

.doc-state {
  padding: 26px;
  border: 1px dashed var(--doc-border);
  border-radius: var(--doc-radius);
  background: var(--doc-card);
  color: var(--doc-muted);
  text-align: center;
}

.doc-state i {
  display: block;
  margin-bottom: 10px;
  color: var(--doc-primary);
  font-size: 1.5rem;
}

.video-page {
  width: min(1200px, calc(100% - 40px));
  margin-inline: auto;
  padding: 34px 0 48px;
}

.video-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--doc-muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s ease;
}

.video-breadcrumb:hover {
  color: var(--doc-primary);
}

.video-stage {
  overflow: hidden;
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  background: #000;
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.25);
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #050608;
}

.video-frame iframe,
.video-frame video {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.player-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050608;
  color: #fff;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.player-loading span {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffcc00;
  border-radius: 50%;
  animation: doc-spin 0.8s linear infinite;
}

.movie-info-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 26px;
  margin-top: 26px;
  padding: 26px;
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  background: var(--doc-card);
  box-shadow: var(--doc-shadow);
}

.movie-logo-frame {
  min-height: 130px;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px solid var(--doc-border);
  border-radius: 16px;
  background: var(--doc-bg);
}

.movie-info-logo {
  width: 100%;
  max-height: 100px;
  object-fit: contain;
}

.movie-copy {
  min-width: 0;
}

.movie-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 7px;
  color: var(--doc-primary);
  font-size: 0.82rem;
  font-weight: 700;
}

.movie-title {
  margin: 0;
  color: var(--doc-text);
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.45;
}

.movie-description {
  margin: 12px 0 0;
  color: var(--doc-muted);
  font-size: 1rem;
  line-height: 2;
}

.video-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.video-actions .button-secondary {
  border-color: var(--doc-border);
  background: var(--doc-bg);
  color: var(--doc-primary);
}

.video-actions .button-secondary:hover {
  border-color: var(--doc-primary);
  background: var(--doc-primary-soft);
  box-shadow: none;
}

.share-status {
  min-height: 1.5em;
  color: var(--doc-muted);
  font-size: 0.82rem;
}

.video-error {
  margin-top: 26px;
  padding: 38px 24px;
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  background: var(--doc-card);
  text-align: center;
}

.video-error i {
  color: var(--doc-primary);
  font-size: 2.2rem;
}

.video-error h1 {
  margin: 14px 0 6px;
  color: var(--doc-text);
  font-size: 1.45rem;
}

.video-error p {
  margin: 0 0 20px;
  color: var(--doc-muted);
}

@keyframes doc-spin {
  to { transform: rotate(360deg); }
}

@media (max-height: 560px) {
  .doc-hero {
    --doc-hero-height: clamp(320px, 64vh, 460px);
  }
}

@container (max-height: 620px) {
  .hero-logo {
    max-height: min(150px, 26cqh);
  }

  .hero-title.is-visible {
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }

  .hero-description {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
}

@container (max-height: 460px) {
  .hero-kicker {
    top: 12px;
    padding: 6px 12px;
  }

  .hero-description,
  .hero-share-status {
    display: none;
  }
}

@media (max-width: 700px) {
  .hero-content {
    width: min(100% - 28px, 1160px);
    padding: 26px 0 78px;
    padding-block: clamp(14px, 3.6cqh, 26px) clamp(46px, 11cqh, 78px);
  }

  .hero-description {
    line-height: 1.75;
  }

  .hero-arrow {
    top: auto;
    bottom: 24px;
    width: 42px;
    height: 42px;
    transform: none;
  }

  .hero-arrow:hover {
    transform: scale(1.05);
  }

  .hero-dots {
    bottom: 38px;
  }

  .hero-share {
    width: 46px;
    min-height: 46px;
    padding: 10px;
    border-radius: 50%;
  }

  .hero-share-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
    clip-path: inset(50%);
  }

  .movies-section {
    padding-top: 46px;
  }

  .video-page {
    width: min(100% - 24px, 1200px);
    padding-top: 20px;
  }

  .video-stage,
  .movie-info-card {
    border-radius: 15px;
  }

  .movie-info-card {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 20px;
  }

  .movie-logo-frame {
    width: 130px;
    min-height: 100px;
  }

  .video-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .video-actions .button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .hero-kicker {
    font-size: 0.75rem;
  }

  .hero-actions {
    flex-wrap: nowrap;
    align-items: center;
  }

  .hero-actions .hero-watch {
    min-width: 0;
  }

  .hero-actions .hero-share {
    flex: 0 0 46px;
    width: 46px;
  }

  .movies-section {
    width: min(100% - 24px, 1180px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-backdrop,
  .button,
  .movie-card,
  .movie-card-backdrop {
    transition: none;
  }
}
