/* ============================================================
   CLASSIC TV PAKISTAN — RESPONSIVE CINEMATIC POLISH
   Scoped as final overrides so existing catalogue and playback
   behavior remains untouched.
   ============================================================ */

:root {
  --bg-deep: #050505;
  --bg-surface: #101010;
  --bg-card: #151515;
  --bg-card-hover: #202020;
  --border: #2b2518;
  --border-gold: rgba(214, 173, 76, .34);
  --gold: #d8b35a;
  --gold-hover: #f0d48a;
  --gold-glow: rgba(216, 179, 90, .18);
  --emerald-accent: #8b1e24;
  --text-primary: #faf8f2;
  --text-muted: #b7b1a4;
  --text-dim: #8b8578;
}

html {
  width: 100%;
  max-width: 100%;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  max-width: 100%;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(216, 179, 90, .075), transparent 42%),
    linear-gradient(180deg, #080808 0%, #050505 56%, #090807 100%);
  background-attachment: scroll;
}

img, video, iframe, canvas, svg {
  max-width: 100%;
}

button, a, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Header: consistent alignment and safer small-screen sizing */
.topbar {
  min-height: 76px;
  padding-inline: clamp(14px, 4vw, 56px);
  background: rgba(5, 5, 5, .94);
  border-bottom-color: rgba(216, 179, 90, .16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar.scrolled {
  background: rgba(5, 5, 5, .98);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}

.brand {
  min-width: 0;
}

.brand-titles {
  min-width: 0;
}

.brand-name {
  letter-spacing: clamp(.3px, .08vw, 1.1px);
}

.nav-link {
  white-space: nowrap;
}

.search-input {
  min-width: 0;
}

/* Cinematic hero: fluid height, balanced text width, safe actions */
.hero-billboard {
  min-height: clamp(390px, 62vw, 700px);
  max-height: 760px;
  height: min(72vh, 760px);
  isolation: isolate;
}

.hero-slides {
  min-height: inherit;
}

.hero-backdrop {
  background-position: center 24%;
}

.hero-vignette {
  background:
    linear-gradient(0deg, rgba(0,0,0,.96) 0%, rgba(0,0,0,.68) 22%, rgba(0,0,0,.12) 66%, rgba(0,0,0,.08) 100%),
    linear-gradient(90deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.44) 34%, transparent 76%);
}

.hero-foreground {
  width: 100%;
  max-width: 1440px;
  padding: clamp(24px, 5vw, 72px) clamp(18px, 5vw, 72px) clamp(38px, 5vw, 68px);
  gap: 6px;
}

.hero-title {
  max-width: min(820px, 90%);
  font-size: clamp(30px, 4.4vw, 64px);
  overflow-wrap: anywhere;
}

.hero-urdu {
  max-width: min(760px, 92%);
  font-size: clamp(18px, 2.4vw, 32px);
  line-height: 1.8;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.hero-btn-play, .hero-btn-mylist {
  min-height: 44px;
  justify-content: center;
}

.hero-btn-play {
  background: linear-gradient(135deg, #f2d68f, #c69b42);
  color: #100d06;
}

.hero-btn-play:hover {
  background: #ffe6a4;
  color: #100d06;
}

.hero-dots {
  right: clamp(18px, 5vw, 72px);
}

/* Content rows: responsive gutters and poster sizing */
.rows-container {
  width: 100%;
  gap: clamp(24px, 3.5vw, 44px);
  padding: clamp(20px, 3vw, 36px) 0 44px;
}

.carousel-row {
  min-width: 0;
}

.row-header {
  padding-inline: clamp(16px, 4.5vw, 64px);
  margin-bottom: 14px;
  gap: 12px;
}

.row-title {
  font-size: clamp(17px, 1.8vw, 24px);
  line-height: 1.35;
}

.row-title-wrap {
  min-width: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.carousel-track {
  gap: clamp(10px, 1.2vw, 16px);
  padding: 5px clamp(16px, 4.5vw, 64px) 18px;
  scroll-snap-type: x proximity;
}

.netflix-card {
  flex: 0 0 clamp(170px, 17vw, 238px);
  width: clamp(170px, 17vw, 238px);
  min-width: clamp(170px, 17vw, 238px);
  max-width: clamp(170px, 17vw, 238px);
  border: 1px solid rgba(216, 179, 90, .08);
  border-radius: 10px;
  overflow: hidden;
  scroll-snap-align: start;
  background: linear-gradient(180deg, #171512, #0b0b0b);
}

.netflix-card:hover {
  border-color: rgba(216, 179, 90, .5);
  box-shadow: 0 12px 30px rgba(0,0,0,.42), 0 0 0 1px rgba(216,179,90,.12);
}

.card-media {
  width: 100%;
  overflow: hidden;
  background: #171512;
}

.card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-info {
  min-width: 0;
  padding: 9px 9px 11px;
  gap: 4px;
}

.card-title, .card-urdu, .card-meta-line {
  overflow-wrap: anywhere;
}

.card-title {
  line-height: 1.4;
}

.card-urdu {
  line-height: 1.9;
}

/* Browse/search pages using the same stylesheet */
.browse-view {
  width: 100%;
  max-width: 1440px;
  padding: 108px clamp(16px, 4.5vw, 64px) 64px;
}

.browse-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  gap: clamp(12px, 1.6vw, 22px);
}

.browse-grid .netflix-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.browse-grid .card-info {
  padding: 10px 9px 12px;
}

.browse-header {
  align-items: center;
}

.browse-filter-pills {
  row-gap: 10px;
}

/* Search and dialogs stay within narrow viewports */
.browse-search-box, .browse-search-input {
  min-width: 0;
}

.modal-overlay {
  padding: clamp(10px, 3vw, 24px);
}

.modal-card, .auth-modal-card {
  max-width: min(920px, 100%);
  min-width: 0;
}

@media (min-width: 1200px) {
  .hero-foreground {
    left: 50%;
    right: auto;
    width: 100%;
    transform: translateX(-50%);
  }

  .rows-container {
    max-width: 1600px;
    margin-inline: auto;
  }
}

@media (max-width: 850px) {
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
    background-attachment: scroll;
  }

  .topbar {
    min-height: 62px;
    padding: 0 14px;
    gap: 10px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
  }

  .brand-name {
    font-size: clamp(10px, 2.8vw, 13px);
    line-height: 1.3;
    white-space: nowrap;
  }

  .brand-sub {
    font-size: 10px;
    line-height: 1.3;
  }

  .hero-billboard {
    height: clamp(350px, 112vw, 470px);
    min-height: 350px;
    max-height: 470px;
  }

  .hero-slides {
    min-height: 100%;
  }

  .hero-backdrop {
    background-position: center 18%;
  }

  .hero-vignette {
    background:
      linear-gradient(0deg, rgba(0,0,0,.98) 0%, rgba(0,0,0,.78) 25%, rgba(0,0,0,.2) 68%, rgba(0,0,0,.08) 100%),
      linear-gradient(90deg, rgba(0,0,0,.38), transparent 90%);
  }

  .hero-foreground {
    padding: 20px 16px 24px;
    gap: 4px;
  }

  .hero-title {
    max-width: 100%;
    font-size: clamp(23px, 6vw, 32px);
    line-height: 1.18;
  }

  .hero-urdu {
    max-width: 100%;
    font-size: clamp(16px, 4.3vw, 21px);
    line-height: 1.9;
  }

  .hero-actions {
    gap: 8px;
    margin-top: 10px;
  }

  .hero-btn-play, .hero-btn-mylist {
    min-height: 42px;
    padding: 9px 14px;
    font-size: 12px;
  }

  .hero-dots {
    top: 14px;
    right: 14px;
  }

  .category-strip {
    padding: 15px 16px 2px;
  }

  .rows-container {
    gap: 26px;
    padding-top: 22px;
    padding-bottom: 28px;
  }

  .row-header {
    padding-inline: 16px;
    margin-bottom: 10px;
  }

  .row-title {
    font-size: 17px;
  }

  .row-see-all {
    font-size: 10px;
    white-space: nowrap;
  }

  .carousel-track {
    gap: 10px;
    padding: 4px 16px 14px;
  }

  .netflix-card {
    flex: 0 0 clamp(138px, 42vw, 176px);
    width: clamp(138px, 42vw, 176px);
    min-width: clamp(138px, 42vw, 176px);
    max-width: clamp(138px, 42vw, 176px);
    border-radius: 8px;
  }

  .card-info {
    padding: 7px 5px 9px;
  }

  .card-title {
    font-size: 12px;
    line-height: 1.4;
  }

  .card-urdu {
    font-size: 11px;
    line-height: 1.8;
  }

  .card-meta-line {
    font-size: 10px;
  }

  .browse-view {
    padding: 76px 14px 36px;
  }

  .browse-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }

  .browse-grid .netflix-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .browse-grid .card-media {
    border-radius: 8px;
  }

  .browse-title {
    font-size: clamp(24px, 7vw, 32px);
  }

  .browse-header {
    align-items: flex-start;
  }

  .browse-filter-pills {
    gap: 7px;
  }

  .filter-pill {
    max-width: 100%;
  }

  .m-search-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-bottom-nav {
    height: calc(58px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
  }

  .auth-modal-card {
    width: calc(100% - 24px);
    padding: 24px 18px;
    margin: auto;
  }
}

@media (max-width: 360px) {
  .topbar {
    padding-inline: 10px;
  }

  .brand-name {
    font-size: 10px;
  }

  .brand-sub {
    display: none;
  }

  .hero-billboard {
    height: 350px;
    min-height: 350px;
  }

  .hero-foreground {
    padding-inline: 13px;
  }

  .hero-actions {
    align-items: stretch;
  }

  .hero-btn-play, .hero-btn-mylist {
    padding-inline: 10px;
  }

  .netflix-card {
    flex-basis: 138px;
    width: 138px;
    min-width: 138px;
    max-width: 138px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
