/*
  GospelVue homepage content skeleton.

  Static/mock structure only — establishes hierarchy, spacing, and
  responsive layout for the featured area and homepage sections.
*/

.home {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

/* ---- Shared: section heading row ---- */

.home-section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.home-section__heading {
  margin: 0;
  font-size: var(--font-size-xl);
  line-height: var(--line-height-tight);
  color: var(--color-text);
}

.home-section__subtitle {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.home-section__status {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  min-height: 1em;
}

.home-section__status:empty {
  display: none;
}

/* ---- Shared: empty/loading content state ----
   Shown instead of video cards when a section has no real, persisted
   video to show yet (e.g. Fresh Videos before ingestion has produced any
   videos) — never mixed with sample/demo cards. See home.js. */

.home-section__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  color: var(--color-text-muted);
}

.home-section__empty-icon {
  color: var(--color-accent);
  opacity: 0.6;
}

.home-section__empty-title {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.home-section__empty-text {
  margin: 0;
  font-size: var(--font-size-sm);
  max-width: 32ch;
}

/* ---- Shared: badges ---- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.4;
  white-space: nowrap;
}

.badge--category {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

.badge--live {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
}

.badge--live::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: var(--radius-full);
  background: currentColor;
}

.badge--upcoming {
  background: var(--color-surface-muted);
  color: var(--color-accent);
}

/* ---- Featured area ---- */

.featured {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-5);
}

.featured__media {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--color-surface-muted), var(--color-border));
  display: flex;
  align-items: center;
  justify-content: center;
}

.featured__media .badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
}

.featured__play-icon {
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-full);
  background: var(--color-bg-elevated);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.featured__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.featured__eyebrow {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.featured__title {
  margin: 0;
  font-size: clamp(var(--font-size-xl), 4vw, var(--font-size-2xl));
  line-height: var(--line-height-tight);
  color: var(--color-text);
}

.featured__description {
  margin: 0;
  color: var(--color-text-muted);
  max-width: 60ch;
}

.featured__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-1);
  font-size: var(--font-size-sm);
}

.featured__creator {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.featured__stat {
  color: var(--color-text-muted);
}

.featured__stat::before {
  content: "\2022";
  margin-right: var(--space-3);
  color: var(--color-text-muted);
}

.featured__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

@media (min-width: 768px) {
  .featured {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: center;
    padding: var(--space-6);
  }
}

/* ---- View toggle (Grid / List) ---- */

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-1);
  gap: var(--space-1);
  background: var(--color-surface);
  flex-shrink: 0;
}

.view-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  padding: var(--space-1) var(--space-3);
  cursor: pointer;
}

.view-toggle__btn.is-active {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.view-toggle__btn svg {
  width: 16px;
  height: 16px;
}

/* ---- Media card (Fresh Videos / Gospel Music) ---- */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--space-5);
  list-style: none;
  margin: 0;
  padding: 0;
}

.media-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}

.media-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Fresh Videos cards wrap their title in a link (see video-card.js). The
   card's primary action is playing the video inline via the media area
   below, not the title link, so the link no longer stretches over the
   whole card — it's a normal, title-scoped link to the GospelVue watch
   page (or the real external watch URL, when there's no first-party watch
   page to link to). */

.media-card__link {
  color: inherit;
  text-decoration: none;
}

.media-card__link:hover {
  text-decoration: underline;
}

.media-card__thumb {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

/* The media area: idle state is a <button> (YouTube-sourced videos, so
   inline playback is possible) or an <a> (everything else, linking out to
   the real watch URL), filling the whole thumb box. Clicking/activating it
   swaps it for a live iframe (.media-card__frame, below) — see
   video-card.js's setupInlinePlayback. */

.media-card__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.media-card__thumbnail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The play mark itself is just the purple/violet triangle-with-cross SVG —
   no circular backing plate. It's sized large (roughly 2.5-3x its old
   footprint) so it reads clearly over any thumbnail; filter: drop-shadow
   (rather than a background/box-shadow, which would imply a solid plate)
   keeps the cross legible on light thumbnails without adding a shape
   behind the mark. The hover/focus grow lives on .media-card__media so it
   also reacts to keyboard focus, not just pointer hover. */

.media-card__play-icon {
  position: relative;
  z-index: 1;
  width: 5.25rem;
  height: 5.25rem;
  filter: drop-shadow(0 2px 6px rgba(17, 12, 34, 0.45));
  transition: transform 0.15s ease, filter 0.15s ease;
}

@media (hover: hover) {
  .media-card__media:hover .media-card__play-icon {
    transform: scale(1.08);
    filter: drop-shadow(0 4px 14px rgba(91, 33, 182, 0.6)) drop-shadow(0 2px 6px rgba(17, 12, 34, 0.45));
  }
}

.media-card__media:focus-visible .media-card__play-icon {
  transform: scale(1.08);
  filter: drop-shadow(0 4px 14px rgba(91, 33, 182, 0.6)) drop-shadow(0 2px 6px rgba(17, 12, 34, 0.45));
}

@media (min-width: 768px) {
  .media-card__play-icon {
    width: 6rem;
    height: 6rem;
  }
}

/* List view's thumbnail column is a fixed 7rem wide (≈3.9rem tall at
   16:9), too small for the default mark without it overflowing the
   overflow:hidden thumb box, so it scales back down there. */

.media-grid[data-view="list"] .media-card__play-icon {
  width: 2rem;
  height: 2rem;
}

/* Once playing, the media area is a full-bleed 16:9 YouTube embed instead
   — the thumb box itself already enforces the 16:9/overflow-hidden frame,
   so the iframe just needs to fill it. */

.media-card__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.media-card__thumb--square {
  aspect-ratio: 1 / 1;
}

/* Badges/duration sit above the media area (idle control or live embed)
   in a corner. pointer-events: none keeps them from ever intercepting a
   click meant for the play control or the embedded player's own controls
   underneath. */

.media-card__thumb .badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 2;
  pointer-events: none;
}

.media-card__duration {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-2);
  z-index: 2;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  padding: 0.1rem var(--space-2);
  border-radius: var(--radius-sm);
}

.media-card__title {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  line-height: var(--line-height-tight);
}

.media-card__meta {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Secondary "Watch on YouTube" action. Sits above the .media-card__link::after
   overlay (which stretches over the whole card so the card itself plays the
   embedded video on click) via z-index, so it stays independently clickable
   as an "open on youtube.com instead" escape hatch. */
.media-card__external-link {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  margin: 0;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  text-decoration: none;
}

.media-card__external-link:hover,
.media-card__external-link:focus-visible {
  color: var(--color-accent);
  text-decoration: underline;
}

/* ---- Fresh Videos: list presentation ----
   Same .media-card markup as the grid; only the layout changes. The card
   becomes a two-column grid (thumbnail, then title/meta stacked) instead
   of a flex column, and the list container becomes a single vertical
   stack instead of a multi-column grid. */

.media-grid[data-view="list"] {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.media-grid[data-view="list"] .media-card {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: var(--space-4);
  row-gap: var(--space-1);
  align-items: center;
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

.media-grid[data-view="list"] .media-card:hover {
  background: var(--color-surface-muted);
}

.media-grid[data-view="list"] .media-card__thumb {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 100%;
}

.media-grid[data-view="list"] .media-card__title {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow-wrap: break-word;
}

.media-grid[data-view="list"] .media-card__meta {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  overflow-wrap: break-word;
}

.media-grid[data-view="list"] .media-card__external-link {
  grid-column: 2;
  grid-row: 3;
}

@media (max-width: 479px) {
  .media-grid[data-view="list"] .media-card {
    grid-template-columns: 5.5rem minmax(0, 1fr);
  }
}

/* ---- Live & Upcoming ---- */

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--space-5);
  list-style: none;
  margin: 0;
  padding: 0;
}

.live-card__thumb {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.live-card__thumb .badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
}

.live-card__title {
  margin: 0;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.live-card__meta {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ---- Community Discussions ---- */

.discussion-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.discussion-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
}

.discussion-row__avatar {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
}

.discussion-row__body {
  flex: 1;
  min-width: 0;
}

.discussion-row__title {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.discussion-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin-top: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.discussion-row__stats {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: right;
  white-space: nowrap;
}

.discussion-row__stats strong {
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

@media (max-width: 479px) {
  .discussion-row {
    flex-wrap: wrap;
  }

  .discussion-row__stats {
    align-items: flex-start;
    text-align: left;
    margin-left: calc(2.5rem + var(--space-4));
  }
}

/* ---- Popular Creators & Churches ---- */

.creator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.creator-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
}

.creator-card__avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-full);
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
}

.creator-card__name {
  margin: 0;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.creator-card__meta {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.creator-card .btn {
  margin-top: var(--space-2);
  width: 100%;
}
