/*
Theme Name: NMC
Author: Tim Wakeling
Author URI: https://timwakeling.co.uk
Description: Custom block theme for the NeuroMuscular Centre
Requires at least: 6.8
Tested up to: 6.8
Requires PHP: 8.4
Version: 2025.10.10
*/

/* Make header fixed position */

html:not(.has-modal-open) .wp-site-blocks > header {
    position: fixed;
    top: 0px;
    width: 100%;
    z-index: 9999;
    box-shadow: 0 5px 10px rgba( 0, 0, 0, 0.04 );
}
html:not(.has-modal-open) body.logged-in .wp-site-blocks > header {
    top: 46px;
}
@media screen and ( min-width: 784px ) {
    html:not(.has-modal-open) body.logged-in .wp-site-blocks > header {
        top: 32px;
    }
}
html:not(.has-modal-open) .wp-site-blocks > header + div,
html:not(.has-modal-open) .wp-site-blocks > header + main {
    margin-top: 7rem !important;
}
html:not(.has-modal-open) .wp-site-blocks:has(.temporary-message) > header + div,
html:not(.has-modal-open) .wp-site-blocks:has(.temporary-message) > header + main {
    margin-top: 10.4rem !important;
}

/* Move Gravity Forms anchors up to compensate for the fixed header */
.gform_anchor {
    position: relative !important;
    top: -25rem !important;
}

/* Increase minimum width of submenus */
.wp-block-navigation__submenu-container {
    min-width: 280px !important;
}

@media screen and ( min-width: 768px ) and ( max-width: 1023px ) {
    html:not(.has-modal-open) .wp-site-blocks > header + div {
        margin-top: 8.7rem !important;
    }
    html:not(.has-modal-open) .wp-site-blocks:has(.temporary-message) > header + div {
        margin-top: 12.1rem !important;
    }
}
@media screen and ( min-width: 1024px ) and ( max-width: 1512px ) {
    html:not(.has-modal-open) .wp-site-blocks > header + div {
        margin-top: 11.6rem !important;
    }
    html:not(.has-modal-open) .wp-site-blocks:has(.temporary-message) > header + div {
        margin-top: 15rem !important;
    }
}
@media screen and ( min-width: 1513px ) {
    html:not(.has-modal-open) .wp-site-blocks > header + div {
        margin-top: 8.7rem !important;
    }
    html:not(.has-modal-open) .wp-site-blocks:has(.temporary-message) > header + div {
        margin-top: 12.1rem !important;
    }
}

/* CTA and search buttons */

.moved-to-top {
    position: absolute;
    top: var( --wp--preset--spacing--30 );
    right: var( --wp--style--root--padding-right );
}

/* Home button icon instead of text */

a[title="Home"]::before {
    content: '\f015';
    font-family: 'Font Awesome 7 Pro';
    font-weight: 400;
    height: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
a[title="Home"] span.wp-block-navigation-item__label {
    display: none;
}

/* Search */

.wp-block-search.wp-block-search__button-only .wp-block-search__input {
    transition: none;
}
header form:not(.wp-block-search__searchfield-hidden) .wp-block-search__inside-wrapper {
    position: absolute;
    bottom: -5.2rem;
    left: 0;
    z-index: 999999;
    background: var( --wp--preset--color--green-40 );
    width: 100%;
    padding: 1rem;
    box-sizing: border-box;
}
form.wp-block-search__searchfield-hidden .wp-block-search__label {
    display: none;
}
.wp-block-search .wp-block-search__button {
    background: transparent;
    color: var( --wp--preset--color--green );
    border: 2px solid transparent;
    padding: 0.5rem;
}
.wp-block-search .wp-block-search__button:hover {
    background: var( --wp--preset--color--green-10 );
    border-color: var( --wp--preset--color--green-40 );
}
.wp-block-search__button svg {
    min-width: 36px;
    min-height: 36px;
}
.wp-block-search__input {
    margin-right: 0.5rem;
}
.wp-block-search__label {
    color: white;
}

/* Links */

a {
	text-decoration-thickness: 2px !important;
	text-underline-offset: .2em;
}
.tw-stretched-link {
    display: block;
    height: 100%;
}
.tw-stretched-link:hover,
.wp-block-post:has( .tw-stretched-link ):hover {
    background: color-mix( in srgb, currentColor 10%, transparent );
}
.wp-block-post:has( .tw-stretched-link ) .tw-stretched-link:hover {
    background: none;
}
.tw-stretched-link a:hover {
    text-decoration: none;
}
.wp-block-site-logo a {
    border-radius: 5px;
}
.wp-block-site-logo a:hover {
    background: var( --wp--preset--color--green-10 );
    outline: 2px solid var( --wp--preset--color--green );
    outline-offset: 4px;
}

/* Breadcrumbs and parent link buttons (a special class of breadcrumb blocks) */

.breadcrumb-item a {
    text-decoration: none;
}
.wp-block-boldblocks-breadcrumb-block:not(.parent-link-button) .breadcrumb-items::before {
    content: '\2196';
    display: inline-block;
    color: white;
    font-weight: 700;
}
.wp-block-boldblocks-breadcrumb-block:has(.breadcrumb-item--home+.breadcrumb-item--current) {
    display: none; /* Hide breadcrumb blocks if they contain only home and current (no parents) */
}
.wp-block-boldblocks-breadcrumb-block:not(:has(.breadcrumb-item--home+.breadcrumb-item--current)) + h1 {
    margin-top: 0.2em !important;
}
.parent-link-button .breadcrumb-item:not(.breadcrumb-item--parent),
.parent-link-button span.sep {
    display: none;
}
.parent-link-button a {
    background: white;
    border: 2px solid currentColor;
    border-radius: 999px;
    font-size: var( --wp--preset--font-size--large );
    font-style: normal;
    font-weight: 700;
    padding-top: var( --wp--preset--spacing--20 );
    padding-bottom: var( --wp--preset--spacing--20 );
    padding-left: 2.25rem;
    padding-right: 2.25rem;
    text-decoration: none;
}
.parent-link-button a:hover {
    background: color-mix( in srgb, currentColor 10%, white );
    color: currentColor;
}
.parent-link-button .breadcrumb-item-name::before {
    content: 'Back to ';
}
.parent-link-button a::before {
    content: '\2196';
    display: inline-block;
    margin-right: 0.5em;
    color: currentColor;
}

/* Paragraph styles */

strong {
    font-weight: 800;
}

/* Focus */

:where(.wp-site-blocks *:focus) {
	outline-width: 3px;
	outline-style: solid;
}
.tw-stretched-link:focus-within {
    outline: 3px solid var( --wp--preset--color--gold );
}
.tw-stretched-link a:focus {
    outline: none;
}

/* Menus */

.wp-block-navigation .wp-block-navigation-submenu .wp-block-navigation-item:not(:last-child) {
	margin-bottom: 5px;
}
.wp-block-navigation .wp-block-navigation-item ul.wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	outline-offset: 0;
}

/* Mobile full screen menu */

.wp-block-navigation__responsive-container .wp-block-navigation__submenu-container {
    padding-top: 0.3rem !important;
}
.wp-block-navigation__responsive-container .wp-block-navigation-item__content {
    border-radius: 5px !important;
    outline-offset: 2px !important;
    outline-color: var( --wp--preset--color--gold );
}

/* Avoid widows and orphans */

h1, h2, h3, h4, h5, h6, blockquote, caption, figcaption, p {
	text-wrap: pretty;
}

/* Other tweaks */

.more-link {
	display: block;
}

/* Paragraph styles */

.is-style-paragraph-info,
.is-style-paragraph-success,
.is-style-paragraph-warning {
    position: relative;
}
.is-style-paragraph-info::before,
.is-style-paragraph-success::before,
.is-style-paragraph-warning::before {
    font-family: 'Font Awesome 7 Pro';
    font-weight: 400;
    display: block;
    position: absolute;
    top: 0.8em;
    left: 0.8em;
}
.is-style-paragraph-info::before {
    content: '\f05a';
    color: var( --wp--preset--color--purple );
}
.is-style-paragraph-success::before {
    content: '\f058';
    color: var( --wp--preset--color--green );
}
.is-style-paragraph-warning::before {
    content: '\f06a';
    color: var( --wp--preset--color--warning-red );
}

/* Paragraph styles when not in content block */

.non-content-block-para {
    border-radius: 5px;
    border-width: 2px;
    border-style: solid;
    padding-top: 0.8em;
    padding-right: 1em;
    padding-bottom: 0.8em;
    padding-left: 2.5em;
    margin-top: 1.2rem;
    margin-bottom: 1.2rem;
}
.non-content-block-para.is-style-paragraph-info {
    background-color: var( --wp--preset--color--purple-10 );
    border-color: var( --wp--preset--color--purple );
}
.non-content-block-para.is-style-paragraph-success {
    background-color: var( --wp--preset--color--green-10 );
    border-color: var( --wp--preset--color--green );
}
.non-content-block-para.is-style-paragraph-warning {
    background-color: var( --wp--preset--color--warning-red-10 );
    border-color: var( --wp--preset--color--warning-red );
}

/* Query blocks with 3 columns and only 1 result */

.wp-block-query.center-1-result .wp-block-post-template.columns-3 .wp-block-post:first-child:last-child {
    grid-column-start: 2;
}

/* Embeds, e.g. videos */

.wp-block-embed iframe {
    border-radius: 5px;
}

/* Forms */

.gform_required_legend {
    display: none;
}
body .gform_body .gfield_label,
body .gform_body .ginput_label_product,
body .gform_body .ginput_label_product span {
    font-weight: 700 !important;
}
.gform_body input,
.gform_body select,
.gform_body textarea {
    font-size: 1.2rem !important;
    align-self: center !important;
}
.gform_button,
.gform_next_button,
.gform_previous_button {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    border-radius: 2rem !important;
}
.gform_validation_errors h2 {
    font-size: 1.2rem !important;
}
.gform_previous_button {
    color: var( --wp--preset--color--green ) !important;
}
#gform_wrapper_6 .gform_previous_button {
    color: var( --wp--preset--color--magenta ) !important;
}
.gfield_consent_description {
    border-radius: 5px !important;
    background: #eee !important;
    border-width: 0 !important;
}
.gf_step_number {
    color: var( --wp--preset--color--green ) !important;
}
.gf_step_active .gf_step_number {
    background: var( --wp--preset--color--green ) !important;
    color: white !important;
}
.ginput_container_singleproduct {
    display: block !important;
}
.gsection_title {
    font-size: 160% !important;
    margin: 0 0 0.5em 0 !important;
}
.gsection {
    border-color: var( --wp--preset--color--purple ) !important;
}
.ginput_total {
    font-size: 160% !important;
}
.ginput_quantity {
    margin-right: auto !important;
}

@media screen and ( max-width: 599px ) {

    .smaller-font-on-mobile {
        font-size: var( --wp--preset--font-size--small ) !important;
    }

}

@media screen and ( max-width: 1023px ) {

    /* Mobile menu */

    .wp-block-navigation__responsive-container ul ul ul {
        position: absolute !important;
        left: -99999px !important;
    }

    a.wp-block-navigation-item__content,
    button.wp-block-navigation-item__content {
        font-size: 1.2rem;
    }

}

@media screen and ( min-width: 1024px ) {

    /* Top menu (larger screens) */

    .wp-block-navigation-item {
        border-radius: 5px;
    }
    a.wp-block-navigation-item__content {
        padding-left: 0.5em;
        padding-right: 0.5em;
    }
    a.wp-block-navigation-item__content,
    button.wp-block-navigation-item__content {
        display: block;
        padding-top: 0.6em;
        padding-bottom: 0.5em;
        border-radius: 5px;
        border: 2px solid transparent;
    }
    a.wp-block-navigation-item__content:hover,
    button.wp-block-navigation-item__content:hover {
        background: #eaf6eb;
        border-color: #abdcaf;
    }
    li.current-menu-item a.wp-block-navigation-item__content,
    button.wp-block-navigation-item__content.current-menu-ancestor {
        background: #eaf6eb;
    }
    .wp-block-navigation-item__label {
        display: block;
        line-height: 1.1;
    }
    .wp-block-navigation .wp-block-navigation__submenu-icon {
        position: relative;
        left: -0.6em;
        background-color: transparent;
    }
    .wp-block-navigation-item.open-on-click {
        padding: 0;
        background-position: center center;
        border-radius: 5px;
    }
    .wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle {
        padding-left: 0.7em;
        padding-right: 1.6em;
    }

    /* Sub-menus (larger screens) */

    .wp-block-navigation .has-child .wp-block-navigation__submenu-container {
        top: calc( 100% + 10px );
        box-shadow: 0 0 10px rgba( 0, 0, 0, 0.05 );
        padding: 5px;
    }
    .wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container {
        border-color: #abdcaf;
        border-radius: 5px;
    }
    .wp-block-navigation-item.open-on-click .wp-block-navigation__submenu-container .wp-block-navigation-submenu__toggle {
        padding-left: 0.5em;
        padding-right: 0.5em;
        margin-right: -5px;
    }
    .wp-block-navigation .has-child .wp-block-navigation__submenu-container a.wp-block-navigation-item__content:hover,
    .wp-block-navigation .has-child .wp-block-navigation__submenu-container button.wp-block-navigation-item__content:hover {
        background: white;
    }
    .wp-block-navigation .has-child .wp-block-navigation__submenu-container li.current-menu-item a.wp-block-navigation-item__content,
    .wp-block-navigation .has-child .wp-block-navigation__submenu-container button.wp-block-navigation-item__content.current-menu-ancestor {
        background: white;
    }

}