/* ===============================
   Site header (pill nav) and footer
   Shared by every page that uses _Layout (Figma: Cybr PARK UI)
   =============================== */

/* Prefixed tokens so page stylesheets that redefine --primary-color etc. can't recolor the chrome */
:root {
    --chrome-green: #2e4c2e;
    --chrome-nav-bg: #d9dcd3;
    --chrome-link: #3f5172;
    --chrome-link-hover: #2980b9;
    --chrome-text-light: #fffaf3;
    --chrome-text-dark: #132239;
    --chrome-cta: #eb9660;
    --chrome-cta-shadow: #b55844;
    --chrome-olive: #a5b04e;
    --chrome-cta-strong: #b55844;
    --chrome-cta-strong-shadow: #8e4334;
    --chrome-gutter: 2.625rem;
    --chrome-max-width: 84.75rem;
    --nav-gap: 2rem; /* minimum even spacing between the brand and every nav link and button */
    /* Height of the fixed banner header; pages offset their content by this */
    --site-header-height: 6.5rem;
}

/* Pages other than the landing page don't set border-box globally, so set it here
   to keep the header/footer the same size everywhere */
.site-header,
.site-header *,
.site-footer,
.site-footer * {
    box-sizing: border-box;
}

/* ---------- Header ---------- */
.site-header {
    position: fixed;
    top: 1.5rem;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 var(--chrome-gutter);
    pointer-events: none; /* only the pill itself is clickable */
}

/* Regular pages: the pill sits on a fixed circuit-board band */
.site-header--banner {
    top: 0;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    background: var(--chrome-green) url('../assets/images/publicSite/circuitHeader.png') center / cover no-repeat;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: auto; /* the band covers scrolled content, so it must not click through */
}

/* Banner without the circuit-board image (educator login) */
.site-header--plain {
    background: var(--chrome-green);
    box-shadow: none;
}

/* Landing page: the pill floats over the hero and scrolls away with it */
.site-header--overlay {
    position: absolute;
}

.site-nav {
    pointer-events: auto;
    max-width: var(--chrome-max-width);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem 0; /* rows only: the link list provides every horizontal gap, including after the brand */
    padding: 0.75rem 2.5rem 0.75rem 1.5rem;
    background: var(--chrome-nav-bg);
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    font-family: 'Poppins', sans-serif;
}

.site-nav__brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    color: var(--chrome-text-dark);
    font-size: 1.75rem;
    text-decoration: none;
}

.site-nav__brand img {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: contain;
}

/* Fills the rest of the pill and spreads every item evenly; --nav-gap is the minimum spacing */
.site-nav__links {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nav-gap);
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Zero-width first item so the brand -> first link gap matches the gaps between links */
.site-nav__links::before { content: ""; }

/* Navy on the gray pill is ~11.5:1; the old blue-gray was ~5.7:1 */
.site-nav__links a {
    color: var(--chrome-text-dark);
    font-size: 1.25rem;
    font-weight: 500;
    text-decoration: none;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.3em;
    cursor: pointer;
    transition: color 0.15s ease;
}

/* Underline instead of a color shift: the old #2980b9 hover was only ~3.1:1 on the pill */
.site-nav__links a:hover,
.site-nav__links a:focus-visible {
    color: var(--chrome-link);
    text-decoration-line: underline;
}

/* "Log in" call-to-action button (signed-out visitors only) */
.site-nav__links a.site-nav__login {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 999px;
    background: var(--chrome-cta);
    color: var(--chrome-text-dark);
    box-shadow: 0 4px 0 var(--chrome-cta-shadow), 0 6px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
}

.site-nav__links a.site-nav__login:hover,
.site-nav__links a.site-nav__login:focus-visible {
    color: var(--chrome-text-dark);
    text-decoration-line: none;
    filter: brightness(1.06);
}

.site-nav__links a.site-nav__login:focus-visible {
    outline: 2px solid var(--chrome-link);
    outline-offset: 3px;
}

.site-nav__links a.site-nav__login:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--chrome-cta-shadow);
}

/* "Donate" is a <button> (it opens a modal) styled to match the text links */
.site-nav__donate {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--chrome-text-dark);
    font: inherit;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: inherit;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.3em;
    cursor: pointer;
    transition: color 0.15s ease;
}

.site-nav__donate:hover,
.site-nav__donate:focus-visible {
    color: var(--chrome-link);
    text-decoration-line: underline;
}
/* Educator "Lessons" dropdown (.nav-dropdown base styles live in site.css) */
.site-nav .nav-dropdown {
    border-radius: 12px;
}

.site-nav .nav-dropdown li a {
    font-size: 1rem;
    color: var(--chrome-text-dark);
}

/* Hamburger (CSS-only checkbox toggle), hidden on desktop */
/* Visually hidden but focusable on mobile; removed entirely on desktop so it isn't an invisible tab stop */
.site-nav__toggle {
    display: none;
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.site-nav__toggle-label { display: none; }

/* Start content right below the fixed banner (class added by _Layout for banner pages only).
   Banner height = vertical padding + pill height, so keep these in step with .site-nav sizing. */
.main-wrapper--with-header {
    padding-top: var(--site-header-height);
}

/* ---------- Request-a-demo call-to-action (above the footer) ---------- */
.demo-cta {
    padding: 4rem var(--chrome-gutter);
    font-family: 'Poppins', sans-serif;
}

.demo-cta__box {
    max-width: 58.75rem;
    margin: 0 auto;
    padding: 2.5rem 3rem 2.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    background: var(--chrome-olive);
    border-radius: 1rem;
    text-align: center;
}

.demo-cta__text {
    margin: 0;
    max-width: 52rem;
    color: var(--chrome-text-dark); /* ~6.8:1 on the olive */
    font-size: 1.5rem;
    line-height: 1.6;
}

.demo-cta__btn {
    display: block;
    width: min(42rem, 100%);
    padding: 1.125rem 1.5rem;
    border-radius: 999px;
    background: var(--chrome-cta-strong);
    color: var(--chrome-text-light); /* large text, ~4.4:1 */
    font-size: 2rem;
    text-decoration: none;
    box-shadow: 0 6px 0 var(--chrome-cta-strong-shadow), 0 8px 14px rgba(0, 0, 0, 0.2);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
}

.demo-cta__btn:hover,
.demo-cta__btn:focus-visible {
    color: var(--chrome-text-light);
    filter: brightness(1.08);
}

.demo-cta__btn:focus-visible {
    outline: 3px solid var(--chrome-text-dark);
    outline-offset: 4px;
}

.demo-cta__btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--chrome-cta-strong-shadow);
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--chrome-green);
    color: var(--chrome-text-light);
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    line-height: 1.6;
    padding: 2.25rem var(--chrome-gutter);
    backdrop-filter: none;
}

.site-footer p {
    max-width: 56rem;
    margin: 0 auto;
}

.site-footer p + p { margin-top: 1.5rem; }

.site-footer a { color: var(--chrome-text-light); }

/* ===============================
   RESPONSIVE
   =============================== */

/* Small laptops: tighten the nav before the links run out of room and wrap
   (the full-size nav needs about 1320px; 1366px Chromebooks keep it) */
@media (max-width: 1365px) {
    .site-nav { padding: 0.625rem 1.75rem 0.625rem 1.25rem; }
    .site-nav__brand { font-size: 1.5rem; }
    :root { --nav-gap: 1.5rem; }
    .site-nav__links a,
    .site-nav__donate { font-size: 1.0625rem; }
    :root { --site-header-height: 6.25rem; }
}

@media (max-width: 1024px) {
    :root { --chrome-gutter: 1.75rem; }
    .demo-cta__text { font-size: 1.25rem; }
    .demo-cta__btn { font-size: 1.625rem; }
    .site-footer { font-size: 1.0625rem; }
}

/* Small laptops and below: collapse links behind the hamburger
   (below 1200px the full nav plus Donate no longer fits on one row) */
@media (max-width: 1199px) {
    .site-header { top: 1rem; }
    .site-header--banner { top: 0; padding-top: 0.5rem; padding-bottom: 0.5rem; }
    .site-nav { padding: 0.5rem 1rem; border-radius: 1.75rem; }
    .site-nav__brand img { width: 2.5rem; height: 2.5rem; }

    .site-nav__toggle { display: block; }

    .site-nav__toggle-label {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 0.3125rem;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0.625rem;
        border-radius: 50%;
        background: var(--chrome-link);
        cursor: pointer;
    }

    .site-nav__toggle-label span {
        display: block;
        height: 2px;
        background: var(--chrome-text-light);
        border-radius: 2px;
    }

    .site-nav__toggle:focus-visible + .site-nav__toggle-label {
        outline: 2px solid var(--chrome-link-hover);
        outline-offset: 2px;
    }

    .site-nav__links {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--nav-gap);
        padding: 0.5rem 0.5rem 0.5rem;
        max-height: calc(100vh - 7rem);
        overflow-y: auto;
    }

    .site-nav__toggle:checked ~ .site-nav__links { display: flex; }

    .site-nav__links::before { display: none; }

    /* 2.75rem (44px) minimum touch target */
    .site-nav__links a {
        display: flex;
        align-items: center;
        min-height: 2.75rem;
        font-size: 1rem;
    }

    .site-nav__donate { min-height: 2.75rem; font-size: 1rem; }

    /* Show the Lessons sub-links inline instead of as a hover dropdown */
    .site-nav .nav-dropdown {
        display: block;
        position: static;
        background: none;
        box-shadow: none;
        padding: 0.5rem 0 0 1rem;
    }

    .site-nav .nav-dropdown li a { padding: 0.25rem 0; }

    :root { --site-header-height: 4.75rem; --nav-gap: 0.5rem; }
}

/* Tablet and below */
@media (max-width: 768px) {
    :root { --chrome-gutter: 1.25rem; }

    .demo-cta { padding: 2.5rem var(--chrome-gutter); }
    .demo-cta__box { padding: 1.75rem 1.25rem 2rem; gap: 1.5rem; }
    .demo-cta__text { font-size: 1.0625rem; }
    .demo-cta__btn { font-size: 1.25rem; padding: 0.875rem 1.25rem; }

    .site-footer { font-size: 1rem; padding: 1.75rem var(--chrome-gutter); }
}

@media (max-width: 480px) {
    :root { --chrome-gutter: 1rem; }
    .site-nav__brand { font-size: 1.25rem; }
    .site-footer { font-size: 0.875rem; }
}
