/*
 * An episode's transcript under it (templates/shows/transcript_part.html, site/hlustun/handrit.js): in the outlet's own
 * type (--st-font-text and the rest, which each outlet's look sets; Heimildin's by name where they aren't), its colours
 * from the text's own, so it's right in the light look and the dark, on every outlet. The times in a margin of their own,
 * quiet till pointed at; the paragraph being heard tinted; a long one folded, its first paragraphs fading out.
 */
.handrit {
    --handrit-sans: var(--st-font-sans, "sanomattextsans_web", system-ui, -apple-system, "Segoe UI", sans-serif);
    --handrit-text: var(--st-font-text, "tiempostext_web", Georgia, serif);
    --handrit-head: var(--st-font-headline, "tiemposheadline_web", Georgia, serif);
    --handrit-muted: color-mix(in srgb, currentColor 58%, transparent);
    --handrit-line: color-mix(in srgb, currentColor 14%, transparent);
    --handrit-gutter: 4.25rem;
    clear: both; /* (below the episode's text and its drop cap) */
    margin: 2.5rem 0 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--handrit-line);
}

.handrit__head {
    margin: 0 0 1.75rem;
}

.handrit__title {
    margin: 0 0 0.375rem;
    font-family: var(--handrit-head);
    font-size: 1.75rem;
    font-weight: 500;
    line-height: 1.15;
}

.handrit__meta,
.handrit__note {
    margin: 0;
    font-family: var(--handrit-sans);
    font-size: 0.9375rem;
    line-height: 1.45;
    color: var(--handrit-muted);
}

.handrit__note {
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

/* A line of it: its time in the margin, the words beside. */
.handrit__lina {
    display: grid;
    grid-template-columns: var(--handrit-gutter) minmax(0, 1fr);
    align-items: baseline;
    margin: 0 -0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    transition: background-color 250ms ease;
}

.handrit__mgr + .handrit__mgr {
    margin-top: 0.75rem;
}

.handrit__texti {
    margin: 0;
}

.handrit__mgr .handrit__texti {
    font-family: var(--handrit-text);
    font-size: 1.125rem;
    line-height: 1.65;
}

.handrit__kafli {
    margin-top: 2.25rem;
    margin-bottom: 0.625rem;
    font-family: var(--handrit-head);
    font-size: 1.375rem;
    font-weight: 500;
    line-height: 1.25;
}

.handrit__efni > .handrit__kafli:first-child {
    margin-top: 0;
}

.handrit__timi {
    justify-self: start;
    padding: 0.125rem 0;
    border: 0;
    background: none;
    color: var(--handrit-muted);
    font-family: var(--handrit-sans);
    font-size: 0.875rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

button.handrit__timi:hover {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

button.handrit__timi::before {
    content: "▶";
    display: inline-block;
    width: 0;
    overflow: hidden;
    font-size: 0.7em;
    vertical-align: 0.1em;
    transition: width 150ms ease;
}

button.handrit__timi:hover::before,
.handrit__lina.is-now button.handrit__timi::before {
    width: 1.1em;
}

.handrit__timi:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
    border-radius: 2px;
}

/* The paragraph being heard. */
.handrit__lina.is-now {
    background: color-mix(in srgb, currentColor 6%, transparent);
}

.handrit__lina.is-now .handrit__timi {
    color: inherit;
    font-weight: 600;
}

/* Folded: its first paragraphs, fading out above the button that opens it. */
.handrit__efni.is-folded {
    max-height: 26rem;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
    mask-image: linear-gradient(to bottom, #000 55%, transparent);
}

.handrit__opna {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 1rem;
    padding: 0.625rem 1rem 0.625rem 1.125rem;
    border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
    border-radius: 999px;
    background: none;
    color: inherit;
    font-family: var(--handrit-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.handrit__opna:hover {
    background: color-mix(in srgb, currentColor 6%, transparent);
}

.handrit__opna:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.handrit__opna svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
    transition: transform 150ms ease;
}

.handrit__opna[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.handrit__opna[hidden] {
    display: none;
}

.handrit__laest {
    margin: 0;
    font-family: var(--handrit-sans);
    color: var(--handrit-muted);
}

/* A phone: no margin for the times; each before its paragraph, on its line. */
@media (max-width: 600px) {
    .handrit {
        --handrit-gutter: 0;
    }

    .handrit__lina {
        display: block;
        margin: 0 -0.5rem;
        padding: 0.375rem 0.5rem;
    }

    .handrit__mgr .handrit__timi {
        display: block;
        margin-bottom: 0.25rem;
    }

    .handrit__lina span.handrit__timi {
        display: none;
    }

    .handrit__kafli .handrit__timi {
        display: block;
        margin-bottom: 0.375rem;
        font-size: 0.8125rem;
    }

    .handrit__mgr .handrit__texti {
        font-size: 1.0625rem;
    }

    .handrit__title {
        font-size: 1.5rem;
    }
}
