/* Restrict height of the website logo. */

.n3inhs-header__logo {
    width: auto;
    max-height: 200px;
}

/* Make the current menu item bold. WordPress sets aria-current="page" on the
   current menu item and the theme sets aria-current="true" on its ancestors
   (see n3inhs_add_aria_current_on_ancestor), so this always matches the same
   items that get the NHS.UK white bottom border. */

.nhsuk-header__navigation-item a[aria-current] {
    font-weight: 700;
}

/* Ensure the search box does not shrink to below recommended size. */

.nhsuk-input-wrapper input,
.nhsuk-input-wrapper button {
    min-height: 44px;
}

/* Remove spacing below card groups on mobile views. */

@media (max-width: 48.0525em) {
    .nhsuk-card-group {
        margin-bottom: 16px;
    }
}

/* Improve display of iframes. */

iframe {
    width: 100%;
    border: 1px solid #D8DDE0;
    margin-bottom: 16px;
}

@media (min-width: 40.0625em) {
    iframe {
        margin-bottom: 24px;
    }
}

/* Fix website logo not having enough space. */

@media (min-width: 40.0625em) {
    .nhsuk-header__container {
        justify-content: space-between;
        /* Vertically centre the service name/logo against the taller search
           box; without this the flex row stretches both sides and the logo
           sits top-aligned, ~10px above the search box centre (issue #84). */
        align-items: center;
    }

    .nhsuk-header__content {
        width: auto;
    }
}

/* Add margin below website logo on smaller screens. */

@media (max-width: 40.0525em) {
    .nhsuk-header__logo {
        margin-bottom: 1rem;
    }
}

.nhsuk-main-wrapper:has(.nhsuk-hero) {
    padding-top: 0;
}

/* Stack action-link blocks vertically (block-level), matching the editor.
   .nhsuk-action-link is display:inline-block upstream, so adjacent blocks
   would otherwise flow side by side on the front-end (issue #83).
   width:fit-content keeps the focus/hover highlight hugging the content. */

.wp-block-n3inhs-action-link {
    display: block;
    width: fit-content;
}

/* Remove the browser UA stylesheet's default figure margin (1em 40px) from
   the core image block, and match the responsive margin-bottom of <p>
   elements (16px, 24px from the tablet breakpoint up). */

.wp-block-image {
    margin: 0 0 16px;
}

@media (min-width: 40.0625em) {
    .wp-block-image {
        margin-bottom: 24px;
    }
}

/* Give the Image block a card-style border by default, and the thicker
   bottom edge cards use to signal "clickable" when the image links
   somewhere. Editors can opt out via the block's "No border" style. */

.wp-block-image:not(.is-style-no-border) img {
    border: 1px solid var(--nhsuk-border-colour);
}

.wp-block-image:not(.is-style-no-border) a img {
    box-shadow: 0 3px 0 var(--nhsuk-border-colour);
}

.wp-block-image:not(.is-style-no-border) a:hover img {
    border-color: var(--nhsuk-border-hover-colour);
    box-shadow: 0 3px 0 var(--nhsuk-border-hover-colour);
}

.wp-block-image:not(.is-style-no-border) a:active img {
    border-color: var(--nhsuk-border-hover-colour);
    box-shadow: 0 3px 0 var(--nhsuk-border-hover-colour);
}

/* Add spacing below the footer widget area so it doesn't sit flush against
   the footer menu. */

.n3inhs-footer__widgets {
    margin-bottom: 16px;
}

@media (min-width: 40.0625em) {
    .n3inhs-footer__widgets {
        margin-bottom: 24px;
    }
}

/* WordPress renders each footer widget as a bare <li> (no wrapping <ul>),
   so browsers still apply default list-item styling, including a bullet. */

.n3inhs-footer__widgets .widget {
    list-style: none;
}

/* NHS table styles for core table block. */

.wp-block-table {
    display: flex;
    flex-direction: column;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar;
    margin: 0 0 40px;
}

@media (min-width: 40.0625em) {
    .wp-block-table {
        margin-bottom: 48px;
    }
}

.wp-block-table table {
    border-collapse: collapse;
    border-spacing: 0;
    box-sizing: border-box;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    width: 100%;
    margin: 0;
}

/* Override WP core inline block styles which load after this file and set
   .wp-block-table td/th { border: 1px solid; padding: 0.5em }. */

.wp-block-table td,
.wp-block-table th {
    border-color: #d8dde0 !important;
    border-style: solid !important;
    border-width: 0 0 1px !important;
    padding-top: 8px !important;
    padding-right: 16px !important;
    padding-bottom: 8px !important;
    padding-left: 0 !important;
    text-align: left;
    vertical-align: top;
}

.wp-block-table td:last-child,
.wp-block-table th:last-child {
    padding-right: 0 !important;
}

.wp-block-table thead {
    border-bottom: none !important;
}

.wp-block-table thead th {
    border-bottom-width: 2px !important;
    font-weight: 600;
}

@media (min-width: 40.0625em) {
    .wp-block-table table {
        font-size: 1.1875rem;
        line-height: 1.4736842105;
    }
}

/* Caption above the table, styled as nhsuk-table__caption. */

.wp-block-table figcaption {
    order: -1;
    display: block;
    font-size: 1.1875rem;
    font-weight: 600;
    line-height: 1.4210526316;
    text-align: left;
    color: #212b32;
    margin-bottom: 8px;
}

@media (min-width: 40.0625em) {
    .wp-block-table figcaption {
        font-size: 1.375rem;
        line-height: 1.3636363636;
    }
}
