/*
 * Fi1m — Film page, magazine edition
 * ==================================
 * Loaded after styles.css, pages/film.css and pages/mag.css (the shared header, headings and cards). A full-bleed hero
 * with the title set in a solid red block that spills out of the picture into the page, then three columns like a
 * magazine spread: a narrow rail for the poster, scores and actions; the copy; a rail for facts and where to watch.
 */

body.mag {
    --rail: 200px;
    --rail-right: 280px;
    --gutter: 36px;
}

/* ------------------------------------------------------------------ 2. Hero */
.mag-hero {
    position: relative;
    height: clamp(360px, 58vh, 640px);
    background: #000;
    overflow: visible;                   /* the title block hangs out of the bottom */
}

.mag-hero-media {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.mag-hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 22%;
}

/* A soft foot so the block reads against busy art; no full-height gradient, the picture is the point */
.mag-hero-media::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 38%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.mag-hero .container {
    position: relative;
    height: 100%;
}

.mag-kicker {
    position: absolute;
    top: 28px;
    left: var(--container-pad);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 6px 12px;
    backdrop-filter: blur(6px);
}

.mag-kicker::before {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--primary);
}

.mag-title-block {
    position: absolute;
    left: var(--container-pad);
    bottom: -58px;                       /* spills into the page below, as the original does */
    max-width: min(760px, 78%);
    z-index: 2;
}

.mag-title {
    display: inline;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.4rem, 5.4vw, 4.6rem);
    /* Each wrapped line is its own slab (clone below). The slab is the glyph box plus padding, about 1.3em, so at
       this line-height the lower slab overlaps the one above by a tenth of an em: the slabs read as one block, and
       the overlap lands in the descender space, below the capitals. */
    line-height: 1.2;
    letter-spacing: -0.005em;
    text-transform: uppercase;
    color: #fff;
    background: var(--primary);
    padding: 0.04em 0.28em 0.06em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;         /* each wrapped line gets its own red slab */
}

.mag-title-meta {
    display: block;
    margin-top: 10px;
}

.mag-title-meta > span {                /* direct child only: the name wrappers inside are plain inline text */
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--paper);
    background: var(--ink);
    padding: 7px 12px 6px;
}

.mag-title-meta a {
    color: inherit;
    border-bottom: 2px solid var(--primary);
}

.mag-title-meta a:hover {
    color: var(--primary);
}

/* ------------------------------------------------------------------ 3. The spread: rail · copy · rail */
.mag-spread {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr) var(--rail-right);
    gap: var(--gutter);
    margin-top: 92px;                    /* room for the hanging title block */
    align-items: start;
}

.mag-rail {
    position: sticky;
    top: calc(var(--header-offset, 0px) + 20px);
    display: grid;
    gap: 14px;
}

.mag-poster {
    border: 1px solid var(--border-color);
}

.mag-poster img {
    width: 100%;
    height: auto;           /* the markup carries width/height for layout stability; the ratio rules */
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
}

/* Scores as slabs: the Fi1m number in red, the others outlined */
.mag-scores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mag-score {
    display: grid;
    align-content: center;
    justify-items: start;
    padding: 12px 14px 10px;
    border: 2px solid var(--ink);
    color: var(--ink);
    min-height: 74px;
}

.mag-score--fi1m {
    grid-column: 1 / -1;
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    min-height: 118px;
}

.mag-score-value {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2.6rem;
    line-height: 0.9;
}

.mag-score--fi1m .mag-score-value {
    font-size: 4.6rem;
}

.mag-score-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 8px;
    opacity: 0.9;
}

.mag-score-label b {
    font-weight: 800;
}

/* Actions: square, upper-case, stacked; the share row below like the original's coloured share slabs */
.mag-actions {
    display: grid;
    gap: 8px;
}

.mag .mag-actions .btn {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    justify-content: flex-start;
    border-radius: 0;
    padding: 11px 14px;
}

.mag .mag-actions .btn-outline {
    border: 2px solid var(--ink);
    color: var(--ink);
}

.mag .mag-actions .btn-outline:hover {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

.mag-share {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.mag-share a,
.mag-share button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    background: var(--ink);
    color: var(--paper);
    transition: background-color 0.2s ease;
}

.mag-share a:hover,
.mag-share button:hover {
    background: var(--primary);
    color: #fff;
}

.mag-share svg {
    width: 18px;
    height: 18px;
}

.mag-rail-note {
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--gray);
}

/* ------------------------------------------------------------------ 4. Copy column */
.mag-copy {
    min-width: 0;
}

/* The instant: the throwaway line, set in the display face like a strapline */
.mag .instant {
    margin: 0 0 30px;
    padding: 0;
    border: 0;
}

.mag .instant-kicker {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    color: var(--primary);
    margin-bottom: 8px;
}

.mag .instant-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.6rem, 2.6vw, 2.2rem);
    line-height: 1.12;
    letter-spacing: -0.005em;
    color: var(--ink);
}

.mag-tags {
    margin-bottom: 22px;
}

.mag .text-block {
    font-size: 1.12rem;
    line-height: 1.7;
    margin-bottom: 8px;
}

.mag .text-block::first-letter {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 3.4em;
    line-height: 0.8;
    float: left;
    margin: 6px 10px 0 0;
    color: var(--primary);
}

/* Consensus: the circle becomes a slab */
.mag .review-score-circle {
    border-radius: 0;
    background: var(--ink);
    color: var(--paper);
    border: 0;
}

.mag .review-score-circle span {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2.2rem;
    color: var(--paper);
}

.mag .review-card:hover {
    transform: none;
}

.mag .review-bar-label {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.mag .review-bar-track {
    border-radius: 0;
}

.mag .review-bar-fill {
    border-radius: 0;
}

.mag .review-card {
    border-radius: 0;
    background: none;
    border: 0;
    border-top: 1px solid var(--border-color);
    padding: 18px 0 6px;
}

.mag .source-logo {
    border-radius: 0;
    font-family: var(--font-display);
    font-weight: 800;
    background: var(--ink);
    color: var(--paper);
}

.mag .review-rating {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--ink);
}

/* ------------------------------------------------------------------ 5. Right rail */
.mag-aside {
    display: grid;
    gap: 28px;
}

.mag .mag-aside .facts {
    position: static;
    max-height: none;
    overflow: visible;
    background: none;
    border: 0;
    padding: 0;
    min-width: 0;
}

.mag .mag-aside .section-title {
    margin: 0 0 14px;
    font-size: 1rem;
}

.mag .fact-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.mag .fact-label {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: var(--primary);
}

.mag .fact-value {
    font-size: 0.92rem;
}

.mag .fact-value a {
    color: var(--ink);
    border-bottom: 1px solid var(--border-color);
}

.mag .fact-value a:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* Where to watch as a list of slabs, not logos on a tint */
.mag-watch-list {
    display: grid;
    gap: 6px;
}

.mag-watch-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 2px solid var(--ink);
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mag-watch-list a:hover {
    background: var(--ink);
    color: var(--paper);
}

.mag-watch-list small {
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--gray);
}

.mag-watch-list a:hover small {
    color: inherit;
}

.mag .region-change {
    font-family: var(--font-main);
    font-size: 0.78rem;
}

.mag .streaming-platforms {
    margin-top: 32px;
}

.mag .streaming-platforms .watch-head {
    align-items: flex-end;
    gap: 12px;
    flex-wrap: nowrap;
    margin-top: 0;
}

.mag .streaming-platforms .watch-head small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.78rem;
}

.mag .region-picker select {
    border-radius: 0;
    border: 2px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    font-size: 0.8rem;
    padding: 2px 6px;
}

/* In the 280px rail the head stacks: slab, rule, then the region line on its own row (name left, "Change" right;
   the picker takes the whole row). One line of "Where to watch · United Kingdom · Not in the UK?" does not fit. */
.mag .mag-aside .streaming-platforms .watch-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    border-bottom: 0;
    margin: 0 0 12px;
}

.mag .mag-aside .streaming-platforms .watch-head > span {
    position: relative;                  /* paints over the rule, keeping the red foot on the slab */
    z-index: 1;
    justify-self: start;
    white-space: nowrap;
}

.mag .mag-aside .streaming-platforms .watch-head::after {
    content: "";
    display: block;
    height: 3px;
    background: var(--ink);
    order: 2;
}

.mag .mag-aside .streaming-platforms .watch-head small {
    order: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
    padding: 0;
    white-space: nowrap;
}

.mag .mag-aside .streaming-platforms .watch-head .region-change {
    margin-left: auto;
}

.mag .mag-aside .streaming-platforms .watch-head .region-picker {
    display: block;
    width: 100%;
}

.mag .mag-aside .streaming-platforms .watch-head .region-picker select {
    width: 100%;
    padding: 5px 8px;
}

.mag .streaming-platforms.is-loading .mag-watch-list {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.mag .streaming-platforms .availability-note {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--gray);
    text-transform: none;
    letter-spacing: 0;
}

.mag-share button.is-copied {
    background: var(--primary);
    color: #fff;
}

/* ------------------------------------------------------------------ 7. Responsive */
@media (max-width: 1100px) {
    body.mag {
        --rail: 168px;
        --rail-right: 240px;
        --gutter: 28px;
    }
}

@media (max-width: 900px) {
    .mag-spread {
        grid-template-columns: var(--rail) minmax(0, 1fr);
    }

    .mag-aside {
        grid-column: 1 / -1;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
        border-top: 3px solid var(--ink);
        padding-top: 8px;
    }
}

@media (max-width: 640px) {
    .mag-hero {
        height: 62vw;
        min-height: 300px;
    }

    .mag-kicker {
        top: 16px;
        font-size: 0.8rem;
    }

    .mag-title-block {
        left: var(--container-pad);
        right: var(--container-pad);
        max-width: none;
        bottom: -40px;
    }

    .mag-title {
        font-size: clamp(1.9rem, 9vw, 2.6rem);
    }

    .mag-title-meta > span {
        font-size: 0.85rem;
        padding: 6px 10px 5px;
    }

    .mag-spread {
        grid-template-columns: 1fr;
        margin-top: 64px;
        gap: 24px;
    }

    .mag-rail {
        --poster-w: 120px;
        position: static;
        grid-template-columns: var(--poster-w) 1fr;
        grid-template-rows: calc(var(--poster-w) * 1.5) auto auto;   /* the first row is exactly the poster's 2:3 */
        grid-template-areas:
            "poster scores"
            "actions actions"
            "share share";
        align-items: stretch;
    }

    /* The poster sets the row height; the score boxes share it, the red slab taking whatever the two small ones leave */
    .mag-poster { grid-area: poster; height: 100%; }
    .mag-poster img { height: 100%; aspect-ratio: auto; }
    .mag-scores { grid-area: scores; grid-template-rows: 1fr auto; min-height: 0; }
    .mag-score { min-height: 0; padding: 10px 14px 9px; }
    .mag-score-value { font-size: 2.2rem; }
    .mag-score-label { margin-top: 5px; font-size: 0.76rem; }
    .mag-actions { grid-area: actions; grid-template-columns: repeat(3, 1fr); }
    .mag-share { grid-area: share; }
    .mag-rail-note { display: none; }

    .mag .mag-actions .btn {
        justify-content: center;
        padding: 10px 8px;
        font-size: 0.9rem;
    }

    .mag-score--fi1m .mag-score-value {
        font-size: 3.2rem;
    }

    .mag-aside {
        grid-template-columns: 1fr;
    }

    .mag .instant-text {
        font-size: 1.45rem;
    }

    .mag .content-highlight .text-content p {
        font-size: 1.12rem;
    }
}
