/* ==========================================================================
   Site Header — global, loads on every template
   Shares --sd-navy / --sd-red variables defined in model-review.css :root.
   Load order: model-review.css (or a shared base.css) before this file.
   ========================================================================== */

/* Safety net for full-bleed sections that use the 100vw technique (e.g.
   .welcome-video-band in homepage.css) — 100vw can be a few pixels wider
   than the visible viewport on some browsers/platforms when a vertical
   scrollbar is present, which would otherwise cause a slight horizontal
   overflow. This clips that overflow rather than letting it introduce
   a horizontal scrollbar of its own. */
/* Global box-sizing reset — was missing sitewide until now. Without
   this, the browser default (content-box) makes padding and border
   ADD to an element's size rather than being included within it. This
   was the actual cause of the Browse by Make logo tiles appearing
   "cut off": .tile-photo-square combines aspect-ratio with padding,
   and under content-box, that padding was making the element larger
   than its 4:3 box should allow — since the parent .make-tile has
   overflow:hidden, the extra size was being silently clipped. This
   reset fixes it at the root rather than patching every individual
   element that happens to combine aspect-ratio/width with padding. */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}

.site-header {
    background: var(--sd-navy);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.25s ease, padding 0.25s ease;
}

.site-header-inner {
    max-width: 1400px; /* was 1100px — widened alongside footer/homepage
        since 1100px still left large empty margins on wide screens */
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
}

/* Sticky-scroll state — since the header is already navy, the "shrink"
   cue is a darker overlay + shadow rather than a background-color swap. */
.site-header.header-scrolled {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.site-header.header-scrolled .site-header-inner {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Logo shrinks on scroll too, not just the header's padding — at full
   150px size, a permanently-pinned sticky header would eat into screen
   space the whole time someone's reading a page. Full size only shows
   at the top, before scrolling.
   Using transform:scale rather than changing width/height directly —
   scale is purely visual and never affects the element's actual layout
   size, so it can't trigger the header's own height to change, which
   is what was likely causing a scroll-position feedback loop (shrink →
   header gets shorter → page scroll position shifts slightly → scroll
   threshold un-triggers → grows back → shifts again → rapid flicker).
   transform sidesteps that entire class of bug by never touching layout
   at all, only compositing. */
.site-header.header-scrolled .site-logo img {
    transform: scale(0.545); /* 60px equivalent visual size from a 110px base */
}

/* ---------- Logo ---------- */
.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-logo img {
    display: block;
    width: 110px; /* was 72px — switched from the simple S-mark icon to
        the full lockup (S + car + wordmark), which needs meaningfully
        more room for the wordmark text to stay legible */
    height: 110px;
    transform-origin: left center;
    transition: transform 0.2s ease;
}

/* ---------- Nav ---------- */
.site-nav {
    display: flex;
    align-items: center;
}

.nav-menu {
    list-style: none;
    display: none; /* hidden on mobile until nav-menu-open is toggled */
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    color: #C7D2E0;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.nav-menu a:hover {
    color: #fff;
}

/* ---------- Mobile nav toggle (hamburger) ---------- */
.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Open state — toggled via JS adding .nav-menu-open to <body> or the nav */
body.nav-menu-open .nav-menu {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--sd-navy);
    padding: 1rem;
    gap: 1rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

body.nav-menu-open .nav-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

body.nav-menu-open .nav-toggle span:nth-child(2) {
    opacity: 0;
}

body.nav-menu-open .nav-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ==========================================================================
   Tablet and up — full nav visible, hamburger hidden
   ========================================================================== */
@media (min-width: 768px) {
    .nav-toggle {
        display: none;
    }

    .nav-menu {
        display: flex;
        position: static;
        background: none;
        padding: 0;
        box-shadow: none;
        flex-direction: row;
    }

    .site-logo img {
        width: 150px; /* was 88px — same reasoning as the mobile size above */
        height: 150px;
    }
}

/* ---------- Shared form status messages ----------
   Used identically across all four site forms (Newsletter, Insurance,
   Inspections, Car Listing enquiry) after a submission — sitewide here
   in header.css rather than duplicated per page-specific stylesheet,
   since the pattern itself never varies by page. */
.form-status {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.form-status-success {
    background: rgba(46, 125, 50, 0.1);
    color: #2E7D32;
}

.form-status-error {
    background: rgba(200, 16, 46, 0.08);
    color: var(--sd-red);
}

/* ---------- Header search — icon by default, expands on click ---------- */
.nav-search {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.nav-search-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.25);
    margin-right: 16px;
}

.nav-search-toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
}

.nav-search-form {
    display: none; /* hidden by default — revealed via .nav-search-open
        below, toggled by header.js. Collapsed rather than removed, so
        it works immediately once JS adds the class, no extra markup
        swap needed. */
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 4px 5px 4px 12px;
    gap: 6px;
    margin-left: 12px;
}

.nav-search-open .nav-search-form {
    display: flex;
}

.nav-search-open .nav-search-toggle {
    display: none; /* the input replaces the icon while open, rather
        than showing both at once */
}

.nav-search-form input[type="search"] {
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--sd-font-body);
    font-size: 0.85rem;
    width: 130px;
    outline: none;
}

.nav-search-form input[type="search"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.nav-search-form button[type="submit"] {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 5px;
}