/* Xplora Header & Footer v1.7.0
 * Safe standalone layer: Astra's native header/footer remain in the DOM but are hidden while this plugin is active.
 */
body.xplora-hf-active #masthead,
body.xplora-hf-active .site-header:not(.xplora-site-header),
body.xplora-hf-active #colophon,
body.xplora-hf-active .site-footer:not(.xplora-site-footer) {
    display: none !important;
}

/* Astra/third-party styles can override the HTML hidden attribute. */
.xplora-inline-search[hidden],
.xplora-mobile-menu[hidden] {
    display: none !important;
}

:root {
    --xplora-ink: #171816;
    --xplora-paper: #f4f1e9;
    --xplora-paper-2: #faf8f3;
    --xplora-muted: #73756f;
    --xplora-line: rgba(23,24,22,.14);
    --xplora-footer: #171916;
    --xplora-footer-text: #f2f0e9;
    --xplora-footer-muted: #a9aba4;
    --xplora-max: 1320px;
}

.xplora-site-header,
.xplora-site-footer,
.xplora-site-header *,
.xplora-site-footer * {
    box-sizing: border-box;
}

.xplora-site-header,
.xplora-site-footer {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

/* ---------- HEADER ---------- */
.xplora-site-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    width: 100%;
    background: transparent;
    border-bottom: 1px solid transparent;
    color: #fff;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: background-color .26s ease, border-color .26s ease, color .26s ease, box-shadow .26s ease, backdrop-filter .26s ease;
}

.admin-bar .xplora-site-header { top: 32px; }

/* Automatic contrast while the header is transparent.
 * JS samples the visual behind the header and applies one of these states.
 */
.xplora-site-header.xplora-header-on-dark:not(.is-scrolled):not(.is-menu-open) {
    color: #fff;
}

.xplora-site-header.xplora-header-on-light:not(.is-scrolled):not(.is-menu-open) {
    color: var(--xplora-ink);
}

.xplora-site-header.xplora-header-on-light:not(.is-scrolled):not(.is-menu-open) .xplora-icon-button:hover,
.xplora-site-header.xplora-header-on-light:not(.is-scrolled):not(.is-menu-open) .xplora-menu-toggle:hover,
.xplora-site-header.xplora-header-on-light:not(.is-scrolled):not(.is-menu-open) .xplora-search-close:hover {
    background: rgba(23,24,22,.07);
}

.xplora-site-header.is-scrolled {
    background: rgba(10,10,10,.98);
    border-bottom-color: rgba(255,255,255,.10);
    color: #fff;
    box-shadow: 0 4px 18px rgba(0,0,0,.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.xplora-site-header.is-menu-open:not(.is-scrolled) {
    background: rgba(250,248,243,.97);
    border-bottom-color: var(--xplora-line);
    color: var(--xplora-ink);
    box-shadow: 0 4px 18px rgba(23,24,22,.05);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.xplora-header-inner {
    width: min(calc(100% - 64px), var(--xplora-max));
    min-height: 86px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 28px;
    transition: min-height .26s ease;
}

/* Deliberately thinner once the user scrolls. */
.xplora-site-header.is-scrolled .xplora-header-inner {
    min-height: 52px;
}

.xplora-wordmark,
.xplora-desktop-nav a,
.xplora-icon-button,
.xplora-menu-toggle {
    transition: color .26s ease, background-color .2s ease, font-size .26s ease;
}

.xplora-wordmark,
.xplora-footer-wordmark {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-weight: 800;
    letter-spacing: .20em;
    text-transform: uppercase;
    text-decoration: none !important;
}

.xplora-wordmark {
    justify-self: start;
    color: inherit !important;
    font-size: 24px;
    line-height: 1;
}

.xplora-site-header.is-scrolled .xplora-wordmark {
    font-size: 20px;
}

.xplora-desktop-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(24px, 3.1vw, 46px);
}

.xplora-desktop-nav a {
    position: relative;
    color: inherit !important;
    text-decoration: none !important;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: .01em;
    white-space: nowrap;
}

.xplora-desktop-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: -8px;
    height: 1px;
    background: currentColor;
    transition: right .22s ease;
}
.xplora-desktop-nav a:hover::after,
.xplora-desktop-nav a[aria-current="page"]::after { right: 0; }

.xplora-header-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 42px;
}

.xplora-icon-button,
.xplora-menu-toggle,
.xplora-search-close {
    width: 42px;
    height: 42px;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    border-radius: 999px;
}

.xplora-icon-button:hover,
.xplora-menu-toggle:hover,
.xplora-search-close:hover { background: rgba(255,255,255,.14); }

.xplora-site-header.is-scrolled .xplora-icon-button:hover,
.xplora-site-header.is-scrolled .xplora-menu-toggle:hover,
.xplora-site-header.is-scrolled .xplora-search-close:hover { background: rgba(255,255,255,.12); }

.xplora-site-header.is-menu-open:not(.is-scrolled) .xplora-icon-button:hover,
.xplora-site-header.is-menu-open:not(.is-scrolled) .xplora-menu-toggle:hover,
.xplora-site-header.is-menu-open:not(.is-scrolled) .xplora-search-close:hover { background: rgba(23,24,22,.06); }

.xplora-icon-button svg,
.xplora-search-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

/* Optical alignment: the magnifier glyph sits slightly low inside its viewBox. */
.xplora-search-toggle svg {
    transform: translateY(-1.5px);
}

.xplora-menu-toggle { display: none; position: relative; }
.xplora-menu-toggle span {
    position: absolute;
    width: 19px;
    height: 1.5px;
    background: currentColor;
    transition: transform .2s ease, top .2s ease;
}
.xplora-menu-toggle span:first-child { top: 17px; }
.xplora-menu-toggle span:last-child { top: 24px; }
.xplora-menu-toggle[aria-expanded="true"] span:first-child { top: 20.5px; transform: rotate(45deg); }
.xplora-menu-toggle[aria-expanded="true"] span:last-child { top: 20.5px; transform: rotate(-45deg); }

/* Search opens INSIDE the existing header rather than in a panel below it. */
.xplora-inline-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    margin: 0;
    animation: xploraSearchIn .18s ease both;
}

@keyframes xploraSearchIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.xplora-inline-search input[type="search"] {
    width: clamp(190px, 20vw, 300px);
    height: 38px;
    margin: 0;
    padding: 0 13px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 2px;
    outline: 0;
    background: rgba(0,0,0,.10);
    color: #fff;
    font: inherit;
    font-size: 14px;
    line-height: 1;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.xplora-inline-search input[type="search"]::placeholder { color: rgba(255,255,255,.76); }

.xplora-inline-search input[type="search"]:focus {
    border-color: #fff;
    box-shadow: 0 0 0 1px rgba(255,255,255,.30);
}

.xplora-inline-search-submit {
    height: 38px;
    margin: 0;
    padding: 0 17px;
    border: 1px solid #fff;
    border-radius: 2px;
    background: #fff;
    color: var(--xplora-ink);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
}

.xplora-search-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
}


/* When automatic contrast chooses dark header text over a bright image,
 * the in-header search adopts the same dark treatment. */
.xplora-site-header.xplora-header-on-light:not(.is-scrolled):not(.is-menu-open) .xplora-inline-search input[type="search"] {
    border-color: rgba(23,24,22,.52);
    background: rgba(255,255,255,.22);
    color: var(--xplora-ink);
}
.xplora-site-header.xplora-header-on-light:not(.is-scrolled):not(.is-menu-open) .xplora-inline-search input[type="search"]::placeholder {
    color: rgba(23,24,22,.62);
}
.xplora-site-header.xplora-header-on-light:not(.is-scrolled):not(.is-menu-open) .xplora-inline-search input[type="search"]:focus {
    border-color: var(--xplora-ink);
    box-shadow: 0 0 0 1px rgba(23,24,22,.10);
}
.xplora-site-header.xplora-header-on-light:not(.is-scrolled):not(.is-menu-open) .xplora-inline-search-submit {
    border-color: var(--xplora-ink);
    background: var(--xplora-ink);
    color: #fff;
}

/* Search follows the black scrolled header with a white treatment. */
.xplora-site-header.is-scrolled .xplora-inline-search input[type="search"] {
    border-color: rgba(255,255,255,.55);
    background: rgba(255,255,255,.08);
    color: #fff;
}
.xplora-site-header.is-scrolled .xplora-inline-search input[type="search"]::placeholder { color: rgba(255,255,255,.66); }
.xplora-site-header.is-scrolled .xplora-inline-search input[type="search"]:focus {
    border-color: #fff;
    box-shadow: 0 0 0 1px rgba(255,255,255,.18);
}
.xplora-site-header.is-scrolled .xplora-inline-search-submit {
    border-color: #fff;
    background: #fff;
    color: #0a0a0a;
}

/* Opening the mobile menu at the very top keeps the light panel treatment. */
.xplora-site-header.is-menu-open:not(.is-scrolled) .xplora-inline-search input[type="search"] {
    border-color: rgba(23,24,22,.34);
    background: rgba(255,255,255,.55);
    color: var(--xplora-ink);
}
.xplora-site-header.is-menu-open:not(.is-scrolled) .xplora-inline-search input[type="search"]::placeholder { color: rgba(23,24,22,.55); }
.xplora-site-header.is-menu-open:not(.is-scrolled) .xplora-inline-search input[type="search"]:focus {
    border-color: var(--xplora-ink);
    box-shadow: 0 0 0 1px rgba(23,24,22,.08);
}
.xplora-site-header.is-menu-open:not(.is-scrolled) .xplora-inline-search-submit {
    border-color: var(--xplora-ink);
    background: var(--xplora-ink);
    color: #fff;
}

/* Keep the centre navigation stable while search expands on the right. */
.xplora-site-header.is-searching .xplora-search-toggle { display: none !important; }

.xplora-mobile-menu {
    border-top: 1px solid var(--xplora-line);
    background: var(--xplora-paper-2);
    padding: 14px 24px 26px;
}
.xplora-mobile-menu a {
    display: block;
    padding: 16px 4px;
    color: var(--xplora-ink) !important;
    text-decoration: none !important;
    font-size: 19px;
    font-weight: 600;
    border-bottom: 1px solid var(--xplora-line);
}

/* ---------- FOOTER (unchanged from v1.1) ---------- */
.xplora-site-footer {
    width: 100%;
    padding: 76px max(32px, calc((100vw - var(--xplora-max))/2)) 24px;
    background: var(--xplora-footer);
    color: var(--xplora-footer-text);
}
.xplora-footer-main {
    display: grid;
    grid-template-columns: minmax(260px, 1.7fr) repeat(4, minmax(120px, .8fr));
    gap: 52px 34px;
    padding-bottom: 64px;
}
.xplora-footer-wordmark {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--xplora-footer-text) !important;
    font-size: 22px;
}
.xplora-footer-brand p {
    max-width: 380px;
    margin: 0;
    color: var(--xplora-footer-muted);
    font-size: 15px;
    line-height: 1.75;
}
.xplora-footer-column h2 {
    margin: 3px 0 18px;
    color: var(--xplora-footer-text);
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.xplora-footer-column a,
.xplora-footer-legal a {
    color: var(--xplora-footer-muted) !important;
    text-decoration: none !important;
    transition: color .2s ease;
}
.xplora-footer-column a {
    display: block;
    width: fit-content;
    margin: 0 0 11px;
    font-size: 14px;
    line-height: 1.45;
}
.xplora-footer-column a:hover,
.xplora-footer-legal a:hover { color: var(--xplora-footer-text) !important; }

.xplora-footer-bottom {
    border-top: 1px solid rgba(255,255,255,.13);
    padding-top: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: var(--xplora-footer-muted);
    font-size: 12px;
}
.xplora-footer-legal { display: flex; flex-wrap: wrap; gap: 18px; }
.xplora-footer-legal a { font-size: 12px; }

@media (max-width: 1050px) {
    .xplora-footer-main { grid-template-columns: 1.5fr repeat(2, 1fr); }
    .xplora-inline-search input[type="search"] { width: 190px; }
}

@media (max-width: 820px) {
    .admin-bar .xplora-site-header { top: 46px; }

    .xplora-header-inner {
        width: calc(100% - 36px);
        min-height: 76px;
        grid-template-columns: 1fr auto;
        gap: 12px;
    }
    .xplora-site-header.is-scrolled .xplora-header-inner { min-height: 52px; }
    .xplora-desktop-nav { display: none; }
    .xplora-menu-toggle { display: inline-grid; }

    /* On small screens the in-header search gets the available row width. */
    .xplora-site-header.is-searching .xplora-wordmark { display: none; }
    .xplora-site-header.is-searching .xplora-header-inner { grid-template-columns: 1fr; }
    .xplora-site-header.is-searching .xplora-header-actions {
        width: 100%;
        justify-self: stretch;
    }
    .xplora-site-header.is-searching .xplora-inline-search {
        flex: 1;
        min-width: 0;
    }
    .xplora-site-header.is-searching .xplora-inline-search input[type="search"] {
        flex: 1;
        min-width: 0;
        width: auto;
    }
    .xplora-site-header.is-searching .xplora-menu-toggle { display: none; }

    .xplora-site-footer { padding: 58px 24px 22px; }
    .xplora-footer-main { grid-template-columns: 1fr 1fr; gap: 42px 28px; }
    .xplora-footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
    .xplora-wordmark { font-size: 20px; }
    .xplora-header-actions { gap: 5px; }
    .xplora-inline-search { gap: 6px; }
    .xplora-inline-search-submit { padding: 0 12px; font-size: 11px; }
    .xplora-search-close { width: 30px; height: 30px; flex-basis: 30px; }
    .xplora-site-footer { padding-left: 22px; padding-right: 22px; }
    .xplora-footer-main { grid-template-columns: 1fr; }
    .xplora-footer-brand { grid-column: auto; }
    .xplora-footer-bottom { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 782px) {
    body.admin-bar .xplora-site-header { top: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    .xplora-site-header,
    .xplora-site-header *,
    .xplora-inline-search { transition: none !important; animation: none !important; }
}

/* ---------- EDITABLE BRAND IMAGES (v1.7) ---------- */
.xplora-wordmark,
.xplora-footer-wordmark {
    display: inline-flex;
    align-items: center;
}

.xplora-logo-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 210px;
    max-height: 42px;
    object-fit: contain;
}

.xplora-site-header.is-scrolled .xplora-logo-image {
    max-width: 180px;
    max-height: 30px;
}

.xplora-footer-logo-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 230px;
    max-height: 58px;
    object-fit: contain;
}

@media (max-width: 782px) {
    .xplora-logo-image {
        max-width: 170px;
        max-height: 34px;
    }
    .xplora-site-header.is-scrolled .xplora-logo-image {
        max-width: 150px;
        max-height: 28px;
    }
}
