/*––––––––––––––––––––––––––––––––––––––––––––––––––
    1. Site structure
    2. Headings
        2.1 Sub Navs
    3. Theme my login forms
    4. CPD Modules
        4.1 CPD Results
        4.2 CPD quiz
    5 Cards
        - 5.1 Featured article
        - 5.2 Article cards
        - 5.3 More articles
        - 5.4 related articles
    6. Home page
    7. Adverts
    8. 404
    9. Advertise page
    10. CIBSE Journal
    11. Sitemap
        11.1 Nav
        11.2 Sections
–––––––––––––––––––––––––––––––––––––––––––––––––– */

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    1. Site structure
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.bg-blue {
    background-color: var(--cibse-box-header-background-color);
}

.bg-header-blue {
    background-color: var(--cibse-color-blue);
}

.bg-light-blue {
    background-color: var(--cibse-box-background-color);
}

.bg-yellow {
    background-color: var(--cibse-color-yellow);
}

.bg-green {
    background-color: var(--cibse-color-green);
}

.bg-red {
    background-color: var(--cibse-color-red);
}

.bg-grey {
    background-color: var(--cibse-color-grey);
}

.bg-purple {
    background-color: var(--cibse-color-purple);
}

.page-id-1298 .entry-header h1 {
    background-color: var(--cibse-color-red);
    color: #FFFFFF;
}

.post-type-archive-magazine .page-header h1 {
    background-color: var(--cibse-color-black);
}

.txt-white {
    color: #FFFFFF;
}

.mt-0 {
    margin-top: 0;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.ps-10 {
    padding-left: 10px;
}

.pe-20 {
    padding-right: 20px;
}

.pb-20 {
    padding-bottom: 20px;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;

    @media (max-width: 1024px) {
        grid-template-columns: 1fr;
    }

    .content-main {
        min-width: 0;
        padding: 0;

        .advertise {
            padding-left: 0;
            padding-right: 0;
        }

    }
}

.content-sidebar {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;

    @media screen and (min-width: 64em) {
        grid-template-columns: 1fr;
        gap: 0;
        width: 300px;
        align-self: start;
    }
    @media screen and (max-width: 37.5em) {
        grid-template-columns: 1fr;
    }

    .sidebar__col {

        > div, section {
            margin-bottom: 20px;
            word-wrap: break-word;

            a {
                display: block;

                img {
                    display: block;
                    width: 100%;
                }
            }

            h3 {
                margin: 0;
                padding: 10px;
                color: #FFFFFF;
                font-size: 1em;
            }

            &.signup {

                a {
                    color: #fff;
                    padding: 10px;

                    img {
                        max-width: 60%;
                        margin-bottom: 10px;
                    }

                    span {
                        display: block;
                        font-weight: 500;

                        &:first-of-type {
                            font-size: 1.5rem;
                        }

                        &:last-of-type {
                            font-size: 0.825rem;
                        }
                    }
                }

            }

            &.jobs {
                border: 1px solid var(--cibse-color-black);
                padding: 5px;
            }

        }

        section {

            > div {
                padding: 10px;

                p {
                    font-size: 0.9rem;
                    margin: 5px 0;

                    &.section__title {
                        font-size: 1.1rem;
                        margin-top: 0;
                    }

                    a {
                        padding: 5px 0;
                    }
                }

                .cpd-sponsor {
                    display: grid;
                    grid-template-columns: 1fr 1fr;
                    padding-top: 10px;
                }
            }

            &.section-articles {

                .section__title {
                    margin-top: 5px;

                    a {
                        padding: 0;
                    }
                }

                > div:not(:last-of-type) {
                    position: relative;

                    &:after {
                        content: "";
                        position: absolute;
                        bottom: 0;
                        left: 10px;
                        right: 10px;
                        border-bottom: 1px solid #FFFFFF;
                    }
                }
            }
        }
    }
}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    2. Headings
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.page-header {
    .page-heading {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        flex-direction: column;

        .heading-subtext {
            font-weight: normal;
            font-size: 0.625em;
        }

        @media screen and (min-width: 64em) {
            flex-direction: row;
        }
    }

    .subheading-text {
        margin: 0 0 10px 0;
    }
}

.more-articles__header {
    background-color: var(--cibse-color-black);
    color: #fff;
    font-weight: 600;
    font-size: 25px;
    margin-top: 20px;
    margin-bottom: 10px;
    padding: 5px 10px;
}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    2.1 Sub Navs
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.cpd__menu {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 10px 0;

    a {
        border: 1px solid var(--cibse-border-color);
        border-bottom: 4px solid var(--cibse-border-color);
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 10px;
        padding: 10px;
        text-align: center;

        h2, p {
            margin: 0;
        }
    }
}

.year-pagination-container {
    margin: 2rem 1rem;

    @media screen and (min-width: 64em) {
        margin: 2rem 6rem;
    }

    .pagination {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        align-items: center;
        list-style: none;
        padding: 0;
        margin: 0;
        gap: 0.5rem;

        a {
            transition: border-radius .12s linear, background-color .12s linear, border-color .12s linear, box-shadow .12s linear, color .12s linear;
            color: var(--cibse-color-black);
            margin-top: 0;
            margin-bottom: 0;
            border-bottom: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 32px;
            padding: 0 4px 0 4px;
            margin-right: 2px;

            &.current {
                box-shadow: 0 2px 0 0 #141414;
            }

            &:hover {
                background-color: var(--cibse-color-blue-tint);
                text-decoration: none;
            }

        }

    }

}

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    gap: 4px;

    a, span {
        transition: border-radius .12s linear, background-color .12s linear, border-color .12s linear, box-shadow .12s linear, color .12s linear;
        color: var(--cibse-color-black);
        margin-top: 0;
        margin-bottom: 0;
        border-bottom: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 32px;
        padding-bottom: 0;
        margin-right: 2px;

        &.current {
            box-shadow: 0 2px 0 0 #141414;
        }

        &.dots {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 28px;
            margin-right: 2px;
        }

        &:not(.next, .prev) {
            width: 28px;
        }

        &:hover {
            background-color: var(--cibse-color-blue-tint);
            text-decoration: none;
        }
    }

}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    3. Theme my login forms
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.fa-asterisk.required {
    padding: 0 4px;
    color: var(--cibse-color-red);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;

    @media screen and (min-width: 64em) {
        grid-template-columns: repeat(2, 1fr);

        .full-width {
            grid-column: span 2;
        }
    }

    .align-right {
        grid-column: 2;

        @media (max-width: 64em) {
            grid-column: 1;
        }
    }

}

.form-group,
.tml-field-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;

    label {
        display: block;
        font-size: 14px;
    }

    input[type='text'],
    input[type='email'],
    input[type='password'],
    input[type='tel'],
    select {
        border-radius: 3px;
        background-color: #FFFFFF;
        color: var(--cibse-color-black);
        border: 1px solid var(--cibse-border-color);
        box-sizing: border-box;
        width: 100%;
        height: 38px;
        padding: 8px 6px;
        margin: 0;
    }

    .tml-toggle-pwd {
        margin: 0;

        &:focus,
        &:hover {
            background-color: transparent;
            box-shadow: none;

            .dashicons {
                color: var(--cibse-color-blue);
            }
        }

        &:active {
            margin: 0;
        }
    }

    .reg-radio {
        display: flex;
        gap: 20px;

        > div {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        span {
            padding: 0 20px 0 4px;
        }
    }
}


.tml-register.tml,
.tml-login.tml,
.tml-lostpassword.tml,
.menu-cpd-menu-log-out-container,
.menu-cpd-menu-log-in-container {
    display: flex;
    flex-direction: column;

    .tml-alerts {
        order: 2;
    }

    form[name='register'],
    form[name='login'],
    form[name='lostpassword'] {
        order: 3;
    }

    .tml-links,
    .menu {
        order: 1;
        display: flex;
        justify-content: flex-start;
        margin: 0 0 20px 0;
        padding: 0;

        li {
            border-right: 1px solid var(--cibse-color-black);
            margin-right: 1em;
            padding-right: 1em;
            list-style: none;

            &:last-child {
                border: none;
            }

            a {
                color: var(--cibse-color-black);
                font-size: 16px;
                font-weight: 500;
                padding: 6px 0px;
                text-underline-offset: 10px;
                text-decoration-thickness: 1px;
            }
        }
    }
}

form[name='login'],
form[name='lostpassword'] {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
}

form[name='register'],
form[name='login'],
form[name='lostpassword'],
form[name='profile'],
form[name='whitepaper-form'],
form[name='cpd-form'],
form[name='pardot-form'],
form[name='pardot-form'],
.cibse__btn {
    .tml-button {
        display: inline-block;
        width: fit-content;
        border: none;
        border-radius: 3px;
        padding: 1rem 2rem;
        margin: 0;
        text-decoration: none;
        background: var(--cibse-color-black);
        color: #ffffff;
        font-size: 1rem;
        font-weight: normal;
        line-height: 1;
        height: auto;
        cursor: pointer;
        text-align: center;
        transition: background 250ms ease-in-out, transform 150ms ease;
        -webkit-appearance: none;
        -moz-appearance: none;
    }

    button:hover,
    button:focus,
    .tml-button:hover,
    .tml-button:focus {
        background: var(--cibse-color-blue);
    }

    button:focus,
    .tml-button:focus {
        outline: var(--cibse-color-blue);
        outline-offset: -4px;
    }

    button:not(.tml-toggle-pwd):active,
    .tml-button:active {
        transform: scale(0.99);
    }
}

.tml-rememberme-wrap {
    justify-content: flex-start;
    flex-direction: row;
}

/** check boxes **/
.checkbox {
    position: relative;
    display: flex;
    align-items: center;
    /*min-height: var(--target);*/

    input[type="checkbox"] {
        -webkit-appearance: none;
        appearance: none;
        flex: none;
        align-self: flex-start;
        width: 1.125rem;
        height: 1.125rem;
        margin: 0.625rem 0 0 0;
        border: 2px solid var(--cibse-color-black); /* unselected: black border */
        background-color: #fff; /* unselected: white background */
        cursor: pointer;
        border-radius: 3px;

        /* Selected checkbox: accent fill with a white tick */

        &:checked {
            border-color: var(--cibse-color-blue);
            background-color: var(--cibse-color-blue);
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
            background-size: 100% 100%;
        }
    }

    label {
        flex: 1;
        align-self: stretch;
        display: flex;
        align-items: flex-start;
        padding: 0.625rem 0.875rem 0.625rem 0.75rem;
        cursor: pointer;
        overflow-wrap: anywhere; /* long answers never force horizontal scroll */
    }
}

.cibse-form__hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    4. CPD Module
–––––––––––––––––––––––––––––––––––––––––––––––––– */
/** 4.1 CPD Results **/
.cpd-results__menu {
    width: fit-content;

    menu {
        border: 1px solid var(--cibse-color-black);
        display: flex;
        padding: 0;

        li {
            list-style: none;
            padding: 0;
            border-right: 1px solid var(--cibse-color-black);
            width: 80px;
            text-align: center;

            &:first-of-type {
                background-color: var(--cibse-color-grey);
                color: #FFFFFF;
                padding: 4px 0;
            }

            &:last-of-type {
                border: none;
            }

            a {
                display: block;
                height: 100%;
                padding: 4px 0;

                &:hover,
                &:active,
                &:focus {
                    text-decoration: none;
                    background-color: var(--cibse-color-blue-tint);
                }
            }
        }
    }
}

.cpd-results__table {
    table-layout: fixed;
    width: 100%;
    margin: 10px 0;
    border-collapse: collapse;
    border-top: 1px solid #999999;
    border-bottom: 1px solid #999999;

    th,
    td {
        vertical-align: top;
        padding: 0.6em;
    }

    tr {
        td, th {
            &:nth-child(1) {
                width: 40%;
                text-align: left;
                font-weight: 500;

                @media screen and (min-width: 64em) {
                    width: 20%;
                }
            }

            &:nth-child(2) {
                width: 20%;
                @media screen and (min-width: 64em) {
                    width: 40%;
                }

                > div {
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    gap: 40px;

                    span {
                        width: 40px;
                    }
                }
            }

            &:nth-child(3) {
                width: 40%;
                text-align: left;
            }
        }

        &.result-pass {
            .fa-square {
                color: var(--cibse-color-green);
            }
        }

        &.result-fail {
            .fa-square {
                color: var(--cibse-color-red);
            }
        }
    }

    tbody tr:nth-child(odd) {
        background-color: #eeeeee;
    }
}

/** 4.2 CPD quiz **/
.cpd-sponsor-container {
    display: flex;
    justify-content: flex-end;

    img {
        max-width: 200px;
    }
}

.cpd-form {

    .question {
        min-width: 0;
        margin: 0 0 30px 0;
        padding: 0;
        border: 0;

        .question__legend {
            padding: 0;
            margin-bottom: 0.75rem;
            font-size: 1.125rem;
            font-weight: 600;
            line-height: 1.35;

            p {
                margin: 0 0 6px 0;
            }
        }

        /* ---------- Choices ---------- */

        .choices {
            display: grid;
            gap: 0.5rem;

            @media (min-width: 40em) {
                grid-template-columns: repeat(2, 1fr);
            }

            .choice {
                position: relative;
                display: flex;
                align-items: center;
                min-height: 2.75rem;;
                border: 2px solid var(--cibse-border-color);
                border-radius: 0.5rem;
                background: #FFFFFF;

                .choice__input {
                    -webkit-appearance: none;
                    appearance: none;
                    flex: none;
                    align-self: flex-start;
                    width: 1.375rem;
                    height: 1.375rem;
                    margin: 0.625rem 0 0 0.875rem;
                    border: 2px solid var(--cibse-color-black); /* unselected: black border */
                    background-color: #fff; /* unselected: white background */
                    cursor: pointer;
                    border-radius: 50%;

                    &:checked {
                        border-color: var(--cibse-color-blue);
                        background-image: radial-gradient(circle, var(--cibse-color-blue) 0 45%, transparent 50%);
                    }
                }

                .choice__label {
                    flex: 1;
                    align-self: stretch;
                    display: flex;
                    align-items: flex-start;
                    gap: 0.325rem;
                    padding: 0.625rem 0.875rem 0.625rem 0.75rem;
                    cursor: pointer;
                    overflow-wrap: anywhere;

                    span:first-of-type {
                        font-weight: 700;
                    }
                }

                &:has(.choice__input:checked) {
                    border-color: var(--cibse-color-blue);
                    background: var(--cibse-color-blue-tint);
                }

                &:has(.choice__input:focus-visible) {
                    outline: 3px solid var(--cibse-color-blue);
                    outline-offset: 2px;
                }
            }

        }

        /* Fallback for browsers without :has() */
        @supports not selector(:has(*)) {
            .choice__input:focus-visible {
                outline: 3px solid var(--cibse-color-blue);
                outline-offset: 2px;
            }
        }

        @media (hover: hover) {
            .choice:hover {
                border-color: var(--cibse-color-blue);
            }
        }

    }

}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    5 Cards
–––––––––––––––––––––––––––––––––––––––––––––––––– */
/** - 5.1 Featured article **/
.featured__article {
    height: 450px;
    width: 100%;
    display: grid;
    grid-template-areas:
        "image"
        "copy";
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-columns: 100%;

    &:hover {
        text-decoration: none;
    }

    img {
        grid-area: image;
        width: 100%;
        height: 100%;
        min-height: 0;
        object-fit: cover;
    }

    .product-month__banner {
        grid-area: image;
        align-self: start;
        z-index: 1;
        width: 64%;
        padding-top: 20px;
    }

    .featured__copy {
        grid-area: copy;
        background-color: var(--cibse-color-black);
        padding: 0.625em 0.875em;
        color: #fff;
        font-size: 0.8rem;

        h2 {
            margin: 0 0 0.625em;
        }

        .featured__published {
            font-size: 0.8125em;
        }
    }

    @media screen and (max-width: 48em) {
        height: auto;
        grid-template-rows: auto auto;

        img {
            height: auto;
            object-fit: contain;
        }
    }
}

/** -5.2 Article cards **/
.card {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #000;
    overflow: hidden;
    margin-bottom: 1.25em;

    .card__body {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 16px;

        .card__title {
            margin: 0 0 8px;
            font-size: 1.125rem;
            line-height: 1.3;

            a {
                color: #000000;
            }
        }

        .card__excerpt {
            margin: 0;
            color: #555;
            font-size: 0.9375rem;
            line-height: 1.5;
        }

        .card__published {
            font-size: 0.75em;
            font-weight: 500;

            .general__meta {
                display: flex;
                justify-content: space-between;

                span:last-of-type {
                    display: flex;
                    gap: 4px;
                    align-content: baseline;
                }
            }
        }
    }
}

.sponsored-posts {

    article:last-of-type {
        margin-bottom: 0;
    }

}

.card__media {
    width: 100%;

    img {
        width: 100%;
        height: auto;
        display: block;
        object-fit: cover;
        object-position: right top;
    }

    &:not(.cpd__media) {
        img {
            aspect-ratio: 16 / 9;
        }
    }


    &.sponsor__img {
        background-color: var(--cibse-color-grey);

        a {
            width: 100%;
            height: 100%;
            display: grid;
            grid-template-areas: "sponsor";
            grid-template-rows: 100%;
            grid-template-columns: 100%;
            text-decoration: none;
            color: var(--cibse-color-black);

            img {
                grid-area: sponsor;
                object-fit: contain;
            }

            .sponsor-container {
                background-color: rgba(255, 255, 255, 0.85);
                align-self: flex-end;
                padding: 10px;
                grid-area: sponsor;
                max-height: 60px;
                z-index: 1;
                margin-bottom: 40px;

                display: flex;
                justify-content: space-between;

                p {
                    margin: 0;
                    padding: 10px 5px 5px 5px;
                    font-family: "Be Vietnam Pro", sans-serif;
                    font-weight: 300;
                    font-style: normal;
                }

                img {
                    width: 40%;
                    padding-right: 5px;
                    max-width: 40%;
                    height: auto;
                    object-fit: contain;
                }
            }
        }

    }
}

.archive__card {

    .card__media {

        a {
            width: 100%;
            height: 100%;
            display: grid;
            grid-template-areas: "sponsor";
            grid-template-rows: 100%;
            grid-template-columns: 100%;

            img {
                grid-area: sponsor;
                object-fit: contain;
            }

            .sponsor-container {
                background-color: rgba(255, 255, 255, 0.85);
                align-self: center;
                padding: 10px;
                grid-area: sponsor;

                display: flex;
                justify-content: space-between;

                p {
                    margin: 0;
                    padding: 10px 5px 5px 5px;
                }

                img {
                    width: 40%;
                    padding-right: 5px;
                    max-width: 40%;
                }
            }
        }
    }
}

/* Switch to horizontal layout on wider screens */
@media (min-width: 600px) {
    .card {
        flex-direction: row;
    }

    .card__media {
        width: 40%;
        flex-shrink: 0;
    }

    .card__media:not(.cpd__media) img {
        height: 100%;
        aspect-ratio: 4 / 3;
    }

    .card__body {
        width: 60%;
        padding: 20px;
    }
}

/** 5.3 More articles **/
.more__articles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    @media screen and (max-width: 48em) {
        grid-template-columns: 1fr;
    }

    h3 {
        border-bottom: 1px solid var(--cibse-border-color);
        padding: 0 0 10px 0;
        margin: 0;
        font-size: 16px;
    }
}

/** 5.4 related articles **/
.related__articles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;

    @media screen and (min-width: 64em) {
        grid-template-columns: repeat(4, 1fr);
    }

    @media screen and (max-width: 48em) {
        grid-template-columns: 1fr;
    }

    h4 {
        font-size: 0.9375em;
    }

}


/*––––––––––––––––––––––––––––––––––––––––––––––––––
    6. Home page
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.home-news-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--cibse-border-color);

    @media screen and (max-width: 48em) {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: 1 / -1;
    }

    .home-news__main {
        display: grid;
        grid-template-columns: 1fr 1fr;

        @media screen and (max-width: 48em) {
            grid-template-columns: 1fr;
        }

        h2 {
            margin: 0;
        }

        h3 {
            background-color: var(--cibse-color-black);
            margin: 0;
            padding: 10px;
            font-size: 1.45em;

            a {
                color: #FFFFFF;
            }
        }

        a {
            img {
                display: block;
            }
        }

        &:first-of-type {
            border-bottom: 1px solid var(--cibse-border-color);
        }

        &:not(:first-of-type) {
            padding: 10px;
            gap: 10px;

            @media screen and (max-width: 48em) {
                > div:first-of-type {
                    display: none;
                }
            }

            h2 {
                font-size: 16px;
            }
        }

    }
}

.home__cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;

    @media screen and (max-width: 37.5em) {
        grid-template-columns: 1fr;
    }

    > div {
        display: flex;
        flex-direction: column;
        gap: 20px;

        .home__section {
            border: 1px solid var(--cibse-border-color);

            h3 {
                background-color: var(--cibse-color-black);
                margin: 0;
                padding: 10px;
                font-size: 1.45em;

                a {
                    color: #FFFFFF;
                }
            }

            .two__cols {
                display: grid;
                grid-template-columns: 1fr 1fr;
                gap: 10px;

                @media screen and (max-width: 48em) {
                    grid-template-columns: 1fr;
                }
            }

            a {
                img {
                    display: block;
                    width: 100%;
                    height: auto;
                }

                &.product-month {
                    display: grid;
                    grid-template-areas: "product";
                    grid-template-rows: 100%;
                    grid-template-columns: 100%;

                    img {
                        grid-area: product;
                    }

                    .product-month__banner {
                        width: 90%;
                        align-self: start;
                        padding-top: 20px;
                        grid-area: product;
                    }
                }
            }

            > div {
                padding: 10px;

                > div {
                    border-bottom: 1px solid var(--cibse-border-color);
                    padding: 10px 0;

                    &:first-of-type {
                        padding-top: 0;
                    }

                    &:last-of-type {
                        border: none;
                        padding-bottom: 0;
                    }
                }

                h2 {
                    font-size: 1.1rem;
                    margin: 0;
                }
            }

            .section__footer {
                background-color: var(--cibse-color-grey);
                text-transform: capitalize;
                color: #fff;
                font-size: 13px;
                font-weight: 400;
            }

            &.home__card {
                display: flex;
                flex-direction: column;
                gap: 16px;
                padding-bottom: 10px;

                h2, p {
                    padding: 0 10px;
                    margin: 0;
                }
            }

        }

    }
}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    7. Adverts
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.advert__container {
    word-wrap: break-word;

    a {
        display: block;

        img {
            width: 100%;
            display: block;
        }
    }

    iframe {
        display: block;
        margin: 0 auto;
    }
}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    8. 404
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.error-404 {
    .page-content {
        min-height: 400px;
        display: grid;
        grid-template-columns:1fr 1fr;
        gap: 40px;
        margin-top: 0;

        > div {

            &:first-of-type {
                display:flex;
                justify-content: center;
                align-items: center;

                img {
                    max-width: 280px;
                    aspect-ratio: 1 / 1;
                }
            }

            &:last-of-type {
                display: flex;
                flex-direction: column;
                justify-content: center;
                gap: 20px;

                .page-title {
                    padding: 0;
                    font-size: 2.5rem;
                    line-height: 1;
                    text-transform: uppercase;
                    font-weight: 200;
                }

                .search-input {
                    margin: 0;
                }
            }

        }

        @media screen and (max-width: 48em) {
            grid-template-columns: 1fr;

            > div {

                margin: 0 10%;

                &:first-of-type {
                    display: none;
                }
            }
        }
    }

}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    9. Advertise page
–––––––––––––––––––––––––––––––––––––––––––––––––– */
/* Box styling for the block */
.contact-directory {
    margin: 0 auto;
    font-style: normal;

    h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
        padding-bottom: 0.5rem;
    }

    dl {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;

        @media (min-width: 48em) {
            grid-template-columns: repeat(2, 1fr);
        }

        .contact-group {
            padding: 1rem;
            background: #ffffff;
            color: var(--cibse-color-black);
            border-left: 4px solid var(--cibse-color-blue);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

            dt {
                font-weight: bold;
                font-size: 1.1rem;
                margin-bottom: 0.5rem;
            }

            dd {
                margin: 0;
                padding: 0.2rem 0;
                font-size: 0.95rem;

                &.contact-name {
                    font-weight: 500;
                }

                &.phone,
                &.email {
                    display: grid;
                    grid-template-columns: 48px 1fr;
                    gap: 4px;
                }
            }

            a {
                color: var(--cibse-color-black);
                text-decoration: none;
                font-weight: 500;

                &:hover {
                    text-decoration: underline;
                    color: var(--cibse-color-blue);
                }
            }
        }
    }
}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    10. CIBSE Journal
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.magazine-page {

    .content-wrapper {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 300px; /* match your sidebar width */
        gap: 2rem;
        align-items: start;

        @media (max-width: 900px) {
            grid-template-columns: 1fr;
        }

        .issue-grid {
            display: grid;
            gap: 1.5rem;
            margin: 0;
            padding: 0;
            list-style: none;

            /** Card: cover on top, title left, PDF icon right **/

            .issue {
                display: grid;
                grid-template-columns: 1fr auto;
                grid-template-areas:
                                    "cover cover"
                                    "title pdf";
                gap: .5rem;
                align-items: start;

                .issue__cover {
                    grid-area: cover;

                    img {
                        display: block;
                        width: 100%;
                        height: auto;
                    }
                }

                .issue__title {
                    grid-area: title;
                    margin: 0;
                    font-size: 0.8125rem;
                    min-height: 2rem;
                }

                .issue__pdf download-pdf {
                    align-self: center;
                }
            }

            &.issue-grid--featured {
                grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));

                .issue__title {
                    font-size: 1.125rem;
                    min-height: 3rem;

                    a {
                        color: inherit;
                        text-decoration: none;
                    }
                }
            }

            &.issue-grid--archive {
                grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            }

        }

        .archive-label {
            margin: 2.5rem 0 1rem;
            padding-bottom: .5rem;
            border-bottom: 1px solid var(--cibse-color-black);
        }

    }

}

/*––––––––––––––––––––––––––––––––––––––––––––––––––
    11. Sitemap
        11.1 Nav
        11.2 Sections
–––––––––––––––––––––––––––––––––––––––––––––––––– */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 2.5rem;
}

.layout {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 2.5rem;
    padding-bottom: 5rem;
    align-items: start;

    @media (max-width: 48em) {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

}

/* ---------- 11.2 Nav ---------- */
.rail {
    position: sticky;
    top: 2.5rem;

    h2 {
        font-size: 0.875rem;
        font-weight: normal;
        margin: 0 0 .75rem;
        color: var(--cibse-color-black);
    }

    ul {
        list-style: none;
        margin: 0;
        padding: 0;
        border-top: 1px solid rgba(145, 145, 145, 0.4);;

        li {
            border-bottom: 1px solid rgba(145, 145, 145, 0.4);;

            a {
                display: flex;
                justify-content: space-between;
                align-items: center;
                gap: .5rem;
                padding: .55rem .25rem .55rem .75rem;
                color: var(--cibse-color-black);
                text-decoration: none;
                border-left: 4px solid var(--cibse-color-grey);

                &:hover {
                    background: var(--cibse-color-blue-tint);
                }

                .n {
                    font-variant-numeric: tabular-nums;
                    color: var(--cibse-color-black);
                    font-size: .85rem;
                }
            }

            &.news-nav-item {
                a {
                    border-left: 4px solid var(--cibse-color-green);
                }
            }

            &.cibse-news-nav-item {
                a {
                    border-left: 4px solid var(--cibse-color-blue);
                }
            }

            &.technical-nav-item {
                a {
                    border-left: 4px solid var(--cibse-color-red);
                }
            }

            &.case-studies-nav-item {
                a {
                    border-left: 4px solid var(--cibse-color-yellow);
                }
            }

            &.voices-nav-item {
                a {
                    border-left: 4px solid var(--cibse-color-blue);
                }
            }

            &.products-nav-item {
                a {
                    border-left: 4px solid var(--cibse-color-yellow);
                }
            }

            &.cpd-nav-item {
                a {
                    border-left: 4px solid var(--cibse-color-grey);
                }
            }

        }

        li[hidden] {
            display: none;
        }
    }

    @media (max-width: 48em) {
        position: static;

        ul {
            display: flex;
            overflow-x: auto;
            border-top: 0;
            gap: .5rem;
            padding-bottom: .5rem;

            li {
                border: 0;
                flex: 0 0 auto;

                a {
                    border: 1px solid rgba(145, 145, 145, 0.4);
                    border-left-width: 1px;
                    padding: .4rem .75rem;
                }

                .n {
                    display: none;
                }

            }
        }

    }
}

/* ---------- 11.1 sections ---------- */
.sections {
    display: grid;
    gap: 1.5rem;
    min-width: 0;

    .sec {
        border: 1px solid rgba(145, 145, 145, 0.4);
        border-left: 6px solid var(--cibse-color-grey);
        padding: 1.5rem 1.5rem 1.25rem;

        &.news-section {
            border-left: 6px solid var(--cibse-color-green);
        }

        &.cibse-news-section {
            border-left: 6px solid var(--cibse-color-blue);
        }

        &.technical-section {
            border-left: 6px solid var(--cibse-color-red);
        }

        &.case-studies-section {
            border-left: 6px solid var(--cibse-color-yellow);
        }

        &.voices-section {
            border-left: 6px solid var(--cibse-color-blue);
        }

        &.products-section {
            border-left: 6px solid var(--cibse-color-yellow);
        }

        &.cpd-section {
            border-left: 6px solid var(--cibse-color-grey);
        }

        @media (max-width: 48em) {
            padding: 1.25rem 1rem;
        }
    }

    .sec[hidden] {
        display: none;
    }

    .sec-head {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        flex-wrap: wrap;
        margin-bottom: .25rem;

        h2 {
            margin: 0 0 1rem 0;

            a {
                color: inherit;
                text-decoration: none;

                &:hover {
                    text-decoration: underline;
                }
            }

        }

        .count {
            color: var(--cibse-color-black);
            font-size: .9rem;
            white-space: nowrap;
        }
    }


    /* post lists flow into columns so a long list stays compact */

    .posts {
        list-style: none;
        margin: 0;
        padding: 0;
        columns: 2 300px;
        column-gap: 2.5rem;

        li {
            break-inside: avoid;
            padding: .55rem 0;
            border-top: 1px solid rgba(145, 145, 145, 0.4);
            display: grid;
            gap: .1rem;
        }

        li[hidden] {
            display: none;
        }

        a {
            font-weight: 500;
            line-height: 1.35;
        }

        time {
            font-size: .82rem;
            color: var(--cibse-color-grey);
            font-variant-numeric: tabular-nums;
        }
    }

    /* sub-sections (e.g. CPD has modules, webinars, white papers) */

    .sub {
        margin-top: 1.25rem;

        h3 {
            margin: 0 0 .5rem;
        }
    }

}