/* =========================================================================
   GCC Foundation Theme — Main Stylesheet
   ========================================================================= */

/* ── Custom Properties ─────────────────────────────────────────────────── */

:root {
    --gcc-header-height: 80px;   /* updated at runtime by main.js */
    --gcc-header-bg: #ffffff;
    --gcc-header-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --gcc-header-z: 1000;

    --gcc-color-primary:   #1a3a5c;
    --gcc-color-accent:    #e8a020;
    --gcc-color-text:      #222222;
    --gcc-color-text-muted:#666666;
    --gcc-color-bg:        #ffffff;
    --gcc-color-border:    #e0e0e0;

    --gcc-container-max:   1200px;
    --gcc-container-pad:   clamp(1rem, 4vw, 2rem);

    --gcc-transition:      0.25s ease;
}

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

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

html {
    scroll-behavior: smooth;
    /* Offset anchor links so the fixed header doesn't cover them */
    scroll-padding-top: calc(var(--gcc-header-height) + var(--wp-admin-bar-height, 0px) + 1rem);
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--gcc-color-text);
    background: var(--gcc-color-bg);
}

img,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--gcc-color-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

a:hover,
a:focus {
    color: var(--gcc-color-accent);
}

/* ── Fixed Header ──────────────────────────────────────────────────────── */

.gcc-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--gcc-header-z);
    background: var(--gcc-header-bg);
    box-shadow: var(--gcc-header-shadow);
    transition: box-shadow var(--gcc-transition);

    /*
     * When the WordPress admin bar is present it sits above everything.
     * WordPress adds `margin-top` to #wpadminbar but we need our header
     * to start below it.
     */
    top: var(--wp-admin-bar-height, 0px);
}

.gcc-header.is-scrolled {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
}

.gcc-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--gcc-container-max);
    margin: 0 auto;
    padding: 0 var(--gcc-container-pad);
    height: var(--gcc-header-height);
}

/*
 * Header spacer — height is kept equal to --gcc-header-height via JS
 * so that content below the fixed header is never obscured.
 */
.gcc-header-spacer {
    height: calc(var(--gcc-header-height) + var(--wp-admin-bar-height, 0px));
    flex-shrink: 0;
}

/* ── Brand / Logo ──────────────────────────────────────────────────────── */

.gcc-header__brand a,
.gcc-header__site-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gcc-color-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.gcc-header__brand img {
    height: 48px;
    width: auto;
}

/* ── Primary Navigation ────────────────────────────────────────────────── */

.gcc-nav__list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}

.gcc-nav__list a {
    display: block;
    padding: 0.5rem 0.875rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gcc-color-text);
    text-decoration: none;
    border-radius: 4px;
    transition: background var(--gcc-transition), color var(--gcc-transition);
}

.gcc-nav__list a:hover,
.gcc-nav__list .current-menu-item > a,
.gcc-nav__list .current_page_item > a {
    background: rgba(26, 58, 92, 0.08);
    color: var(--gcc-color-primary);
}

/* Dropdown menus */
.gcc-nav__list .menu-item-has-children {
    position: relative;
}

.gcc-nav__list .menu-item-has-children > .sub-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--gcc-color-border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    list-style: none;
    padding: 0.5rem 0;
    z-index: calc(var(--gcc-header-z) + 1);
}

.gcc-nav__list .menu-item-has-children:hover > .sub-menu,
.gcc-nav__list .menu-item-has-children:focus-within > .sub-menu {
    display: block;
}

.gcc-nav__list .sub-menu a {
    border-radius: 0;
    padding: 0.5rem 1rem;
}

/* ── Mobile Nav Toggle ─────────────────────────────────────────────────── */

.gcc-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.gcc-nav-toggle__bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--gcc-color-primary);
    border-radius: 2px;
    transition: transform var(--gcc-transition), opacity var(--gcc-transition);
}

.gcc-nav-toggle[aria-expanded="true"] .gcc-nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.gcc-nav-toggle[aria-expanded="true"] .gcc-nav-toggle__bar:nth-child(2) {
    opacity: 0;
}
.gcc-nav-toggle[aria-expanded="true"] .gcc-nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .gcc-nav-toggle {
        display: flex;
    }

    .gcc-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--gcc-header-bg);
        border-top: 1px solid var(--gcc-color-border);
        padding: 1rem var(--gcc-container-pad);
        box-shadow: var(--gcc-header-shadow);
    }

    .gcc-nav.is-open {
        display: block;
    }

    .gcc-nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .gcc-nav__list a {
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid var(--gcc-color-border);
    }

    .gcc-nav__list .menu-item-has-children > .sub-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding-left: 1rem;
        display: block;
    }
}

/* ── Main Content Area ─────────────────────────────────────────────────── */

.gcc-main {
    min-height: 60vh;
}

/* ── Container ─────────────────────────────────────────────────────────── */

.gcc-container {
    max-width: var(--gcc-container-max);
    margin: 0 auto;
    padding: 3rem var(--gcc-container-pad);
}

.gcc-container--full {
    max-width: 100%;
}

/* ── Entry / Page Content ──────────────────────────────────────────────── */

.gcc-entry__title {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 700;
    color: var(--gcc-color-primary);
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.gcc-entry__content {
    max-width: 72ch;
}

.gcc-entry__content > * + * {
    margin-top: 1.25em;
}

.gcc-entry__content h2,
.gcc-entry__content h3,
.gcc-entry__content h4 {
    color: var(--gcc-color-primary);
    line-height: 1.25;
    margin-top: 2em;
    margin-bottom: 0.5em;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.gcc-footer {
    background: var(--gcc-color-primary);
    color: rgba(255, 255, 255, 0.85);
    padding: 3rem 0 2rem;
}

.gcc-footer__inner {
    max-width: var(--gcc-container-max);
    margin: 0 auto;
    padding: 0 var(--gcc-container-pad);
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: flex-start;
}

.gcc-footer__site-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.gcc-footer__tagline {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
}

.gcc-footer__nav {
    margin-left: auto;
}

.gcc-footer__nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    list-style: none;
}

.gcc-footer__nav-list a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    transition: color var(--gcc-transition);
}

.gcc-footer__nav-list a:hover {
    color: #fff;
}

.gcc-footer__copy {
    width: 100%;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 1.5rem;
    margin-top: 1rem;
}

/* ── Blank Canvas template ─────────────────────────────────────────────── */

/*
 * When using the Blank Canvas template the page provides its own
 * complete layout. We only ensure the admin bar offset is respected
 * so fixed/sticky elements inside custom pages still land in the
 * right place.
 */
body.gcc-blank-canvas {
    /* No forced padding — let the custom page control everything. */
}

body.gcc-blank-canvas.admin-bar {
    /*
     * WordPress injects `margin-top` onto the body when the admin bar
     * is present. Override that with padding so position:fixed children
     * of the custom page are offset correctly.
     */
    margin-top: 0 !important;
    padding-top: var(--wp-admin-bar-height, 0px);
}

/* ── Accessibility ─────────────────────────────────────────────────────── */

:focus-visible {
    outline: 3px solid var(--gcc-color-accent);
    outline-offset: 3px;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.skip-link {
    position: absolute;
    top: -999px;
    left: 0;
    z-index: 9999;
    background: var(--gcc-color-primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}
