/* Skootr shared components, 2026. Needs tokens.css first.
   Used by guidelines.html and every page in site-2026. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 6rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--step-1)/var(--lh-body) var(--font-text);
  overflow-wrap: break-word;
}
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 {
  margin: 0;
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 850;
  line-height: var(--lh-snug);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--step-5); line-height: 1.02; }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-3); font-weight: 800; }
h4 { font-size: var(--step-2); font-weight: 750; letter-spacing: 0; }
p, ul, ol, dl, figure, blockquote { margin: 0; }
p { text-wrap: pretty; }
a { color: var(--link); text-decoration-thickness: 0.09em; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 0.16em; }
strong, b { font-weight: 700; }
::selection { background: var(--tint-strong); color: var(--text); }

/* One focus style everywhere: thick ink ring with a white gap, visible on
   white, mist, puff, teal and headlight. Dark surfaces flip it to white. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--focus-gap);
  border-radius: 6px;
}
.on-night :focus-visible, .on-night:focus-visible { outline-color: var(--white); box-shadow: 0 0 0 3px var(--code-bg); }

.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--s-4); top: -6rem; z-index: 100;
  padding: var(--s-3) var(--s-5);
  background: var(--solid); color: var(--on-solid);
  font-weight: 700; text-decoration: none; border-radius: var(--r-pill);
}
.skip:focus { top: var(--s-4); }

.wrap {
  width: 100%;
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.flow > * + * { margin-top: var(--flow, 1em); }
.lede { font-size: var(--step-2); line-height: 1.5; max-width: 36em; }
.muted { color: var(--text-muted); }
.small { font-size: var(--step--1); }

/* ---------- Buttons ----------
   Pills. The headlight button is the one orange thing in any view.
   A chunky key on the handlebar: raised at rest, lifts on hover, presses flat. */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 3rem; padding: 0.65rem 1.5rem;
  border: 0; border-radius: var(--r-pill);
  background: var(--tint); color: var(--on-tint);
  font: 750 var(--step-1)/1.2 var(--font-display);
  text-decoration: none; cursor: pointer;
  --ledge: rgb(0 0 0 / 0.22);
  box-shadow: inset 0 -4px 0 var(--ledge);
  transition: transform var(--t-quick) var(--ease-putt), box-shadow var(--t-quick), background-color var(--t-quick);
}
.btn:hover { transform: translateY(-2px); background: var(--tint-strong); box-shadow: inset 0 -6px 0 var(--ledge); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ledge); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--focus-gap), inset 0 -4px 0 var(--ledge); }
.btn--go { background: var(--action); color: var(--action-text); }
.btn--go:hover { background: var(--action-hover); }
.btn--ink { --ledge: rgb(128 128 128 / 0.5); background: var(--solid); color: var(--on-solid); }
.btn--ink:hover { background: var(--solid-hover); }
.btn--plain { background: var(--white); color: var(--ink); }
.btn--plain:hover { background: var(--teal-mist); }
.btn--small { min-height: var(--target); padding: 0.45rem 1.1rem; font-size: var(--step-0); }
.btn--wide { width: 100%; }
/* Ride along: RESERVED, see ADR 0055. Select scenarios only, one per view at most. Markup inside the button:
   <span class="btn__rider" aria-hidden="true"><img class="only-light" ...><img class="only-dark" ...></span> */
.btn__rider { display: none; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .btn__rider { display: block; position: absolute; bottom: calc(100% - 4px); left: 1rem; right: 1rem; pointer-events: none; }
  .btn__rider img { position: relative; left: 0; width: 2.9rem; max-width: none; opacity: 0; transition: left 0.9s var(--ease-roll), opacity 0.2s; }
  .btn--ride:hover .btn__rider img, .btn--ride:focus-visible .btn__rider img { left: calc(100% - 2.9rem); opacity: 1; }
}

.textlink {
  display: inline-flex; align-items: center; min-height: var(--target);
  color: var(--link); font-weight: 700;
}

/* ---------- Stickers ----------
   Rally stickers on a legshield. Each one parks at its own small angle. */
.stickers { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-3); padding: 0; list-style: none; align-items: center; }
.sticker {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 0.7rem 1.35rem;
  border-radius: var(--r-pill);
  background: var(--teal-wash); color: var(--ink);
  font: 800 var(--step-2)/1.1 var(--font-display);
  transform: rotate(var(--tilt, -2deg));
}
.sticker--teal { background: var(--teal); color: var(--ink); }
.sticker--ink { background: var(--solid); color: var(--on-solid); }
.sticker--deep { background: var(--select); color: var(--on-select); }
.sticker--dust { background: var(--dust); color: var(--ink); }
.sticker--puff { background: var(--puff); color: var(--teal-ink); }
.sticker--egg { border-radius: var(--r-egg); padding: 1.1rem 1.6rem; }
.sticker--slab { border-radius: var(--r-m); }
.sticker--big { font-size: var(--step-3); padding: 1rem 1.8rem; }

/* ---------- Forms ---------- */
.field { display: grid; gap: var(--s-2); }
.field > label, .field > .label { font-weight: 700; }
.field .hint { color: var(--text-muted); font-size: var(--step--1); }
.input, .select {
  width: 100%; min-height: 3.25rem; padding: 0.7rem 1rem;
  border: 2px solid var(--border); border-radius: var(--r-s);
  background: var(--surface); color: var(--text);
  font: 400 var(--step-1)/1.3 var(--font-text);
}
.select {
  appearance: none; -webkit-appearance: none; padding-right: 2.75rem;
  background-image: var(--select-arrow);
  background-repeat: no-repeat; background-position: right 1rem center; background-size: 0.9rem;
}
.input::placeholder { color: var(--text-muted); opacity: 1; }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input[aria-invalid="true"] { border-color: var(--error); border-width: 3px; background: var(--error-bg); }
.field .error { display: flex; gap: var(--s-2); align-items: flex-start; color: var(--error); font-weight: 700; font-size: var(--step-0); }
.field .error::before { content: "!"; flex: none; display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: var(--r-egg); background: var(--error); color: var(--on-error); font: 900 0.9rem/1 var(--font-display); }
.check { display: grid; grid-template-columns: auto 1fr; gap: var(--s-3); align-items: start; min-height: var(--target); padding-block: var(--s-2); }
.check input {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 1.75rem; height: 1.75rem; border: 2px solid var(--border); border-radius: 0.5rem; background: var(--surface);
  display: grid; place-items: center; cursor: pointer;
}
.check input::after { content: ""; width: 0.95rem; height: 0.5rem; border-left: 4px solid var(--on-select); border-bottom: 4px solid var(--on-select); border-radius: 2px; transform: rotate(-45deg) translate(1px, -2px) scale(0); transition: transform var(--t-quick) var(--ease-putt); }
.check input:checked { background: var(--select); border-color: var(--select); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -2px) scale(1); }
.notice {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s-4); align-items: center;
  padding: var(--s-5); border-radius: var(--r-m);
  background: var(--tint); color: var(--text);
}
.notice__mark { width: 2.75rem; height: 2.5rem; border-radius: var(--r-egg); background: var(--teal); display: grid; place-items: center; }
.notice__mark::after { content: ""; width: 1.1rem; height: 0.6rem; border-left: 4px solid var(--white); border-bottom: 4px solid var(--white); border-radius: 2px; transform: rotate(-45deg) translate(1px, -2px); }

/* ---------- Callout: a note with a plain egg marker, not a card with a rail ---------- */
.callout {
  position: relative; padding: var(--s-5) var(--s-5) var(--s-5) 4.25rem;
  border-radius: var(--r-m) var(--r-l) var(--r-m) var(--r-l);
  background: var(--band);
}
.callout::before {
  content: ""; position: absolute; left: 1.1rem; top: 1.35rem;
  width: 2.1rem; height: 1.8rem; border-radius: var(--r-egg);
  background: var(--exhaust);
}
.callout--tip { background: var(--tint); }
.callout--tip::before { background: var(--teal); border-radius: var(--r-egg-b); }

/* ---------- Code ---------- */
code, kbd, pre { font-family: var(--font-code); font-size: 0.9em; }
:not(pre) > code { padding: 0.12em 0.4em; border-radius: 0.4em; background: var(--tint); color: var(--on-tint); font-weight: 500; }
.code {
  border-radius: var(--r-m); background: var(--code-bg); color: var(--white);
  overflow: hidden;
}
.code__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-2) var(--s-2) 0 var(--s-5); }
.code__name { color: var(--teal-soft); font: 500 var(--step--1)/1.2 var(--font-code); }
.code__copy {
  min-height: var(--target); min-width: var(--target); padding: 0.4rem 1rem;
  border: 0; border-radius: var(--r-pill); background: var(--code-btn); color: var(--white);
  font: 700 var(--step--1)/1 var(--font-display); cursor: pointer;
}
.code__copy:hover { background: var(--code-btn-hover); }
.code pre { margin: 0; padding: var(--s-4) var(--s-5) var(--s-5); overflow-x: auto; font-size: var(--step--1); line-height: 1.7; tab-size: 2; }
.code .c { color: var(--teal-soft); }       /* comment */
.code .s { color: var(--headlight); }       /* string */
.code .k { color: var(--teal-wash); font-weight: 700; }  /* keyword */

/* ---------- Questions: native details ---------- */
.questions { border-top: 3px solid var(--rule); }
.questions details { border-bottom: 3px solid var(--rule); }
.questions summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-5);
  min-height: 4rem; padding: var(--s-4) 0;
  color: var(--heading); font: 750 var(--step-2)/1.25 var(--font-display);
  cursor: pointer; list-style: none;
}
.questions summary::-webkit-details-marker { display: none; }
.questions summary::after {
  content: ""; flex: none; width: 2.5rem; height: 2.25rem; border-radius: var(--r-egg);
  background:
    linear-gradient(var(--on-tint), var(--on-tint)) center / 1rem 4px no-repeat,
    linear-gradient(var(--on-tint), var(--on-tint)) center / 4px 1rem no-repeat,
    var(--tint);
  transition: transform var(--t-move) var(--ease-putt);
}
.questions details[open] summary::after {
  background: linear-gradient(var(--on-select), var(--on-select)) center / 1rem 4px no-repeat, var(--select);
  transform: rotate(180deg);
}
.questions details > div { padding: 0 3.5rem var(--s-5) 0; max-width: var(--measure); }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: var(--s-3) var(--s-4); text-align: left; vertical-align: top; border-bottom: 2px solid var(--rule); }
thead th { font: 800 var(--step-0)/1.2 var(--font-display); color: var(--heading); border-bottom: 3px solid var(--border-strong); }

/* ---------- Supporting art: parcels and puffs ---------- */
.art { overflow: visible; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .btn:hover, .btn:active { transform: none; }
}

/* ---------- Print and forced colors ---------- */
@media print {
  /* Keep fills when printing; white text on a dropped fill would vanish */
  html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { font-size: 11pt; }
  a { text-decoration: underline; }
}
@media (forced-colors: active) {
  .btn, .sticker, .callout, .notice, .code, .input, .select, .check input { border: 2px solid CanvasText; }
  .check input:checked { background: Highlight; }
  .questions summary::after { forced-color-adjust: none; }
  :focus-visible { outline: 3px solid Highlight; box-shadow: none; }
}
