/*
Theme Name:   Where Pets Are Welcome
Theme URI:    https://wherepetsarewelcome.uk/
Description:  Where Pets Are Welcome — Child Theme for Divi 5
Author:       Paul James Digital
Author URI:   https://pauljamesdigital.co.uk/
Template:     Divi
Version:      1.0.0
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  wpaw
*/

/* ============================================
   Custom CSS
   Add site-specific overrides below this line.
   The pjd-directory plugin manages its own
   stylesheet — only put theme-level CSS here.
============================================ */


/* ============================================================
   WPAW MEGA MENU
   Brand tokens:
     Navy     #051435   — headings, active states
     Oxblood  #800020   — accent border, hover underlines
     Gold     #C9A84C   — highlights (used sparingly)
     Charcoal #333333   — body text, nav links
   Font: Nunito (loaded by Divi parent theme)
   Breakpoint: 1024px (desktop) / below (mobile)
   ============================================================ */


/* ─── Divi stacking context fix ─────────────────────────
   Divi's Theme Builder header template column sits at
   z-index: 2 in the root stacking context.  The hero
   content row (.et_pb_row_0) sits at z-index: 5 in the
   same root context — so page content was always painted
   above the header, including above our mega panel no
   matter how high its own z-index was set.
   Giving .et-l--header a stacking context at z-index 10
   moves the entire header above the hero in the root
   stacking context, fixing the bleed-through.
   ────────────────────────────────────────────────────── */

.et-l--header {
    position: relative !important;
    z-index: 10 !important;
}

/* ─── Reset ─────────────────────────────────────────────── */

.wpaw-nav,
.wpaw-nav *,
.wpaw-nav *::before,
.wpaw-nav *::after {
    box-sizing: border-box;
}

/* ─── Nav wrapper ───────────────────────────────────────── */

.wpaw-nav {
    position: relative;
    z-index: 1000;
    display: flex !important;
    align-items: center;
    width: 100%;
}

/* ─── Nav links wrapper ─────────────────────────────────── */
/* Contains both menu ULs and is the mobile overlay target. */

.wpaw-nav__links {
    display: flex !important;
    align-items: center;
    flex: 1;
    min-width: 0;
}

/* ─── Top-level menu lists (split either side of the logo) ── */

.wpaw-nav__menu--left,
.wpaw-nav__menu--right {
    display: flex !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 32px;
    align-items: center;
    flex: 1;
}

.wpaw-nav__menu--left {
    justify-content: flex-end;
    padding-right: 80px !important;
}

.wpaw-nav__menu--right {
    justify-content: flex-start;
    padding-left: 80px !important;
}

/* ─── Centred logo ───────────────────────────────────────── */

.wpaw-nav__logo-wrap {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    line-height: 0;
    flex-shrink: 0;
    text-decoration: none;
}

.wpaw-nav__logo-img {
    display: block;
    height: 52px;
    width: auto;
    max-width: 140px;
}

/* ─── Search button ──────────────────────────────────────── */

.wpaw-nav__search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #333333;
    margin-left: 16px;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.wpaw-nav__search-btn:hover,
.wpaw-nav__search-btn:focus {
    color: #051435;
    outline: none;
}

.wpaw-nav__search-btn:focus-visible {
    outline: 2px solid #800020;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ─── Search overlay ─────────────────────────────────────── */

.wpaw-nav__search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    gap: 12px;
}

.wpaw-nav__search-overlay[hidden] {
    display: none !important;
}

.wpaw-nav__search-overlay:not([hidden]) {
    animation: wpaw-search-in 0.15s ease forwards;
}

@keyframes wpaw-search-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.wpaw-nav__search-form {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 640px;
    border-bottom: 2px solid #051435;
    gap: 8px;
}

.wpaw-nav__search-input {
    flex: 1;
    font-family: Nunito, sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #051435;
    background: none;
    border: none;
    padding: 8px 0;
    outline: none;
    min-width: 0;
}

.wpaw-nav__search-input::placeholder {
    color: #aaaaaa;
    font-weight: 400;
}

.wpaw-nav__search-submit {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #051435;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.wpaw-nav__search-submit:hover {
    color: #800020;
}

.wpaw-nav__search-submit:focus-visible {
    outline: 2px solid #800020;
    outline-offset: 2px;
    border-radius: 2px;
}

.wpaw-nav__search-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #333333;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.wpaw-nav__search-close:hover {
    color: #800020;
}

.wpaw-nav__search-close:focus-visible {
    outline: 2px solid #800020;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ─── Standard nav links ────────────────────────────────── */

.wpaw-nav__link {
    font-family: Nunito, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #333333;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.15s ease;
}

.wpaw-nav__link:hover,
.wpaw-nav__link:focus {
    color: #051435;
    text-decoration: none;
}

/* ─── Mega menu trigger button ──────────────────────────── */

.wpaw-nav__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: Nunito, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #333333;
    letter-spacing: 0.02em;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
}

.wpaw-nav__trigger:hover,
.wpaw-nav__trigger:focus {
    color: #051435;
    outline: none;
}

.wpaw-nav__trigger:focus-visible {
    outline: 2px solid #800020;
    outline-offset: 3px;
    border-radius: 2px;
}

.wpaw-nav__chevron {
    width: 12px;
    height: 8px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.wpaw-nav__item--mega[aria-expanded="true"] .wpaw-nav__chevron {
    transform: rotate(180deg);
}

/* ─── Mega panel ────────────────────────────────────────── */

.wpaw-nav__mega {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    max-width: 1400px;
    background: #ffffff;
    border-top: 3px solid #800020;
    box-shadow: 0 8px 32px rgba(5, 20, 53, 0.12);
    z-index: 999999;
}

/* Animate panel open — respects prefers-reduced-motion */
.wpaw-nav__mega:not([hidden]) {
    animation: wpaw-mega-in 0.18s ease forwards;
}

@keyframes wpaw-mega-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wpaw-nav__mega:not([hidden]) {
        animation: none;
    }
}

.wpaw-nav__mega-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 32px 32px;
}

/* ─── Country tabs ──────────────────────────────────────── */

.wpaw-nav__countries {
    display: flex !important;
    list-style: none !important;
    margin: 0 0 0 0 !important;
    padding: 0 !important;
    border-bottom: 2px solid #e8e8e8;
    gap: 0;
}

.wpaw-nav__country-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 10px 20px;
    cursor: pointer;
    font-family: Nunito, sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #666666;
    letter-spacing: 0.03em;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.wpaw-nav__country-tab:hover {
    color: #051435;
}

.wpaw-nav__country-tab--active {
    color: #051435;
    border-bottom-color: #800020;
}

.wpaw-nav__country-tab:focus-visible {
    outline: 2px solid #800020;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ─── Country panels ────────────────────────────────────── */

.wpaw-nav__country-panels {
    padding-top: 24px;
}

.wpaw-nav__country-panel {
    display: none;
}

.wpaw-nav__country-panel--active {
    display: grid !important;
    grid-template-columns: 200px 1fr 240px;
    gap: 0 40px;
    align-items: start;
    min-height: 300px;
}

/* ─── Panel 1: Counties ─────────────────────────────────── */

.wpaw-nav__panel--counties {
    border-right: 1px solid #e8e8e8;
    padding-right: 32px;
}

.wpaw-nav__panel-heading {
    display: block;
    font-family: Nunito, sans-serif;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #333333;
    text-decoration: none;
    margin-bottom: 12px;
}

.wpaw-nav__panel-heading:hover {
    color: #051435;
}

.wpaw-nav__county-list {
    list-style: none !important;
    margin: 0 0 16px 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wpaw-nav__county-link {
    display: block;
    font-family: Nunito, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    text-decoration: none;
    padding: 5px 8px 5px 0;
    border-radius: 3px;
    transition: color 0.12s ease, padding-left 0.12s ease;
}

.wpaw-nav__county-link:hover,
.wpaw-nav__county-link:focus {
    color: #051435;
    padding-left: 6px;
}

.wpaw-nav__county-link--active {
    color: #051435;
    font-weight: 700;
    padding-left: 6px;
}

.wpaw-nav__browse-all {
    display: inline-block;
    font-family: Nunito, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #333333;
    text-decoration: none;
    margin-top: 4px;
}

.wpaw-nav__browse-all:hover {
    color: #051435;
    text-decoration: underline;
}

.wpaw-nav__empty-note {
    font-size: 13px;
    color: #888888;
    margin: 8px 0;
}

/* ─── Panel 2: Areas / Towns ────────────────────────────── */

.wpaw-nav__panel--content {
    border-right: 1px solid #e8e8e8;
    padding-right: 32px;
    min-height: 200px;
}

.wpaw-nav__subheading {
    font-family: Nunito, sans-serif;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #333333;
    margin: 0 0 12px 0;
}

/* Areas view */

.wpaw-nav__area-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-wrap: wrap;
}

.wpaw-nav__area-list li {
    width: 50%;
    margin-bottom: 4px;
    padding-right: 16px;
    box-sizing: border-box;
}

.wpaw-nav__area-list a {
    display: block;
    font-family: Nunito, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.12s ease;
}

.wpaw-nav__area-list a:hover,
.wpaw-nav__area-list a:focus {
    color: #051435;
}

/* Type indicators — small dot prefix per area type */
.wpaw-nav__area-item--national_park > a::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #051435 !important;
    margin-right: 7px;
    vertical-align: middle;
    flex-shrink: 0;
}

.wpaw-nav__area-item--aonb > a::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #800020 !important;
    margin-right: 7px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Scotland National Scenic Areas — same colour as AONBs (designated landscapes) */
.wpaw-nav__area-item--national_scenic_area > a::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #800020 !important;
    margin-right: 7px;
    vertical-align: middle;
    flex-shrink: 0;
}

.wpaw-nav__area-item--region > a::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #C9A84C !important;
    margin-right: 7px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Towns view */

.wpaw-nav__towns-view {
    display: none; /* JS shows/hides via hidden attr + display */
}

.wpaw-nav__towns-view:not([hidden]) {
    display: block;
}

.wpaw-nav__back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 12px;
    cursor: pointer;
    font-family: Nunito, sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #333333;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.12s ease;
}

.wpaw-nav__back-btn:hover {
    color: #051435;
}

.wpaw-nav__back-btn:focus-visible {
    outline: 2px solid #800020;
    outline-offset: 2px;
    border-radius: 2px;
}

.wpaw-nav__county-all {
    display: inline-block;
    font-family: Nunito, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #051435;
    text-decoration: none;
    margin-bottom: 12px;
}

.wpaw-nav__county-all:hover {
    color: #800020;
    text-decoration: underline;
}

.wpaw-nav__town-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    columns: 2;
    column-gap: 24px;
}

.wpaw-nav__town-list li {
    break-inside: avoid;
    margin-bottom: 2px;
}

.wpaw-nav__town-list a {
    display: block;
    font-family: Nunito, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.12s ease;
}

.wpaw-nav__town-list a:hover,
.wpaw-nav__town-list a:focus {
    color: #051435;
}

/* ─── Panel 3: Featured property ────────────────────────── */

.wpaw-nav__panel--featured {
    padding-left: 0;
}

.wpaw-nav__featured-card {
    display: block;
    text-decoration: none;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.wpaw-nav__featured-card:hover {
    box-shadow: 0 4px 16px rgba(5, 20, 53, 0.15);
    transform: translateY(-2px);
}

.wpaw-nav__featured-img {
    display: block;
    width: 100%;
    height: 145px;
    object-fit: cover;
}

.wpaw-nav__featured-name {
    display: block;
    font-family: Nunito, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #051435;
    padding: 10px 12px 4px;
    line-height: 1.3;
}

.wpaw-nav__featured-loc {
    display: block;
    font-family: Nunito, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #666666;
    padding: 0 12px 12px;
}

.wpaw-nav__featured-cta {
    display: block;
    font-family: Nunito, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #333333;
    text-decoration: none;
    margin-top: 8px;
}

.wpaw-nav__featured-cta:hover {
    color: #051435;
    text-decoration: underline;
}

/* ─── Hamburger ─────────────────────────────────────────── */

.wpaw-nav__hamburger {
    display: none; /* shown below 1024px */
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
}

.wpaw-nav__hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #051435;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* × transform when open */
.wpaw-nav--open .wpaw-nav__hamburger span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.wpaw-nav--open .wpaw-nav__hamburger span:nth-child(2) {
    opacity: 0;
}
.wpaw-nav--open .wpaw-nav__hamburger span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.wpaw-nav__hamburger:focus-visible {
    outline: 2px solid #800020;
    outline-offset: 4px;
    border-radius: 2px;
}

/* ─── Body scroll lock (mobile) ─────────────────────────── */

body.wpaw-nav-lock {
    overflow: hidden;
}

/* ─── Mobile overlay ────────────────────────────────────── */

@media (max-width: 1023px) {

    /* Hide desktop mega panel and items when in mobile mode */
    .wpaw-nav__mega,
    .wpaw-nav__item--mega .wpaw-nav__mega {
        display: none !important;
    }

    /* Show hamburger */
    .wpaw-nav__hamburger {
        display: flex;
    }

    /* Hide the nav links wrapper — overlay reveals it */
    .wpaw-nav__links {
        display: none !important;
    }

    /* Mobile overlay: .wpaw-nav__links detached to <body> when open.
       Position:fixed works correctly here because the element is no longer
       inside Divi's header (which has a transform stacking context). */
    .wpaw-nav__links--mobile-open {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #ffffff;
        z-index: 999999;
        padding: 72px 24px 32px;
        overflow-y: auto;
        animation: wpaw-slide-in 0.22s ease;
    }

    /* Both menu lists shown as vertical columns in the overlay */
    .wpaw-nav__links--mobile-open .wpaw-nav__menu--left,
    .wpaw-nav__links--mobile-open .wpaw-nav__menu--right {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
        flex: none !important;
        padding: 0 !important;
        justify-content: flex-start !important;
    }

    @keyframes wpaw-slide-in {
        from { opacity: 0; transform: translateY(-12px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    @media (prefers-reduced-motion: reduce) {
        .wpaw-nav__links--mobile-open {
            animation: none;
        }
    }

    /* Keep hamburger above the overlay */
    .wpaw-nav__hamburger {
        position: relative;
        z-index: 1000000;
    }

    /* Hide logo and search button behind the overlay when open */
    .wpaw-nav--open .wpaw-nav__logo-wrap {
        display: none !important;
    }

    .wpaw-nav--open .wpaw-nav__search-btn {
        display: none !important;
    }

    /* Mobile menu items */
    .wpaw-nav__item {
        border-bottom: 1px solid #f0f0f0;
    }

    .wpaw-nav__link {
        display: block;
        padding: 14px 4px;
        font-size: 17px;
    }

    /* Mobile: trigger acts as accordion toggle */
    .wpaw-nav__trigger {
        width: 100%;
        justify-content: space-between;
        padding: 14px 4px;
        font-size: 17px;
    }

    /* Mobile accordion container for Places to Stay */
    .wpaw-nav__mobile-places {
        display: none;
        padding: 0 0 12px 12px;
    }

    /* Country tabs in mobile accordion */
    .wpaw-nav__countries {
        flex-direction: column !important;
        border-bottom: none;
        gap: 0;
    }

    .wpaw-nav__country-tab {
        text-align: left;
        padding: 10px 8px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 15px;
    }

    .wpaw-nav__country-tab--active {
        border-bottom-color: #f0f0f0;
        color: #800020;
    }

    /* Mobile county list */
    .wpaw-nav__county-list {
        padding: 8px 0 8px 16px !important;
    }

    .wpaw-nav__county-link {
        padding: 6px 0;
        font-size: 14px;
    }

    /* Hide panel 2 (areas/towns) and panel 3 (featured) on mobile */
    .wpaw-nav__panel--content,
    .wpaw-nav__panel--featured {
        display: none !important;
    }

    /* Mobile county panel — hidden by default, shown by JS on country tab click */
    .wpaw-nav__mobile-county-panel {
        display: none;
        padding: 8px 0 8px 12px;
    }

    /* Browse-all link shown in mobile county panel */
    .wpaw-nav__mobile-county-panel .wpaw-nav__browse-all {
        display: inline-block;
        margin-top: 8px;
    }

    /* Hide the desktop browse-all outside the mobile county panel */
    .wpaw-nav__panel--counties .wpaw-nav__browse-all {
        display: none;
    }

    .wpaw-nav__panel-heading {
        display: none;
    }
}

@media (min-width: 1024px) {
    /* Ensure mobile accordion is never visible on desktop */
    .wpaw-nav__mobile-places {
        display: none !important;
    }
}

/* ─── Focus-visible baseline ────────────────────────────── */

.wpaw-nav a:focus-visible,
.wpaw-nav button:focus-visible {
    outline: 2px solid #800020;
    outline-offset: 2px;
    border-radius: 2px;
}
