/**
 * HOTHEAL shared page chrome
 * ==========================
 *
 * The ONE canonical copy of everything every HOTHEAL page has in common:
 * design tokens, the MyListing leak-hiding block, the reset, the sticky
 * header + nav + hamburger, the language switcher, the footer, and the
 * chrome-level RTL rules.
 *
 * Before this file existed each template inlined its own copy. That produced
 * 9 variants of the header CSS, 7 of the :root tokens, 5 of the footer and
 * 8 of the language switcher across 14 files, and every chrome change meant
 * editing 12 templates by hand.
 *
 * Loaded by hotheal_chrome_styles() as a real <link> stylesheet, so the
 * browser caches it once and reuses it on every subsequent page instead of
 * re-downloading ~5 KB of identical inline CSS on each click.
 *
 * WHAT BELONGS HERE:    anything the header, nav, footer or language
 *                       switcher needs, on any page.
 * WHAT DOES NOT:        page-specific styles, and page-specific RTL rules
 *                       (.hh-pcard-*, .hh-search-field-*, .hh-404, .hh-back
 *                       and friends) - those stay in their own template's
 *                       <style> block, which still loads after this file.
 *
 * Page-specific design tokens (--purple on /public-programs/, --green on
 * the LGBTQ+ page, the success and error colours on the auth pages) are
 * also still declared per template; they extend the base set below.
 *
 * CAUTION: never write an asterisk followed by a slash inside these
 * comments. Doing so closes the comment early and the CSS parser then eats
 * the rules that follow - which is exactly how the :root block below got
 * silently dropped on the first deploy of this file, leaving --orange
 * undefined and the header background transparent.
 */

/* ===== DESIGN TOKENS ===== */
:root {
    --orange: #F97316;
    --orange-hover: #EA580C;
    --orange-light: rgba(249,115,22,0.1);
    --bg: #F8FAFC;
    --card: #FFFFFF;
    --text-primary: #32373C;
    --text-secondary: #64748B;
    --text-tertiary: #94A3B8;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --open-bg: #DCFCE7;
    --open-text: #15803D;
    --closed-bg: #FEE2E2;
    --closed-text: #DC2626;
    --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
}

/* ===== HIDE MYLISTING THEME LEAKS =====
   The templates bypass the theme's markup but still call wp_head(), so the
   theme's own header/footer nodes can still be emitted. Hide them all.
   `.c27-site-wrapper` was previously only in single-providers.php. */
.site-header,
.site-footer,
#site-header,
#site-footer,
.header-container,
.footer-container,
.mylisting-header,
.mylisting-footer,
.c27-main-header,
.c27-footer,
.c27-site-wrapper,
.cts-sidebar,
.admin-bar #wpadminbar + .site-header { display: none !important; }

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ===== HEADER ===== */
.hh-header {
    background: var(--orange);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(249,115,22,.25);
}
.hh-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.hh-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.hh-logo img {
    height: 40px;
    width: auto;
    display: block;
}
.hh-logo span { font-weight: 400; opacity: .85; }
.hh-nav { display: flex; align-items: center; gap: 28px; }
.hh-nav a {
    color: rgba(255,255,255,.9);
    font-size: 14px;
    font-weight: 500;
    transition: color .2s;
}
.hh-nav a:hover { color: #fff; }

/* The active nav item. Previously spelled `.hh-nav-active` on donate +
   lgbtq and `.active` on public-programs, with dead copies of the rule in
   register, signin and 404. hotheal_chrome_header() now emits one class. */
.hh-nav a.hh-nav-active {
    color: #fff;
    font-weight: 700;
    border-bottom: 2px solid #fff;
    padding-bottom: 2px;
}

/* MyListing's frontend.css ships `a:focus, a:hover { color: var(--accent) }`
   which scores (0,1,1) and therefore outranks ANY single-class colour rule.
   --accent is #6c1cff live (set by the customizer, not the stylesheet), so
   without this the wordmark turns blue-violet on hover and on keyboard
   focus. Restating at (0,2,0) wins with no !important and no dependence on
   load order. See the README section on theme specificity. */
.hh-logo:hover,
.hh-logo:focus { color: #fff; }

/* ===== HAMBURGER (pure CSS, no JS) ===== */
.hh-hamburger-toggle { display: none; }
.hh-hamburger-label {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 28px;
    height: 28px;
    cursor: pointer;
}
.hh-hamburger-label span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
}
@media (max-width: 768px) {
    .hh-hamburger-label { display: flex; }
    .hh-nav {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--orange);
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height .35s ease;
    }
    .hh-nav a {
        padding: 14px 24px;
        width: 100%;
        border-top: 1px solid rgba(255,255,255,.15);
    }
    .hh-nav a.hh-nav-active { border-bottom: none; }
    /* Must be :has(), NOT the sibling combinator - three templates place
       <nav> before the checkbox, where `~` silently fails. */
    .hh-header-inner:has(.hh-hamburger-toggle:checked) .hh-nav { max-height: 500px; }
    .hh-hamburger-toggle:checked ~ .hh-hamburger-label span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .hh-hamburger-toggle:checked ~ .hh-hamburger-label span:nth-child(2) { opacity: 0; }
    .hh-hamburger-toggle:checked ~ .hh-hamburger-label span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

/* ===== LANGUAGE SWITCHER ===== */
.hh-lang-switch {
    position: relative;
    margin-left: 8px;
}
.hh-lang-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.hh-lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    padding: 8px;
    min-width: 140px;
    z-index: 9999;
}
.hh-lang-switch:focus-within .hh-lang-dropdown,
.hh-lang-switch:hover .hh-lang-dropdown {
    display: block;
}
.hh-lang-option {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #32373C;
    font-weight: 500;
    transition: background 0.2s;
    text-decoration: none;
}
.hh-lang-option:hover {
    background: rgba(249,115,22,0.1);
    color: #F97316;
}
.hh-lang-option.active {
    background: #F97316;
    color: #fff;
}

/* Desktop switcher sits in the header bar; the mobile one lives inside the
   hamburger nav, because the desktop dropdown is hidden under 769px. */
.hh-lang-switch--desktop { display: block; }
.hh-lang-switch--mobile  { display: none; }

@media (max-width: 768px) {
    .hh-lang-switch--desktop { display: none; }
    .hh-lang-switch--mobile {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 14px 24px;
        width: 100%;
        border-top: 1px solid rgba(255,255,255,.15);
        margin-left: 0;
    }
    .hh-lang-switch--mobile .hh-lang-option {
        flex: 1;
        text-align: center;
        padding: 8px 10px;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 600;
        background: rgba(255,255,255,0.15);
        color: rgba(255,255,255,0.9);
    }
    .hh-lang-switch--mobile .hh-lang-option.active {
        background: #fff;
        color: #F97316;
    }
    .hh-lang-switch--mobile .hh-lang-option:hover {
        background: rgba(255,255,255,0.25);
        color: #fff;
    }
    .hh-lang-switch--mobile .hh-lang-option.active:hover {
        background: #fff;
        color: #F97316;
    }
}

/* ===== FOOTER ===== */
.hh-footer {
    background: #1E293B;
    color: rgba(255,255,255,.7);
    padding: 48px 20px 32px;
    text-align: center;
}
.hh-footer-logo {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
}
.hh-footer-logo span { font-weight: 400; opacity: .7; }
.hh-footer-disclaimer {
    font-size: 13px;
    max-width: 540px;
    margin: 0 auto 24px;
    line-height: 1.6;
    color: rgba(255,255,255,.5);
}
.hh-footer-socials {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}
.hh-footer-social {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    color: rgba(255,255,255,.7);
}
.hh-footer-social:hover { background: rgba(255,255,255,.2); color: #fff; }
.hh-footer-copy {
    font-size: 12px;
    color: rgba(255,255,255,.35);
}

/* ===== RTL - CHROME ONLY =====
   Page-level RTL rules stay in their own template. Note that the desktop
   nav override MUST stay scoped to >=769px: the mobile nav is a column, and
   an unscoped rule (higher specificity) breaks it. */
[dir="rtl"] { direction: rtl; text-align: right; }
[dir="rtl"] .hh-header-inner { flex-direction: row-reverse; }
@media (min-width: 769px) { [dir="rtl"] .hh-nav { flex-direction: row-reverse; } }
[dir="rtl"] .hh-footer { direction: rtl; }
[dir="rtl"] .hh-lang-switch { margin-left: 0; margin-right: 8px; }
[dir="rtl"] .hh-lang-dropdown { right: auto; left: 0; }
@media (max-width: 768px) {
    [dir="rtl"] .hh-lang-switch--mobile { margin-right: 0; }
}
