/* Jimmy's Ride — design system, typography chapter.
   Standalone: no shared stylesheet, no webfonts, no external assets. */

:root {
  --bg: #05070c;
  --bg-soft: #080d16;
  --ink: #e8f1fb;
  --ink-dim: #a3b5c9;
  --muted: #71839a;
  --cyan: #38bdf8;
  --cyan-soft: rgba(56, 189, 248, 0.1);
  --hair: rgba(122, 174, 255, 0.16);
  --hair-strong: rgba(122, 174, 255, 0.3);
  --glass: linear-gradient(155deg, rgba(17, 28, 43, 0.7), rgba(6, 11, 19, 0.55));
  --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);
  --amber: #ffc46b;
  --danger: #ff6b5a;
  --tag-ok-bg: #0b241d;
  --tag-ok-line: #2fbf8f;
  --tag-ok-ink: #a9e6cf;

  /* Semantic text colours — same five tokens as styles.css and
     experience/base.css, resolving to this page's own ink/ink-dim/muted. */
  --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 experience/base.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 */

  /* Fixed header. The bar stays in flow (sticky), so it never covers the
     first line at load; its height is also the anchor offset. */
  --ds-head-h: 63px;
}

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

html {
  background: var(--bg);
  /* Anchor jumps stop below the fixed bar with a 20 px breath, never under
     the title they point at. */
  scroll-padding-top: calc(var(--ds-head-h) + 20px);
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(80% 55% at 50% 0%, rgba(10, 92, 170, 0.16), transparent 66%),
    linear-gradient(180deg, #05070c 0%, #060a11 52%, #05070c 100%);
}

::selection {
  background: rgba(56, 189, 248, 0.26);
}

a {
  color: inherit;
  text-decoration: none;
}

.ds-wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

/* ---------- Header ---------- */

.ds-head {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--hair);
  background: rgba(5, 7, 12, 0.92);
  box-shadow: 0 12px 28px -24px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.ds-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}

/* The way back sits at the leading edge of the bar, where a reader starts
   scanning and where a browser's own back control would be. */
.ds-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ds-head-div {
  width: 1px;
  height: 16px;
  flex: none;
  background: var(--hair);
}

.ds-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  color: var(--muted);
  font: 500 12px/1 var(--font);
  white-space: nowrap;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.ds-back svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.ds-back:hover {
  color: var(--cyan);
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.ds-back:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.ds-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.ds-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--cyan);
  flex: none;
}

.ds-mark svg {
  width: 20px;
  height: 20px;
}

.ds-sub {
  font: 500 10px/1 var(--font);
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.ds-back {
  font-size: 12px;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.ds-back:hover {
  color: var(--cyan);
}

/* ---------- Hero ---------- */

.ds-hero {
  padding: clamp(44px, 7vw, 92px) 0 clamp(30px, 4vw, 48px);
}

.ds-kicker {
  margin: 0 0 14px;
  font: 600 10px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.ds-hero h1 {
  margin: 0;
  font-size: clamp(38px, 5.4vw, 64px);
  font-weight: 250;
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--text-value);
}

.ds-lede {
  max-width: 720px;
  margin: 22px 0 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-dim);
}

.ds-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

/* Page facts are labels too: no pill outline, no fill, no control shape. */
.ds-chip {
  font: 500 10px/1 var(--font);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ds-chip + .ds-chip::before {
  content: "·";
  margin-right: 6px;
  color: rgba(154, 172, 192, 0.45);
}

/* ---------- Sections ---------- */

.ds-section {
  padding: clamp(42px, 6vw, 74px) 0;
  border-top: 1px solid rgba(122, 174, 255, 0.1);
}

.ds-section-head {
  margin-bottom: clamp(22px, 3vw, 34px);
}

.ds-section-head h2 {
  margin: 0;
  font-size: clamp(24px, 2.8vw, 34px);
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.ds-h3 {
  margin: 40px 0 16px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.ds-grid {
  display: grid;
  gap: 16px;
}

.ds-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ds-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ds-card {
  min-width: 0;
  padding: 22px 22px 20px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.ds-card-label {
  display: block;
  margin-bottom: 16px;
  font: 600 9.5px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* Breathing-space specimen: the same projected block, inset vs pinned. */
.bs-spec {
  margin: 0 0 14px;
  padding: 10px;
  border: 1px dashed rgba(122, 174, 255, 0.22);
  border-radius: 12px;
  background: rgba(4, 9, 16, 0.55);
}

.bs-spec-panel {
  display: flex;
  /* Stays centred: this specimen demonstrates the 16 px vertical inset, and
     a baseline row would lift the 44 px numeral's ink to 11 px of the border,
     under the clearance floor. Production reading rows use baseline. */
  align-items: center;
  gap: 10px;
  min-height: 92px;
  border: 1px solid rgba(122, 174, 255, 0.24);
  border-radius: 8px;
  background: linear-gradient(150deg, rgba(14, 25, 40, 0.9), rgba(5, 10, 18, 0.8));
}

.bs-spec-panel em {
  font: 500 13px/1 var(--font);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  color: var(--text-unit);
}

.bs-spec-panel b {
  margin-left: auto;
  font: 500 20px/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.bs-spec-speed {
  font: 200 44px/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.bs-spec--ok .bs-spec-panel {
  padding: 16px;
}

/* Rejected: no padding at all, so the block runs into the top and bottom. */
.bs-spec--bad .bs-spec-panel {
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
  padding: 0;
  border-color: rgba(255, 107, 90, 0.55);
  background: rgba(255, 107, 90, 0.05);
}

.bs-spec--bad .bs-spec-speed {
  font-size: 56px;
  line-height: 0.8;
}

.bs-spec--bad .bs-spec-panel b {
  margin-left: 0;
  align-self: flex-end;
}

.ds-note-small {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.family-sample {
  margin: 0 0 16px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.family-display {
  font-size: 30px;
  font-weight: 250;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.family-read {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-value);
  font-variant-numeric: tabular-nums;
}

.family-text {
  font-size: 19px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-prose);
  font-variant-numeric: tabular-nums;
}

.family-mono {
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.family-copy {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
}

/* A font stack is documentation prose, not a value: sans and prose ink. */
.family-copy code {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-prose);
  overflow-wrap: anywhere;
}

.family-note,
.ds-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-prose);
}

.ds-note {
  margin-top: 20px;
  padding-left: 14px;
  border-left: 1px solid var(--hair-strong);
}

/* ---------- Tables ---------- */

.ds-table-wrap {
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: rgba(8, 14, 24, 0.45);
  overflow: hidden;
}

.scale-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.scale-table th {
  padding: 12px 9px;
  border-bottom: 1px solid var(--hair-strong);
  font: 600 9.5px/1.25 var(--font);
  letter-spacing: 0.04em;
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}

.scale-table td {
  padding: 11px 9px;
  border-bottom: 1px solid rgba(122, 174, 255, 0.08);
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-dim);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.scale-table tr:last-child td {
  border-bottom: 0;
}

.scale-table td strong {
  font-weight: 600;
  color: var(--ink);
}

.scale-table td:first-child {
  color: var(--ink);
}

.scale-table th:nth-child(1),
.scale-table td:nth-child(1) {
  width: 12%;
}

.scale-table th:nth-child(2),
.scale-table td:nth-child(2) {
  width: 7%;
}

.scale-table th:nth-child(3),
.scale-table td:nth-child(3) {
  width: 7%;
}

.scale-table th:nth-child(4),
.scale-table td:nth-child(4) {
  width: 7%;
}

.scale-table th:nth-child(5),
.scale-table td:nth-child(5) {
  width: 9%;
}

.scale-table th:nth-child(6),
.scale-table td:nth-child(6) {
  width: 9%;
}

.scale-table th:nth-child(7),
.scale-table td:nth-child(7) {
  width: 10%;
}

.scale-table th:nth-child(8),
.scale-table td:nth-child(8) {
  width: 24%;
}

.scale-table th:nth-child(9),
.scale-table td:nth-child(9) {
  width: 13%;
}

.rationale th:nth-child(1),
.rationale td:nth-child(1) {
  width: 13%;
}

.rationale th:nth-child(2),
.rationale td:nth-child(2) {
  width: 14%;
}

.rationale th:nth-child(3),
.rationale td:nth-child(3) {
  width: 16%;
}

.rationale th:nth-child(4),
.rationale td:nth-child(4) {
  width: 12%;
}

.rationale th:nth-child(5),
.rationale td:nth-child(5) {
  width: 11%;
}

.rationale th:nth-child(6),
.rationale td:nth-child(6) {
  width: 11%;
}

.rationale th:nth-child(7),
.rationale td:nth-child(7) {
  width: 13%;
}

.rationale th:nth-child(8),
.rationale td:nth-child(8) {
  width: 10%;
}

/* Density table: surface, padding, radius, eyebrow, value, chip, status. */

.density th:nth-child(1),
.density td:nth-child(1) {
  width: 11%;
}

.density th:nth-child(2),
.density td:nth-child(2) {
  width: 13%;
}

.density th:nth-child(3),
.density td:nth-child(3) {
  width: 11%;
}

.density th:nth-child(4),
.density td:nth-child(4) {
  width: 17%;
}

.density th:nth-child(5),
.density td:nth-child(5) {
  width: 15%;
}

.density th:nth-child(6),
.density td:nth-child(6) {
  width: 16%;
}

.density th:nth-child(7),
.density td:nth-child(7) {
  width: 17%;
}

/* ---------- Unified language specimens ---------- */

.ds-lede--tight {
  margin-top: 0;
  margin-bottom: 26px;
}

.ds-demo-card {
  padding: 13px 16px 14px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.ds-demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ds-demo-micro {
  font: 600 9.5px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.ds-demo-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 13px 0 6px;
  font-size: 34px;
  font-weight: 300;
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--text-value);
  font-variant-numeric: tabular-nums;
}

.ds-demo-value em {
  font: 500 10px/1 var(--font);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  color: var(--text-unit);
}

.ds-demo-foot {
  margin: 0;
  font-size: 10.5px;
  color: var(--muted);
}

.ds-demo-foot b {
  font: 500 10.5px/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
}

.ds-demo-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* Battery specimen — identical component to the live surfaces, at desktop
   scale. The charge sits in the ring, range is the hero figure, and the
   ring marker shows the 80% limit. */
.ds-soc {
  --soc-ring: 66px;
  --soc-gap: 12px;
  --soc-num: 17px;
  --soc-pct: 8.5px;
  --soc-range: 30px;
  --soc-unit: 10px;
  --soc-label: 10.5px;
  --soc-meta: 9.5px;
  margin-top: 8px;
}

/* Ring with its limit under it on the left, the range readout centred
   against it on the right, and the two supplementary readings as one footnote
   row under the band reaching both card edges — the same card as the desktop
   rail, the mobile card and the in-car card. The charge plan is its own card
   (.ds-next-body). */
.ds-battery-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: start;
  column-gap: 24px;
  row-gap: var(--soc-gap);
}

.ds-battery-band > .soc-ring {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
}

.ds-battery-band > .soc-readout {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: start;
}

.ds-battery-band > .energy-notes {
  grid-column: 1 / -1;
  grid-row: 2;
  flex-direction: row;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: var(--soc-gap);
}

.ds-card .energy-notes {
  --energy-note-size: 9.5px;
}

/* Next charge body — the standalone card's plan lines, no divider because
   it no longer sits beside the ring. */
.ds-next-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-top: 8px;
  min-width: 0;
}

.ds-bs-time {
  margin: 2px 0 3px;
  font: 300 13px/1 var(--font);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text-value);
}

/* “Ready by” shares the plan line, anchored right; the time above keeps its
   left edge. */
.ds-next-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.ds-bs-line {
  font: 400 9.5px/1.35 var(--font);
  color: var(--text-prose);
  white-space: nowrap;
}

.ds-bs-line b {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-value);
}

.ds-bs-line em {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  color: var(--text-unit);
}

.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;
}

/* Unfiltered glow stroke, matching the live surfaces. */
.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: 1px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.soc-ring-value strong {
  font-size: var(--soc-num);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text-value);
}

.soc-ring-value em {
  font: 500 var(--soc-pct)/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: 5px;
  line-height: 0.9;
}

.soc-range-hero strong {
  font-size: var(--soc-range);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text-value);
}

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

.soc-range-label {
  margin: 0 0 var(--caption-gap);
  font-size: var(--soc-label);
  color: var(--muted);
}

/* The limit is the readout's third line — marker + "Charge limit 80 %" on
   one line, meta size, hanging from the same left edge as the range. */
.soc-limit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  font-size: var(--soc-meta);
  line-height: 1.3;
  color: var(--muted);
}

.soc-limit-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.soc-limit i {
  width: 6px;
  height: 6px;
  border: 1.5px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(56, 189, 248, 0.5);
}

.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;
}

.ds-demo-statusrow {
  gap: 22px;
  padding: 6px 0 2px;
}

/* The specimen sits at content height next to a taller neighbour: no
   stretched card, no dead space under the rules. */
#status-control {
  align-self: start;
}

/* Status is a bare label; a whole-card verdict adds .is-chip, the same
   hairline pill the shipped surfaces use. The only control on this page that
   wears a control shape is the real button below. */
.ds-status {
  display: inline-flex;
  align-items: center;
  font: 600 10px/1 var(--font);
  letter-spacing: 0.02em;
}

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

.ds-status.is-quiet {
  color: var(--muted);
}

.ds-status.is-chip {
  padding: 2px 7px;
  border: 1px solid rgba(122, 174, 255, 0.24);
  border-radius: 999px;
  background: rgba(122, 174, 255, 0.07);
}

.ds-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);
}

/* The interactive counterpart: a real button, with a control shape and
   the cursor and hover affordances a status never has. */
.ds-control {
  appearance: none;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid rgba(56, 189, 248, 0.46);
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--cyan);
  font: 600 10px/1 var(--font);
  letter-spacing: 0.06em;
  cursor: pointer;
}

.ds-control:hover {
  border-color: rgba(56, 189, 248, 0.72);
  background: rgba(56, 189, 248, 0.2);
}

.ds-control:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.ds-icon-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 0 4px;
}

.ds-icon {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--cyan);
}

.ds-rules {
  margin: 18px 0 0;
  padding-left: 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.ds-rules li {
  margin-bottom: 7px;
}

.ds-rules li:last-child {
  margin-bottom: 0;
}

.ds-rules code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
}

/* ---------- Specimens ---------- */

.spec {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: rgba(8, 14, 24, 0.42);
}

.spec-tag {
  font: 600 9.5px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.spec-sample {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.spec-meta {
  margin-top: auto;
  font: 500 10.5px/1.4 var(--font);
  letter-spacing: 0.01em;
  color: var(--muted);
}

.hero {
  font-size: 22px;
  font-weight: 350;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.page {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 30px;
  font-weight: 300;
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.page .spec-unit {
  font-size: 0.33em;
}

.section {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.u {
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  color: var(--text-unit);
  margin-left: 0 !important;
}

.spec-unit {
  font: 500 0.28em/1 var(--font);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text-unit);
}

.section .spec-unit {
  font-size: 0.5em;
}

.mspec .spec-unit {
  font-size: 0.47em;
}

.body {
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--ink-dim);
}

.note {
  font: 400 10.5px/1.45 var(--font);
  letter-spacing: 0.01em;
  color: var(--muted);
}

.note b {
  font: 500 10.5px/1 var(--font);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
}

.micro {
  font: 600 9.5px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.nav {
  font: 600 10px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--cyan);
}

.cinema {
  font-size: 19.9px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.cvalue {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font: 500 35.5px/1 var(--font);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.ctitle {
  font-size: 20.2px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.clabel {
  font-size: 16.3px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
}

.ctag {
  display: inline-flex;
  align-self: flex-start;
  font: 600 13.8px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--tag-ok-ink);
}

.mtitle {
  font-size: 36px;
  font-weight: 250;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.mcard {
  font-size: 11.3px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.mbody {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-dim);
}

.mmicro {
  font: 600 11.3px/1.2 var(--font);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.mspec {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 26.5px;
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hudval {
  font-size: 66px;
  font-weight: 200;
  line-height: 0.92;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.hudlab {
  font: 600 8.5px/1.2 var(--font);
  letter-spacing: 0.16em;
  color: var(--text-value);
}

/* ---------- Case rules ---------- */

.rule-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-dim);
}

.rule-list strong {
  font-weight: 600;
  color: var(--ink);
}

.rule-list code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
}

/* A unit symbol quoted as an example is still a unit: it renders in the
   unit ink, like the readings it describes, not in the code accent. */
.ds-rules code.u,
.rule-list code.u,
.ds-note code.u {
  color: var(--text-unit);
}

.case-pair {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(122, 174, 255, 0.08);
  font: 500 11px/1.4 var(--font);
  letter-spacing: 0.04em;
}

.case-pair:last-of-type {
  border-bottom: 0;
}

.case-pair .before {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(255, 107, 90, 0.55);
}

.case-pair .arrow {
  color: var(--muted);
}

.case-pair .after {
  color: var(--cyan);
}

.allow {
  border-color: rgba(56, 189, 248, 0.28);
}

.reject {
  border-color: rgba(255, 107, 90, 0.24);
}

.ds-math {
  margin-top: 16px;
}

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

.ds-foot {
  margin-top: clamp(30px, 5vw, 60px);
  border-top: 1px solid var(--hair);
}

.ds-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  font: 500 10px/1.5 var(--font);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ds-foot-row a {
  color: var(--ink-dim);
}

.ds-foot-row a:hover {
  color: var(--cyan);
}

/* ---------- Colour section ---------- */

.colour-table th:nth-child(1),
.colour-table td:nth-child(1) {
  width: 17%;
}

.colour-table th:nth-child(2),
.colour-table td:nth-child(2) {
  width: 19%;
}

.colour-table th:nth-child(3),
.colour-table td:nth-child(3) {
  width: 13%;
}

.colour-table th:nth-child(4),
.colour-table td:nth-child(4) {
  width: 29%;
}

.colour-table th:nth-child(5),
.colour-table td:nth-child(5) {
  width: 22%;
}

.scale-table td code {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.token-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: 1px;
}

.token-swatch.is-value { background: var(--text-value); }
.token-swatch.is-unit { background: var(--text-unit); }
.token-swatch.is-label { background: var(--text-label); }
.token-swatch.is-prose { background: var(--text-prose); }
.token-swatch.is-live { background: var(--text-live); }
.token-swatch.is-ok { background: var(--tag-ok-bg); box-shadow: inset 0 0 0 1px var(--tag-ok-line); }
.token-swatch.is-warn { background: var(--amber); }
.token-swatch.is-danger { background: var(--danger); }

.colour-sample {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px 28px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--hair);
  border-radius: 14px;
  background: rgba(8, 14, 24, 0.45);
}

.cs-pair {
  display: inline-block;
  white-space: nowrap;
}

.cs-value {
  font: 300 28px/1 var(--font);
  letter-spacing: -0.02em;
  color: var(--text-value);
}

.cs-unit {
  font: 500 11px/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--text-unit);
}

.cs-label {
  font: 600 10px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--text-label);
}

.cs-prose {
  font: 400 12.5px/1.4 var(--font);
  color: var(--text-prose);
}

/* A reading inside a prose sentence keeps the value ink. */
.cs-prose-value {
  font-weight: 400;
  color: var(--text-value);
}

.cs-ok {
  font: 600 10px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--tag-ok-ink);
}

/* ---------- Enforced colour rules & v0.4.14 rejections ---------- */

.enforce-table th:nth-child(1),
.enforce-table td:nth-child(1) { width: 13%; }

.enforce-table th:nth-child(2),
.enforce-table td:nth-child(2) { width: 14%; }

.enforce-table th:nth-child(3),
.enforce-table td:nth-child(3) { width: 13%; }

.enforce-table th:nth-child(4),
.enforce-table td:nth-child(4) { width: 14%; }

.enforce-table th:nth-child(5),
.enforce-table td:nth-child(5) { width: 46%; }

.ds-reject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.ds-reject-pair {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px dashed rgba(255, 107, 90, 0.3);
  border-radius: 10px;
  background: rgba(255, 107, 90, 0.04);
}

.ds-reject-line {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  font-size: 15px;
  line-height: 1.2;
}

.ds-reject-line--glued {
  gap: 0;
}

.ds-reject-label {
  font: 600 10px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--text-label);
}

.ds-reject-value {
  font: 300 22px/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--text-value);
}

.ds-reject-muted {
  font: 500 15px/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--text-prose);
}

.ds-reject-muted em {
  font-style: normal;
  color: var(--muted);
}

/* ---------- Reading rows & label order specimen ---------- */

.cs-warn {
  font: 600 10px/1 var(--font);
  letter-spacing: 0.08em;
  color: var(--amber);
}

/* Specimen rows size themselves to their content: a cell may never be
   narrower than the nowrap reading it holds, so the row wraps to a second
   line instead of letting one specimen's text run into the next one's.
   (v0.8.3 shipped three equal 1fr columns, which is exactly what happened.) */
.ds-reading-row,
.ds-kv-spec {
  display: flex;
  flex-wrap: wrap;
  column-gap: 8px;
  row-gap: 16px;
  margin: 14px 0 16px;
  padding: 16px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: rgba(8, 14, 24, 0.5);
}

.ds-reading-row > div,
.ds-kv-spec > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 auto;
  min-width: min-content;
}

.ds-reading-label {
  font: 600 9.5px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--text-label);
  white-space: nowrap;
}

.ds-reading-value {
  font: 300 26px/1 var(--font);
  letter-spacing: -0.01em;
  color: var(--text-value);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ds-reading-value em {
  font: 500 12px/1 var(--font);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  color: var(--text-unit);
}

.ds-kv-spec .ds-reading-value {
  font: 500 15px/1.2 var(--font);
  /* A state word in the value slot is a reading, like a number: value ink. */
  color: var(--text-value);
}

/* Caption-clearance specimen. The caption keeps --caption-gap of clear space
   above the value, so their text boxes can never intersect. */
.ds-caption-spec {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 14px 0 16px;
  padding: 16px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: rgba(8, 14, 24, 0.5);
}

.ds-caption-label {
  margin: 0 0 var(--caption-gap);
  font: 600 9.5px/1 var(--font);
  letter-spacing: 0.02em;
  color: var(--text-label);
}

.ds-caption-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font: 300 40px/1 var(--font);
  letter-spacing: -0.01em;
  color: var(--text-value);
  font-variant-numeric: tabular-nums;
}

.ds-caption-card {
  margin-top: 16px;
}

.ds-caption-value em {
  font: 500 11px/1 var(--font);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  color: var(--text-unit);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .ds-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scale-table th,
  .scale-table td {
    font-size: 11px;
  }
}

/* Two of the ladder's four specimens are 26 px readings. Below the width at
   which a card can hold both on one line, all four stack instead of leaving
   one long cell alone on a row and a half-empty row beneath it. */
@media (max-width: 1060px) {
  #card-ladder-card .ds-reading-row > div {
    flex-basis: 100%;
  }
}

@media (max-width: 760px) {
  .ds-grid-2,
  .ds-grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Specimen rows carry up to four readings and long strings. They wrap
     into as many lines as the content needs, so the documentation page
     never scrolls sideways and no two specimens share pixels. */
  .ds-reading-row .ds-reading-label,
  .ds-reading-row .ds-reading-value,
  .ds-kv-spec .ds-reading-label,
  .ds-kv-spec .ds-reading-value {
    white-space: normal;
  }

  /* The ladder specimen carries the energy line; the 1060 px block above
     already stacks its four steps. */

  .ds-head-row {
    min-height: 58px;
  }

  :root {
    --ds-head-h: 59px;
  }

  .ds-sub {
    display: none;
  }

  .ds-lede {
    font-size: 14px;
  }

  .ds-table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .scale-table,
  .scale-table tbody,
  .scale-table tr,
  .scale-table td {
    display: block;
    width: 100%;
  }

  .scale-table thead {
    display: none;
  }

  .scale-table tr {
    margin-bottom: 12px;
    padding: 14px 16px;
    border: 1px solid var(--hair);
    border-radius: 12px;
    background: rgba(8, 14, 24, 0.42);
  }

  .scale-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    width: auto !important;
    padding: 5px 0;
    border: 0;
    text-align: right;
  }

  .scale-table td:first-child {
    margin-bottom: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(122, 174, 255, 0.1);
    font-size: 13px;
  }

  .scale-table td::before {
    content: attr(data-label);
    flex: none;
    font: 600 9.5px/1.3 var(--font);
    letter-spacing: 0.06em;
    color: var(--muted);
    text-align: left;
  }

  .scale-table td:first-child::before {
    display: none;
  }

  .ds-foot-row {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    min-height: 76px;
    padding: 14px 0;
  }
}

@media (max-width: 400px) {
  .ds-wrap {
    padding: 0 18px;
  }

  .ds-head-row {
    gap: 10px;
  }

  .ds-back {
    font-size: 11px;
  }

  .ds-hero h1 {
    font-size: 34px;
  }

  .ds-card {
    padding: 18px 16px;
  }

  /* A 300 px track floor cannot fit a 320 px viewport; let the specimen
     column shrink instead of scrolling the page sideways. */
  .ds-reject-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Component specimens (section 10) ---------- */

.ds-orb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 16px 0 14px;
}

.ds-orb {
  display: block;
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.ds-orb.is-active {
  box-shadow:
    0 0 0 2px rgba(5, 7, 12, 0.92),
    0 0 0 3px rgba(56, 189, 248, 0.82),
    0 0 16px rgba(56, 189, 248, 0.5),
    var(--paint-rim);
}

.ds-media-demo {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 16px 0 14px;
}

.ds-media-label {
  font: 500 10px/1.2 var(--font);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.ds-track {
  display: block;
  height: 3px;
  margin-bottom: 6px;
  border-radius: var(--media-radius);
  background: var(--media-track);
  overflow: hidden;
}

.ds-track i {
  display: block;
  height: 100%;
  border-radius: var(--media-radius);
  background: var(--media-fill);
}

.ds-avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 14px;
}

.ds-avatar {
  display: block;
  flex: none;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--avatar-ring);
  border-radius: 50%;
  background: var(--avatar-wash);
  pointer-events: none;
}

.ds-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
