/* ==========================================================================
   Poster tiles (homepage): flat colour feature tiles, same look as the page header
   ========================================================================== */
.duchy-poster-tiles {
    max-width: 1400px;
    margin: 0 auto;
    padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 32px);
    box-sizing: border-box;
}

.duchy-poster-tiles__row {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(12px, 2vw, 24px);
}

.duchy-poster-tiles__row[data-tile-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.duchy-poster-tiles__row[data-tile-count="1"] { grid-template-columns: minmax(0, 1fr); }

.duchy-poster-tiles__item {
    margin: 0;
    padding: 0;
    display: flex;
}

.duchy-poster-tile {
    --pt-ink: var(--ink, #0b0d12);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
    border: var(--b, 3px solid var(--pt-ink));
    border-radius: 24px;
    background: var(--paper, #fff);
    color: var(--pt-ink);
    text-decoration: none;
    font-family: 'Inter', system-ui, sans-serif;
    box-shadow: var(--shadow, 5px 5px 0 var(--pt-ink));
    overflow: hidden;
}

.duchy-poster-tile--pink { --pt-bg: #ff3399; }
.duchy-poster-tile--cyan { --pt-bg: var(--cyan, #00f0ff); }
.duchy-poster-tile--yellow { --pt-bg: var(--yellow, #ffd700); }

.duchy-poster-tile__media {
    position: relative;
    display: block;
    flex: 0 0 auto;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--pt-bg);
    border-bottom: var(--b, 3px solid var(--pt-ink));
}

.duchy-poster-tile__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duchy-poster-tile__credit {
    position: absolute;
    left: 0;
    bottom: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    border-top-right-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.duchy-poster-tile__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    box-sizing: border-box;
    padding: clamp(16px, 2vw, 24px);
    background: var(--pt-bg);
}

.duchy-poster-tile__chip {
    background: var(--pt-ink);
    color: #fff;
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: clamp(12px, 1.6vw, 18px);
}

.duchy-poster-tile__title {
    display: block;
    font-size: clamp(1.45rem, 2.2vw, 2rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--pt-ink);
    overflow-wrap: break-word;
}

.duchy-poster-tile--pink .duchy-poster-tile__title {
    color: #fff;
    text-shadow: 2px 2px 0 #000;
}

.duchy-poster-tile__line {
    display: block;
    margin-top: clamp(10px, 1.4vw, 16px);
    margin-bottom: 18px;
    max-width: 34ch;
    font-size: clamp(0.95rem, 1.2vw, 1.05rem);
    font-weight: 600;
    line-height: 1.4;
    color: var(--pt-ink);
}

.duchy-poster-tile__foot {
    display: block;
    width: 100%;
    margin-top: auto;
    box-sizing: border-box;
    padding-top: 12px;
    border-top: 3px solid var(--pt-ink);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--pt-ink);
}

.duchy-poster-tile:focus-visible {
    outline: 4px solid var(--pt-ink);
    outline-offset: 4px;
    box-shadow: 0 0 0 8px #fff, 0 0 0 12px var(--pt-ink);
}

@media (prefers-reduced-motion: no-preference) {
    .duchy-poster-tile {
        transition: transform 0.14s ease, box-shadow 0.14s ease;
    }
    .duchy-poster-tile:hover {
        transform: translate(-2px, -3px);
        box-shadow: 8px 8px 0 var(--pt-ink);
    }
}

@media (max-width: 800px) {
    .duchy-poster-tiles {
        padding-left: 0;
        padding-right: 0;
    }
    .duchy-poster-tiles__row,
    .duchy-poster-tiles__row[data-tile-count="2"],
    .duchy-poster-tiles__row[data-tile-count="1"] {
        display: flex;
        gap: 14px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 4px 16px 14px;
        scroll-padding-left: 16px;
    }
    .duchy-poster-tiles__item {
        flex: 0 0 82%;
        max-width: 22rem;
        scroll-snap-align: start;
    }
}

/* Specificity guard: the SuperDesign home (.ch-sd-home) and global a/h2 rules must not restyle the tiles. */
.duchy-poster-tiles a.duchy-poster-tile,
.duchy-poster-tiles a.duchy-poster-tile:hover,
.duchy-poster-tiles a.duchy-poster-tile:focus-visible {
    color: var(--ink, #0b0d12);
    text-decoration: none;
}
.duchy-poster-tiles .duchy-poster-tile--pink .duchy-poster-tile__title {
    color: #fff;
}
.duchy-poster-tiles .duchy-poster-tile__chip {
    color: #fff;
}

/* Standalone v7 homepage does not load the theme's .screen-reader-text rule, so keep the heading visually hidden here. */
.duchy-poster-tiles .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
