/* core.css: WS1 core engine (HUD, toys, verb cursor, hints, fit, fonts gate, tone cuts) */

/* ---------- boot gates ---------- */

.core-probe {
  position: absolute; top: 0; left: 0;
  width: var(--gutter); height: 0;
  visibility: hidden; pointer-events: none;
}

/* Display lines stay hidden until the fonts gate has fitted them. */
html.fonts-pending :is(.title, .thing .w, .finale-line) { visibility: hidden; }

/* No-flash pre-roll: an ink page, main hidden, HUD visible at 0 m. */
html.preroll-pending body { background-color: var(--ink); color: var(--paper); transition: none; }
html.preroll-pending main,
html.preroll-pending .ruler { visibility: hidden; }

/* Tone changes are cuts (the blade and the impact are the visible events). */
html.tone-cut body { transition: none !important; }
html.tone-quick body { transition: background-color .12s linear, color .12s linear !important; }

/* Fit: no transitions while fitting (reduced motion's .01ms would animate font-size). */
html[data-fitting] [data-fit],
html[data-fitting] [data-fit] *,
html[data-fitting] [data-fit] *::before,
html[data-fitting] [data-fit] *::after { transition: none !important; }
/* Fit passes 1-2 measure at rest: no transforms, intrinsic width. */
html[data-measure] [data-fit] {
  width: max-content !important;
  max-width: none !important;
  transform: none !important;
  translate: none !important;
  rotate: none !important;
  scale: none !important;
}

/* ---------- HUD: the instrument ---------- */

.hud-top { align-items: flex-start; }
.hud-mark { line-height: 1.1; }

.hud-instr {
  display: flex; flex-direction: column; align-items: flex-end;
  text-align: right;
}
.hud-depth {
  font-family: var(--flex);
  font-size: 15px; font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  font-variation-settings: "wdth" 100, "wght" 560, "opsz" 14;
  white-space: nowrap;
}
.hud-bar {
  position: relative;
  align-self: stretch;
  height: 1px; margin: 5px 0 5px;
  background: color-mix(in srgb, currentColor 18%, transparent);
}
.hud-bar i {
  position: absolute; inset: 0;
  background: currentColor;
  transform-origin: right center;
  transform: scaleX(0);
}
.hud-read {
  display: flex; flex-direction: column; align-items: flex-end;
  font-size: 10px; line-height: 1.4;
  opacity: .78;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.hud-controls {
  display: flex; align-items: baseline; justify-content: flex-end;
  gap: 14px;
  margin-top: 7px;
  font-size: 10px;
  pointer-events: auto;
}
.hud-controls:empty { display: none; }
.hud-controls > span:empty { display: none; }
.hud-controls button {
  appearance: none; -webkit-appearance: none;
  background: none; border: 0; border-radius: 0;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
  /* 44 px hit area around 10 px type */
  padding: 16px 8px; margin: -16px -8px;
  cursor: pointer;
  white-space: nowrap;
}
.hud-controls button[aria-pressed="false"] { opacity: .55; }
.hud-keys-wrap { position: relative; }
.hud-keys-tip {
  position: absolute; top: calc(100% + 14px); right: -4px;
  padding: 7px 9px;
  background: var(--ink); color: var(--paper);
  white-space: pre; text-align: left; line-height: 1.6;
  opacity: 0; visibility: hidden;
  transition: opacity .15s, visibility 0s .15s;
  pointer-events: none;
}
body[data-tone="ink"] .hud-keys-tip { background: var(--paper); color: var(--ink); }
.hud-keys-wrap:hover .hud-keys-tip,
.hud-keys:focus-visible + .hud-keys-tip { opacity: 1; visibility: visible; transition: opacity .15s; }

@media (max-width: 720px) {
  .hud-depth { font-size: 14px; }
  .hud-keys-tip { white-space: normal; width: max-content; max-width: 62vw; }
}

/* ---------- hero meta: phone copy variant ---------- */
.hm-short { display: none; }
@media (max-width: 720px) {
  .hm-long { display: none; }
  .hm-short { display: inline; }
  .fa-left { display: none; }
}

/* ---------- toys, focus ---------- */

.toy {
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}
:where(a, button, input, select, textarea, summary, [tabindex], .toy):focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 6px;
}
body[data-tone="signal"] :where(a, button, input, select, textarea, summary, [tabindex], .toy):focus-visible {
  outline-color: var(--ink);
}
/* HUD controls carry a 44 px padded hit area: keep their ring tight to the label */
.hud-controls button:focus-visible { outline-offset: -6px; }

/* ---------- verb cursor (fine pointers only; created by core) ---------- */

.verb {
  position: fixed; left: 0; top: 0;
  z-index: 60;
  padding: 3px 6px 2px;
  font-size: 10px;
  background: var(--ink); color: var(--paper);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s linear;
}
.verb.on { opacity: 1; }
body[data-tone="ink"] .verb { background: var(--paper); color: var(--ink); }
body[data-tone="signal"] .verb { background: var(--ink); color: var(--signal); }

/* ---------- hints (created by core.hint) ---------- */

.hint {
  margin-left: 1.6em;
  opacity: 0;
  transition: opacity .6s ease;
  font-variant-numeric: tabular-nums;
}
.hint.on { opacity: var(--hint-o, .6); }
/* labels that already sit at reduced opacity: keep the hint at about .6 overall */
:is(.hero-kicker, .stairs-pin > .label, .gravity-pin > .label, .finale-copy > .label) .hint { --hint-o: 1; }

/* ---------- layout fixes owned by core (C2) ---------- */

.gravity-pin,
.finale-copy { padding-top: max(64px, 8vh); }
