/* =====================================================================
   Mobile-first responsive foundation
   Breakpoints: mobile < 768px | tablet 768–1024px | desktop > 1024px
   ===================================================================== */

/* ---- Reset & box model ------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-size: 1rem; /* 16px minimum for readable body text */
    line-height: 1.6;
    overflow-x: hidden; /* guard against accidental horizontal scroll */
}

/* ---- Fluid media -------------------------------------------------- */
img,
video,
iframe,
embed,
object,
svg {
    max-width: 100%;
    height: auto;
}

/* WordPress alignment/embed safety */
.wp-block-embed,
.wp-block-image img,
figure {
    max-width: 100%;
}

/* ---- Fluid container --------------------------------------------- */
.container,
#primary,
#masthead .site-header__inner,
.site-footer__inner {
    width: 100%;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;  /* 16px */
    padding-right: 1rem;
}

@media (min-width: 768px) {
    .container,
    #primary,
    #masthead .site-header__inner,
    .site-footer__inner {
        padding-left: 1.25rem; /* 20px */
        padding-right: 1.25rem;
    }
}

/* ---- Responsive typography scale --------------------------------- */
h1 {
    font-size: clamp(1.75rem, 4vw + 1rem, 2.5rem);
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.5rem, 3vw + 0.75rem, 2rem);
    line-height: 1.25;
}

h3 {
    font-size: clamp(1.25rem, 2vw + 0.6rem, 1.5rem);
    line-height: 1.3;
}

p,
li {
    font-size: 1rem;
}

/* ---- Accessible touch targets ------------------------------------ */
a.button,
button,
input[type="submit"],
input[type="button"],
.menu-toggle,
.main-navigation a {
    min-height: 44px;
}

input,
textarea,
select {
    min-height: 44px;
    font-size: 1rem; /* prevents iOS zoom-on-focus */
    max-width: 100%;
}

/* ---- Screen-reader helper ---------------------------------------- */
.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    padding: 0.75rem 1rem;
    background: #fff;
    color: #111;
}

.skip-link:focus {
    left: 0;
}

/* =====================================================================
   Site header & responsive navigation
   ===================================================================== */
#masthead {
    border-bottom: 1px solid #e2e2e2;
    background: #fff;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.site-branding {
    margin: 0;
    font-size: 1.25rem;
}

.site-branding a {
    text-decoration: none;
    color: inherit;
}

/* Hamburger button (visible on mobile only) */
.menu-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.menu-toggle__bar {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Backdrop behind the slide-out menu */
.menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 90;
}

/* ---- Mobile navigation (< 768px): slide-out drawer --------------- */
@media (max-width: 767.98px) {
    .main-navigation .primary-menu {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(80vw, 320px);
        margin: 0;
        padding: 4.5rem 1.25rem 1.5rem;
        list-style: none;
        background: #fff;
        box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
        transform: translateX(100%);
        transition: transform 0.28s ease;
        overflow-y: auto;
        z-index: 100;
    }

    .main-navigation .primary-menu li {
        margin: 0;
    }

    .main-navigation .primary-menu a {
        display: flex;
        align-items: center;
        padding: 0.75rem 0;
        border-bottom: 1px solid #eee;
        text-decoration: none;
        color: inherit;
    }

    /* Open state */
    body.menu-open {
        overflow: hidden; /* lock background scroll */
    }

    body.menu-open .main-navigation .primary-menu {
        transform: translateX(0);
    }

    body.menu-open .menu-backdrop {
        opacity: 1;
        visibility: visible;
    }
}

/* ---- Desktop / tablet navigation (>= 768px): horizontal ---------- */
@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }

    .menu-backdrop {
        display: none;
    }

    .main-navigation .primary-menu {
        display: flex;
        align-items: center;
        gap: 1.5rem;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .main-navigation .primary-menu a {
        display: inline-flex;
        align-items: center;
        text-decoration: none;
        color: inherit;
    }

    .main-navigation .primary-menu a:hover {
        text-decoration: underline;
    }
}

/* =====================================================================
   Content sections — stack on mobile, full width with padding
   ===================================================================== */
#primary {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

#primary article + article {
    margin-top: 1.5rem;
}

/* Generic responsive section helper used by page templates */
.section {
    padding: 1.5rem 0;
}

@media (min-width: 768px) {
    .section {
        padding: 2.5rem 0;
    }
}

/* =====================================================================
   Site footer
   ===================================================================== */
.site-footer {
    margin-top: 2rem;
    padding: 1.5rem 0;
    border-top: 1px solid #e2e2e2;
    background: #f7f7f7;
}

.site-footer__inner {
    text-align: center;
}

.site-footer p {
    margin: 0;
}

/* =====================================================================
   US-002 — Touch & small-screen optimisation
   Forms, click-to-call, single-column cards, mobile dropdowns, sticky CTA
   ===================================================================== */

/* ---- Header click-to-call --------------------------------------- */
.site-header__call {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    margin-left: auto;
    padding: 0 0.6rem;
    border-radius: 6px;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.site-header__call:hover,
.site-header__call:focus {
    text-decoration: underline;
}

.site-header__call-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
}

.site-header__call-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* On the smallest screens the digits can crowd the bar — keep the icon
   tappable and hide the number text (still reachable via aria-label). */
@media (max-width: 400px) {
    .site-header__call-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
}

/* ---- Reusable responsive card grid (mobile-first: one column) ---- */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

.card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.4rem;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card__title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    line-height: 1.3;
}

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

.card__title a:hover,
.card__title a:focus {
    text-decoration: underline;
}

.card__excerpt {
    margin: 0;
    color: #444;
}

/* ---- Touch-friendly forms --------------------------------------- */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.1rem;
}

.form-field label {
    font-weight: 600;
}

.form-field .required-mark {
    color: #b3261e;
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.75rem;
    border: 1px solid #b9b9b9;
    border-radius: 6px;
    font-size: 1rem; /* 16px — avoids iOS zoom-on-focus */
    font-family: inherit;
    line-height: 1.4;
    background: #fff;
    color: #111;
}

.form-field textarea {
    min-height: 120px;
    resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 1px;
    border-color: #1a73e8;
}

.form-field input[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
    border-color: #b3261e;
}

.form-error {
    min-height: 1em;
    color: #b3261e;
    font-size: 0.85rem;
}

/* Honeypot — hidden from humans, present for bots */
.form-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Buttons sized for thumbs */
.button,
a.button,
.form-submit button,
button[type="submit"],
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.7rem 1.4rem;
    border: 0;
    border-radius: 6px;
    background: #1a73e8;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.button--secondary,
a.button--secondary {
    background: transparent;
    color: #1a73e8;
    border: 2px solid #1a73e8;
}

.button:hover,
a.button:hover,
button[type="submit"]:hover,
input[type="submit"]:hover {
    filter: brightness(0.95);
}

/* On mobile the primary submit goes full width for an easy target */
@media (max-width: 767.98px) {
    .form-submit button,
    .form-submit input[type="submit"] {
        width: 100%;
    }
}

/* ---- Contact / inquiry section ---------------------------------- */
.contact-section {
    padding: 2rem 0;
    border-top: 1px solid #e2e2e2;
    background: #fff;
}

.contact-section__inner {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1rem;
}

.contact-section__title {
    margin-top: 0;
    text-align: center;
}

.contact-section__lead {
    margin: 0 0 1.5rem;
    text-align: center;
    color: #444;
}

.contact-callout {
    margin: 0 0 1.5rem;
    text-align: center;
}

.contact-callout a {
    font-weight: 700;
    color: #1a73e8;
}

.form-notice {
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
}

.form-notice--success {
    background: #e6f4ea;
    border: 1px solid #b7dfc1;
    color: #1e7e34;
}

.form-notice--error {
    background: #fce8e6;
    border: 1px solid #f3c1bd;
    color: #b3261e;
}

/* ---- Mobile dropdown / submenu support -------------------------- */
.submenu-toggle {
    display: none;
}

@media (max-width: 767.98px) {
    .main-navigation .sub-menu {
        list-style: none;
        margin: 0;
        padding: 0 0 0 1rem;
    }

    /* JS-enhanced: collapse submenus, reveal on toggle */
    .js .main-navigation .menu-item-has-children > .sub-menu {
        display: none;
    }

    .js .main-navigation .menu-item-has-children.is-open > .sub-menu {
        display: block;
    }

    .js .main-navigation .menu-item-has-children {
        position: relative;
    }

    .submenu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0;
        right: 0;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        background: transparent;
        color: inherit;
        font-size: 1.1rem;
        line-height: 1;
        cursor: pointer;
    }

    .submenu-toggle::before {
        content: "\25BE"; /* ▾ */
        transition: transform 0.2s ease;
    }

    .menu-item-has-children.is-open > .submenu-toggle::before {
        transform: rotate(180deg);
    }
}

/* ---- Sticky mobile call-to-action bar --------------------------- */
.mobile-cta-bar {
    display: none;
}

@media (max-width: 767.98px) {
    .mobile-cta-bar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 80;
        gap: 1px;
        background: #d9d9d9;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.12);
        transition: transform 0.25s ease;
    }

    .mobile-cta-bar.is-hidden {
        transform: translateY(100%);
    }

    .mobile-cta-bar__action {
        flex: 1 1 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        min-height: 52px;
        padding: 0.5rem;
        background: #fff;
        color: #1a73e8;
        font-weight: 600;
        text-decoration: none;
    }

    .mobile-cta-bar__action--primary {
        background: #1a73e8;
        color: #fff;
    }

    .mobile-cta-bar__icon {
        display: inline-flex;
        width: 18px;
        height: 18px;
    }

    .mobile-cta-bar__icon svg {
        width: 100%;
        height: 100%;
        fill: currentColor;
    }

    /* Keep page content clear of the fixed bar */
    body {
        padding-bottom: 52px;
    }
}
