/* ============================================================
   Trimble Header — Bricks element
   ============================================================
   Custom properties (set inline on .trm-header by Header.php):
     --trm-bg              — header background
     --trm-border          — bottom border colour
     --trm-text            — nav text
     --trm-text-hover      — nav hover
     --trm-phone           — phone link colour
     --trm-cta-bg / --trm-cta-bg-hover / --trm-cta-text
     --trm-overlay-bg / --trm-overlay-text / --trm-overlay-accent
     --trm-logo-h          — default logo height
     --trm-logo-h-min      — logo height when shrunk
   ============================================================ */

/* ── Reset shielding ─────────────────────────────────────── */
.trm-header,
.trm-header * {
    box-sizing: border-box;
}

.trm-header ul.trm-header__menu,
.trm-header ul.trm-mobile__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ── Header shell ────────────────────────────────────────── */
.trm-header {
    --trm-pad-y: 18px;
    --trm-pad-y-min: 10px;
    --trm-pad-x: clamp(16px, 4vw, 28px);
    --trm-gap: 22px;

    position: relative;
    background: var(--trm-bg, #FAFAF9);
    color: var(--trm-text, #0F1B2E);
    border-bottom: 1px solid var(--trm-border, #E2E8F0);
    font-family: inherit;
    line-height: 1.45;
    transition: padding 220ms ease, box-shadow 220ms ease;
    z-index: 100;
    width: 100%;
}

/* Use position:fixed (not sticky) so the header escapes any Bricks
   section/container that has overflow:hidden|auto|scroll set on it.
   A body padding-top spacer is added by header.js to compensate. */
.trm-header--shrink,
.trm-header--sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

/* Sit below the WordPress admin bar when logged-in. */
body.admin-bar .trm-header--shrink,
body.admin-bar .trm-header--sticky {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .trm-header--shrink,
    body.admin-bar .trm-header--sticky {
        top: 46px;
    }
}

.trm-header--shrink.is-shrunk,
.trm-header--sticky.is-stuck {
    box-shadow: 0 1px 0 0 rgba(15, 27, 46, 0.05), 0 8px 24px -16px rgba(15, 27, 46, 0.18);
}

/* While header.js applies the initial state on a pre-scrolled page,
   suppress all transitions so the logo / padding / shadow don't animate
   from "full" to "shrunk" on load. The class is removed after two rAFs. */
.trm-header.trm-header--booting,
.trm-header.trm-header--booting *,
.trm-header.trm-header--booting *::before,
.trm-header.trm-header--booting *::after {
    transition: none !important;
    animation: none !important;
}

.trm-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--trm-gap);
    padding: var(--trm-pad-y) var(--trm-pad-x);
    max-width: 1320px;
    margin: 0 auto;
    transition: padding 220ms ease;
}

.trm-header--shrink.is-shrunk .trm-header__inner {
    padding-top: var(--trm-pad-y-min);
    padding-bottom: var(--trm-pad-y-min);
}

/* ── Logo ─────────────────────────────────────────────────── */
.trm-header__logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    line-height: 0;
}

.trm-header__logo img,
.trm-header__logo-svg {
    display: block;
    height: var(--trm-logo-h, 38px);
    width: auto;
    max-width: 100%;
    transition: height 220ms ease;
}

.trm-header--shrink.is-shrunk .trm-header__logo img,
.trm-header--shrink.is-shrunk .trm-header__logo-svg {
    height: var(--trm-logo-h-min, 30px);
}

/* ── Desktop nav ─────────────────────────────────────────── */
.trm-header__nav {
    display: flex;
    align-items: center;
    gap: var(--trm-gap);
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.trm-header__menu {
    display: flex;
    align-items: center;
    gap: 22px;
}

.trm-header__menu-link {
    display: inline-block;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--trm-text, #0F1B2E);
    text-decoration: none;
    padding: 6px 2px;
    transition: color 160ms ease;
}

.trm-header__menu-link:hover,
.trm-header__menu-link:focus-visible {
    color: var(--trm-text-hover, #1E40AF);
}

/* ── Actions: phone + CTA ────────────────────────────────── */
.trm-header__actions {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-left: 14px;
    border-left: 1px solid var(--trm-border, #E2E8F0);
}

.trm-header__phone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--trm-phone, #1E3A8A);
    text-decoration: none;
    transition: opacity 160ms ease;
}

.trm-header__phone:hover {
    opacity: 0.78;
}

.trm-header__phone-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.trm-header__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    background: var(--trm-cta-bg, #1E40AF);
    color: var(--trm-cta-text, #FAFAF9);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 160ms ease, transform 160ms ease;
    white-space: nowrap;
}

.trm-header__cta:hover {
    background: var(--trm-cta-bg-hover, #0F2A6E);
    color: var(--trm-cta-text, #FAFAF9);
}

.trm-header__cta:active {
    transform: translateY(1px);
}

/* ── Hamburger toggle (mobile only) ──────────────────────── */
.trm-header__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--trm-text, #0F1B2E);
    cursor: pointer;
    border-radius: 6px;
    transition: background 160ms ease;
}

.trm-header__toggle:hover,
.trm-header__toggle:focus-visible {
    background: rgba(15, 27, 46, 0.06);
    outline: none;
}

.trm-header__toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 220ms ease, opacity 180ms ease;
}

.trm-header__toggle[aria-expanded="true"] .trm-header__toggle-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.trm-header__toggle[aria-expanded="true"] .trm-header__toggle-bar:nth-child(2) {
    opacity: 0;
}
.trm-header__toggle[aria-expanded="true"] .trm-header__toggle-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ── Mobile full-screen overlay ──────────────────────────── */
.trm-mobile {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--trm-overlay-bg, #1E40AF);
    color: var(--trm-overlay-text, #FAFAF9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.trm-mobile.is-open {
    opacity: 1;
    pointer-events: auto;
}

.trm-mobile[hidden] {
    display: none;
}

.trm-mobile__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 0;
    color: var(--trm-overlay-text, #FAFAF9);
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 160ms ease;
}

.trm-mobile__close:hover,
.trm-mobile__close:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.trm-mobile__close svg {
    width: 24px;
    height: 24px;
}

.trm-mobile__inner {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 80px 28px 32px;
    max-width: 640px;
    margin: 0 auto;
}

.trm-mobile__eyebrow {
    font-size: 11px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--trm-overlay-accent, #BFD4FB);
    margin-bottom: 18px;
}

.trm-mobile__nav {
    flex: 1 1 auto;
}

.trm-mobile__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.trm-mobile__item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.trm-mobile__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 4px;
    color: var(--trm-overlay-text, #FAFAF9);
    text-decoration: none;
    font-size: 22px;
    font-weight: 500;
    line-height: 1.2;
    transition: padding 160ms ease, opacity 160ms ease;
}

.trm-mobile__link:hover,
.trm-mobile__link:focus-visible {
    padding-left: 8px;
    outline: none;
    opacity: 0.92;
}

.trm-mobile__link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.65;
}

.trm-mobile__cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 36px;
}

.trm-mobile__cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 22px;
    background: var(--trm-overlay-text, #FAFAF9);
    color: var(--trm-overlay-bg, #1E40AF);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 160ms ease;
}

.trm-mobile__cta-btn:hover {
    opacity: 0.92;
    color: var(--trm-overlay-bg, #1E40AF);
}

.trm-mobile__phone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    color: var(--trm-overlay-accent, #BFD4FB);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: background 160ms ease;
}

.trm-mobile__phone:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--trm-overlay-text, #FAFAF9);
}

.trm-mobile__phone svg {
    width: 16px;
    height: 16px;
}

/* ── Body lock when mobile menu is open ──────────────────── */
body.trm-no-scroll {
    overflow: hidden;
    touch-action: none;
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .trm-header,
    .trm-header__inner,
    .trm-header__logo img,
    .trm-header__logo-svg,
    .trm-mobile,
    .trm-mobile__link,
    .trm-header__cta,
    .trm-header__toggle-bar {
        transition: none !important;
    }
}
