/* permanent container: houses #screen (the cross-fading carousel) plus the
   shared metadata caption row below it, so the two always reserve the same
   combined space regardless of which screen/view is active */
.carousel-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

#screen {
  position: relative;
  flex: 1;
  min-height: 0;
}

/* shared caption row for the currently-focused episode (date/episode-number/
   duration) — populated by updateCarouselMeta() (screens.js), empty+hidden on
   the podcasts screen. Permanently reserves --meta-h regardless of content, so
   the carousel above never shifts based on whether metadata is showing. */
.carousel-meta {
  flex: none;
  height: var(--meta-h);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 20px;
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .2s ease;
  /* the focused card's artwork is deliberately scaled to less than the full
     height of its own centered square (see .carousel-item.pos-current), which
     leaves a consistent gap between the card and this row — pull the caption
     up into that reserved-but-empty space. A transform (paint-only) rather
     than a negative margin, so it doesn't perturb --carousel-stage-h's sizing
     math the way shrinking this row's actual flex height would. */
  transform: translateY(-12px);
}
.carousel-meta .dot-sep {
  display: inline-block;
  margin: 0 6px;
  opacity: .6;
  transform: translateY(-1px);
}
.carousel-meta.hidden {
  opacity: 0;
  pointer-events: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  padding: 0 20px;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* --- episodes screen: nav (browsing) vs playing sub-views, folded into one
   screen (see index.html/setScreen()) --- */
.episode-subview {
  display: none;
  width: 100%;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.episode-subview.active {
  display: flex;
}

/* --- podcasts / episodes carousel --- */

.carousel {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-item {
  position: absolute;
  /* shared by podcasts-nav/episode-nav/playing (single rule, so all three stay
     pixel-identical) — simple centering within .carousel's own box, now that
     the metadata/scrub rows are permanent siblings below rather than escaping
     flow, so there's nothing left below the carousel to bias away from */
  top: 50%;
  left: 50%;
  width: 100%;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .28s ease, filter .28s ease;
}
.carousel-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 12px 30px var(--shadow-1);
  background: var(--surface);
}
.carousel-item .meta {
  font-size: 12px;
  color: var(--dim);
}

/* episode-nav card: same width as .artwork-wrap itself (playing.css) and
   .podcast-art-wrap (below) — scaled up on focus by the shared
   .carousel-item.pos-current rule above, so all three "focused card" contexts
   (podcasts, episode-nav, playing) are pixel-identical. Sized as a percentage
   of .carousel-item's own (already shrink-to-fit-safe) width rather than the
   viewport, so it scales down along with the rest of the card on short
   viewports instead of overflowing — see .carousel's max-height in dial.css.
   66.7% == the old min(50vw,200px)'s 50vw, expressed relative to
   .carousel-item's ~75vw width (50/75 = 2/3), so this is a no-op change in
   size on any viewport where nothing needs to shrink. */
.episode-card {
  position: relative;
  width: min(66.7%, 200px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
/* .carousel-item img (below) sets a fixed shadow for the plain podcast-art
   image — override back to .artwork's own value (playing.css) so the episode
   artwork matches the playing card's shadow exactly */
.episode-card .artwork {
  width: 100%;
  box-shadow: 0 16px 40px var(--shadow-1);
}
.episode-number {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7));
  z-index: 3;
}

/* explicit width+aspect-ratio (same pattern .artwork-wrap uses for episode/
   playing, playing.css) rather than shrink-to-fit — a shrink-to-fit
   inline-block parent can't give its own percentage-sized child (the img
   below) a definite basis to resolve against */
.podcast-art-wrap {
  position: relative;
  width: min(66.7%, 200px);
  aspect-ratio: 1 / 1;
}

.info-icon {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  display: flex;
  /* button box stays a full 48px tap target flush with the corner, but the glyph
     itself is aligned to the corner (via padding, not centered) so it's not the
     48px hit-area pushing it inward that reads as "not in the corner" */
  align-items: flex-start;
  justify-content: flex-end;
  padding: 6px 6px 0 0;
  background: transparent;
  border: none;
  color: var(--fg);
  z-index: 3;
}
.info-icon svg {
  width: 24px;
  height: 24px;
  /* no background chip behind the tap zone anymore — a drop-shadow keeps the glyph
     readable over varied artwork instead of relying on a filled backdrop */
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7));
}
/* shared by all three "focused card" contexts (podcasts-nav, episode-nav,
   playing) so they're pixel-identical in size/position — see dial.css's
   portrait block for the matching peek-card/container-sizing rules */
.carousel-item.pos-current {
  transform: translate(-50%, -50%) scale(1.265);
  opacity: 1;
  filter: none;
  z-index: 2;
}
/* podcast-nav-only: discreet grey ring so the focused card reads as clearly
   "in focus" against the neighbors — descendant selector (not `>`), since the
   img sits inside .podcast-art-wrap, one level below .carousel-item.
   episode/playing artwork already gets its own border via .artwork (playing.css) */
#podcasts-carousel .carousel-item.pos-current img {
  border: 1px solid var(--border-soft);
}
/* gradient fade (not flat opacity) — fully opaque at the edge nearest the
   focused card, fading to fully hidden by 75% across the peek card's own
   width (the remaining 25%, its outer edge, stays invisible) */
.carousel-item.pos-prev {
  transform: translate(calc(-50% - 92%), -50%) scale(.72);
  -webkit-mask-image: linear-gradient(to left, black 0%, transparent 75%);
  mask-image: linear-gradient(to left, black 0%, transparent 75%);
  filter: blur(.5px);
  z-index: 1;
}
.carousel-item.pos-next {
  transform: translate(calc(-50% + 92%), -50%) scale(.72);
  -webkit-mask-image: linear-gradient(to right, black 0%, transparent 75%);
  mask-image: linear-gradient(to right, black 0%, transparent 75%);
  filter: blur(.5px);
  z-index: 1;
}
.carousel-item.pos-hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(.5);
}
/* info icon only makes sense on the focused card — the click handler already
   restricts to pos-current (screens.js), this just matches it visually */
.carousel-item.pos-prev .info-icon,
.carousel-item.pos-next .info-icon {
  display: none;
}

