/* pages/title.css — ფილმის/სერიალის გვერდი */

.main--title { padding-bottom: 64px; }

/* ── Hero ─────────────────────────────────────────────────── */
.title-hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: clamp(540px, 46vw, 740px);
  isolation: isolate;
}
.title-stage {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--c-surface);
}
.title-backdrop { width: 100%; height: 100%; object-fit: cover; object-position: 60% 20%; }
.title-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 11, 17, 0.94) 0%, rgba(8, 11, 17, 0.72) 32%, rgba(8, 11, 17, 0.18) 62%, rgba(8, 11, 17, 0) 78%),
    linear-gradient(0deg, var(--c-bg) 0%, rgba(8, 11, 17, 0.6) 22%, rgba(8, 11, 17, 0) 50%),
    linear-gradient(180deg, rgba(8, 11, 17, 0.55) 0%, rgba(8, 11, 17, 0) 22%);
}

.title-content {
  display: grid;
  justify-items: start;
  gap: 16px;
  width: min(760px, 64%);
  padding: 128px 0 36px var(--gutter);
}
.title-heading { max-width: 100%; }
.title-logo {
  width: auto;
  max-width: min(460px, 100%);
  height: auto;
  max-height: clamp(96px, 9vw, 150px);
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 4px 22px rgba(0, 0, 0, 0.5));
}
.title-name {
  display: block;
  font-size: clamp(2.2rem, 4.4vw, 3.8rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-shadow: 0 4px 26px rgba(0, 0, 0, 0.5);
}

.title-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  font-size: var(--fs-md);
  color: rgba(238, 242, 248, 0.9);
}
.title-cert {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.title-rating { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.title-rating .icon { color: #ffc94d; }
.title-quality {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: #0b0f17;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.title-geo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.title-geo::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.title-geo--dub { background: rgba(255, 90, 95, 0.18); color: #ffb3b5; border: 1px solid rgba(255, 90, 95, 0.45); }
.title-geo--sub { color: #ffd6d6; border: 1px solid rgba(255, 110, 110, 0.4); }

.title-genres { display: flex; flex-wrap: wrap; gap: 8px; }
.title-tagline { font-style: italic; color: var(--c-text-2); }
.title-overview { max-width: 64ch; font-size: var(--fs-md); line-height: 1.7; color: rgba(238, 242, 248, 0.88); }
.title-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.title-actions .btn-primary { min-width: 160px; }
.title-resume-note,
.title-note { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--c-text-2); }
.watchlist-toggle[aria-pressed="true"] { border-color: rgba(173, 196, 255, 0.55); color: var(--c-accent-soft); }

/* ── სექციები ─────────────────────────────────────────────── */
.title-body { display: grid; gap: 44px; padding: 20px var(--gutter) 40px; }
.title-section { display: grid; gap: 16px; min-width: 0; }
.title-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.title-section-heading { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; }

.season-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.season-picker::-webkit-scrollbar { display: none; }

/* ── ეპიზოდები ────────────────────────────────────────────── */
.episode-list { display: grid; gap: 8px; margin-inline: -10px; }
.episode-link {
  display: grid;
  grid-template-columns: clamp(180px, 18vw, 240px) minmax(0, 1fr);
  gap: 18px;
  padding: 10px;
  border-radius: var(--radius-lg);
  transition: background-color var(--dur-fast) var(--ease);
}
.episode-link:hover { background: var(--c-surface); }
.episode.is-current .episode-link { background: var(--c-surface); box-shadow: inset 0 0 0 1px rgba(135, 166, 251, 0.45); }
.episode-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--c-surface-2);
}
.episode-thumb img { width: 100%; height: 100%; object-fit: cover; }
.episode-play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(8, 11, 17, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.episode-link:hover .episode-play,
.episode-link:focus-visible .episode-play { opacity: 1; }
.episode-progress { position: absolute; left: 8px; right: 8px; bottom: 8px; width: auto; }
.episode-text { display: grid; align-content: start; gap: 6px; min-width: 0; padding-top: 2px; }
.episode-title { font-size: var(--fs-md); font-weight: 600; line-height: 1.35; }
.episode-number { color: var(--c-text-2); }
.episode-meta { font-size: var(--fs-xs); color: var(--c-text-3); }
.episode-overview {
  display: -webkit-box;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--c-text-2);
  overflow: hidden;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.episodes-empty { padding: 18px 0; color: var(--c-text-2); }

/* ── მსახიობები ───────────────────────────────────────────── */
.cast-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 124px;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.cast-card { display: grid; justify-items: center; align-content: start; gap: 4px; min-width: 0; text-align: center; }
.cast-photo {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  margin-bottom: 8px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--c-text-2);
}
.cast-photo img { width: 100%; height: 100%; object-fit: cover; }
.cast-name,
.cast-role {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cast-name { font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; }
.cast-role { font-size: var(--fs-xs); line-height: 1.35; color: var(--c-text-3); }
.cast-link { display: grid; justify-items: center; align-content: start; gap: 4px; min-width: 0; border-radius: var(--radius-md); }
.cast-link .cast-photo { transition: border-color var(--dur-fast) var(--ease), transform var(--dur) var(--ease); }
.cast-link:hover .cast-photo { border-color: rgba(173, 196, 255, 0.55); transform: translateY(-2px); }
.cast-link:hover .cast-name { color: var(--c-accent-soft); }
.fact-link { color: var(--c-text); text-decoration: underline; text-decoration-color: rgba(173, 196, 255, 0.35); text-underline-offset: 3px; border-radius: 3px; }
.fact-link:hover { color: var(--c-accent-soft); text-decoration-color: currentColor; }

/* ── კოლექციის ნაწილი ─────────────────────────────────────── */
.title-collection {
  padding: 18px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(100% 140% at 0% 0%, rgba(255, 201, 77, 0.08), transparent 60%),
    var(--c-surface);
  border: 1px solid var(--c-line);
}
.title-collection-head { display: grid; gap: 4px; min-width: 0; }
.title-collection-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--c-line-strong);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-text-2);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.title-collection-all:hover { color: var(--c-text); border-color: rgba(173, 196, 255, 0.45); }
.title-collection-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #ffd98a; }
.collection-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 128px;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.collection-strip-link { display: grid; gap: 6px; border-radius: var(--radius-md); }
.collection-strip-poster {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--c-surface-2);
  color: var(--c-text-3);
  box-shadow: 0 0 0 1px var(--c-line) inset;
}
.collection-strip-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur) var(--ease); }
.collection-strip-link:hover .collection-strip-poster img { transform: scale(1.04); }
.collection-strip-index {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: rgba(8, 11, 17, 0.8);
  font-size: var(--fs-2xs);
  font-weight: 700;
}
.collection-strip-item.is-current .collection-strip-poster { box-shadow: 0 0 0 2px #ffc94d; }
.collection-strip-item.is-current .collection-strip-index { background: #ffc94d; color: #2a1d00; }
.collection-strip-title { font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.collection-strip-year { font-size: var(--fs-xs); color: var(--c-text-3); }
.collection-strip-item.is-current .collection-strip-year { color: #ffd98a; font-weight: 600; }

/* ── დეტალები ─────────────────────────────────────────────── */
.title-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px 28px;
  padding: 22px 24px;
  border-radius: var(--radius-xl);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
}
.title-fact { display: grid; align-content: start; gap: 4px; min-width: 0; }
.title-fact dt { font-size: var(--fs-xs); color: var(--c-text-3); }
.title-fact dd { font-size: var(--fs-md); overflow-wrap: anywhere; }

/* ── მსგავსი (რიგი) და ტრეილერი ────────────────────────────── */
.main--title .row { margin-top: 4px; }

.trailer-modal {
  width: min(1120px, 94vw);
  max-width: none;
  padding: 0;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-xl);
  background: #000;
  color: var(--c-text);
  overflow: hidden;
}
.trailer-modal::backdrop { background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(6px); }
.trailer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 20px; }
.trailer-title { font-size: var(--fs-md); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trailer-frame { aspect-ratio: 16 / 9; background: #000; }
.trailer-frame iframe { width: 100%; height: 100%; border: 0; }

/* ── Skeleton ─────────────────────────────────────────────── */
.title-skeleton { display: grid; gap: 16px; padding-bottom: 40px; }
.title-skeleton .sk-line { margin: 0 var(--gutter); }
.title-sk-stage { display: block; height: clamp(420px, 42vw, 640px); border-radius: 0; }

/* ── მობილური ─────────────────────────────────────────────── */
@media (max-width: 899px) {
  .title-hero { display: block; min-height: 0; }
  .title-stage { position: relative; aspect-ratio: 16 / 10; }
  .title-stage::after {
    background: linear-gradient(0deg, var(--c-bg) 0%, rgba(8, 11, 17, 0.4) 40%, rgba(8, 11, 17, 0) 70%);
  }
  .title-content {
    position: relative;
    width: auto;
    margin-top: -56px;
    padding: 0 16px 8px;
    gap: 14px;
  }
  .title-logo { max-width: 80%; max-height: 86px; }
  .title-name { font-size: clamp(1.8rem, 8vw, 2.4rem); }
  .title-meta { font-size: var(--fs-sm); gap: 6px 12px; }
  .title-actions { width: 100%; }
  .title-actions .btn-primary { flex: 1 1 100%; }
  /* მეორეხარისხოვანი ღილაკები: ხატულა + წარწერა ქვემოთ, ერთ რიგში (3 ან 4 ღილაკი) */
  .title-actions { gap: 8px; }
  .title-actions .btn-ghost {
    flex: 1 1 0;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    min-height: 68px;
    padding: 10px 4px;
    border-radius: 14px;
    font-size: var(--fs-xs);
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }
  .title-actions .btn-ghost .btn-label,
  .title-actions .btn-ghost > span:not(.btn-spinner) { overflow-wrap: anywhere; }
  .title-actions .btn-icon { width: auto; }
  /* გაზიარება — „ყურების“ გვერდით, კვადრატული ხატულა; დანარჩენი ოთხი ქვედა რიგში რჩება */
  .title-actions > * { order: 2; }
  .title-actions .btn-primary { order: 0; flex: 1 1 calc(100% - 60px); min-width: 0; }
  .title-actions .btn-ghost.share-btn {
    order: 1;
    flex: 0 0 52px;
    min-height: 0;
    padding: 0;
    border-radius: var(--radius-pill, 999px);
  }
  .title-actions .share-btn .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .title-body { gap: 34px; padding: 20px 16px 32px; }
  .episode-list { margin-inline: 0; }
  .episode-link { grid-template-columns: 132px minmax(0, 1fr); gap: 12px; padding: 8px 0; }
  .episode-link:hover { background: transparent; }
  .episode-play { opacity: 1; width: 36px; height: 36px; }
  .episode-overview { -webkit-line-clamp: 2; line-clamp: 2; }
  .cast-row { grid-auto-columns: 96px; gap: 12px; }
  .cast-photo { width: 84px; height: 84px; }
  .title-collection { padding: 14px; margin-inline: -4px; }
  .collection-strip { grid-auto-columns: 104px; gap: 10px; }
  .title-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 18px; gap: 16px; }
  .title-sk-stage { height: 62vw; }
}

/* ── ფლეერი გვერდზე (ღილაკების ქვეშ, მსახიობების ზემოთ) ──────
   ფონი + ჩატვირთვის ანიმაცია ჩანს მყისიერად; ფლეერი (watch.css + js/player/inline-player.js) ასინქრონულად ცვლის მას. */
.title-player { min-width: 0; }
.title-player[hidden] { display: none; }
.title-player-frame {
  position: relative;
  width: 100%;
  max-width: 1120px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.title-player-wait { position: absolute; inset: 0; display: grid; place-items: center; }
.title-player-wait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.4; }
.title-player-wait .player-spinner {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  animation: title-player-spin 0.9s linear infinite;
}
@keyframes title-player-spin { to { transform: rotate(360deg); } }
/* ტელეფონზე — კიდიდან კიდემდე (როგორც ვიდეო აპლიკაციებში) */
@media (max-width: 599px) {
  .title-player-frame { width: calc(100% + 32px); margin-inline: -16px; border-radius: 0; box-shadow: none; }
}
