/* =============================================================
   BioPedia World — Custom Header CSS
   Inspired by EchoesOfYou.com.ng editorial style
   Palette: Terracotta accent (#D06A5B / #b85a4b), 
            near-black text (#111), white bg
   ============================================================= */

:root {
    --bp-green:        #D06A5B;
    --bp-green-dark:   #b85a4b;
    --bp-green-pale:   #fdf1ef;
    --bp-black:        #111111;
    --bp-dark:         #1a1a1a;
    --bp-mid:          #555555;
    --bp-light:        #888888;
    --bp-border:       #e8e8e8;
    --bp-white:        #ffffff;
    --bp-topbar-bg:    #fdf6f5;

    --bp-font-display: 'Playfair Display', Georgia, serif;
    --bp-font-body:    'DM Sans', -apple-system, sans-serif;

    --bp-container:    1200px;
    --bp-radius:       8px;
    --bp-transition:   0.25s cubic-bezier(0.4,0,0.2,1);
    --bp-shadow:       0 2px 20px rgba(0,0,0,0.08);
    --bp-shadow-lg:    0 8px 40px rgba(0,0,0,0.14);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Container ─────────────────────────────────────────────── */
.bp-container {
    width: 100%;
    max-width: var(--bp-container);
    margin: 0 auto;
    padding: 0 24px;
}

/* ══════════════════════════════════════════════════════════════
   TOP BAR
   ══════════════════════════════════════════════════════════════ */
.bp-topbar {
    background: var(--bp-topbar-bg);
    border-bottom: 1px solid var(--bp-border);
    padding: 7px 0;
}

.bp-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bp-topbar-label {
    font-family: var(--bp-font-body);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--bp-green-dark);
    white-space: nowrap;
}

.bp-topbar-tagline {
    font-family: var(--bp-font-body);
    font-size: 12px;
    color: var(--bp-mid);
    flex: 1;
    text-align: center;
}

.bp-topbar-date {
    font-family: var(--bp-font-body);
    font-size: 11px;
    color: var(--bp-light);
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════
   MAIN HEADER ROW (Logo + Actions)
   ══════════════════════════════════════════════════════════════ */
.bp-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bp-white);
    box-shadow: var(--bp-shadow);
    transition: box-shadow var(--bp-transition);
}

.bp-header.bp-scrolled {
    box-shadow: var(--bp-shadow-lg);
}

.bp-header-main {
    padding: 14px 0;
    border-bottom: 1px solid var(--bp-border);
}

.bp-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* ── Logo ───────────────────────────────────────────────────── */
.bp-logo { flex-shrink: 0; }

.bp-logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--bp-black);
    transition: opacity var(--bp-transition);
}
.bp-logo-link:hover { opacity: 0.82; }

.bp-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: var(--bp-green-dark);
    flex-shrink: 0;
}
.bp-logo-icon svg { width: 100%; height: 100%; }

/* WP custom logo */
.bp-logo .custom-logo-link img {
    max-height: 48px;
    width: auto;
    display: block;
}

.bp-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.bp-logo-site-name {
    font-family: var(--bp-font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--bp-black);
    letter-spacing: -0.02em;
}

.bp-logo-tagline {
    font-family: var(--bp-font-body);
    font-size: 10px;
    font-weight: 400;
    color: var(--bp-green-dark);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 3px;
}

/* ── Header Actions (Search + Hamburger) ────────────────────── */
.bp-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bp-search-toggle,
.bp-nav-search-btn,
.bp-search-close,
.bp-mobile-close,
.bp-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 50%;
    transition: background var(--bp-transition), color var(--bp-transition);
    color: var(--bp-dark);
}

.bp-search-toggle svg,
.bp-nav-search-btn svg,
.bp-search-close svg,
.bp-mobile-close svg {
    width: 20px;
    height: 20px;
}

.bp-search-toggle:hover,
.bp-nav-search-btn:hover,
.bp-search-close:hover {
    background: var(--bp-green-pale);
    color: var(--bp-green-dark);
}

/* Hamburger */
.bp-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    gap: 5px;
    padding: 4px;
}
.bp-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--bp-dark);
    border-radius: 2px;
    transition: transform var(--bp-transition), opacity var(--bp-transition), width var(--bp-transition);
    transform-origin: center;
}
.bp-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.bp-hamburger.is-open span:nth-child(2) { opacity: 0; width: 0; }
.bp-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.bp-hamburger:hover span { background: var(--bp-green-dark); }

/* ══════════════════════════════════════════════════════════════
   NAVIGATION BAR
   ══════════════════════════════════════════════════════════════ */
.bp-nav-wrap {
    background: var(--bp-white);
}

.bp-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* ── WP nav menu ────────────────────────────────────────────── */
.bp-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
}

.bp-menu li { position: relative; }

.bp-menu > li > a {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 16px;
    font-family: var(--bp-font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--bp-dark);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: color var(--bp-transition);
    white-space: nowrap;
    position: relative;
}

.bp-menu > li > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 3px;
    background: var(--bp-green);
    border-radius: 3px 3px 0 0;
    transform: scaleX(0);
    transition: transform var(--bp-transition);
}

.bp-menu > li > a:hover,
.bp-menu > li.current-menu-item > a,
.bp-menu > li.current-menu-ancestor > a {
    color: var(--bp-green-dark);
}

.bp-menu > li > a:hover::after,
.bp-menu > li.current-menu-item > a::after,
.bp-menu > li.current-menu-ancestor > a::after {
    transform: scaleX(1);
}

/* ── Dropdown sub-menus ─────────────────────────────────────── */
.bp-menu .sub-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    background: var(--bp-white);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    box-shadow: var(--bp-shadow-lg);
    list-style: none;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--bp-transition), transform var(--bp-transition), visibility var(--bp-transition);
    z-index: 200;
}

.bp-menu li:hover > .sub-menu,
.bp-menu li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bp-menu .sub-menu li a {
    display: block;
    padding: 10px 18px;
    font-family: var(--bp-font-body);
    font-size: 13px;
    font-weight: 400;
    color: var(--bp-dark);
    text-decoration: none;
    transition: background var(--bp-transition), color var(--bp-transition), padding var(--bp-transition);
    border-left: 3px solid transparent;
}
.bp-menu .sub-menu li a:hover {
    background: var(--bp-green-pale);
    color: var(--bp-green-dark);
    border-left-color: var(--bp-green);
    padding-left: 22px;
}

/* Dropdown arrow indicator */
.bp-menu > li.menu-item-has-children > a::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    margin-left: 4px;
    opacity: 0.6;
    order: 1;
}

/* Nav search button on right */
.bp-nav-search-wrap {
    display: flex;
    align-items: center;
    padding: 8px 0;
}

/* ══════════════════════════════════════════════════════════════
   SEARCH BAR — fixed position so it always appears directly
   below the sticky header regardless of scroll position.
   JS sets top = header.getBoundingClientRect().bottom on open.
   ══════════════════════════════════════════════════════════════ */
.bp-search-bar {
    position: fixed;
    left: 0;
    right: 0;
    top: 0; /* overridden by JS to header bottom position */
    z-index: 998; /* below header (1000), above content */
    background: var(--bp-green-pale);
    border-bottom: 1px solid var(--bp-border);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1),
                opacity    0.25s ease,
                padding    0.25s ease;
}

.bp-search-bar.is-open {
    max-height: 90px;
    opacity: 1;
    padding: 14px 0;
}

.bp-search-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* WP search form overrides */
.bp-search-bar .search-form {
    flex: 1;
    display: flex;
    gap: 0;
    border: 2px solid var(--bp-green);
    border-radius: 30px;
    overflow: hidden;
    background: var(--bp-white);
}

.bp-search-bar .search-field {
    flex: 1;
    padding: 10px 18px;
    font-family: var(--bp-font-body);
    font-size: 14px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--bp-dark);
}

.bp-search-bar .search-submit {
    padding: 10px 20px;
    background: var(--bp-green);
    color: var(--bp-white);
    border: none;
    font-family: var(--bp-font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--bp-transition);
    white-space: nowrap;
}
.bp-search-bar .search-submit:hover { background: var(--bp-green-dark); }

.bp-search-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    color: var(--bp-mid);
}

/* ══════════════════════════════════════════════════════════════
   HEADER SPACER (compensates for sticky height)
   ══════════════════════════════════════════════════════════════ */
.bp-header-spacer { display: none; } /* JS sets height */

/* ══════════════════════════════════════════════════════════════
   MOBILE OVERLAY PANEL
   ══════════════════════════════════════════════════════════════ */
.bp-mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--bp-transition), visibility var(--bp-transition);
    /* Backdrop drawn as pseudo-element so it never blocks panel clicks */
}

.bp-mobile-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(17,17,17,0.55);
    backdrop-filter: blur(3px);
    pointer-events: none; /* let clicks pass through to JS overlay handler */
}

.bp-mobile-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.bp-mobile-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: min(340px, 90vw);
    height: 100%;
    background: var(--bp-white);
    padding: 28px 24px 40px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    gap: 28px;
    z-index: 2; /* sits above the ::before backdrop */
}

.bp-mobile-overlay.is-open .bp-mobile-panel {
    transform: translateX(0);
}

.bp-mobile-close {
    align-self: flex-end;
    width: 36px;
    height: 36px;
    color: var(--bp-mid);
    margin-bottom: -12px;
}
.bp-mobile-close svg { width: 22px; height: 22px; }

/* Mobile logo */
.bp-mobile-logo .custom-logo-link img,
.bp-mobile-logo img { max-height: 44px; width: auto; }

.bp-mobile-logo-text {
    font-family: var(--bp-font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--bp-black);
    text-decoration: none;
}

/* Mobile menu */
.bp-mobile-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.bp-mobile-menu li a {
    display: block;
    padding: 13px 0;
    font-family: var(--bp-font-body);
    font-size: 15px;
    font-weight: 500;
    color: var(--bp-dark);
    text-decoration: none;
    border-bottom: 1px solid var(--bp-border);
    transition: color var(--bp-transition), padding-left var(--bp-transition);
}
.bp-mobile-menu li a:hover {
    color: var(--bp-green-dark);
    padding-left: 6px;
}

.bp-mobile-menu .current-menu-item > a {
    color: var(--bp-green-dark);
    border-left: 3px solid var(--bp-green);
    padding-left: 10px;
}

/* Mobile sub-menu */
.bp-mobile-menu .sub-menu {
    list-style: none;
    padding-left: 14px;
    border-left: 2px solid var(--bp-green-pale);
    margin-left: 8px;
}

/* Chevron toggle button injected by JS next to parent anchors */
.bp-chevron-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--bp-mid);
    vertical-align: middle;
    flex-shrink: 0;
    transition: background var(--bp-transition), color var(--bp-transition);
    padding: 0;
    margin-left: 4px;
}
.bp-chevron-btn svg {
    transition: transform 0.28s ease;
    display: block;
}
.bp-chevron-btn:hover {
    background: var(--bp-green-pale);
    color: var(--bp-green-dark);
}
.bp-chevron-btn.bp-open svg {
    transform: rotate(180deg);
}
.bp-chevron-btn.bp-open {
    color: var(--bp-green-dark);
}

/* Make the li a flex row so anchor + chevron sit inline */
.bp-mobile-menu .menu-item-has-children {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    border-bottom: 1px solid var(--bp-border);
}
.bp-mobile-menu .menu-item-has-children > a {
    flex: 1;
    border-bottom: none !important;
    padding-right: 4px;
}
/* The sub-menu takes full width below the link row */
.bp-mobile-menu .menu-item-has-children > .sub-menu {
    width: 100%;
    flex-basis: 100%;
}

/* Mobile search */
.bp-mobile-search .search-form {
    display: flex;
    border: 2px solid var(--bp-green);
    border-radius: 30px;
    overflow: hidden;
}
.bp-mobile-search .search-field {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    border: none;
    outline: none;
    font-family: var(--bp-font-body);
}
.bp-mobile-search .search-submit {
    padding: 10px 16px;
    background: var(--bp-green);
    color: var(--bp-white);
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: background var(--bp-transition);
}
.bp-mobile-search .search-submit:hover { background: var(--bp-green-dark); }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
    .bp-menu > li > a { padding: 16px 12px; font-size: 13px; }
}

/* Mobile: hide desktop nav, show hamburger */
@media (max-width: 768px) {
    .bp-topbar-tagline { display: none; }
    .bp-topbar-date    { display: none; }

    .bp-nav-wrap    { display: none; }
    .bp-search-toggle { display: none; }
    .bp-hamburger   { display: flex; }

    .bp-logo-site-name { font-size: 19px; }
}

@media (max-width: 480px) {
    .bp-container { padding: 0 16px; }
    .bp-topbar-label { font-size: 9px; }
    .bp-logo-site-name { font-size: 17px; }
}

/* ══════════════════════════════════════════════════════════════
   ACCESSIBILITY: focus styles
   ══════════════════════════════════════════════════════════════ */
.bp-menu a:focus-visible,
.bp-hamburger:focus-visible,
.bp-search-toggle:focus-visible,
.bp-nav-search-btn:focus-visible {
    outline: 2px solid var(--bp-green);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════════
   ADMIN BAR COMPENSATION
   ══════════════════════════════════════════════════════════════ */
.admin-bar .bp-header { top: 32px; }
@media screen and (max-width: 782px) {
    .admin-bar .bp-header { top: 46px; }
}
