/* Speedless Driving site header (yellow and black top bar with mobile hamburger menu).
   Used by header.js. Keep this file next to header.js and logo-header.png.
   Everything is scoped under .sd-header so it will not clash with page styles. */

/* keeps in-page anchor targets from hiding under the sticky bar */
html { scroll-padding-top: 76px; }

.sd-header {
  --sd-yellow: #FFFF0E;
  --sd-black: #0A0A0A;
  --sd-fg: #F4F4E4;
  --sd-muted: #B8B8A0;
  --sd-line: #2A2A20;
  --sd-display: "Merriweather", "Bookman Old Style", Georgia, "Times New Roman", serif;
  --sd-body: "Figtree", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;

  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: var(--sd-black);
  color: var(--sd-fg);
  border-bottom: 1px solid var(--sd-line);
  font-family: var(--sd-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
.sd-header *, .sd-header *::before, .sd-header *::after { box-sizing: border-box; }
.sd-header a { color: inherit; }
.sd-header :focus-visible { outline: 3px solid var(--sd-yellow); outline-offset: 3px; }

.sd-wrap {
  width: 100%; max-width: none; margin-inline: 0;   /* full width, so the logo sits far left and the menu gets the most room */
  padding-inline: clamp(12px, 2vw, 28px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 68px;
}
.sd-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

.sd-brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.sd-logo { width: 44px; aspect-ratio: 1; flex: none; border-radius: 50%; background: url("logo-header.png") center / contain no-repeat; }
.sd-name { font: 900 0.82rem/1.2 var(--sd-display); letter-spacing: .1em; text-transform: uppercase; color: var(--sd-yellow); white-space: nowrap; }

.sd-nav ul { display: flex; align-items: center; gap: clamp(14px, 1.9vw, 30px); list-style: none; margin: 0; padding: 0; }
.sd-nav a { white-space: nowrap; text-decoration: none; font-weight: 600; font-size: 0.95rem; color: var(--sd-muted); }
.sd-nav a:hover { color: var(--sd-yellow); }

/* "More Protection" drop-down (desktop) */
.sd-nav li { position: relative; flex: none; }
/* the menu is centred in the space between the logo and the right edge of the screen */
.sd-nav { flex: 1 1 auto; min-width: 0; }
.sd-nav ul { justify-content: center; }
.sd-has-sub { display: flex; align-items: center; gap: 2px; padding-block: 14px; }
.sd-sub-toggle { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--sd-muted); cursor: pointer; }
.sd-sub-toggle svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.sd-has-sub:hover .sd-sub-toggle, .sd-sub-toggle:focus-visible, .sd-has-sub.open .sd-sub-toggle { color: var(--sd-yellow); }
.sd-has-sub.open .sd-sub-toggle svg { transform: rotate(180deg); }
.sd-nav .sd-sub { display: none; position: absolute; top: 100%; left: -18px; min-width: 300px; flex-direction: column; gap: 0; padding: 8px 0; background: var(--sd-black); border: 1px solid var(--sd-line); border-radius: 8px; box-shadow: 0 18px 30px rgba(0,0,0,.4); z-index: 2; }
.sd-has-sub:hover > .sd-sub, .sd-has-sub:focus-within > .sd-sub, .sd-has-sub.open > .sd-sub { display: flex; }
.sd-has-sub.sd-hide > .sd-sub { display: none !important; }
.sd-sub a { display: block; padding: 12px 18px; white-space: nowrap; }

.sd-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-height: 40px; padding: 0 20px; border-radius: 999px;
  background: var(--sd-yellow); color: var(--sd-black); border: 2px solid var(--sd-yellow);
  font: 700 0.95rem/1 var(--sd-body); text-decoration: none; transition: transform .15s ease;
}
.sd-header .sd-btn { color: var(--sd-black); }
.sd-btn:hover { transform: translateY(-2px); }

/* hamburger (phones and tablets), sits to the left of the logo */
.sd-burger { display: none; position: relative; width: 44px; height: 44px; flex: none; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.sd-burger span { position: absolute; left: 10px; right: 10px; height: 3px; border-radius: 2px; background: var(--sd-yellow); transition: transform .2s ease, opacity .2s ease, top .2s ease; }
.sd-burger span:nth-child(1) { top: 14px; }
.sd-burger span:nth-child(2) { top: 21px; }
.sd-burger span:nth-child(3) { top: 28px; }
.sd-burger[aria-expanded="true"] span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.sd-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.sd-burger[aria-expanded="true"] span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

.sd-menu { position: absolute; left: 0; right: 0; top: 100%; background: var(--sd-black); border-bottom: 1px solid var(--sd-line); box-shadow: 0 18px 30px rgba(0,0,0,.35); }
.sd-menu[hidden] { display: none; }
.sd-menu ul { list-style: none; margin: 0; padding: 0 0 12px; }
.sd-menu a { display: block; padding: 16px clamp(16px, 4vw, 32px); font: 700 1.1rem/1.2 var(--sd-display); color: var(--sd-yellow); text-decoration: none; border-top: 1px solid var(--sd-line); }
.sd-menu li:first-child a { border-top: 0; }
.sd-menu .sd-msub { padding: 0; }
.sd-menu .sd-msub a { padding-left: calc(clamp(16px, 4vw, 32px) + 22px); font-size: 1rem; }
.sd-menu .sd-msub li:first-child a { border-top: 1px solid var(--sd-line); }
.sd-menu a:hover, .sd-menu a:focus-visible { color: var(--sd-fg); }

@media (max-width: 1000px) {
  .sd-nav { display: none; }
  .sd-burger { display: block; }
}
@media (min-width: 1001px) { .sd-menu { display: none !important; } }

/* phones: hide the button so the name fits, and scale the name so both words stay on one line */
@media (max-width: 539px) {
  .sd-name { font-size: clamp(0.8rem, calc((100vw - 156px) / 12.6), 1.35rem); letter-spacing: 0.06em; }
}
@media (max-width: 380px) { .sd-brand { gap: 8px; } }

@media (prefers-reduced-motion: reduce) {
  .sd-burger span, .sd-btn { transition: none; }
}
