/* Site header. Markup: src/partials/header-*.html. Behaviour: /header.js.
   Every class starts with srh- so nothing here meets the Impreza theme or the sr- product styles.
   The desktop layout starts at 1280px: keep that number in step with header.js. */

/* The theme reads these for sticky offsets. The scroll padding keeps #anchors and focused fields clear of the bar. */
:root { --header-height: 64px; --header-sticky-height: 64px; scroll-padding-top: calc(var(--header-sticky-height) + 16px); }

/* Tokens and base text for the header, its mobile sheet and the footer (.srf, laid out in /footer.css). */
.srh,
.srh-sheet,
.srf {
  --srh-orange: #F5612F;     /* accents only: 3.2:1 on white, never behind or as text */
  --srh-cta: #CC4418;        /* the orange that carries text: 4.8:1 with white */
  --srh-cta-hover: #B33A12;
  --srh-tint: #FEF0EA;
  --srh-ink: #1F1D1D;
  --srh-text: #2B2929;
  --srh-muted: #676464;
  --srh-line: #E7E2DC;
  --srh-canvas: #FAF9F7;
  --srh-shadow: 0 1px 2px rgba(43, 41, 41, .06), 0 8px 24px rgba(43, 41, 41, .08);
  --srh-speed: 160ms;
  --srh-bar: 64px;
  --srh-gutter: 24px;        /* side margin; with the width cap below it keeps the header in line with the page content */
  color: var(--srh-text);
  font: 400 16px/1.6 Poppins, 'Trebuchet MS', sans-serif;
  letter-spacing: 0;
}

/* Undo the theme's element styles inside the header and footer. :where() keeps these as weak as the theme's own
   element selectors, so they win by coming later and every srh- or srf- class still overrides them. */
:where(.srh, .srh-sheet, .srf) * { box-sizing: border-box; }
:where(.srh, .srh-sheet, .srf) :is(ul, li, p) { margin: 0; padding: 0; list-style: none; font-size: inherit; line-height: inherit; } /* the theme sets 16px/20px on p and ul */
:where(.srh, .srh-sheet, .srf) a { color: inherit; text-decoration: none; }
:where(.srh, .srh-sheet, .srf) button { appearance: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: none; cursor: pointer; }
:where(.srh, .srh-sheet, .srf) [hidden] { display: none !important; }
:where(.srh, .srh-sheet, .srf) :focus-visible { outline: 2px solid var(--srh-orange); outline-offset: 2px; }

.srh-icon { display: block; flex: 0 0 auto; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.srh-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The header holds its place in the page; the part you see is fixed to the top of the window. */
.srh { height: var(--header-height); }
.srh__inner { position: fixed; top: 0; left: 0; right: 0; z-index: 111; background: #fff; box-shadow: var(--srh-shadow); }

.srh-bar,
.srh-utility__inner { width: calc(100% - 2 * var(--srh-gutter)); max-width: var(--site-content-width, 1920px); margin: 0 auto; }
.srh-bar { position: relative; display: flex; align-items: center; gap: 24px; height: var(--srh-bar); }
.srh-logo { display: flex; flex: 0 0 auto; align-items: center; }
.srh-logo img { display: block; width: auto; max-width: none; height: 44px; }
.srh-utility, .srh-nav, .srh-actions { display: none; }

.srh-menu-button,
.srh-sheet__close { display: flex; flex: 0 0 44px; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; }
.srh-menu-button { margin-left: auto; }

.srh-phone { display: flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; }
.srh-phone .srh-icon { width: 20px; height: 20px; color: var(--srh-orange); }
.srh-quote,
.srh-phone--button { justify-content: center; min-height: 44px; padding: 12px 16px; border: 1px solid var(--srh-cta); border-radius: 8px; font-size: 15px; font-weight: 600; line-height: 20px; letter-spacing: .02em; white-space: nowrap; }
.srh-quote { display: flex; align-items: center; background: var(--srh-cta); color: #fff; }
.srh-phone--button { border-color: var(--srh-text); background: #fff; }
.srh-phone--button .srh-icon { color: currentColor; }

.srh-panel__title { margin: 0 0 12px; color: var(--srh-muted); font-size: 12px; font-weight: 600; line-height: 16px; letter-spacing: .04em; text-transform: uppercase; }
.srh-brands { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* Mobile menu: a full-height sheet with the quote and call buttons pinned to the bottom. */
.srh-sheet { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #fff; }
.srh-sheet:not([open]) { display: none; }
.srh-sheet[open] { display: flex; flex-direction: column; }
.srh-sheet::backdrop { background: var(--srh-text); }
.srh-sheet__top { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 8px 24px; border-bottom: 1px solid var(--srh-line); }
.srh-sheet__body { flex: 1; min-height: 0; padding: 16px 24px 24px; overflow-y: auto; overscroll-behavior: contain; }
.srh-sheet__item { border-bottom: 1px solid var(--srh-line); }
.srh-sheet__item > a,
.srh-sheet__toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; padding: 12px 0; font-size: 16px; font-weight: 500; line-height: 24px; text-align: left; }
.srh-sheet__toggle .srh-icon { width: 20px; height: 20px; transition: transform var(--srh-speed) ease-out; }
.srh-sheet__toggle[aria-expanded="true"] { padding-inline: 8px; background: var(--srh-tint); color: var(--srh-ink); }
.srh-sheet__toggle[aria-expanded="true"] .srh-icon { transform: rotate(180deg); }
.srh-sheet__item.current-menu-item > a,
.srh-sheet__item.is-current > .srh-sheet__toggle { padding-left: 12px; box-shadow: inset 3px 0 var(--srh-orange); }
.srh-sheet__sub { padding: 16px 8px 24px; }
.srh-sheet__sub a { display: flex; align-items: center; min-height: 48px; font-size: 16px; font-weight: 500; line-height: 24px; }
.srh-sheet__sub .srh-brands a { font-size: 14px; }
.srh-sheet__sub ul + .srh-panel__title { margin-top: 24px; }
.srh-sheet__sub .current-menu-item > a { color: var(--srh-cta); text-decoration: underline; text-underline-offset: 4px; }
.srh-sheet__footer { display: grid; flex: 0 0 auto; gap: 8px; padding: 16px 24px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--srh-line); }
.srh-sheet__footer a { min-height: 48px; }
html.srh-menu-open { overflow: hidden; }

@media (max-width: 374px) {
  .srh { --srh-gutter: 16px; }
  .srh-sheet__top, .srh-sheet__body, .srh-sheet__footer { padding-inline: 16px; }
}

@media (min-width: 1280px) {
  :root { --header-height: 112px; --header-sticky-height: 72px; }
  .srh { --srh-bar: 72px; }
  /* header.js moves the header up as the page scrolls, until the strip is out of view and the bar stays. */
  .srh__inner { transform: translateY(var(--srh-shift, 0)); }

  .srh-utility { display: block; height: 40px; border-bottom: 1px solid var(--srh-line); background: var(--srh-canvas); font-size: 14px; line-height: 20px; }
  .srh-utility__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 100%; }
  .srh-utility__facts { display: flex; align-items: center; gap: 24px; }
  .srh-utility__facts span + span { padding-left: 24px; border-left: 1px solid var(--srh-line); }

  .srh-bar .srh-logo img { height: 52px; }
  .srh-menu-button { display: none; }
  .srh-nav { display: block; }
  .srh-actions { display: flex; align-items: center; margin-left: auto; }

  .srh-nav__list { display: flex; align-items: center; gap: 16px; }
  .srh-nav__item { display: flex; align-items: center; border-radius: 4px; white-space: nowrap; }
  .srh-nav__item--drop { position: relative; }
  .srh-nav__item.is-open { background: var(--srh-tint); box-shadow: 0 0 0 6px var(--srh-tint); }
  .srh-nav__link,
  .srh-nav__toggle { display: flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 500; line-height: 24px; }
  .srh-nav__link { position: relative; }
  .srh-nav__toggle { justify-content: center; width: 24px; border-radius: 4px; }
  .srh-nav__toggle .srh-icon { width: 16px; height: 16px; transition: transform var(--srh-speed) ease-out; }
  .srh-nav__item.is-open .srh-nav__toggle .srh-icon { transform: rotate(180deg); }

  /* Current page: the build adds current-menu-item to the exact link; header.js adds is-current to its section. */
  .srh-nav__item:is(.current-menu-item, .is-current) > .srh-nav__link { color: var(--srh-cta); }
  .srh-nav__item:is(.current-menu-item, .is-current) > .srh-nav__link::after { content: ''; position: absolute; right: 0; bottom: 4px; left: 0; height: 2px; background: var(--srh-orange); }
  .srh-nav__item.is-open:is(.current-menu-item, .is-current) > .srh-nav__link { color: var(--srh-cta-hover); }

  /* Panels sit 8px under the bar. A small one hangs from its own item; the wide one spans from the bar's left edge. */
  .srh-panel { position: absolute; top: calc(100% + (var(--srh-bar) - 44px) / 2 + 8px); left: 0; width: 288px; padding: 16px 24px; border: 1px solid var(--srh-line); border-radius: 12px; background: #fff; box-shadow: var(--srh-shadow); white-space: normal; animation: srh-panel-in var(--srh-speed) ease-out; }
  .srh-panel--wide { top: calc(100% + 8px); width: min(720px, 100%); padding: 24px; }
  /* Covers the gap between an item and its panel, so the pointer never leaves on the way down. */
  .srh-panel::before { content: ''; position: absolute; right: 0; bottom: 100%; left: 0; height: 24px; }
  .srh-panel__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
  .srh-panel a { display: flex; align-items: center; min-height: 40px; font-size: 15px; font-weight: 500; line-height: 24px; }
  .srh-panel .current-menu-item > a { color: var(--srh-cta); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
}

/* From here the seven links have room for the page's own 40px side margin (the theme's 2.5rem). */
@media (min-width: 1360px) {
  .srh { --srh-gutter: 40px; }
}

@keyframes srh-panel-in { from { opacity: 0; transform: translateY(-4px); } }

/* Hover. The .srh / .srh-sheet prefix is needed to outrank the theme's ".no-touch a:hover". */
@media (hover: hover) {
  .srh a:hover,
  .srh-sheet a:hover { color: var(--srh-cta); text-decoration: underline; text-underline-offset: 4px; }
  .srh .srh-phone:hover,
  .srh-sheet .srh-phone:hover { color: var(--srh-text); }
  .srh .srh-quote:hover,
  .srh-sheet .srh-quote:hover { border-color: var(--srh-cta-hover); background: var(--srh-cta-hover); color: #fff; text-decoration: none; }
  .srh-sheet .srh-phone--button:hover { background: var(--srh-canvas); text-decoration: none; }
  .srh-nav__toggle:hover,
  .srh-menu-button:hover,
  .srh-sheet__close:hover { background: var(--srh-tint); }
}

@media (prefers-reduced-motion: reduce) {
  .srh *, .srh-sheet * { animation: none !important; transition: none !important; }
}
