/* ============================================================================
 * header-footer-polish.css
 * Sitewide header + footer UI polish and a UNIFIED header -> content gap.
 * Loaded LAST in head.php so it cleanly overrides the base header/footer rules
 * (which live in layout.css, bundled into app.min.css). Uses the existing
 * brand tokens (--primary-color #f15a23, etc.) so light + dark mode both work.
 * Reversible: delete this file + its <link> to revert.
 * ========================================================================== */

/* ---- 1. Unified gap between the sticky header and the page body ----------- */
/* Previously #content had no top padding, so the gap was just the H1 margin and
 * varied page to page. Standardize a comfortable, identical gap everywhere. */
#content {
    padding-top: 2.25rem;
    padding-bottom: 3rem;
}

/* ---- 2. Header bar: lighter, calmer ------------------------------------- */
header[role="banner"] {
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid var(--color-gray-200, #e9ecef);
    padding: 0.25rem 0;
}
.header-top-row {
    padding: 0.5rem 0;
    gap: 0.5rem 0.75rem;
}

/* ---- 3. Desktop layout: logo left | ...flex gap... | nav · search · toggle.
 * The whole control group is right-aligned (margin-left:auto on the NAV, not
 * the search), so the menu sits flush right with the search/toggle instead of
 * hugging the logo and leaving a dead gap mid-header. ---- */
@media (min-width: 1025px) {
    .header-top-row { justify-content: flex-start; }
    #logo { order: 1; }
    nav#mainNav {
        order: 2;
        flex-grow: 0;
        justify-content: flex-end;
        margin: 0 0 0 auto;
    }
    nav#mainNav ul {
        justify-content: flex-end;
        max-width: none;
        gap: 0.1rem 0.2rem;
    }
    .site-search-wrapper { order: 3; margin-left: 0.75rem; }
    .site-search-input   { width: 190px; }
    .theme-toggle        { order: 4; margin-left: 0.25rem; }
}

/* Mobile: slimmer bar + a logo you can actually see. The bundle scales the
 * logo img down to ~30px tall inside a 90px+ bar — oversized chrome around an
 * undersized brand. Pin the logo at 40px and trim the row padding. The toggle
 * groups next to the hamburger on the right (search is hidden on mobile). */
@media (max-width: 1024px) {
    header[role="banner"] { padding: 0.25rem 0; }
    .header-top-row { padding: 0.4rem 0; }
    #logo img { height: 40px; width: auto; max-height: none; }
    .theme-toggle  { margin-left: auto; }
    /* 44px total (the a11y tap minimum) — the bundle's 8px padding ON TOP of
     * min-height:44px made it 55px tall and stretched the whole bar. */
    .hamburger-menu {
        margin-left: 0.5rem;
        box-sizing: border-box;
        height: 44px;
        padding: 6px 8px;
    }
}

/* ---- 4. Nav links: uniform, subtle - no solid orange fill blocks --------- */
nav#mainNav ul li a {
    padding: 0.45rem 0.7rem;
    color: var(--text-color, #343a40);
    font-weight: 500;
    border-radius: 8px;
    position: relative;
    transition: color .15s ease, background-color .15s ease;
}
nav#mainNav ul li a:hover,
nav#mainNav ul li a:focus {
    background-color: rgba(241, 90, 35, 0.08);
    color: var(--primary-color, #f15a23);
}
/* Active section = brand-colour text with a thin underline accent, not a block */
nav#mainNav ul li a.active-main-link {
    background-color: transparent !important;
    color: var(--primary-color, #f15a23) !important;
    font-weight: 600;
}
@media (min-width: 1025px) {
    nav#mainNav ul li a.active-main-link::before {
        content: "";
        position: absolute;
        left: 0.7rem;
        right: 0.7rem;
        bottom: 0.2rem;
        height: 2px;
        background: var(--primary-color, #f15a23);
        border-radius: 2px;
    }
}

/* ---- 5. Kill the duplicate caret on "Tools" (keep the .mega-caret chevron) */
.mega-nav .mega-trigger::after {
    content: none !important;
    display: none !important;
    border: 0 !important;
}

/* ---- 6. Header tools (search + toggle) vertical rhythm ------------------- */
.site-search-input { height: 40px; }
.theme-toggle { width: 40px; height: 40px; }

/* ---- 7. Footer: turn the heavy stacked card-grid into clean columns ------ */
/* footer.php wraps the 4 groups in .footer-tools-grid > .footer-tools-col. */
.navigation { padding: 2.75rem 0 1.25rem; }
.footer-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem 2rem;
    max-width: var(--max-width, 1200px);
}
.footer-tools-col { min-width: 0; }

/* Small, quiet uppercase group labels instead of big orange-underlined H2s */
.navigation .tool-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted, #6b7280);
    border-bottom: none;
    padding-bottom: 0;
    margin: 0 0 0.6rem;
    display: block;
}
/* Tools become a single clean vertical list of links (no boxes/borders/shadows) */
.footer-tools-col .tool-group {
    display: block;
    grid-template-columns: none;
    gap: 0;
    margin: 0;
}
.navigation .tool-item,
.navigation .tool-item:hover {
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
    border-radius: 0;
}
.navigation .tool-link {
    padding: 0.3rem 0;
    gap: 0.55rem;
    color: var(--text-color, #343a40);
}
.navigation .tool-link:hover { color: var(--primary-color, #f15a23); }
.navigation .tool-icon { font-size: 0.95rem; width: 20px; }
.navigation .tool-text { font-size: 0.88rem; font-weight: 400; }
.navigation .tool-link--view-all {
    margin-top: 0.35rem;
    font-weight: 600;
    color: var(--primary-color, #f15a23);
}
.navigation .tool-link--view-all .tool-text { font-weight: 600; }

/* ---- 8. Responsive footer columns --------------------------------------- */
@media (max-width: 992px) {
    .footer-tools-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}
@media (max-width: 560px) {
    .footer-tools-grid { grid-template-columns: 1fr; }
}

/* ---- 9. Dark mode: keep the polished header/footer coherent ------------- */
html[data-theme="dark"] header[role="banner"] {
    border-bottom-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}
html[data-theme="dark"] nav#mainNav ul li a { color: var(--text-color, #e5e7eb); }
html[data-theme="dark"] nav#mainNav ul li a:hover,
html[data-theme="dark"] nav#mainNav ul li a:focus {
    background-color: rgba(241, 90, 35, 0.16);
}
