/* Blog: listings (posts page and search results) and single posts. */

/* Montserrat SemiBold, self-hosted */
@font-face {
    font-family: Montserrat;
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url( ../fonts/montserrat-600.woff2 ) format( 'woff2' );
}

/* Keeps the bar's space while it is pinned */
.blog-filters-slot {
    display: flow-root;
}

.blog-filters {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

/* Pagination of the listings */
.pagination .nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination .nav-links .page-numbers {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 0;
    background-color: var( --neutral-extra-light );
    color: var( --blue-500 );
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
}

.pagination .nav-links .page-numbers.current {
    background-color: var( --blue-500 );
    color: var( --neutral-white );
}

/* Search field */
.blog-search {
    position: relative;
}

.blog-search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3.25rem;
    border: 1px solid var( --blue-500 );
    border-radius: 1rem;
    background: transparent url( ../svg/search.svg ) no-repeat 1rem center / 1.5rem;
    color: var( --neutral-black );
    line-height: 1.5;
    box-shadow: none;
}

.blog-search-input::placeholder {
    color: var( --neutral-dark );
}

.blog-search-input:focus {
    outline: 0;
    border-color: var( --neutral-black );
}

.blog-search.is-filled .blog-search-input {
    padding-right: 3.5rem;
    border-radius: 3rem;
    border-color: var( --neutral-black );
}

.blog-search-clear {
    position: absolute;
    top: 50%;
    right: 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    transform: translateY( -50% );
}

.blog-search-clear::before,
.blog-search-clear::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 2px;
    background: var( --neutral-black );
}

.blog-search-clear::before {
    transform: translate( -50%, -50% ) rotate( 45deg );
}

.blog-search-clear::after {
    transform: translate( -50%, -50% ) rotate( -45deg );
}

/* Category and order dropdowns (details elements) */
.blog-drops {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
}

.blog-drop {
    position: relative;
}

.blog-drop > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var( --neutral-black );
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}

.blog-drop > summary::-webkit-details-marker {
    display: none;
}

.blog-drop > summary::after {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    margin: 0 0.25rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate( 45deg ) translateY( -2px );
    transition: transform 0.2s;
}

.blog-drop[open] > summary::after {
    transform: rotate( -135deg ) translateY( -2px );
}

.blog-drop-list {
    position: absolute;
    z-index: 20;
    top: calc( 100% + 0.75rem );
    left: 0;
    min-width: min( 18.75rem, calc( 100vw - 2rem ) );
    margin: 0;
    padding: 0.5rem;
    list-style: none;
    background-color: var( --neutral-extra-light );
    box-shadow: 16px 2px 24px rgba( 0, 58, 93, 0.04 );
}

.blog-drop-list a {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var( --neutral-light );
    color: var( --neutral-black );
    font-weight: 500;
    text-decoration: none;
}

.blog-drop-list li:last-child a {
    border-bottom-color: transparent;
}

.blog-drop-list a:hover,
.blog-drop-list a:focus-visible {
    color: var( --blue-500 );
}

.blog-drop-list a.is-active {
    border-radius: 0.5rem;
    border-bottom-color: var( --blue-500 );
    background-color: var( --blue-500 );
    color: var( --neutral-white );
}

/* Empty state */
.blog-empty {
    padding: 5rem 0;
}

.blog-empty-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 31rem;
    margin: 0 auto;
    text-align: center;
}

/* Lens illustration with the headline over its right half */
.blog-empty-visual {
    --blog-empty-scale: 1;
    position: relative;
    width: 555px;
    max-width: none;
    height: 152px;
    transform: scale( var( --blog-empty-scale ) );
    transform-origin: top center;
    margin-bottom: calc( 152px * ( var( --blog-empty-scale ) - 1 ) );
}

.blog-empty-image {
    position: absolute;
    top: -8px;
    left: -3px;
    width: 293px;
    height: 164px;
}

.blog-empty-oops {
    position: absolute;
    top: 40px;
    left: 215px;
    margin: 0;
    color: var( --green-700 );
    font-family: var( --heading-font-family );
    font-size: 3.5rem;
    line-height: 4rem;
    white-space: nowrap;
}

.blog-empty-title {
    margin: 0;
    font-family: Montserrat, sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.blog-empty-text {
    margin: 0;
}

/* Single post: E-E-A-T block ("Legally reviewed by" and the date of the last update) */
.blog-reviewer {
    gap: 1rem;
}

.blog-reviewer-figure {
    display: block;
    flex: none;
    width: 4.5rem;
    height: 4.5rem;
    overflow: hidden;
    border-radius: 50%;
    background-color: var( --neutral-white );
}

.blog-reviewer-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.blog-reviewer-info {
    min-width: 0;
}

.blog-reviewer-info p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.4286;
}

.blog-reviewer-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var( --blue-500 );
    font-weight: 700;
}

.blog-reviewer-label svg {
    flex: none;
}

.blog-reviewer .blog-reviewer-name {
    margin-top: 0.125rem;
    color: var( --neutral-black );
    font-size: 1.125rem;
    font-weight: 800;
    line-height: 1.3333;
}

.blog-reviewer .blog-reviewer-name a {
    color: inherit;
    font-style: normal;
    text-decoration: none;
}

.blog-reviewer .blog-reviewer-name a:hover,
.blog-reviewer .blog-reviewer-name a:focus-visible {
    text-decoration: underline;
}

.blog-reviewer-info .blog-reviewer-date {
    margin-top: 0.25rem;
    color: var( --neutral-black );
}

/* Single post: sidebar */
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Sidebar form */
.blog-sidebar-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
    padding: 1.5rem;
    background-color: var( --blue-500 );
    color: var( --neutral-white );
}

.blog-sidebar-form-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
}

.blog-sidebar-form-title {
    margin: 0;
    color: inherit;
    font-family: Montserrat, sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
}

.blog-sidebar-form-intro {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.4286;
}

.blog-sidebar-form .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
}

.blog-sidebar-form .wpcf7-form > p,
.blog-sidebar-form .wpcf7-form > div {
    margin: 0;
}

/* Two-column field rows */
.blog-sidebar-form .row {
    display: grid;
    grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
    gap: 1rem;
    margin: 0;
}

.blog-sidebar-form .row > * {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
}

.blog-sidebar-form .wpcf7-form-control-wrap {
    display: block;
}

.blog-sidebar-form input[type="text"],
.blog-sidebar-form input[type="email"],
.blog-sidebar-form input[type="tel"],
.blog-sidebar-form textarea {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.875rem 1rem;
    border: 1px solid var( --neutral-white );
    border-radius: 0.75rem;
    background: transparent;
    color: var( --neutral-white );
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4286;
    box-shadow: none;
}

.blog-sidebar-form input[type="text"],
.blog-sidebar-form input[type="email"],
.blog-sidebar-form input[type="tel"] {
    height: 3rem;
}

.blog-sidebar-form textarea {
    height: 5.75rem;
    min-height: 0;
    resize: none;
}

.blog-sidebar-form input::placeholder,
.blog-sidebar-form textarea::placeholder {
    color: var( --neutral-white );
    opacity: 1;
}

.blog-sidebar-form input:focus,
.blog-sidebar-form textarea:focus {
    outline: 2px solid var( --neutral-white );
    outline-offset: 2px;
}

/* Consent checkbox and legal text */
.blog-sidebar-form .wpcf7-acceptance {
    display: block;
}

.blog-sidebar-form .wpcf7-list-item {
    display: block;
    margin: 0;
}

.blog-sidebar-form .wpcf7-list-item label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
}

.blog-sidebar-form input[type="checkbox"] {
    flex: none;
    width: 1rem;
    height: 1rem;
    margin: 0.125rem 0 0;
    border: 1px solid var( --neutral-white );
    border-radius: 4px;
    background: transparent;
    appearance: none;
    cursor: pointer;
}

.blog-sidebar-form input[type="checkbox"]:checked {
    background: var( --neutral-white ) url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5' fill='none' stroke='%23267b8e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" ) center / 100% no-repeat;
}

.blog-sidebar-form .wpcf7-list-item-label {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
    line-height: 1.5;
}

.blog-sidebar-form .wpcf7-list-item-label a {
    color: inherit;
    font-size: inherit;
    font-style: italic;
    font-weight: 800;
    line-height: inherit;
    text-decoration: underline;
}

.blog-sidebar-form .wpcf7-list-item-label strong,
.blog-sidebar-form .wpcf7-list-item-label b {
    font-size: inherit;
    font-weight: 700;
    line-height: inherit;
}

/* Submit: 24 px below the fields */
.blog-sidebar-form input[type="submit"],
.blog-sidebar-form .wpcf7-submit {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.75rem 2rem;
    border: 0;
    border-radius: 2.5rem;
    background-color: var( --neutral-white );
    color: var( --neutral-black );
    font-size: 0.875rem;
    font-weight: 800;
    line-height: 1.4286;
}

.blog-sidebar-form .wpcf7-spinner {
    display: none;
}

.blog-sidebar-form .wpcf7-not-valid-tip,
.blog-sidebar-form .wpcf7-response-output {
    margin: 0.5rem 0 0;
    padding: 0;
    border: 0;
    color: var( --neutral-white );
    font-size: 0.75rem;
}

.blog-sidebar-form-note {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.4286;
    text-align: center;
}

.blog-sidebar-form-note strong {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.5;
}

@media ( min-width: 992px ) {
    .blog-sidebar-form input[type="submit"],
    .blog-sidebar-form .wpcf7-submit {
        font-size: 1rem;
        line-height: 1.5;
    }

    .blog-sidebar-form-title {
        font-size: 1.75rem;
        line-height: 1.4286;
    }

    .blog-sidebar-form-intro,
    .blog-sidebar-form-note {
        font-size: 1rem;
        line-height: 1.5;
    }
}

.blog-related {
    min-width: 0;
    padding: 2rem 1.5rem;
    background-color: var( --blue-200 );
}

.blog-related-title {
    margin: 0 0 1rem;
    color: var( --neutral-black );
    font-family: var( --default-font-family );
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3333;
}

.blog-related-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.blog-related-list li + li {
    border-top: 1px solid var( --green-200 );
}

.blog-related-list a {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    color: var( --neutral-black );
    font-size: 0.875rem;
    font-style: italic;
    font-weight: 800;
    line-height: 1.4286;
    text-decoration: underline;
}

.blog-related-list li:first-child a {
    padding-top: 0;
}

.blog-related-list li:last-child a {
    padding-bottom: 0;
}

.blog-related-list a span {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: break-word;
}

.blog-related-list a svg {
    flex: none;
    color: var( --blue-500 );
}

/* Single post: dynamic CTA banner (Figma "CTA") */
.blog-cta {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2.5rem 0;
    padding: 2rem 1.5rem 0;
    overflow: hidden;
    border-radius: 1.5rem;
    background-color: transparent;
    /* The uploaded image carries its own tint; without one the banner is flat teal */
    background-image: var( --blog-cta-bg, linear-gradient( var( --blue-500 ), var( --blue-500 ) ) );
    background-position: center bottom;
    background-size: cover;
    color: #fffdf4;
}

.blog-cta-title {
    margin: 0 0 0.5625rem;
    font-size: 1.125rem;
    font-weight: 800;
    line-height: 1.3333;
}

.blog-cta-text {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.4286;
}

.blog-cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.blog-cta-buttons .btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    width: 100%;
    margin: 0;
    padding: 0.625rem 2rem;
    border-radius: 2.5rem;
    font-size: 0.875rem;
    font-weight: 800;
    line-height: 1.4286;
}

.blog-cta-buttons .btn svg {
    flex: none;
}

.blog-cta .blog-cta-evaluation {
    border: 1px solid var( --neutral-white );
    background-color: transparent;
    color: var( --neutral-white );
}

.blog-cta .blog-cta-evaluation:hover,
.blog-cta .blog-cta-evaluation:focus-visible {
    background-color: var( --neutral-white );
    color: var( --blue-500 );
}

/* Mobile: portrait bottom left, logo to its right */
.blog-cta-figure {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    min-height: 11rem;
}

.blog-cta-photo {
    display: block;
    width: auto;
    max-width: 10.4375rem;
    height: 11rem;
    object-fit: contain;
    object-position: bottom left;
}

.blog-cta-logo {
    align-self: center;
    width: 9.3125rem;
    height: auto;
    margin-left: auto;
}

/* Desktop: text and buttons left, portrait right */
@media ( min-width: 768px ) {
    .blog-cta {
        display: block;
        min-height: 19rem;
        padding: 2rem;
    }

    .blog-cta-body {
        position: relative;
        z-index: 1;
        max-width: 60%;
    }

    .blog-cta-text {
        max-width: 26rem;
    }

    .blog-cta-body .blog-cta-text + .blog-cta-buttons {
        margin-top: 1.5rem;
    }

    .blog-cta-buttons {
        width: min( 100%, 19.5rem );
    }

    .blog-cta-figure {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 38%;
        min-height: 0;
    }

    .blog-cta-photo {
        position: absolute;
        right: 28%;
        bottom: 0;
        width: auto;
        max-width: 70%;
        height: 72%;
        object-position: bottom center;
    }

    .blog-cta-logo {
        position: absolute;
        top: 2.25rem;
        right: 1rem;
        width: min( 9.3125rem, 60% );
        margin: 0;
    }
}

/* Tablet and mobile */
@media ( max-width: 991.98px ) {
    /* Cancels the top padding of the newsletter section that follows, so it starts right after the sidebar */
    .blog-post-body {
        margin-bottom: -3rem;
    }

    /* Sidebar: the form and the related links become one full-width band */
    .blog-sidebar-form {
        margin-inline: -1.5rem;
    }

    .blog-sidebar {
        gap: 0;
    }

    .blog-related {
        margin-inline: -1.5rem;
        background-color: transparent;
    }

    .blog-related-list li + li {
        border-top: 0;
    }

    .blog-related-list a,
    .blog-related-list li:first-child a,
    .blog-related-list li:last-child a {
        padding-block: 0.625rem;
    }

    .blog-related-list a svg {
        color: var( --neutral-black );
    }

    /* Filters: one line, compact search, full-width panels, bar pinned under the header */
    .blog-filters {
        position: relative;
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .blog-search-input {
        height: 2.5rem;
        padding-top: 0;
        padding-bottom: 0;
        font-size: 0.875rem;
    }

    .blog-drops {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 1rem;
    }

    .blog-drop {
        position: static;
        min-width: 0;
    }

    .blog-drop > summary {
        max-width: 100%;
        font-size: 0.875rem;
        line-height: 1.4286;
    }

    .blog-drop > summary > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .blog-drop-list {
        top: 100%;
        left: 0;
        right: 0;
        min-width: 0;
        padding: 0.5rem 1.5rem;
    }

    .blog-filters.is-stuck {
        position: fixed;
        right: 0;
        left: 0;
        z-index: 1000;
        margin: 0;
        padding: 1rem 1.5rem;
        background-color: var( --blue-200 );
    }
}

/* Mobile */
@media ( max-width: 767.98px ) {
    /* Empty state */
    .blog-empty {
        padding: 3rem 0;
    }

    .blog-empty-visual {
        --blog-empty-scale: 0.58;
    }

    .blog-empty-title {
        font-size: 1.5rem;
    }

    /* CTA: edge-to-edge band, 400 px minimum with the portrait at the bottom */
    .blog-cta {
        margin: 2.5rem -1.5rem;
        padding: 1.96875rem 1.5rem 2rem;
        border-radius: 0;
    }

    /* Bottom padding reserves the portrait height */
    .blog-cta.has-photo {
        min-height: 25rem;
        padding-bottom: 12.0625rem;
    }

    .blog-cta-body {
        position: relative;
        z-index: 1;
    }

    .blog-cta-body .blog-cta-text + .blog-cta-buttons {
        margin-top: 1.5rem;
    }

    .blog-cta-figure {
        position: absolute;
        inset: 0;
        min-height: 0;
        pointer-events: none;
    }

    .blog-cta-photo {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 10.4375rem;
        max-width: none;
        height: 11.0625rem;
        object-position: bottom left;
    }

    .blog-cta-logo {
        position: absolute;
        bottom: 6.3125rem;
        left: 9.375rem;
        width: 9.3125rem;
        margin: 0;
    }
}
