/* ————
Report template
——— */

.report-template {
    --report-page-background: var(--wp--preset--color--off-white);
    background-color: var(--report-page-background);
}

/* Anchor links: only the sidebar's offset (--scroll-padding-top, set below for each screen size).
   Drops legacy/features.css's `* { scroll-margin-top: 8rem }`, which every other page type keeps. Footnotes keep theirs. */
:where(.report-template) * {
    scroll-margin-top: 0;
}

/* ————
Header
——— */

.report-header {
    position: relative;
    background-color: var(--report-color);
    color: var(--report-text);
}

/* Open menu */
#site-header.report-header.mobile-menu {
    background-color: var(--report-color) !important;
}

.report-header__media {
    margin: 0;
}

.report-header__image {
    display: block;
    width: 100%;
}

.report-header .report-meta {
    justify-content: center;
}

.report-header .report-meta__date {
    font-size: var(--wp--preset--font-size--large);
}

.report-header__title {
    margin: 0;
    line-height: 1.1;
    text-wrap: balance;
}

.report-header__byline {
    margin: 0;
    font-size: var(--wp--preset--font-size--large);
    line-height: 1.35;
}

.report-header__byline p {
    margin: 0;
}

.report-header__byline p + p {
    margin-top: var(--one-spacer);
}

/* Top-level report */

.report-header__band {
    display: flow-root;
}

.report-header--report .report-header__intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--three-spacer);
    max-width: 980px;
    margin: 0 auto;
    padding: var(--five-spacer) 0 var(--three-spacer);
    text-align: center;
}

.report-header--report .report-header__title {
    font-size: clamp(2.25rem, 4.6vw, 4.25rem);
    letter-spacing: -1px;
}

.report-header__subtitle {
    max-width: 840px;
    margin: 0;
    font-family: 'Pressura Extended', sans-serif;
    font-size: clamp(1.375rem, 2.4vw, 2.25rem);
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.5px;
    text-wrap: balance;
}

.report-header--report .report-header__byline {
    margin-top: var(--three-spacer);
}

.report-header--report .report-header__image {
    height: auto;
    max-height: 85vh;
    object-fit: cover;
}

.report-header--report.mobile-menu .report-header__media {
    display: none;
}

@media screen and (max-width: 1079px) {
    .report-header--report .report-header__intro {
        gap: var(--two-spacer);
        padding: var(--four-spacer) 0 var(--two-spacer);
    }

    .report-header--report .report-header__byline {
        margin-top: var(--one-spacer);
    }
}

/* Chapter */

.report-header--chapter .report-header__nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
}

.report-header--chapter.mobile-menu .report-header__nav {
    position: relative;
}

.report-header--chapter:not(.mobile-menu) .report-header__nav {
    pointer-events: none;
}

.report-header--chapter .report-header__nav :is(a, button, #menu-items) {
    pointer-events: auto;
}

.report-header--chapter #menu-contents {
    border-bottom: 0;
    padding-bottom: 0 !important;
}

.report-header__split {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.report-header--chapter .report-header__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.report-header--chapter .report-header__image {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: cover;
}

.report-header__panel {
    display: flex;
    flex-direction: column;
    padding: var(--two-spacer) var(--global--spacing-horizontal) var(--four-spacer);
}

.report-header__part-of {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.3em;
    min-height: 42px;
    margin: 0;
    font-size: var(--wp--preset--font-size--large);
    line-height: 1.2;
}

.report-header__part-of span {
    opacity: 0.7;
}

.report-header--chapter .report-header__intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--two-spacer);
    margin: auto 0;
    padding: var(--four-spacer) 0 var(--two-spacer);
    text-align: center;
}

.report-header--chapter .report-header__title {
    font-size: clamp(2.25rem, 4.4vw, 4rem);
    letter-spacing: -1px;
}

/* No image */
.report-header__split.has-no-image .report-header__panel {
    padding-top: calc(10px + 42px + var(--three-spacer));
}

@media screen and (min-width: 1080px) {
    .report-header__split {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-height: max(640px, 85vh);
    }

    .report-header--chapter .report-header__media {
        aspect-ratio: auto;
    }

    .report-header__panel {
        padding: var(--five-spacer) calc((100vw - var(--responsive--alignwide-width)) / 2 + var(--three-spacer)) var(--five-spacer) var(--four-spacer);
    }

    .report-header__part-of {
        margin-right: calc(47px + var(--three-spacer));
    }

    .report-header__split.has-no-image {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
    }

    .report-header__split.has-no-image .report-header__panel {
        padding-top: calc(var(--five-spacer) + 42px + var(--three-spacer));
        padding-left: calc((100vw - var(--responsive--alignwide-width)) / 2 + var(--three-spacer));
    }

    .report-header__split.has-no-image .report-header__part-of {
        margin-right: 0;
    }

    .report-header__split.has-no-image .report-header__intro {
        padding: var(--five-spacer) 0;
    }

    .report-header--chapter #menu-contents > .d-lg-none {
        display: flex !important;
    }

    .report-header--chapter #search-toggle {
        display: none !important;
    }

    .report-header--chapter:not(.mobile-menu) #menu-items {
        display: none !important;
    }

    .report-header--chapter.mobile-menu #menu-items {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        margin-top: var(--three-spacer);
    }

    .report-header--chapter.mobile-menu #menu-items nav ul {
        flex-direction: column !important;
    }

    .report-header--chapter.mobile-menu .menu-item {
        font-size: var(--wp--preset--font-size--x-large);
    }

    .report-header--chapter.mobile-menu #search-trigger {
        display: none !important;
    }

    .report-header--chapter.mobile-menu #search-modal {
        position: static;
        max-width: 600px;
        opacity: 1;
        pointer-events: all;
    }
}

/* ————
Content and sidebar
——— */

.report-template #page-wrapper {
    position: relative; /* the sidebar's column */
    padding-bottom: var(--four-spacer);
}

/* More room above each section */
.report-template .entry-content > :not(.report-sidebar, #footnote-popup) ~ h2 {
    margin-top: var(--five-spacer);
}

.report-template .entry-content > :is(.report-chapters, .annex-timeline) {
    margin-top: var(--four-spacer);
}

/* Callouts */
:where(.report-template .entry-content > .wp-block-group.has-background:not(.alignfull)) {
    border-radius: 10px;
}

/* Captions under full-width images */
.report-template .entry-content > .wp-block-image.alignfull figcaption {
    padding: 0 var(--global--spacing-horizontal);
}

.report-sidebar {
    font-size: var(--wp--preset--font-size--medium);
    line-height: 1.25;
}

.report-template .report-sections ul {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
}

.report-template .report-sections li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.report-sections a {
    display: block;
    color: inherit;
    text-decoration: none;
    opacity: 0.55;
    transition: opacity 0.2s ease;
}

.report-sections a:hover,
.report-sections a:focus-visible,
.report-sections a.is-current {
    opacity: 1;
}

.report-sidebar__download {
    flex-shrink: 0;
    font: inherit;
    font-size: var(--wp--preset--font-size--medium);
    border: 0;
    cursor: pointer;
}

/* The 'Sections' button */
.report-sidebar__toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-transform: uppercase;
    cursor: pointer;
}

.report-sidebar__toggle::after {
    content: '';
    width: 16px;
    height: 16px;
    background: url(../icons/details-icon.svg) center / contain no-repeat;
    transform: rotate(90deg);
    transition: transform 0.2s ease;
}

.report-sidebar.is-open .report-sidebar__toggle::after {
    transform: rotate(270deg);
}

/* Wide screens */
@media screen and (min-width: 1280px) {
    /* A linked heading lines up with the top of the sticky sections list */
    html {
        --scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--three-spacer));
    }

    .report-template #page-wrapper {
        padding-top: var(--five-spacer);
    }

    .report-template #page-wrapper > .report-sidebar {
        position: absolute;
        top: var(--five-spacer);
        bottom: var(--four-spacer);
        left: calc((100% - var(--responsive--alignwide-width)) / 2 + var(--three-spacer));
        z-index: 1;
        width: calc((var(--responsive--alignwide-width) - var(--responsive--aligndefault-width)) / 2 - 2 * var(--three-spacer));
        max-width: 280px;
        margin: 0;
    }

    .report-sidebar__inner {
        position: sticky;
        top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--three-spacer));
        display: flex;
        flex-direction: column;
        gap: var(--three-spacer);
        height: calc(100vh - var(--wp-admin--admin-bar--height, 0px) - 2 * var(--three-spacer));
        max-height: 100%;
    }

    .report-sections {
        min-height: 0;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .report-sidebar__download {
        margin-top: auto;
    }

    .report-sections,
    .report-sidebar__download {
        transition: opacity 0.2s ease;
    }

    .report-sidebar .is-covered {
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    }

    :where(.report-template .entry-content > .alignwide, .report-template .entry-content > .alignfull) {
        position: relative;
        z-index: 2;
    }

    :where(.report-template .entry-content > .alignwide:not(.has-background), .report-template .entry-content > .alignfull:not(.has-background)) {
        background-color: var(--report-page-background);
    }
}

/* Smaller screens */
@media screen and (max-width: 1279px) {
    /* Clears the sticky Sections bar */
    html {
        --scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 90px);
    }

    .report-template #page-wrapper > .report-sidebar {
        position: sticky;
        top: var(--wp-admin--admin-bar--height, 0px);
        z-index: 50;
        width: auto;
        max-width: none;
        margin: 0;
        border-bottom: 1px solid;
        background-color: var(--report-page-background);
    }

    .report-sidebar__inner {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--one-spacer);
        padding: var(--one-spacer) var(--global--spacing-horizontal);
    }

    .report-sidebar.has-toggle .report-sidebar__toggle {
        display: inline-flex;
    }

    .report-sidebar__download {
        margin-left: auto;
    }

    .report-sections {
        order: 3;
        width: 100%;
        max-height: 60vh;
        overflow-y: auto;
    }

    .report-sidebar.has-toggle:not(.is-open) .report-sections {
        display: none;
    }

    .report-sections ul {
        padding-bottom: var(--one-spacer) !important;
    }
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

@media print {
    .report-sidebar {
        display: none !important;
    }
}
