/*
 * Guest discovery: the person page and the people entry into search.
 *
 * The profile follows Tafrah's show header and IMDb's identity-to-credits flow.
 * People search follows the compact result-kind row used by Apple Podcasts.
 */
@layer pages {
  .guest-page {
    container: guest-page / inline-size;
  }

  /* ------------------------------ profile ------------------------------ */
  .guest-profile {
    display: grid;
    grid-template-columns: minmax(0, min(23vi, 6rem)) minmax(0, 1fr);
    align-items: start;
    gap: 1rem;
  }

  .guest-profile__photo {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    font-size: var(--fs-24);
  }

  .guest-profile__copy {
    min-width: 0;
    justify-items: start;
    gap: var(--space-2);
    text-align: start;
  }

  .guest-profile__copy h1 {
    font-size: var(--fs-title);
    line-height: var(--lh-title);
    overflow-wrap: anywhere;
  }

  .guest-profile .verified-badge {
    color: var(--green-400);
  }

  .guest-profile__roles {
    color: var(--muted-strong);
    font-size: var(--fs-14);
    font-weight: 500;
  }

  .guest-profile__copy .guest-stats {
    justify-content: start;
    margin: 0;
  }

  .guest-stats > div,
  .guest-stats dd {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
  }

  .guest-stats svg {
    flex: none;
  }

  .guest-stats dd {
    order: -1;
    margin: 0;
    color: var(--text);
    font-weight: 700;
  }

  .guest-profile__bio {
    max-width: 60ch;
    color: var(--text-soft);
    font-size: var(--fs-14);
    line-height: var(--lh-reading);
    overflow-wrap: anywhere;
  }

  .guest-profile__actions {
    grid-column: 1 / -1;
    align-items: flex-start;
    justify-content: flex-start;
    gap: var(--space-2);
  }

  .guest-profile__actions > button {
    flex: 1 1 auto;
  }

  .guest-links summary {
    list-style: none;
  }

  .guest-links summary::-webkit-details-marker {
    display: none;
  }

  .guest-links ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-2) 0 0;
    padding: 0;
    list-style: none;
  }

  .guest-links a {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--primary-text);
    padding-inline: var(--space-4);
    font-weight: 600;
  }

  /* ------------------------------- credits ------------------------------ */
  .guest-role {
    color: var(--muted-strong);
    font-weight: 600;
  }

  .guest-role[data-role='host'] {
    color: var(--coral-text);
  }

  /* Credit rows measure their own column, so enlarged text narrows them like a phone does. */
  .guest-page .episode-list {
    container: guest-credits / inline-size;
  }

  .guest-page .episode-row p {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .guest-shows__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

  .guest-show {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
    min-width: 0;
  }

  .guest-show__header {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-3);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text);
    padding: 0;
    text-align: start;
  }

  .guest-show__header > span {
    display: grid;
    min-width: 0;
  }

  .guest-show__header strong {
    font-size: var(--fs-16);
    overflow-wrap: anywhere;
  }

  .guest-show__header small {
    color: var(--muted);
    font-size: var(--fs-12);
  }

  .guest-show__credits {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .guest-show__credits a {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 2.75rem;
    align-items: center;
    gap: var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: var(--space-1) var(--space-2);
  }

  .guest-show__credits a:hover {
    background: var(--surface-hover);
  }

  .guest-show__title {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .guest-show__credits small {
    color: var(--muted);
    font-size: var(--fs-12);
    white-space: nowrap;
  }

  /* ------------------------------- search ------------------------------- */
  /* One row of result kinds that scrolls sideways instead of wrapping. */
  .guest-search-kinds {
    display: flex;
    flex-wrap: nowrap;
    min-width: 0;
    gap: var(--space-2);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    margin-block: var(--space-3) var(--space-4);
    padding-block: 2px;
    scroll-padding-inline: var(--space-2);
    scrollbar-width: none;
  }

  .guest-search-kinds::-webkit-scrollbar {
    display: none;
  }

  .guest-search-kinds .chip {
    white-space: nowrap;
  }

  .guest-search-start .section-heading p {
    max-width: 40ch;
  }

  @container guest-page (min-width: 42rem) {
    .guest-profile {
      grid-template-columns: minmax(0, 8rem) minmax(0, 1fr);
      column-gap: var(--space-5);
    }

    .guest-profile__photo {
      grid-row: 1 / span 2;
    }

    .guest-profile__actions {
      grid-column: 2;
    }

    .guest-profile__actions > button {
      flex: 0 1 auto;
    }

    .guest-shows__list {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  /* At narrow widths dates drop below the compact grouped credits. */
  @container guest-page (max-width: 30rem) {
    .guest-show__credits a {
      grid-template-columns: auto minmax(0, 1fr);
    }

    .guest-show__credits small {
      grid-column: 2;
      white-space: normal;
    }
  }

  @container guest-credits (max-width: 20rem) {
    .guest-page .episode-row {
      grid-template-columns: 3rem minmax(0, 1fr);
      gap: var(--space-2) var(--space-3);
    }

    .guest-page .episode-row .cover-frame {
      width: 3rem;
    }

    .guest-page .episode-row__stack {
      flex-wrap: wrap;
      grid-column: 1 / -1;
    }
  }
}
