/* ==========================================================================
   Base: reset, typography, app chrome (cut-off bar, header, tab bar, footer)
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--fs-m);
  line-height: 1.5;
  color: var(--ink);
  background: var(--studio);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Studio light: a soft key light from above, like a cyclorama. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -10%, var(--studio-hi) 0%, transparent 60%),
    linear-gradient(180deg, transparent 60%, var(--studio-2) 140%);
}

img, svg, canvas, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--vana);
  outline-offset: 3px;
  border-radius: 6px;
}
.panel :focus-visible { outline-color: var(--mint); }

::selection { background: var(--vana); color: var(--vana-ink); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--studio); padding: 10px 16px; border-radius: var(--pill);
  text-decoration: none; transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: max(var(--gutter), env(safe-area-inset-left)); }

/* ---------- Type ---------- */
/* Display, page and section titles lean forward like livery lettering.
   Italic is for whole headings and big numbers, never a single word. */
.display {
  font-stretch: var(--wide);
  font-style: italic;
  font-weight: 820;
  font-size: clamp(2.05rem, 1.1rem + 4.4vw, 4.4rem);
  line-height: 1.0;
  letter-spacing: -0.03em;
}
.h1 { font-stretch: var(--wide); font-style: italic; font-weight: 760; font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem); letter-spacing: -0.025em; line-height: 1.05; }
.h2 { font-stretch: 115%; font-style: italic; font-weight: 720; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); letter-spacing: -0.02em; }
.h3 { font-stretch: 106%; font-weight: 620; font-size: var(--fs-l); }
.h4 { font-weight: 620; font-size: var(--fs-m); }
.lede { font-size: clamp(1.02rem, 0.95rem + 0.35vw, 1.2rem); color: var(--ink-2); max-width: 38ch; line-height: 1.55; }
.small { font-size: var(--fs-s); }
.xsmall { font-size: var(--fs-xs); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.wide { font-stretch: var(--wide); }
.semi { font-stretch: var(--semi); }
.size-code { font-stretch: var(--semi); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.prose { max-width: 68ch; }
.prose p + p { margin-top: 0.8em; }

/* ---------- Livery marks ---------- */
/* Compound flag: a slanted chip of the tire type's colour, placed before its
   name. Set --cc on the flag or an ancestor (style="--cc: var(--cc-winter)"). */
.cc-flag {
  display: inline-block; flex: none; width: 16px; height: 8px; border-radius: 2px;
  background: var(--cc, var(--muted)); transform: skewX(var(--slant)); vertical-align: 0.08em;
}
/* Pinstripe: green with a volt tip, the "you are here" bar for nav and tabs. */
.main-nav a[aria-current="page"]::after,
.tabbar a[aria-current="page"]::before {
  content: ""; position: absolute; height: 3px;
  background: linear-gradient(90deg, var(--vana) 0 66%, transparent 66% 74%, var(--volt) 74%);
  transform: skewX(var(--slant));
}

/* ---------- Cut-off bar (live: ship-today countdown, SHP-04) ---------- */
.cutoff-bar {
  background: var(--panel);
  color: var(--panel-ink);
  font-size: var(--fs-xs);
  letter-spacing: 0.01em;
}
.cutoff-inner { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.cutoff-inner b { color: var(--mint); font-weight: 650; font-variant-numeric: tabular-nums; }
.cutoff-extra { margin-left: auto; color: var(--panel-muted); display: none; }
@media (max-width: 520px) { .cut-more { display: none; } }
@media (min-width: 720px) { .cutoff-extra { display: inline; } }

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint); flex: none;
  box-shadow: 0 0 0 0 rgba(143, 227, 176, 0.6);
  animation: pulse 2.4s var(--ease) infinite;
}
.live-dot.is-late { background: var(--signal-panel); box-shadow: none; animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(143, 227, 176, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(143, 227, 176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(143, 227, 176, 0); }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--studio) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }

.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark { width: 28px; height: 28px; color: var(--ink); }
.brand-word { font-stretch: var(--wide); font-weight: 760; font-size: 1.12rem; letter-spacing: -0.01em; }

.main-nav { display: none; gap: 4px; }
.main-nav a {
  text-decoration: none; font-size: var(--fs-s); font-weight: 520; color: var(--ink-2);
  padding: 8px 12px; border-radius: var(--pill); transition: background 0.15s, color 0.15s;
}
.main-nav a:hover { background: var(--line); color: var(--ink); }
.main-nav a[aria-current="page"] { position: relative; color: var(--ink); font-weight: 650; }
.main-nav a[aria-current="page"]::after { left: 12px; right: 12px; bottom: 1px; }

.header-search { display: none; position: relative; flex: 1; max-width: 320px; margin-left: auto; }
.header-search input {
  width: 100%; height: 40px; border-radius: var(--pill); border: 1px solid var(--line-2);
  background: var(--paper-2); padding: 0 14px 0 38px; font-size: var(--fs-s);
}
.header-search input::placeholder { color: var(--muted); }
.hs-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.zip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 10px;
  border-radius: var(--pill); border: 1px solid var(--line-2); background: transparent;
  font-size: var(--fs-xs); color: var(--ink-2);
}
.zip-btn b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.zip-btn .zip-label { white-space: nowrap; }
@media (max-width: 380px) { .zip-btn .zip-label { font-size: 0; } .zip-btn .zip-label b { font-size: var(--fs-xs); } }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; border: 0; background: transparent; color: var(--ink); text-decoration: none;
}
.icon-btn:hover { background: var(--line); }
.cart-link { display: none; }

.count-badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--pill); background: var(--vana); color: var(--vana-ink);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}

@media (min-width: 900px) {
  .main-nav { display: flex; }
  .cart-link { display: inline-grid; }
}
/* Header budget: 6 nav items + ZIP + search must fit the 1136px container */
@media (min-width: 900px) and (max-width: 1099px) {
  .main-nav a[data-nav="help"] { display: none; }
  .zip-btn .zip-label { font-size: 0; }
  .zip-btn .zip-label b { font-size: var(--fs-xs); }
}
@media (min-width: 1280px) {
  .header-search { display: block; max-width: 220px; }
  .header-search + .header-actions { margin-left: 0; }
  .zip-btn .zip-label { font-size: 0; }
  .zip-btn .zip-label b { font-size: var(--fs-xs); }
}

/* ---------- Main ---------- */
main { display: block; min-height: 60vh; outline: none; }
.view { padding-bottom: 72px; }
/* Opacity only: a transform here would trap position:fixed children (buy bar) */
.view-enter { animation: viewFade 0.35s ease both; }
@keyframes viewFade { from { opacity: 0; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section { padding-block: clamp(40px, 6vw, 88px); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head p { color: var(--muted); max-width: 52ch; margin-top: 6px; }

/* ---------- Tab bar (mobile) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; font-size: 11px; font-weight: 560; color: var(--muted);
}
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"]::before { top: 0; width: 32px; }
.tabbar .tab-advisor > span:first-child {
  display: grid; place-items: center; width: 34px; height: 34px; margin-top: -4px;
  border-radius: 50%; background: var(--panel); color: var(--mint);
}
.tabbar .count-badge { top: 6px; right: calc(50% - 22px); }
body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  .tabbar { display: none; }
  body { padding-bottom: 0; }
}

/* ---------- Footer ---------- */
/* The livery bookend: racing green with the volt pinstripe along the top edge. */
.site-footer {
  position: relative; background: var(--livery); color: var(--livery-ink); padding-top: 56px;
  --line: var(--livery-line);
}
.site-footer::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px;
  background: linear-gradient(180deg, var(--volt) 0 4px, transparent 4px 7px, var(--volt) 7px 8px, transparent 8px);
}
.site-footer :focus-visible { outline-color: var(--volt); }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 1fr 1fr; }
.footer-brand { grid-column: 1 / -1; }
.footer-brand .brand-word { font-style: italic; font-size: var(--fs-xl); }
.footer-brand p { color: var(--livery-muted); margin-top: 6px; max-width: 36ch; }
.footer-brand .footer-contact { font-size: var(--fs-s); }
.site-footer nav { display: flex; flex-direction: column; gap: 10px; }
.site-footer h2 { font-size: var(--fs-s); font-weight: 650; margin-bottom: 4px; color: var(--volt); }
.site-footer nav a { text-decoration: none; color: var(--livery-ink); opacity: 0.86; font-size: var(--fs-s); }
.site-footer nav a:hover { opacity: 1; text-decoration: underline; }
/* Legal notes: the rule sits on an inner box so it lines up with the columns above. */
.footer-legal { margin-top: 40px; padding-block: 24px 36px; border-top: 1px solid var(--livery-line); display: grid; gap: 20px; }
.footer-legal p { font-size: var(--fs-xs); line-height: 1.55; color: var(--livery-muted); max-width: 64ch; }
.footer-legal strong { display: block; margin-bottom: 4px; font-weight: 650; color: var(--livery-ink); }
.footer-legal a { color: var(--livery-ink); text-underline-offset: 2px; }
.footer-legal a:hover { color: var(--volt); }
@media (min-width: 900px) {
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
  .footer-brand { grid-column: auto; }
  /* Same tracks as .footer-grid so each note starts on a column edge above. */
  .footer-legal { grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
  .footer-legal p { max-width: none; }
  .footer-legal .legal-wide { grid-column: span 2; }
}

.noscript { padding: 40px 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
