/* UltrZn TV (layouts/ultrzn_tv.html.erb) — loaded alongside application.css,
   so the dark-surface and cyan-accent variable overrides defined there
   already reskin plain Bootstrap components for free. This file mirrors
   studio.css section for section (the sidebar, the hamburger) plus two
   TV-specific additions: the channel page's tab strip and its banner
   placeholder.

   IMPORTANT — hard-won lesson from studio.css: a comment here must never
   contain the two-character sequence asterisk-slash anywhere except its own
   closing token. CSS comments end at the FIRST such sequence, so shorthand
   like "the dash-clr-star slash dash-bs-star variables" silently truncates
   the comment early and corrupts every rule after it until the next real
   comment closes. Spell prefixes out in full prose instead. */

/* Same glass surface as the main app's aside and UZ Studio's sidebar
   (application.css) — real backdrop blur under the "glass" tier, a flat
   color plus gradient sheen under "glass-lite" (see the data-ui-tier
   selectors in application.css). Bootstrap's .offcanvas reads its own
   offcanvas-bg/offcanvas-color variables (defaulting to the app's darkest
   tone) rather than plain background-color inheritance; the sidebar-bg token
   can be a multi-layer gradient plus color under glass-lite, which isn't
   valid fed into that variable (Bootstrap's own rule consumes it as a plain
   background-color), so it's applied directly as a background shorthand
   with !important instead, same as before. */
#ultrznTvSidebar {
  --bs-offcanvas-bg: var(--clr-surface-2);
  --bs-offcanvas-color: var(--clr-text);
  background: var(--ui-sidebar-bg) !important;
  backdrop-filter: var(--ui-blur);
  -webkit-backdrop-filter: var(--ui-blur);
  color: var(--clr-text) !important;
}

/* Bootstrap's own .nav-pills rule redeclares its active-background variable
   to its hardcoded default blue (not derived from the app's primary color),
   and since .nav-pills is closer to .nav-link.active than #ultrznTvSidebar, that
   redeclaration wins over an override placed on the sidebar itself — this
   has to land on .nav-pills directly. Same translucent glass-pill treatment
   as the main app's aside .nav-link.active and UZ Studio's sidebar — the
   active-background token is always a plain color (never a gradient) in
   either tier, so it's safe to feed straight into Bootstrap's own
   background-color variable slot; the glow ring has no such slot, so it's a
   separate box-shadow rule below. */
#ultrznTvSidebar .nav-pills {
  --bs-nav-pills-link-active-bg: var(--ui-active-bg);
  --bs-nav-pills-link-active-color: var(--clr-cyan);
}
#ultrznTvSidebar .nav-pills .nav-link.active {
  box-shadow: var(--ui-active-glow);
}

/* The navbar-toggler (hamburger) has no light/dark variant set, so its icon
   defaults to Bootstrap's own navbar-color variable (dark). This exact rule
   is copied verbatim from studio.css so UltrZn TV's mobile hamburger matches
   UZ Studio's hamburger color exactly. */
.navbar-toggler {
  color: var(--clr-text) !important;
  border-color: var(--clr-border) !important;
}

/* :not(.active) so this (an ID selector, higher specificity than Bootstrap's
   own .nav-pills .nav-link.active rule) doesn't shadow the active pill's own
   active-color variable set above. */
#ultrznTvSidebar .nav-pills .nav-link:not(.active) {
  color: var(--clr-text);
  text-align: start;
}

#ultrznTvSidebar .nav-pills .nav-link:hover {
  color: var(--clr-cyan);
}

/* Liked videos: the sidebar link's flame (the reaction widget's, outlined
   in the link's own color like the other sidebar icons) and the page
   heading's flame, in color as on video cards. */
.sidebar-flame { display: inline-flex; width: 1.25em; justify-content: center; }
.sidebar-flame .rx-flame { width: 1.1em; height: 1.1em; }
.liked-videos-heading .rx-flame { width: 1.1em; height: 1.1em; vertical-align: -0.15em; }
.liked-videos-heading .rx-flame .fo { fill: url(#rxFlameGradient); stroke: #ff6a00; }
.liked-videos-heading .rx-flame .fi { fill: #ffe07a; }

/* Channel page tab strip (Home/Videos/Shorts/Live/Playlists/Posts/Store) —
   the same cyan glass pills as UZ Studio ▸ Syndication's tabs
   (.syndication-tabs in studio.css, which this layout doesn't load). */
.channel-tabs { gap: 4px; padding-bottom: 2px; }
.channel-tabs .nav-link {
  white-space: nowrap;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.channel-tabs .nav-link:not(.active) { color: var(--clr-text); }
.channel-tabs .nav-link.active {
  background: var(--clr-cyan-dim);
  color: var(--clr-cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 232, 255, 0.35);
}

/* Channel About tab: the Details column on the right (below on phones). */
.channel-about-details {
  padding: 16px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 12px;
}

/* Video action buttons (Like/Save/Share on videos/show) — icon-only,
   mirrors posts.css's .post-action-btn treatment verbatim (posts.css isn't
   loaded on this layout) so the two feel like one design system. */
.post-action-btn {
  color: var(--clr-muted) !important;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
  transition: color 0.15s;
  background: none;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.post-action-btn:hover,
.post-action-btn:focus {
  color: var(--clr-cyan) !important;
}
.post-action-btn.like-btn:hover,
.post-action-btn.like-btn:focus {
  color: var(--clr-red, #ff3b30) !important;
}
.post-action-btn.like-btn.liked,
.post-action-btn.like-btn.liked:hover,
.post-action-btn.like-btn.liked:focus {
  color: var(--clr-red, #ff3b30) !important;
}
.post-action-count {
  font-size: 0.85rem;
  color: var(--clr-muted);
}
.post-action-btn.bookmark-btn.bookmarked,
.post-action-btn.bookmark-btn.bookmarked:hover,
.post-action-btn.bookmark-btn.bookmarked:focus {
  color: var(--clr-cyan) !important;
}
/* Video like (thumbs up) uses the same cyan as Save/bookmark, not the
   heart's red — scoped to .video-like-btn (not just .like-btn, which posts.css
   also uses for its red heart) so this doesn't reach the posts feed, and
   placed after the .like-btn rules above so it wins on equal specificity. */
.post-action-btn.video-like-btn:hover,
.post-action-btn.video-like-btn:focus,
.post-action-btn.video-like-btn.liked,
.post-action-btn.video-like-btn.liked:hover,
.post-action-btn.video-like-btn.liked:focus {
  color: var(--clr-cyan) !important;
}
.post-action-btn form,
form .post-action-btn {
  display: inline;
}

/* Watch page transcript panel (videos/_transcript_panel, rows from
   video_transcripts/show; behaviour in transcript_controller.js). The body
   is the only scrolling part and is position relative, because the
   controller measures row offsets from it to keep the spoken line in view. */
.transcript-panel {
  display: flex;
  flex-direction: column;
  max-height: 420px;
  border: 1px solid var(--clr-border);
  border-radius: 12px;
  background: var(--clr-surface-2);
  overflow: hidden;
}
.transcript-panel[hidden] { display: none; }
/* Mobile placement, just below the player. */
[data-transcript-target="mobileSlot"] .transcript-panel { margin-top: 1rem; }
.transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
}
.transcript-search { padding: 0 14px 8px; }
.transcript-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 6px 8px;
}
.transcript-row {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--clr-text);
  text-align: start;
  font-size: 14px;
  line-height: 1.4;
}
.transcript-row:hover,
.transcript-row:focus-visible { background: var(--clr-surface-3, rgba(255, 255, 255, 0.06)); }
.transcript-row.active { background: rgba(0, 232, 255, 0.12); }
.transcript-row.active .transcript-time { color: var(--clr-cyan); }
.transcript-time {
  flex-shrink: 0;
  min-width: 3.25em;
  color: var(--clr-muted);
  font-variant-numeric: tabular-nums;
}
.transcript-footer {
  padding: 8px 14px 12px;
  border-top: 1px solid var(--clr-border);
}
.transcript-footer[hidden] { display: none; }

/* Mux Player (videos/_player). 16:9 by default and never taller than 640px
   on the watch page; the embed page sizes it to the frame in its own
   layout. The black background shows before the poster loads. */
.ultrzn-player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 640px;
  background: #000;
  border-radius: 0.375rem;
  overflow: hidden;
  --media-object-fit: contain;
}
.ultrzn-player-fill { height: 100%; aspect-ratio: auto; max-height: none; border-radius: 0; }

/* ── History (ultrzntv/history) ──────────────────────────────────────── */
.history-thumb {
  width: 168px;
  aspect-ratio: 16 / 9;
  background-color: var(--clr-surface-2);
}
.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 575.98px) {
  .history-thumb { width: 120px; }
}
.history-badge {
  position: absolute;
  bottom: 6px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.75);
}
.history-badge-duration { right: 6px; }
.history-badge-short { left: 6px; }
.history-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
}
.history-progress > span {
  display: block;
  height: 100%;
  background: var(--clr-cyan);
}
.history-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-entry .min-w-0 { min-width: 0; }
/* A day whose last entry was just removed (Turbo Stream) hides its heading. */
.history-day:not(:has(.history-entry)) { display: none; }
.history-search { min-width: 220px; }

/* ── Shorts viewer (ultrzntv/shorts) ─────────────────────────────────── */
/* One Short per screen: native vertical scroll-snap does swipe;
   shorts_controller.js does wheel, keyboard and players. The height
   leaves room for the top bar (and the bottom nav on phones). */
.shorts-feed {
  height: calc(100dvh - 150px);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.shorts-feed::-webkit-scrollbar { display: none; }
.shorts-feed:focus { outline: none; }
.short-slide {
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  padding: 4px 0;
}
.short-stage {
  position: relative;
  height: 100%;
  aspect-ratio: 9 / 16;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.short-poster,
.short-player,
.short-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.short-poster { object-fit: cover; }
mux-player.short-video {
  --controls: none;
  --media-object-fit: cover;
}
.short-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.short-control {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}
.short-control:focus-visible { outline: 2px solid var(--clr-cyan); outline-offset: 2px; }
.short-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 56px 14px 14px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}
.short-title { font-weight: 600; }
.short-description {
  max-height: 30vh;
  overflow-y: auto;
}
.short-description summary { cursor: pointer; color: rgba(255, 255, 255, 0.8); }
.short-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
}
.shorts-end {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  scroll-snap-align: end;
}
.shorts-comments { --bs-offcanvas-width: min(440px, 100vw); }
@media (max-width: 767.98px) {
  .shorts-feed { height: calc(100dvh - 190px); }
  .short-slide { flex-direction: column; align-items: stretch; gap: 8px; }
  .short-stage { flex: 1; height: auto; width: 100%; aspect-ratio: auto; min-height: 0; }
  .short-actions { flex-direction: row; justify-content: center; flex-wrap: wrap; padding-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .shorts-feed { scroll-behavior: auto; }
}

/* ── Channel Shorts tab ─────────────────────────────────────────────── */
.short-card-thumb {
  aspect-ratio: 9 / 16;
  background-color: var(--clr-surface-2);
}
.short-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
