/* Credits on a title's page, and a person's own page. */

.credits-byline {
    margin: -0.5rem 0 1rem;
    color: var(--mb-ink-muted);
}

.credits-byline a {
    color: var(--mb-ink-strong);
    font-weight: 600;
}

.credits-heading {
    margin: 0 0 0.5rem;
    color: var(--mb-ink-muted);
    font-size: 0.875rem;
    font-weight: 600;
}

/* The section's label and the way to everything else, on one line. */
.credits-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.credits-title {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
}

.credits-all {
    color: var(--mb-link);
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
}

/* One row of portraits at every width, sliding sideways under a thumb or a
   trackpad: a second row of faces would push the reviews off the screen. The
   next portrait is cut at the edge, which is what says there is more to slide
   to. */
.credits-cast {
    display: grid;
    grid-auto-flow: column;
    /* Four portraits and a bit of the fifth on a phone, as many as fit a wider
       column; never so narrow that a name has no room. */
    grid-auto-columns: clamp(4.25rem, calc((100% - 2rem) / 4.4), 5.5rem);
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding-bottom: 0.375rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.credits-cast-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.25;
    scroll-snap-align: start;
}

.credits-cast-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    color: var(--mb-ink-strong);
    font-weight: 600;
    text-decoration: none;
}

.credits-cast-link:hover .credits-name,
.credits-cast-link:focus-visible .credits-name {
    text-decoration: underline;
}

/* A long name or a list of parts keeps to two lines, so one actor's row of
   characters does not make every portrait's box taller. */
.credits-cast .credits-name,
.credits-cast .credits-character {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.credits-portrait {
    flex-shrink: 0;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    object-fit: cover;
    background: var(--mb-surface-sunken);
}

.credits-portrait-small {
    width: 2.5rem;
    height: 2.5rem;
}

.credits-portrait-blank,
.credits-portrait-more {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mb-ink-faint);
    font-size: 1.5rem;
}

.credits-portrait-small.credits-portrait-blank {
    font-size: 1.125rem;
}

.credits-portrait-more {
    color: var(--mb-link);
    font-size: 1rem;
    font-weight: 700;
}

.credits-character,
.credits-episodes,
.credits-aside {
    color: var(--mb-ink-muted);
    font-weight: normal;
}

.credits-character {
    margin-top: 0.125rem;
}

.credits-episodes {
    font-size: 0.6875rem;
}

/* The crafts a reader looks for, a line each, their names lined up. */
.credits-crafts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
    font-size: 0.875rem;
}

.credits-crafts dt {
    color: var(--mb-ink-muted);
    font-weight: normal;
}

.credits-crafts dd {
    margin: 0;
}

/* A title's full credits. */

.credits-department {
    margin: 1.25rem 0 0.5rem;
    color: var(--mb-ink-muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.credits-roster li {
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--mb-border-faint);
}

.credits-roster-person {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--mb-ink-strong);
    font-weight: 600;
    text-decoration: none;
}

.credits-roster-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.credits-roster-text .credits-aside {
    font-size: 0.875rem;
}

.credits-roster-person:hover .credits-name,
.credits-roster-person:focus-visible .credits-name {
    text-decoration: underline;
}

/* A person's own page. */

/* A person's page opens the way a title's does: the portrait where the poster
   would be. On a phone it sits beside the name, and what follows runs the full
   width under both; past that, everything sits beside it. */
.person-hero {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    grid-template-areas:
        "portrait head"
        "body body";
    gap: 1rem 1.25rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.person-portrait {
    grid-area: portrait;
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: var(--mb-radius);
    background: var(--mb-surface-sunken);
    color: var(--mb-ink-faint);
    font-size: 2.5rem;
}

.person-hero-head {
    grid-area: head;
    align-self: center;
}

.person-hero-body {
    grid-area: body;
    min-width: 0;
}

@media (min-width: 768px) {
    .person-hero {
        grid-template-columns: 13rem minmax(0, 1fr);
        grid-template-areas:
            "portrait head"
            "portrait body";
        gap: 0.75rem 2.5rem;
    }

    .person-hero-head {
        align-self: end;
    }
}

.person-trade {
    margin: 0 0 0.25rem;
    color: var(--mb-accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.person-name {
    margin: 0 0 0.5rem;
    font-size: calc(1.5rem + 1vw);
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.1;
}

.person-meta {
    color: var(--mb-ink-muted);
    font-size: 0.9375rem;
}

/* Separators trail their item, so a wrap never starts a line with a dot. */
.person-meta .list-inline-item:not(:last-child)::after {
    content: "·";
    margin-left: 0.5rem;
    color: var(--mb-ink-faint);
}

.person-bio,
.person-bio-text {
    max-width: 62ch;
    line-height: 1.65;
}

.person-bio,
.person-hero-body > .person-bio-text {
    margin: 0 0 1.25rem;
}

.person-bio-teaser {
    margin: 0;
}

.person-bio-text {
    white-space: pre-line;
}

.person-bio-fold > summary {
    color: var(--mb-link);
    font-weight: 600;
    cursor: pointer;
}

.person-bio-fold .person-bio-text {
    margin: 0.5rem 0 0;
}

/* Opened, the whole text takes the place of its head, and the control says it
   folds it back. */
.person-bio:has(.person-bio-fold[open]) .person-bio-teaser,
.person-bio-fold[open] .person-bio-closed,
.person-bio-fold:not([open]) .person-bio-open {
    display: none;
}

/* The tally, in the tiles the rating card draws its figures with. */
/* Four to a row on a phone, none wider than its figure needs on a screen. */
.person-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(4.25rem, 1fr));
    gap: 0.5rem;
    margin: 0 0 1rem;
}

@media (min-width: 768px) {
    .person-stats {
        grid-template-columns: repeat(auto-fill, 7.5rem);
    }
}

.person-stat-box {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--mb-border-faint);
    border-radius: var(--mb-radius);
    background: var(--mb-surface-sunken);
    color: inherit;
    text-decoration: none;
}

a.person-stat-box:hover,
a.person-stat-box:focus-visible {
    border-color: var(--mb-accent);
}

.person-stat-value {
    color: var(--mb-ink-strong);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.person-stat-of {
    color: var(--mb-ink-muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.person-stat-label {
    overflow: hidden;
    color: var(--mb-ink-muted);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-seen-bar {
    width: 100%;
    height: 0.25rem;
    margin-top: 0.375rem;
    overflow: hidden;
    border: 0;
    border-radius: var(--mb-radius-pill);
    background: var(--mb-border-faint);
    accent-color: var(--mb-state-watched);
    appearance: none;
}

.person-seen-bar::-webkit-progress-bar {
    background: var(--mb-border-faint);
}

.person-seen-bar::-webkit-progress-value {
    background: var(--mb-state-watched);
}

.person-seen-bar::-moz-progress-bar {
    background: var(--mb-state-watched);
}

.person-more {
    margin-top: 1rem;
}

.person-more > summary {
    color: var(--mb-link);
    cursor: pointer;
}
