/* =========================================================
   WebTV category — broadcast channel browser
   ========================================================= */

.kj-webtv-cat-page {
  --header-bg: var(--surface-dark);
  background: var(--surface-dark);
  color: var(--color-white);
  overflow: hidden;
}

body.kj-webtv-cat-page .header-top,
body.kj-webtv-cat-page .kj-trending-topics,
body.kj-webtv-cat-page .site-header-scrollable {
  display: none;
}

/* Dark site header to match the WebTV broadcast UI. */
body.kj-webtv-cat-page .primary-nav,
body.kj-webtv-cat-page .site-header-scrollable,
body.kj-webtv-cat-page .site-header-scrollable.sticky,
body.kj-webtv-cat-page .kj-trending-topics--desktop {
  --header-bg: var(--surface-dark);
  --nav-fade-color: var(--surface-dark);
  background-color: var(--surface-dark);
  color: var(--color-white);
}

body.kj-webtv-cat-page .primary-nav .kj-read-in-app {
  --kj-read-in-app-fg: var(--color-white);
  --kj-read-in-app-bg: transparent;
  --kj-read-in-app-border: var(--color-white);
}

body.kj-webtv-cat-page .primary-nav .nav-logo {
  width: auto;
}

body.kj-webtv-cat-page .nav-logo__brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* WebTV always shows the mark + YouTube icon (no crossfade on load). */
body.kj-webtv-cat-page .primary-nav .nav-logo__link,
body.kj-webtv-cat-page .primary-nav .nav-logo__stack {
  width: auto;
}

body.kj-webtv-cat-page .primary-nav .nav-logo__link .nav-logo__img--default,
body.kj-webtv-cat-page
  .primary-nav
  .nav-logo__link:hover
  .nav-logo__img--default {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

body.kj-webtv-cat-page .nav-logo__img--menu {
  position: relative;
  width: auto;
  height: 32px;
  opacity: 1;
  filter: brightness(0) invert(calc(1 - var(--menu-logo-invert, 0)));
}

body.kj-webtv-cat-page .nav-logo__img {
  transition: none;
}

body.kj-webtv-cat-page .kj-webtv-logo-yt {
  display: flex;
  flex-shrink: 0;
  line-height: 0;
}

body.kj-webtv-cat-page .kj-webtv-logo-yt .kj-icon--youtube {
  width: calc(22px * 28.57 / 20);
  height: 22px;
}

body.kj-webtv-cat-page .kj-webtv-logo-yt:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* Desktop header is full-bleed so it aligns with the WebTV stage. */
@media (min-width: 1180px) {
  body.kj-webtv-cat-page .primary-nav > .container,
  body.kj-webtv-cat-page .primary-nav > .kj-layout-shell {
    max-width: none;
    margin-inline: 0;
  }
}

.kj-webtv-cat-page .kj-page-wrap {
  background: var(--surface-dark);
}

/* Lock the broadcast UI to the viewport so the channel list is the only scroller. */
body.kj-webtv-cat-page .kj-site {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

body.kj-webtv-cat-page .kj-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.kj-webtv-cat-wrap {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-height: 0;
  padding: 0;
  margin: 0;
}

.kj-webtv-cat {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  background: var(--surface-dark);
}

.kj-webtv-cat__empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--color-blue);
}

/* Stage: player + channel list */
.kj-webtv-cat__stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}

.kj-webtv-cat__player-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-color: color-mix(
    in srgb,
    var(--color-white) 14%,
    var(--surface-dark)
  );
  background-image:
    linear-gradient(135deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.15)),
    var(--kj-webtv-hero, none);
  background-size: cover;
  background-position: center;
}

.kj-webtv-cat__player {
  position: relative;
  flex: 1 1 auto;
  min-height: clamp(220px, 52vw, 620px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.kj-webtv-cat__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.kj-webtv-cat__poster {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.kj-webtv-cat__poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kj-webtv-cat__dots {
  position: absolute;
  right: 20px;
  bottom: 16px;
  display: flex;
  gap: var(--kj-card-body-gap);
  z-index: 2;
}

.kj-webtv-cat__dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.kj-webtv-cat__dots span.is-active {
  background: #fff;
}

/* Channel sidebar — flex column so the list can scroll inside a bounded height. */
.kj-webtv-cat__channels {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: color-mix(in srgb, var(--color-white) 6%, var(--surface-dark));
  border-inline-start: var(--kj-border-reverse);
  overflow: hidden;
}

.kj-webtv-cat__channel-list {
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Desktop: take the list out of flow so its length can never size the stage
   row. Otherwise a long list stretches the iframe past the viewport and
   YouTube centres the video off-screen (black frame, no bottom controls). */
@media screen and (min-width: 1024px) {
  .kj-webtv-cat__channels {
    position: relative;
  }

  .kj-webtv-cat__channel-list {
    position: absolute;
    inset: 0;
  }
}

.kj-webtv-cat__channel-item {
  content-visibility: auto;
  contain-intrinsic-size: auto 72px;
}

.kj-webtv-cat__channel-item + .kj-webtv-cat__channel-item {
  border-top: var(--kj-border-reverse);
}

.kj-webtv-cat__channel-more {
  padding: 12px 16px 17.6px;
}

.kj-webtv-cat__channel-status {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-blue);
  text-align: center;
}

.kj-webtv-cat__channel-sentinel {
  height: 1px;
}

/* Infinite-scroll skeleton rows (WebTV is always dark). */
.kj-webtv-cat__channel-item.kj-skeleton {
  --kj-skel-base: rgba(255, 255, 255, 0.08);
  --kj-skel-hi: rgba(255, 255, 255, 0.16);
  content-visibility: visible;
}

.kj-webtv-cat__channel-item.kj-skeleton .kj-webtv-cat__channel {
  cursor: default;
}

.kj-webtv-cat__channel-item.kj-skeleton .kj-webtv-cat__channel-logo {
  background-color: var(--kj-skel-base);
}

.kj-webtv-cat__channel-item.kj-skeleton .kj-skel--line {
  height: 0.8em;
  margin-top: 0.5em;
}

.kj-webtv-cat__channel-item.kj-skeleton .kj-skel--line:first-child {
  margin-top: 0;
}

.kj-webtv-cat__channel {
  display: flex;
  align-items: center;
  gap: 13.6px;
  width: 100%;
  padding: 15.2px 16px;
  border: 0;
  background: transparent;
  color: var(--color-white);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

@media (prefers-reduced-motion: no-preference) {
  .kj-webtv-cat__channel {
    transition: background 0.15s var(--ease-out);
  }
}

.kj-webtv-cat__channel.is-active,
.kj-webtv-cat__channel:focus-visible {
  background: var(--color-blue);
}

.kj-webtv-cat__channel:focus-visible {
  outline: max(2px, 0.08em) solid var(--color-blue, #0a5cff);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .kj-webtv-cat__channel:hover {
    background: var(--color-blue);
  }
}

/* Dark mode: --color-blue turns light, so the label needs dark text. */
[data-theme="dark"] .kj-webtv-cat__channel.is-active,
[data-theme="dark"] .kj-webtv-cat__channel:focus-visible {
  color: #000;
}

@media (hover: hover) and (pointer: fine) {
  [data-theme="dark"] .kj-webtv-cat__channel:hover {
    color: #000;
  }
}

.kj-webtv-cat__channel-logo {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.kj-webtv-cat__channel-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kj-webtv-cat__channel-name {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--primaryFont, system-ui, sans-serif);
  font-size: 12.48px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.04em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Bottom info bar — pinned to the foot of the WebTV shell. */
.kj-webtv-cat__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
  flex: 0 0 auto;
  gap: 24px;
  align-items: center;
  padding: 16px 20px;
  background: #000;
  border-top: var(--kj-border-reverse);
}

.kj-webtv-cat__now {
  display: flex;
  align-items: flex-start;
  gap: 13.6px;
  min-width: 0;
}

.kj-webtv-cat__live {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 3.2px 7.2px;
  background: var(--color-red);
  color: #fff;
  font-family: var(--primaryFont, system-ui, sans-serif);
  font-size: 10.88px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
}

.kj-webtv-cat__now-body {
  min-width: 0;
}

.kj-webtv-cat__now-title {
  display: block;
  font-family: var(--primaryFont, system-ui, sans-serif);
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.kj-webtv-cat__now-dek {
  margin: 0;
  font-size: 12.48px;
  line-height: 1.35;
  color: var(--color-blue);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kj-webtv-cat__now-dek[hidden] {
  display: none;
}

.kj-webtv-cat__next {
  min-width: 0;
  padding-inline-start: 16px;
  border-inline-start: var(--kj-border-reverse);
}

.kj-webtv-cat__next-label {
  display: block;
  font-family: var(--primaryFont, system-ui, sans-serif);
  font-size: 9.92px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-blue);
  margin-bottom: 4px;
}

.kj-webtv-cat__next-title {
  display: block;
  font-family: var(--primaryFont, system-ui, sans-serif);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-white);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Responsive */
@media screen and (max-width: 1023px) {
  .kj-webtv-cat__stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .kj-webtv-cat__channels {
    border-inline-start: 0;
    border-top: var(--kj-border-reverse);
    min-height: 0;
  }

  .kj-webtv-cat__player {
    min-height: clamp(200px, 56vw, 420px);
  }

  .kj-webtv-cat__bar {
    grid-template-columns: 1fr;
    gap: 13.6px;
  }

  .kj-webtv-cat__next {
    padding-inline-start: 0;
    border-inline-start: 0;
    padding-top: 12px;
    border-top: var(--kj-border-reverse);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kj-webtv-cat__channel {
    transition: none;
  }
}

/* Click-to-load YouTube facade */
.kj-webtv-cat__facade {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
}

.kj-webtv-cat__facade-play {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
}

.kj-webtv-cat__facade:focus-visible {
  outline: 3px solid var(--color-blue, #0a5cff);
  outline-offset: -3px;
}
