/* --- episode list / episode detail overlays (list-based nav alternative) ---
   Parallel plain-tap browsing path alongside the dial UI, opened by tapping
   #carousel-meta (see updateCarouselMeta() in screens.js, wiring in
   detail-views.js) — same .menu-overlay/.show mechanics as the burger menu/
   share/info modals (menu.css), but a full-bleed page shape instead of a
   centered dialog card, so this file's overrides must load after menu.css
   (index.html) to win by source order. */

#app.episode-list-open,
#app.episode-detail-open {
  touch-action: auto;
}

.detail-overlay {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  /* above #header's 35 (base.css) — these read as a full takeover page, unlike
     the existing modals which deliberately stay under the header at z-index 30 */
  z-index: 40;
}

.detail-panel {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  background: var(--surface-2);
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* only .detail-scroll scrolls — header stays pinned */
  padding-top: env(safe-area-inset-top, 0px);
}

.detail-header {
  position: relative;
  flex: none;
  height: 52px;
  border-bottom: 1px solid var(--hairline);
}
/* .menu-back-close (menu.css) is pinned flush to top:0/right:0 by default —
   nudge it in from the true edge so it doesn't sit flush against the screen's
   physical corner on these full-bleed pages (the existing modals don't need
   this, since .menu-panel's own 20px padding already provides that gap) */
.detail-header .menu-back-close {
  top: 8px;
  right: 8px;
}

.detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 20px max(env(safe-area-inset-bottom, 20px), 20px);
  -webkit-user-select: text;
  user-select: text;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* old Edge */
}
.detail-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.detail-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 4px 0 10px;
}

/* --- #carousel-meta tap affordance --- */

.carousel-meta-tappable {
  cursor: pointer;
}
.carousel-meta-tappable:active {
  opacity: .7;
}
/* .carousel-meta is display:flex, so a ::after on the container itself becomes
   its own flex item/row — harmless for episode-nav's single-line caption (flex-
   direction:row, so it just trails inline), but podcast-nav's caption is
   flex-direction:column (carousel.css .podcast-meta), where that would add a
   3rd stacked row and get clipped by .carousel-meta's fixed height/overflow:
   hidden. So the two cases are scoped separately below: the plain trailing
   chevron for everything except .podcast-meta, and — for .podcast-meta — the
   chevron instead goes on the last .podcast-meta-line itself (an ordinary
   block, not a flex item), where it appends inline with no extra row. */
.carousel-meta-tappable:not(.podcast-meta)::after {
  content: '\203A'; /* › */
  margin-left: 6px;
  opacity: .55;
}
.carousel-meta.podcast-meta.carousel-meta-tappable .podcast-meta-line:last-child::after {
  content: '\203A';
  margin-left: 6px;
  opacity: .55;
}

/* --- episode list overlay --- */

.detail-podcast-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.detail-podcast-art {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--surface);
  box-shadow: 0 8px 20px var(--shadow-1);
}
.detail-podcast-name {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}
.detail-podcast-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--dim);
}
.detail-podcast-meta .podcast-meta-line {
  margin-top: 2px;
}

.detail-podcast-about {
  font-size: 13px;
  line-height: 1.5;
  color: var(--dim);
  white-space: pre-line;
  margin-bottom: 2px;
}
.detail-podcast-about.clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.detail-about-more {
  display: block;
  margin: 4px 0 18px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.detail-about-more.hidden {
  display: none;
}

.episode-list-rows {
  display: flex;
  flex-direction: column;
}
.episode-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--hairline);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}
.episode-row:last-child {
  border-bottom: none;
}
.episode-row-thumb {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface);
}
.episode-row-body {
  flex: 1;
  min-width: 0;
}
.episode-row-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}
/* two-line clamp — full snippet text is set via JS, this just does the visual
   truncation without manual string-slicing */
.episode-row-snippet {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  color: var(--dim);
  margin-bottom: 6px;
}
.episode-row-meta {
  font-size: 11px;
  color: var(--dim);
}
.episode-row-meta .dot-sep {
  display: inline-block;
  margin: 0 5px;
  opacity: .6;
}
.episode-row-meta .listened-tick {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 4px;
  color: var(--success);
}
.episode-row-meta .listened-tick svg {
  width: 12px;
  height: 12px;
}
.episode-row-play {
  flex: none;
  align-self: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.episode-row-play svg {
  width: 18px;
  height: 18px;
  margin-left: 2px; /* optical centering for a play triangle */
}
.episode-list-empty {
  padding: 20px 0;
  font-size: 13px;
  color: var(--dim);
  text-align: center;
}

/* --- episode detail overlay --- */

.detail-episode-art {
  display: block;
  width: min(66.7%, 240px); /* same fractional-sizing convention as .episode-card, carousel.css */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 16px 40px var(--shadow-1); /* matches .episode-card .artwork */
  background: var(--surface);
  margin: 4px auto 18px;
}
.detail-episode-title {
  margin: 0 0 4px;
  font-size: 19px;
  line-height: 1.3;
  text-align: center;
}
.detail-episode-podcast {
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--dim);
  text-align: center;
}
.detail-episode-meta {
  margin-bottom: 18px;
  font-size: 12px;
  color: var(--dim);
  text-align: center;
}
.detail-episode-meta .dot-sep {
  display: inline-block;
  margin: 0 6px;
  opacity: .6;
}
.detail-episode-meta .listened-tick {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 4px;
  color: var(--success);
}
.detail-episode-meta .listened-tick svg {
  width: 14px;
  height: 14px;
}
.detail-play-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 240px;
  margin: 0 auto 24px;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 15px;
  font-weight: 700;
}
.detail-play-icon {
  display: flex;
}
.detail-play-icon svg {
  width: 20px;
  height: 20px;
}
/* hidden when the detail overlay was opened from the playing screen — already
   playing, so there's no play action to offer (openEpisodeDetailOverlay, detail-views.js) */
.detail-play-button.hidden {
  display: none;
}
