/* Jimmy's Ride — shared presentation shell for cockpit, HUD and mobile screens.
   The screen content is laid out in container units (cqw), so each mockup
   scales as one piece instead of re-flowing like a responsive web page. */

:root {
  --bg: #04060a;
  --ink: #eef5fd;
  --ink-dim: #a8bbd0;
  --muted: #6f8298;
  --cyan: #38bdf8;
  --cyan-bright: #7ddcff;
  --cyan-soft: rgba(56, 189, 248, 0.14);
  --amber: #ffc46b;
  --danger: #ff6b5a;
  --tag-ok-bg: #0b241d;
  --tag-ok-line: #2fbf8f;
  --tag-ok-ink: #a9e6cf;
  --hair: rgba(122, 174, 255, 0.16);
  --hair-strong: rgba(122, 174, 255, 0.3);
  --glass: linear-gradient(155deg, rgba(17, 28, 43, 0.72), rgba(6, 11, 19, 0.6));
  --font: "SF Pro Display", "SF Pro Text", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Semantic text colours. One set for all four surfaces and the HUD.
     Values are ink; every unit is the same light grey as prose; labels
     and bare state words are muted; prose is ink-dim; cyan is otherwise
     reserved for live chrome and status tags. */
  --text-value: var(--ink);
  --text-unit: var(--ink-dim);
  --text-label: var(--muted);
  --text-prose: var(--ink-dim);
  --text-live: var(--cyan);
  /* Minimum clear space between a caption and the value it names.
     Same token and value as styles.css and design-system.css. */
  --caption-gap: 0.9em;

  /* Breathing space — v0.4.13. Inviolable floors: when content does not
     fit, remove content; never reduce these insets. */
  --bs-display: 16px;      /* display edge floor */
  --bs-display-pct: 4%;    /* …or 4% of the display height */
  --bs-panel: 12px;        /* panel inset floor */
  --bs-panel-pct: 2.5%;    /* …or 2.5% of the panel's short side */
  --bs-gap: 10px;          /* stacked-block gap floor */
  --bs-gap-pct: 1.6%;      /* …or 1.6% of the container height */
  --bs-balance: 2%;        /* top vs bottom tolerance for a centred block */
}

/* A non-interactive state is a label first: modes, schedules and states
   inside a labelled row carry no border, fill, padding or radius, so they
   cannot be read as controls. A whole-card verdict adds .is-chip, a hairline
   pill at this surface's density — still non-interactive. */
.status {
  display: inline-flex;
  align-items: center;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-label);
  white-space: nowrap;
}

.status.is-ok {
  color: var(--tag-ok-ink);
}

/* Same chip grammar as desktop and mobile, scaled in container units:
   hairline blue ring + 7 % fill for a neutral verdict, green for OK. The
   negative block margin keeps the chip's outer box on the label's line, so
   adding a chip never pushes a height-constrained in-car card's content
   down; the pill itself still draws at full height. */
.status.is-chip {
  padding: 0.24cqw 0.72cqw;
  margin-block: -0.38cqw;
  border: 1px solid rgba(122, 174, 255, 0.24);
  border-radius: 999px;
  background: rgba(122, 174, 255, 0.07);
}

.status.is-chip.is-ok {
  border-color: rgba(47, 191, 143, 0.34);
  background: rgba(47, 191, 143, 0.1);
  color: var(--tag-ok-ink);
}

/* Inline unit token. One unit, one colour, one face — used wherever a unit
   sits inside a value row or a sentence instead of its own styled element. */
.u {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  color: var(--text-unit);
  /* The gap is the real space in the text plus a minimum margin, so the space
     survives rendering even when the in-car type resolves to a few pixels. */
  margin-left: 0.15em !important;
}

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

/* Only real controls get a pointer. Status labels never do. */
button {
  cursor: pointer;
}

::selection {
  background: rgba(56, 189, 248, 0.28);
  color: #fff;
}

/* ---------- Presentation shell ---------- */

.shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 18%, rgba(10, 70, 130, 0.28), transparent 68%),
    radial-gradient(44% 34% at 50% 96%, rgba(56, 189, 248, 0.1), transparent 72%),
    linear-gradient(180deg, #04060a 0%, #05080e 52%, #04060a 100%);
}

.shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(90, 150, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(90, 150, 255, 0.024) 1px, transparent 1px);
  background-size: 128px 128px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 10%, transparent 74%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 10%, transparent 74%);
}

.shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 46%, transparent 40%, rgba(0, 0, 0, 0.5) 100%);
}

.display-nav,
.display-stage,
.display-foot {
  position: relative;
  z-index: 1;
}

/* ---------- Top bar ---------- */

.display-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex: none;
  min-height: 76px;
  padding: 12px clamp(18px, 2.4vw, 32px);
  border-bottom: 1px solid rgba(122, 174, 255, 0.09);
  background: linear-gradient(180deg, rgba(4, 6, 10, 0.9), rgba(4, 6, 10, 0.34));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-context {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 10px/1 var(--font);
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.nav-context .tag {
  padding: 6px 10px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.07);
  letter-spacing: 0.06em;
}

.nav-context .arrow {
  color: var(--hair-strong);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.6vw, 22px);
  font: 500 10px/1 var(--font);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--hair-strong);
  outline: none;
}

.nav-links .is-current {
  color: var(--cyan);
}

/* Contextual tools that belong to a specific screen (for example the HUD's
   link back to the cockpit) sit below the shared header, never inside the
   projection surface. */
.view-toolbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(12px, 1.6vw, 20px);
  padding: 2px clamp(18px, 2vw, 32px) 0;
  margin-top: 6px;
  font: 500 10px/1 var(--font);
  letter-spacing: 0.03em;
  color: var(--muted);
}

.toolbar-link {
  color: var(--text-prose);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.toolbar-link:hover,
.toolbar-link:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--hair-strong);
  outline: none;
}

/* ---------- Stage and hardware frame ---------- */

.display-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(14px, 2.2vh, 30px) clamp(14px, 2vw, 32px);
}

/* A single projected display is anchored under the header at the standard
   stack gap; surplus height falls below instead of becoming top whitespace.
   Vertical scroll is allowed, so nothing is compressed to fit. */
.display-stage.is-top {
  align-items: start;
}

.hardware {
  position: relative;
  padding: 8px;
  border-radius: 24px;
  background: linear-gradient(158deg, #1a2430 0%, #06090e 34%, #0a1119 68%, #1c2634 100%);
  box-shadow:
    0 44px 100px -40px rgba(0, 0, 0, 0.95),
    0 0 90px -32px rgba(56, 189, 248, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.hardware::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 21px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  pointer-events: none;
}

.hardware::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 17px;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.screen {
  position: relative;
  overflow: hidden;
  border-radius: 17px;
  background: #05080d;
  isolation: isolate;
  container-type: inline-size;
}

.cockpit-screen {
  width: min(92vw, calc(80vh * 16 / 9));
  aspect-ratio: 16 / 9;
}

.hud-screen {
  /* 2560 × 562: the same 2560-wide design canvas 10 % shorter than the
     original 624. Both the standalone page and the in-car band use it. */
  width: min(92vw, calc(78vh * 2560 / 562));
  aspect-ratio: 2560 / 562;
}

/* ---------- Footer ---------- */

.display-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  flex: none;
  padding: 8px clamp(18px, 3vw, 40px) 16px;
  font: 500 9.5px/1.6 var(--font);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.display-foot .meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.display-foot .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
}

.display-foot .credit {
  max-width: 620px;
  text-align: right;
  letter-spacing: 0.04em;
  line-height: 1.7;
  text-transform: none;
}

.display-foot .credit a {
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
}

.display-foot .credit a:hover {
  color: var(--cyan);
}

.foot-link {
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.foot-link:hover {
  color: var(--cyan);
}

/* ---------- Shared battery component ---------- */

/* Same drawing on every surface: the charge sits inside the ring, remaining
   range is the hero figure, and a marker on the ring shows the 80% limit.
   Surfaces only swap the scale variables below. */
.soc-block {
  --soc-ring: 8.4cqw;
  --soc-gap: 1.4cqw;
  --soc-num: 2.3cqw;
  --soc-pct: 1.05cqw;
  --soc-range: 4.6cqw;
  --soc-unit: 1.2cqw;
  --soc-label: 0.9cqw;
  --soc-meta: 0.8cqw;
}

.soc-layout {
  display: flex;
  align-items: center;
  gap: var(--soc-gap);
}

.soc-ring {
  position: relative;
  flex: none;
  width: var(--soc-ring);
  height: var(--soc-ring);
}

.soc-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.soc-ring-track {
  fill: none;
  stroke: rgba(120, 170, 255, 0.15);
  stroke-width: 6;
}

.soc-ring-fill {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 6;
  stroke-linecap: round;
}

/* Separate unfiltered glow stroke; a drop-shadow filter on the dashed
   stroke is what made the arc disappear in some renderers. */
.soc-ring-glow {
  fill: none;
  stroke: rgba(56, 189, 248, 0.28);
  stroke-width: 11;
  stroke-linecap: round;
}

.soc-ring-limit {
  fill: #05080d;
  stroke: var(--cyan);
  stroke-width: 2.2;
}

.soc-ring-value {
  position: absolute;
  inset: 0;
  display: grid;
  grid-auto-flow: column;
  align-content: center;
  justify-content: center;
  align-items: baseline;
  gap: 0.09em;
  /* The strut must be the numeral's own size. Inheriting the ambient 16 px
     made the line box taller than the value, so the digits sat on a baseline
     sized for a different font and their ink drifted off centre as the ring
     scaled. */
  font-size: var(--soc-num);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  /* Optical centring. The grid centres the numeral's line box, but the ink
     of lining figures sits above that box: the line box reserves descender
     space under a baseline no digit reaches. Where the engine supports
     `text-box-trim`, the pair is trimmed to cap height and the grid centres
     the ink exactly; older engines get a calibrated 6 % downward nudge,
     measured to land within 0.8 px of the circle's centre. */
  transform: translateY(calc(var(--soc-num) * 0.06));
}

@supports (text-box-trim: trim-both) {
  .soc-ring-value {
    transform: none;
  }

  .soc-ring-pair {
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
  }
}

/* Inline pair keeps the real text space; the grid only centres it. */
.soc-ring-pair {
  display: inline;
  white-space: nowrap;
}

.soc-ring-value strong {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-size: var(--soc-num);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-value);
}

.soc-ring-value em {
  font: 500 calc(var(--soc-num) * 0.6)/1 var(--font);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  color: var(--text-unit);
}

.soc-readout {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.soc-range-hero {
  display: flex;
  align-items: baseline;
  gap: 0.14em;
  line-height: 0.9;
}

.soc-range-hero strong {
  font-size: var(--soc-range);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text-value);
  text-shadow: 0 0 2cqw rgba(56, 189, 248, 0.14);
}

.soc-range-hero em {
  font: 500 calc(var(--soc-range) * 0.6)/1 var(--font);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  color: var(--text-unit);
}

/* Caption above a value: never let the caption's box touch the hero's box.
   The clearance is part of the reading-row rule (see design-system.html). */
.soc-range-label {
  margin: 0 0 var(--caption-gap);
  font-size: var(--soc-label);
  color: var(--muted);
}

.soc-meta {
  display: flex;
  margin: 0.55em 0 0;
}

.soc-limit {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  line-height: 1.3;
  font-size: var(--soc-meta);
  font-weight: 500;
  color: var(--muted);
}

.soc-limit i {
  width: 0.72em;
  height: 0.72em;
  border: 0.14em solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 0.6em rgba(56, 189, 248, 0.45);
}

.soc-limit b {
  font: 500 var(--soc-meta)/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--text-value);
}

.soc-limit em {
  font-style: normal;
  color: var(--text-unit);
}

.soc-limit-val {
  display: inline;
  white-space: nowrap;
}

/* ---------- Shared screen primitives ---------- */

/* Card-header caption, in-car surfaces. Same step and optical weight as the
   desktop .micro and the mobile .m-label: 600 at 0.02em. Tracking was the
   only place the cockpit header read lighter than the same caption
   elsewhere. */
.micro {
  font: 600 0.78cqw/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.micro.is-cyan {
  color: var(--cyan);
}

.micro.is-amber {
  color: var(--amber);
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--hair);
  border-radius: 1.1cqw;
  background: var(--glass);
  box-shadow:
    0 1.4cqw 3.4cqw -1.8cqw rgba(0, 0, 0, 0.92),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(1.1cqw);
  -webkit-backdrop-filter: blur(1.1cqw);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(160, 210, 255, 0.28), transparent);
  pointer-events: none;
}

/* ---------- Narrow viewports ---------- */

@media (max-width: 840px) {
  .display-nav {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 10px 12px;
  }

  .nav-context {
    display: none;
  }

  .display-stage {
    padding: 12px;
  }

  .hardware {
    padding: 5px;
    border-radius: 16px;
  }

  .screen {
    border-radius: 12px;
  }

  .display-foot {
    padding: 6px 16px 12px;
    font-size: 7.5px;
  }

  .display-foot .credit {
    display: none;
  }
}

@media (max-width: 560px) {
  .nav-links {
    gap: 14px;
    font-size: 8px;
  }

  .display-foot .meta {
    gap: 8px;
  }
}
