.pt-template .pa-grid {
    grid-template-columns: var(--pt-tracks, repeat(var(--pt-columns), minmax(0, 1fr)));
    align-items: stretch;
}

.pt-template.pt-equal .pa-grid {
    grid-auto-rows: 1fr;
}

.pt-template .pa-grid > .pa-card {
    min-height: 0;
}

.pt-template .pa-grid > .pa-height-limited {
    min-height: 0;
    height: 100%;
}

@media (max-width: 640px) {
    .pt-template .pa-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none !important;
        grid-auto-rows: auto;
    }

    .pt-template.pt-equal .pa-grid {
        grid-auto-rows: auto;
    }

    .pt-template .pa-grid > .pa-card {
        grid-area: auto !important;
        height: auto;
    }
}

.pt-template .pa-card > .pt-flow-heading {
    flex: none;
    grid-column: 1 / -1;
    overflow-wrap: anywhere;
}

.pt-template .pa-card > .pt-heading-mobile {
    display: none;
}

@media (max-width: 640px) {
    .pt-template .pa-grid > .pa-card {
        order: var(--pt-mobile-order, 0);
    }

    .pt-template .pa-card > .pt-heading-desktop {
        display: none;
    }

    .pt-template .pa-card > .pt-heading-mobile {
        display: block;
    }
}

.pt-template .pt-title-small { --pt-title-scale: 0.75; }
.pt-template .pt-title-large { --pt-title-scale: 1.5; }
.pt-template .pt-title-xlarge { --pt-title-scale: 2; }

section.pa-section.pt-template[id] .pa-card .pa-title {
    font-size: calc(var(--pa-title-size, 1.125rem) * var(--pt-title-scale, 1)) !important;
}

@media (min-width: 641px) and (max-width: 980px) {
    section.pa-section.pt-template[id] .pa-card .pa-title {
        font-size: calc(var(--pa-tablet-title-size, 1.125rem) * var(--pt-title-scale, 1)) !important;
    }
}

@media (max-width: 640px) {
    section.pa-section.pt-template[id] .pa-card .pa-title {
        font-size: calc(var(--pa-mobile-title-size, 1.125rem) * var(--pt-title-scale, 1)) !important;
    }

    .pt-template.pa-hide-excerpt-mobile .pt-excerpt-fill .pa-excerpt {
        display: block;
    }
}

@media (min-width: 641px) {
    .pt-template .pt-image-adaptive > .pa-image-link > .pa-image {
        object-fit: cover;
    }
}

/* A narrow content column can need the reading order even on a wider screen. */
.pt-template.pt-stack .pa-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none !important;
    grid-auto-rows: auto;
}

.pt-template.pt-stack .pa-grid > .pa-card {
    grid-area: auto !important;
    height: auto;
    order: var(--pt-mobile-order, 0);
}

.pt-template.pt-stack .pa-card > .pt-heading-desktop { display: none; }
.pt-template.pt-stack .pa-card > .pt-heading-mobile { display: block; }

section.pa-section.pt-template.pt-stack[id] .pa-card .pa-title {
    font-size: calc(var(--pa-mobile-title-size, 1.125rem) * var(--pt-title-scale, 1)) !important;
}

.pt-template.pt-stack .pa-card > .pa-image-link > .pa-image {
    object-fit: var(--pa-mobile-image-fit, contain);
}

section.pa-section.pt-template[id] .pa-grid > .pt-card-overlay {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
    padding: 0;
    border: 0;
}

.pt-template .pt-card-overlay > .pt-flow-heading {
    grid-area: 1 / 1;
}

.pt-template .pt-card-overlay > .pa-image-link {
    position: relative;
    grid-area: 2 / 1;
    align-self: stretch;
    min-height: 100%;
    background: #343434;
}

.pt-template .pt-card-overlay > .pa-image-link > .pa-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.pt-template .pt-card-overlay > .pa-card-content {
    position: relative;
    grid-area: 2 / 1;
    align-self: end;
    padding: 0.65rem 0.8rem 0.7rem;
    background: rgb(0 0 0 / 55%);
    pointer-events: none;
}

.pt-template .pt-card-overlay > .pa-card-content::before {
    content: "";
    position: absolute;
    inset: auto 0 100%;
    height: 1.65rem;
    background: linear-gradient(to bottom, transparent, rgb(0 0 0 / 55%));
}

.pt-template .pt-card-overlay .pa-meta {
    margin-top: 0;
    color: #fff;
}

section.pa-section.pt-template[id] .pt-card-overlay .pa-title,
section.pa-section.pt-template[id] .pt-card-overlay .pa-title a {
    color: #fff !important;
}

.pt-template .pt-card-overlay .pa-title {
    margin-bottom: 0;
}

.pt-template .pt-card-overlay .pa-title a {
    pointer-events: auto;
}

section.pa-section.pt-template[id] .pt-card-overlay .pa-title a:hover,
section.pa-section.pt-template[id] .pt-card-overlay .pa-title a:focus-visible {
    color: #fff !important;
    text-decoration: underline;
}

.pt-template .pt-card-overlay > .pa-excerpt {
    grid-area: 3 / 1;
    align-self: start;
    margin-top: 0.45rem;
}

.pt-template .pa-grid > .pt-balanced {
    position: relative;
}

.pt-outer {
    display: grid;
    min-height: var(--pt-grid-height, 0px);
    grid-template-columns: var(--pt-tracks, repeat(var(--pt-columns), minmax(0, 1fr)));
    gap: var(--pa-gap-row, 16px) var(--pa-gap-col, 12px);
    align-items: stretch;
}

.pt-outer > .pt-region {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.pt-outer > .pt-region > .pa-grid {
    flex: 1 1 auto;
}

.pt-outer > .pt-region.pt-equal:not(.pt-stack) > .pa-grid {
    grid-auto-rows: var(--pt-region-tracks);
}

@media (max-width: 640px) {
    .pt-outer {
        min-height: 0;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none !important;
        grid-auto-rows: auto !important;
    }
    .pt-outer > .pt-region {
        grid-area: auto !important;
        order: var(--pt-region-order);
    }
}

.pt-grid-stack {
    display: grid;
    gap: clamp(20px, 4vw, 48px);
}

@media (min-width: 641px) {
    .pt-outer.pt-height-controlled > .pt-region,
    .pt-outer.pt-height-controlled > .pt-region > .pa-grid {
        min-height: 0;
    }

}

.pt-template .pa-excerpt {
    text-align: justify;
    text-align-last: start;
    -webkit-hyphens: auto;
    hyphens: auto;
}

@media (min-width: 641px) {
    .pt-outer.pt-outer-relaxed {
        min-height: 0;
        grid-template-rows: none !important;
        grid-auto-rows: auto !important;
        align-items: start;
    }

    .pt-outer.pt-outer-relaxed > .pt-region {
        overflow: visible;
    }

    .pt-outer.pt-outer-reflow {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: clamp(18px, 3vw, 30px);
    }

    .pt-outer.pt-outer-reflow > .pt-region {
        grid-area: auto !important;
    }

    .pt-outer.pt-outer-reflow > .pt-region-dominant {
        grid-column: 1 / -1 !important;
    }

    .pt-outer > .pt-region.pt-pair > .pa-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none !important;
        grid-auto-rows: auto;
        align-items: start;
    }

    .pt-template.pt-pair .pa-grid > .pa-card {
        grid-area: auto !important;
        height: auto;
    }

    .pt-template.pt-pair .pa-grid > .pa-card:not([data-pt-column-span="1"]) {
        grid-column: 1 / -1 !important;
    }

    .pt-template.pt-pair .pt-heading-desktop { display: none; }
    .pt-template.pt-pair .pt-heading-mobile { display: block; }
}

.pt-template:is(.pt-stack, .pt-pair) .pa-grid {
    row-gap: 12px;
}

section.pa-section.pt-template:is(.pt-stack, .pt-pair)[id] .pa-card .pa-title {
    font-size: min(calc(var(--pa-mobile-title-size, 1.125rem) * var(--pt-title-scale, 1)), 1.8rem) !important;
    line-height: 1.16;
}

.pt-template:is(.pt-stack, .pt-pair) .pa-meta {
    margin-top: 5px;
}

.pt-template:is(.pt-stack, .pt-pair):not(.pa-hide-excerpt-mobile) .pa-excerpt,
.pt-template:is(.pt-stack, .pt-pair) .pt-excerpt-fill .pa-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    line-height: 1.45;
}

@media (max-width: 640px) {
    .pt-outer { row-gap: 22px; }
    .pt-grid-stack { gap: 24px; }
    .pt-region > .pt-region-heading { margin-bottom: 10px; }
}

@media (min-width: 641px) {
    .pt-outer-reflow > .pt-region-dominant.pt-pair .pa-card:not([data-pt-column-span="1"], .pt-image-uniform) > .pa-image-link {
        max-height: clamp(200px, 42vw, 390px);
    }
}

.pt-template .pa-grid > .pt-widget-slot {
    min-width: 0;
    min-height: 0;
    overflow-wrap: anywhere;
    order: var(--pt-mobile-order, 0);
}
.pt-widget-slot img, .pt-widget-slot iframe, .pt-widget-slot video { max-width: 100%; }
.pt-template.pt-stack .pa-grid > .pt-widget-slot { grid-area: auto !important; height: auto; }
@media (max-width: 640px) {
    .pt-template .pa-grid > .pt-widget-slot { grid-area: auto !important; height: auto; }
}

.pt-template.pt-pair .pa-grid > .pt-widget-slot { grid-area: auto !important; height: auto; }

/* Center the crop within the image link. */
section.pa-section.pt-template[id] .pa-image-link > .pa-image {
    object-fit: cover;
    object-position: center;
}

@media (641px <= width <= 1180px) {
    section.pa-section.pt-template[id] .pa-card > .pa-image-link {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;
        aspect-ratio: 16 / 9;
    }

    .pt-template .pa-grid > .pa-card {
        height: auto;
    }

    .pt-outer.pt-height-controlled {
        grid-template-rows: none !important;
        grid-auto-rows: auto;
    }

    .pt-outer.pt-height-controlled > .pt-region {
        overflow: visible;
    }

    .pt-template .pa-grid {
        grid-template-rows: none !important;
        grid-auto-rows: auto !important;
    }
}

/* Keep vertical spacing compact without changing horizontal gutters. */
section.pa-section.pt-template[id] .pa-grid,
.pt-outer {
    row-gap: min(var(--pa-gap-row, 16px), clamp(12px, 1.6vw, 18px));
}

.pt-grid-stack {
    align-items: start;
    row-gap: clamp(14px, 2vw, 24px);
}

/* Let automatic rows follow their own content instead of the tallest row. */
section.pa-section.pt-template.pt-equal[id] .pa-grid {
    grid-auto-rows: auto;
}

.pt-outer:not(.pt-height-controlled) > .pt-region > .pa-grid {
    flex-grow: 0;
}

/* Keep the player inside its assigned grid cell. */
.pt-widget-slot .foutbol-player[id] {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

@media (min-width: 641px) {
    .pt-template:not(.pt-stack, .pt-pair) > .pa-grid > .pt-widget-slot:has(.foutbol-player) {
        position: relative;
        align-self: stretch;
        min-block-size: 0;
    }

    .pt-template:not(.pt-stack, .pt-pair) > .pa-grid > .pt-widget-slot .foutbol-player[id] {
        position: absolute;
        inset: 0;
        height: 100% !important;
        overflow-y: auto !important;
    }

    /* A widget-only grid has no article tracks to supply a height. */
    .pt-template:not(.pt-stack, .pt-pair) > .pa-grid:not(:has(> .pa-card)) > .pt-widget-slot .foutbol-player[id] {
        position: relative;
        height: auto !important;
    }
}

@media (min-width: 641px) {
    /* Use the outer grid area when the player is the only item in its flow. */
    .pt-outer:not(.pt-outer-reflow) > .pt-region:not(.pt-stack, .pt-pair):has(> .pa-grid > .pt-widget-slot:only-child .foutbol-player) > .pa-grid {
        flex: 1 1 auto;
        min-height: 0;
    }

    .pt-outer:not(.pt-outer-reflow) > .pt-region:not(.pt-stack, .pt-pair) > .pa-grid > .pt-widget-slot:only-child:has(.foutbol-player) {
        grid-area: 1 / 1 / -1 / -1 !important;
    }

    .pt-outer:not(.pt-outer-reflow) > .pt-region:not(.pt-stack, .pt-pair) > .pa-grid > .pt-widget-slot:only-child .foutbol-player[id] {
        position: absolute;
        height: 100% !important;
    }

    .pt-template:not(.pt-stack, .pt-pair) > .pa-grid > .pt-widget-slot .foutbol-player[id] .foutbol-episodes-list {
        max-height: none;
    }
}

@media (min-width: 641px) {
    .pt-outer:not(.pt-outer-reflow):not(:has(.pa-card)) > .pt-region:not(.pt-stack, .pt-pair) > .pa-grid > .pt-widget-slot:only-child .foutbol-player[id] {
        position: relative;
        height: auto !important;
    }
}

/* Bound excerpt height on narrower screens without a word-count limit. */
@media (max-width: 1180px) {
    section.pa-section.pt-template[id] .pa-card .pa-excerpt {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 5;
        overflow: hidden;
    }
    section.pa-section.pt-template.pa-hide-excerpt-mobile[id] .pa-card:not(.pt-excerpt-fill) .pa-excerpt {
        --pt-mobile-excerpt: none;
    }
}
@media (max-width: 640px) {
    section.pa-section.pt-template[id] .pa-card .pa-excerpt {
        display: var(--pt-mobile-excerpt, -webkit-box);
        -webkit-line-clamp: 3;
    }
}
