/* =========================================================
   Site header — hand-coded replacement for the Elementor
   header template (id 5683) and its now-inactive RomeTheme
   "Nav Menu" (rtm-navmenu) widget. See header.php header
   comment for why this fully replaces the Elementor location
   instead of running alongside it.
   ========================================================= */

:root {
    --hec-header-bg: #ffffff;
    --hec-header-text: #101010;
    --hec-header-accent: #A502A8;
    --hec-header-border: #eeeeee;
    --hec-mobile-nav-bg: #101010;
    --hec-mobile-nav-text: #ffffff;
    --hec-mobile-nav-border: rgba(255, 255, 255, 0.12);
}

.hec-site-header {
    background-color: var(--hec-header-bg) !important;
    border-bottom: 1px solid var(--hec-header-border);
    position: relative;
    z-index: 9999;
}

/* Standard WordPress core accessibility helper - header.php's
   "Skip to content" link (every page, via get_header()) depends on
   this class. header.css is the only stylesheet enqueued
   unconditionally on every single template (front-page.css, which
   used to be the only place this was defined, isn't loaded on single
   blog posts at all - the skip link was rendering as fully visible
   plain text there). The :focus rule is what actually makes a skip
   link satisfy WCAG 2.4.1/Lighthouse's "skip link is focusable" audit -
   without it the link is technically reachable by Tab but stays
   invisible while focused, which doesn't count as usable. */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}
.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: #21759b;
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

.hec-site-header__inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0.75em 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.hec-site-header__logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.hec-site-header__logo img {
    display: block;
    height: 42px;
    width: auto;
}

/* ---------- Nav menu ---------- */
.hec-nav {
    flex-grow: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    /* Small optical nudge - geometric centering against the logo image
       reads slightly low since the logo's own visual weight sits
       higher in its box than its true vertical center (usability
       audit). Revisit this offset if the logo asset is ever
       re-exported (see the tagline/transparency fixes above). */
    margin-top: -2px;
}

.hec-menu,
.hec-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.hec-menu {
    gap: 28px;
}

.hec-menu > li {
    position: relative;
}

.hec-menu a {
    display: block;
    padding: 0.5em 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--hec-header-text) !important;
    text-decoration: none;
    transition: color 0.2s ease;
}
.hec-menu a:hover,
.hec-menu a:focus-visible,
.hec-menu li.current-menu-item > a,
.hec-menu li.current-menu-ancestor > a {
    color: var(--hec-header-accent);
}

/* Dropdown (Services > CCTV Solutions, About > FAQ / Privacy Policy) */
.hec-menu li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
}

.hec-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background-color: var(--hec-header-bg);
    border: 1px solid var(--hec-header-border);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}
.hec-menu li.menu-item-has-children:hover > .sub-menu,
.hec-menu li.menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.hec-menu .sub-menu a {
    padding: 0.6em 0.9em;
    border-radius: 4px;
}
.hec-menu .sub-menu a:hover {
    background-color: #fdf5ff;
}
.hec-menu .sub-menu li.menu-item-has-children > a::after {
    transform: rotate(-45deg) translateY(0);
}

/* ---------- Contact CTA button ---------- */
.hec-nav-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.55em 1.4em;
    background-color: var(--hec-header-accent);
    color: #ffffff !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 999px;
    transition: background-color 0.2s ease;
}
.hec-nav-cta:hover,
.hec-nav-cta:focus-visible {
    background-color: #7a0180;
    color: #ffffff !important;
}

/* ---------- Hamburger (mobile only) ---------- */
/* Explicit resets below (not just `background:none`/`border:none`) because
   this is a real <button> element and the theme's global Elementor kit
   button style (solid purple pill - the same one "Get Started" uses)
   was winning on specificity/order and rendering the hamburger as a
   filled purple pill with no visible bars. */
.hec-hamburger {
    display: none !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    min-width: 0;
    margin: 0;
    padding: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}
.hec-hamburger:hover,
.hec-hamburger:focus-visible {
    background-color: rgba(165, 2, 168, 0.08) !important;
}
.hec-hamburger:active {
    background-color: rgba(165, 2, 168, 0.16) !important;
}
.hec-hamburger:focus-visible {
    outline: 2px solid var(--hec-header-accent);
    outline-offset: 2px;
}
.hec-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--hec-header-text) !important;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}
.hec-hamburger:hover span,
.hec-hamburger:active span,
.hec-hamburger[aria-expanded="true"]:hover span,
.hec-hamburger[aria-expanded="true"]:active span {
    background-color: var(--hec-header-accent) !important;
}
.hec-hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hec-hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.hec-hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 992px) {
    /* nav is position:absolute on mobile (see .hec-nav below) and drops
       out of the header row's flex flow, leaving logo/CTA/hamburger as
       the row's only remaining items - order puts the CTA between them
       regardless of its actual DOM position (it's a sibling straight
       after </nav> in header.php, not inside the mobile menu itself). */
    .hec-nav-cta {
        order: 1;
        padding: 0.5em 1em;
        font-size: 0.85rem;
    }

    .hec-hamburger {
        order: 2;
        display: flex !important;
    }

    /* Open mobile panel gets its own solid dark background + white text -
       it was previously inheriting the light header's colors/background,
       which made links unreadable once opened. */
    .hec-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--hec-mobile-nav-bg);
        border-bottom: 1px solid var(--hec-mobile-nav-border);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease;
    }
    .hec-nav.is-open {
        max-height: 80vh;
        overflow-y: auto;
    }

    .hec-menu,
    .hec-menu ul {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .hec-menu {
        gap: 0;
        padding: 8px 20px 16px;
    }
    .hec-menu a {
        padding: 0.75em 0;
        border-bottom: 1px solid var(--hec-mobile-nav-border);
        color: var(--hec-mobile-nav-text) !important;
    }
    .hec-menu a:hover,
    .hec-menu a:focus-visible,
    .hec-menu li.current-menu-item > a,
    .hec-menu li.current-menu-ancestor > a {
        color: var(--hec-header-accent) !important;
    }
    .hec-menu .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0 0 0 1em;
        display: none;
        background-color: transparent;
    }
    .hec-menu .sub-menu a {
        border-bottom-color: var(--hec-mobile-nav-border);
    }
    .hec-menu .sub-menu a:hover {
        background-color: rgba(255, 255, 255, 0.06);
    }
    .hec-menu li.menu-item-has-children.is-open > .sub-menu {
        display: flex;
    }
    .hec-menu li.menu-item-has-children > a::after {
        margin-left: auto;
    }

    /* Hamburger bars: switch to white to match the (now dark) header
       once the panel is open, so they stay visible against it. */
    .hec-hamburger[aria-expanded="true"] span {
        background-color: var(--hec-mobile-nav-text);
    }
}
