/* Jimmy's Ride — cross-surface navigation.
   One identical band on Desktop, In-car, Mobile and HUD: brand glyph and
   wordmark on the left, the three-way surface switch pinned to the centre,
   Design System entry and build version on the right. No vehicle metadata,
   surface labels or HUD links live in the header; those belong to the page
   that needs them.

   Centring is absolute, not grid-based: the switch is pinned to 50% of the
   primary row, so brand or meta width can never pull it off centre. */

/* Shared top-bar and content-origin tokens. Every surface uses the exact same
   header height, so switching between Desktop / In-car / Mobile never moves
   the content start line. The sole breakpoint change is one extra stacked
   row at narrow widths. */
:root {
  --topbar-h: 73px;
  --content-gap: 13px;
}

/* Keep the scrollbar state identical on every surface. Classic scrollbars take
   15px of layout width; if one page scrolls and another does not, the content
   box changes width and the whole layout shifts sideways when switching.
   `overflow-y: scroll` (rather than scrollbar-gutter, which reserves a 15px
   strip even when the platform's scrollbar is a 0px overlay) makes every page
   pay the same width, so the box is identical before and after the switch.
   Overlay platforms still measure 0px and keep the full-bleed layout. */
html {
  overflow-y: scroll;
}

.surface-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  padding-block: 10px;
  padding-inline: clamp(18px, 2.4vw, 32px);
  border-bottom: 1px solid rgba(122, 174, 255, 0.1);
  background: linear-gradient(180deg, rgba(5, 7, 12, 0.9), rgba(5, 7, 12, 0.4));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.surface-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  width: 100%;
}

/* Brand and the design-system entry share the left side of the bar. */
.surface-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
}

.surface-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
}

.surface-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--cyan);
  filter: drop-shadow(0 0 7px rgba(56, 189, 248, 0.45));
}

.surface-mark svg {
  width: 100%;
  height: 100%;
}

/* Readable text wordmark beside the glyph. It is the header's anchor, so the
   version chip stays small and quiet on the opposite side. */
.surface-word {
  font: 600 13px/1 var(--font);
  letter-spacing: 0.045em;
  color: var(--text-value);
  white-space: nowrap;
}

/* Right-hand reference group: one entry to the design system plus the build
   version. Both are the same on every surface. */
.surface-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
}

/* A real control, drawn in the same segmented language as the switch. */
.surface-design {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(8, 14, 24, 0.55);
  color: var(--text-prose);
  font: 600 9.5px/1 var(--font);
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.surface-design:hover,
.surface-design:focus-visible {
  color: var(--text-value);
  border-color: rgba(56, 189, 248, 0.34);
  background: rgba(56, 189, 248, 0.09);
  outline: none;
}

/* Plain, non-interactive build label: no box, no hover, no pointer. */
.surface-version {
  font: 500 9.5px/1 var(--font);
  letter-spacing: 0.06em;
  color: var(--text-label);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

/* Segmented switch: three equal options, 46px tall so the click target is
   comfortable on trackpads and touch alike. Slightly larger than the old
   secondary tabs to keep the hierarchy readable. */
.surface-switch {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(8, 14, 24, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex: none;
}

.surface-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--muted);
  font: 600 10px/1 var(--font);
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.surface-option:hover {
  color: var(--ink-dim);
  background: rgba(56, 189, 248, 0.06);
}

.surface-option:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 2px;
}

.surface-option.is-current {
  color: var(--text-value);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.16), rgba(10, 132, 255, 0.08));
  box-shadow:
    inset 0 0 0 1px rgba(56, 189, 248, 0.24),
    0 0 20px -8px rgba(56, 189, 248, 0.55);
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.surface-option.is-current:hover {
  color: var(--text-value);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.2), rgba(10, 132, 255, 0.1));
}

.surface-option.is-current:focus-visible {
  outline-color: var(--cyan);
}

/* Review surfaces start their content on the same line as Desktop. */
.display-stage {
  margin-top: var(--content-gap);
}

/* Narrow viewports: brand and meta share the first line, the surface switch
   drops to its own centred line. */
@media (max-width: 960px) {
  :root {
    --topbar-h: 103px;
  }

  .surface-bar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    gap: 8px;
    padding-block: 10px;
  }

  .surface-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand status"
      "switch switch";
    row-gap: 8px;
  }

  .surface-left {
    grid-area: brand;
  }

  .surface-switch {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    grid-area: switch;
    justify-self: center;
  }

  .surface-meta {
    grid-area: status;
    justify-self: end;
    margin-left: 0;
  }
}

/* Smallest review width: the switch becomes a full-width equal row so all
   three options stay reachable at 390px. */
@media (max-width: 520px) {
  .surface-switch {
    width: 100%;
    max-width: 320px;
  }

  .surface-option {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 10px;
    letter-spacing: 0.02em;
  }
}
