/* ==========================================================================
   ROS INFINITY - kit.css: reset, base and the shared components of every website page (V_FINAL section 4).
   Load order: tokens.css -> fonts.css -> kit.css -> page CSS (style.css / account.css / admin.css).
   Moved here (X50; each page file drops its copy): from style.css the reset, .cut, .btn*, .icon, .visually-hidden
   and .skip-link; from account.css .auth-card(+__hud), .field*, .input*, .check*, .seg*, .alert*, .badge*.
   Existing hooks are restyled, never renamed. Until a page file drops its copy, its later rule wins: harmless.

   House rules: tokens only. Nothing focusable is clipped: the chamfer is painted by ::before/::after, so focus
   rings, a toast moved into a <dialog> and child shadows stay whole. Motion animates transform and opacity only;
   every loop stops under prefers-reduced-motion and html[data-motion="paused"]. Status = icon + word.

   Public classes (M1 baseline; WP-18/19/22 build on these):
     .cut(--sm|--md|--xl|--feature)  knobs --cut --bw --bd --fill
     .btn(--primary|--ghost|--gold|--gold-line|--solid|--quiet|--danger|--icon|--sm|--lg|--block)
          states :disabled, [aria-disabled="true"], [aria-busy="true"] (+ .spin inside)
     .card(--lg|--glass|--blur|--feature|--danger|--media|--link) __head __eyebrow __title __text __media(--tall)
          __body __link (stretched link)
     .chip(--neutral|--silver|--ember|--gold|--ok|--warn|--info)  .chip__dot(--ok|--ember|--off)
     .badges  .badge(--md|--founder|--gold|--tester|--staff)  .tester-mark(--sm|--lg)
     .auth-card __hud  .field([data-state=checking|ok|error], --check) __top __label __link __msg __hint __caps
          __foot __count(.is-warn)  .input(--area) __icon __el(--mono) __btn __status(.st-ok .st-bad .spin)
     .check __input __box  .alert(--info|--ok|--warn|--gold)
     .seg(--3|--4; --n, --tab) __tab([aria-selected|aria-checked]) __thumb
     dialog.dialog([data-tone=danger|good|ok|gem|beta|gold|info]) __head __icon __title __body __actions __form
     .toast(--top; [data-tone=ok|info|warn|danger|error|gold|beta|gem]; .is-visible) __text __action
     ol.tracker(--vertical) > li.tracker__step(.is-done|.is-current|[aria-current="step"]|.is-next|.is-blocked)
          > .tracker__num + .tracker__body > .tracker__title .tracker__text .tracker__here
     .skel(--line; --w)  .eyebrow  .hud-num  .mono  .spin  .icon(--inf)  .visually-hidden  .skip-link
   ========================================================================== */

/* ---------- 1. Reset and base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--sp-2));   /* anchors and focus never land under the sticky bar */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink-0);
  color: var(--text-1);
  font: 400 var(--fs-body)/var(--lh-body) var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, video, canvas, picture { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: var(--lh-head); }
[hidden] { display: none !important; }
::selection { background: var(--ember-600); color: #fff; }
::placeholder { color: var(--text-3); opacity: 1; }
:focus-visible { outline: var(--focus); outline-offset: 3px; }

/* ---------- 2. Utilities ---------- */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--inf { width: 1.75em; }                              /* the i-infinity symbol (viewBox 30 27 180 66) is wide */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: var(--z-boot);
  padding: 10px var(--sp-4);
  background: var(--ember-600);                            /* white on ember-600 = 5.90:1 */
  color: #fff;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--dur-2) var(--ease-out);
}
.skip-link:focus { transform: none; }

.eyebrow {                                                 /* label style (3.2) */
  font: 600 var(--fs-label)/1.2 var(--font-cond);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-3);
}
.hud-num {                                                 /* the game HUD's bold italic condensed numerals */
  font-family: var(--font-cond);
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  letter-spacing: var(--track-display);
}
.mono { font-family: var(--font-mono); letter-spacing: .04em; }

.spin {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgb(255 255 255 / .16);
  border-top-color: var(--gold-300);
  border-radius: var(--r-pill);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 3. Chamfer engine (4.1) ----------
   Top-left + bottom-right corners cut like the logo letters. ::before paints the ring as an even-odd polygon (hollow,
   so fills may be translucent), ::after the fill, inset by the ring width. Knobs: --cut, --bw (ring width), --bd (ring
   paint: colour or gradient), --fill (colour or image layers). Never clip-path the element itself. */
.cut, .btn, .card, .chip, .badge, .auth-card, .input, .check__box, .seg, .alert {
  --cut: var(--cut-lg);
  --bw: 1px;
  --bd: var(--line-2);
  --fill: var(--ink-2);
  position: relative;
  isolation: isolate;
}
:is(.cut, .btn, .card, .chip, .badge, .auth-card, .input, .check__box, .seg, .seg__thumb, .alert, .dialog, .toast)::before,
:is(.cut, .btn, .card, .chip, .badge, .auth-card, .input, .check__box, .seg, .seg__thumb, .alert, .dialog, .toast)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
:is(.cut, .btn, .card, .chip, .badge, .auth-card, .input, .check__box, .seg, .seg__thumb, .alert, .dialog, .toast)::before {
  --i: calc(var(--cut) + var(--bw) * .414);              /* inner corner: the diagonal stays --bw thick */
  background: var(--bd);
  clip-path: polygon(evenodd,
    var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut), var(--cut) 0,
    var(--i) var(--bw), calc(100% - var(--bw)) var(--bw), calc(100% - var(--bw)) calc(100% - var(--i)),
    calc(100% - var(--i)) calc(100% - var(--bw)), var(--bw) calc(100% - var(--bw)), var(--bw) var(--i), var(--i) var(--bw));
}
:is(.cut, .btn, .card, .chip, .badge, .auth-card, .input, .check__box, .seg, .seg__thumb, .alert, .dialog, .toast)::after {
  --c: calc(var(--cut) - var(--bw) * .586);              /* meets the ring's inner edge exactly */
  inset: var(--bw);
  background: var(--fill);
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
}

/* ---------- 4. Buttons (4.2): sm 40 / md 48 / lg 56, hit target >= 40 ---------- */
.btn {
  --cut: var(--cut-md);
  --bw: 0px;
  --bd: transparent;
  --fill: var(--grad-cta);
  --glow: var(--glow-cta);
  --sheen: linear-gradient(105deg, transparent 40%, rgb(255 255 255 / .28) 50%, transparent 60%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 40px;
  min-height: 48px;
  padding: 0 var(--sp-6);
  font: 700 14px/1 var(--font-display);
  letter-spacing: var(--track-button);
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: #fff;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-1) var(--ease-out), filter var(--dur-2) var(--ease-out), color var(--dur-1) linear;
}
.btn::after { background: var(--sheen) 120% 0 / 260% 100% no-repeat, var(--fill); }   /* one sheen band, parked left */
.btn .icon { width: 18px; height: 18px; }

.btn--primary { --fill: var(--grad-cta); color: #fff; }
.btn--ghost { --bw: 1px; --bd: var(--line-ui); --fill: rgb(var(--ink-1-rgb) / .72); color: var(--text-1); }
.btn--ghost:hover { --bd: var(--ember-500); --fill: rgb(var(--ember-rgb) / .12); }
.btn--gold { --fill: var(--grad-gold); --glow: var(--glow-gold); color: var(--gold-ink); }
.btn--gold-line { --bw: 1px; --bd: var(--gold-500); --fill: var(--ink-3); --glow: var(--glow-gold); color: var(--gold-300); }
.btn--solid { --bw: 1px; --bd: var(--line-2); --fill: var(--ink-5); --glow: 0 0 0 transparent; color: var(--text-1); }
.btn--solid:hover { --bd: var(--line-ui); }
.btn--quiet {
  --fill: transparent;
  --sheen: none;
  --glow: 0 0 0 transparent;
  padding: 0 var(--sp-2);
  color: var(--text-2);
  text-underline-offset: 4px;
}
.btn--quiet:hover { color: var(--text-1); text-decoration: underline; }
.btn--danger { --bw: 1px; --bd: var(--ember-text); --fill: rgb(var(--ink-1-rgb) / .72); color: var(--ember-text); }
.btn--danger:hover { --fill: rgb(var(--ember-rgb) / .12); }
.dialog .btn--danger { --bw: 0px; --bd: transparent; --fill: var(--ember-600); color: #fff; }   /* the confirm itself */

.btn--sm { --cut: var(--cut-sm); min-height: 40px; padding: 0 var(--sp-4); font-size: 13px; }
.btn--lg { --cut: 14px; min-height: 56px; padding: 0 var(--sp-8); font-size: 15px; }
.btn--block { width: 100%; }
.btn--icon { width: 40px; min-height: 40px; padding: 0; gap: 0; }
.btn--icon.btn--sm { width: 36px; min-width: 36px; min-height: 36px; }

@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); filter: drop-shadow(var(--glow)); }
  .btn:hover::after { background-position: -20% 0, 0 0; transition: background-position 600ms var(--ease-out); }
  .btn--quiet:hover { transform: none; }
}
.btn:active { transform: translateY(0) scale(.98); }

.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.btn:disabled::after, .btn[aria-disabled="true"]::after { background-position: 120% 0, 0 0; transition: none; }
.btn[aria-busy="true"] { opacity: .85; cursor: progress; }   /* busy also sets disabled: busy wins */
.btn[aria-busy="true"] > .icon { display: none; }            /* the spinner replaces the icon */
.btn .spin { width: 16px; height: 16px; border-color: rgb(255 255 255 / .3); border-top-color: currentColor; }

/* ---------- 5. Cards (4.3) ---------- */
.card { --cut: var(--cut-lg); --bw: 1px; --bd: var(--line-2); --fill: var(--ink-2); padding: var(--sp-6); }
.card--lg { padding: var(--sp-8); }
.card--glass { --fill: var(--glass); }
.card--blur::after { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }   /* only where no video plays behind */
.card--feature { --bd: linear-gradient(160deg, rgb(var(--gold-rgb) / .9), rgb(var(--gold-rgb) / .22) 48%, rgb(var(--gold-rgb) / .65)); }
.card--danger { --bd: rgb(var(--ember-rgb) / .6); }

.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.card__eyebrow {
  margin-bottom: var(--sp-2);
  font: 600 var(--fs-label)/1.2 var(--font-cond);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-3);
}
.card__title { font: 600 var(--fs-h3)/1.2 var(--font-display); color: var(--text-1); }
.card__text { color: var(--text-2); }

.card--media { padding: 0; }
.card__media {
  --c: calc(var(--cut) - var(--bw) * .586);
  position: relative;
  aspect-ratio: 16 / 9;
  margin: var(--bw) var(--bw) 0;
  overflow: hidden;
  background: var(--ink-3);
  clip-path: polygon(var(--c) 0, 100% 0, 100% 100%, 0 100%, 0 var(--c));   /* same chamfer as the card */
}
.card__media--tall { aspect-ratio: 3 / 4; }
.card__media > img, .card__media > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-4) var(--ease-out);
}
.card__body { padding: var(--sp-6); }

.card--link { transition: transform var(--dur-4) var(--ease-out); }
.card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }   /* the whole card is one target */
.card__link:focus-visible { outline: none; }
.card__link:focus-visible::after { outline: var(--focus); outline-offset: 3px; }   /* the ring goes around the card */
@media (hover: hover) {
  .card--link:hover { transform: translateY(-2px); }
  .card--link:hover .card__media > img, .card--link:hover .card__media > video { transform: scale(1.03); }
}

/* ---------- 6. Chips (4.4): 24 tall, tone text on its own 14 % tint (gold: gold-300 on a gold-500 tint) ---------- */
.chip {
  --cut: var(--cut-xs);
  --bw: 0px;
  --bd: transparent;
  --tone: var(--ember-text);
  --tint: var(--tone);
  --fill: color-mix(in srgb, var(--tint) 14%, transparent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  vertical-align: middle;
  font: 600 12.5px/1 var(--font-cond);
  letter-spacing: var(--track-micro);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--tone);
}
.chip .icon { width: 14px; height: 14px; }
.chip--ember { --tone: var(--ember-text); }
.chip--gold { --tone: var(--gold-300); --tint: var(--gold-500); }
.chip--ok { --tone: var(--ok); }
.chip--warn { --tone: var(--warn); }
.chip--info { --tone: var(--info); }
.chip--neutral, .chip--silver { --tone: var(--text-2); --fill: var(--ink-3); }
.chip__dot { flex: none; width: 6px; height: 6px; border-radius: var(--r-pill); background: currentColor; }
.chip__dot--ok { background: var(--ok); }
.chip__dot--ember { background: var(--ember-text); }
.chip__dot--off { background: var(--text-3); }

/* ---------- 7. Badges and the tester mark (4.5): live text on code-drawn plates ---------- */
.badges { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.badge {
  --cut: var(--cut-xs);
  --bw: 1px;
  --bd: var(--line-2);
  --fill: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  font: 700 12.5px/1 var(--font-cond);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-2);
}
.badge .icon { width: 14px; height: 14px; }
.chip .icon--inf, .badge .icon--inf { width: 24px; }
.badge--md { min-height: 28px; }
.badge--founder, .badge--gold { --bw: 0px; --bd: transparent; --fill: var(--grad-gold); color: var(--gold-ink); }
.badge--tester { --bd: var(--grad-tester); --fill: var(--tester-plate); color: var(--gold-300); }
.badge--tester .icon { color: var(--gold-500); }
.badge--staff { --bd: var(--ember-500); --fill: var(--ink-3); color: var(--ember-text); }

.tester-mark { display: block; width: 96px; height: auto; filter: drop-shadow(0 0 10px rgb(var(--ember-rgb) / .35)); }
.tester-mark--sm { width: 64px; }
.tester-mark--lg { width: 128px; }

/* ---------- 8. Forms (4.7): the sign-in card, fields, inputs, textarea, checkbox, alerts ---------- */
.auth-card {
  --cut: var(--cut-xl);
  --bw: 1px;
  --bd: linear-gradient(160deg, rgb(var(--ember-rgb) / .6), var(--line-1) 36%, var(--line-1) 64%, rgb(var(--gold-rgb) / .5));
  --fill: linear-gradient(180deg, var(--ink-2), var(--ink-1));
  width: 100%;
  max-width: 540px;
  padding: clamp(24px, 3.4vw, 40px);
  filter: drop-shadow(var(--shadow-2));
}
.auth-card__hud {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: calc(var(--sp-1) * -1) 0 var(--sp-6);
  font: 600 var(--fs-label)/1.2 var(--font-cond);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-3);
}
.auth-card__hud > :first-child { color: var(--ember-text); }

.field { margin-bottom: var(--sp-5); }
.field__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.field__label {
  display: block;
  margin-bottom: var(--sp-2);
  font: 600 var(--fs-label)/var(--lh-ui) var(--font-body);
  color: var(--text-2);
}
.field__link {
  font: 600 var(--fs-label)/var(--lh-ui) var(--font-body);
  color: var(--text-2);
  text-decoration: underline;
  text-decoration-color: var(--line-ui);
  text-underline-offset: 3px;
  transition: color var(--dur-1) linear;
}
.field__link:hover { color: var(--text-1); text-decoration-color: currentColor; }

.input {
  --cut: var(--cut-sm);
  --bw: 1px;
  --bd: var(--line-ui);                                    /* >= 3:1 on ink-0..3 */
  --fill: var(--ink-3);
  display: flex;
  align-items: center;
  height: 48px;
}
.input:hover { --bd: var(--text-3); }
.input:focus-within { --bd: var(--gold-300); filter: drop-shadow(0 0 4px rgb(var(--gold-rgb) / .35)); }
.input__icon { width: 18px; height: 18px; margin-left: var(--sp-4); color: var(--text-3); transition: color var(--dur-1) linear; }
.input:focus-within .input__icon { color: var(--gold-300); }
.input__el {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 14px;
  border: 0;
  outline: 0;                                              /* the wrapper's ring shows focus */
  background: transparent;
  color: var(--text-1);
  font: 500 1rem/1 var(--font-body);
  letter-spacing: .01em;
}
.input__el--mono { font: 600 .98rem/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.input__el:-webkit-autofill {
  -webkit-text-fill-color: var(--text-1);
  caret-color: var(--text-1);
  box-shadow: 0 0 0 100px var(--ink-3) inset;
  transition: background-color 99999s;
}
.input__el::-ms-reveal { display: none; }
.input__btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 100%;
  color: var(--text-3);
  transition: color var(--dur-1) linear;
}
.input__btn .icon { width: 18px; height: 18px; }
.input__btn:hover, .input__btn[aria-pressed="true"] { color: var(--text-1); }
.input__btn:focus-visible { outline-offset: -6px; }

.input__status { display: none; place-items: center; flex: none; width: 22px; height: 22px; margin-right: var(--sp-4); }
.input__status > * { display: none; grid-area: 1 / 1; }
.input__status .icon { width: 18px; height: 18px; stroke-width: 2.6; }
.st-ok { color: var(--ok); }
.st-bad { color: var(--ember-text); }
.field[data-state="checking"] .input__status, .field[data-state="ok"] .input__status, .field[data-state="error"] .input__status { display: grid; }
.field[data-state="checking"] .spin, .field[data-state="ok"] .st-ok, .field[data-state="error"] .st-bad { display: block; }

.field[data-state="error"] .input { --bd: var(--ember-text); }
.field[data-state="error"] .input:focus-within { filter: drop-shadow(0 0 4px rgb(var(--ember-rgb) / .4)); }
.field[data-state="error"] .input__icon { color: var(--ember-text); }
.field[data-state="ok"] .input:not(:focus-within) { --bd: rgb(var(--ok-rgb) / .7); }

.field__msg, .field__hint { margin-top: var(--sp-2); color: var(--text-3); font-size: var(--fs-label); line-height: 1.45; }
.field__msg:empty { display: none; }
.field[data-state="ok"] .field__msg { color: var(--ok); }
.field[data-state="error"] .field__msg:not(:empty) { display: flex; align-items: flex-start; gap: 6px; color: var(--ember-text); }
.field[data-state="error"] .field__msg:not(:empty)::before {  /* the alert glyph: never colour alone */
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: .15em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.field__caps {                                             /* the Caps Lock pill: warn chip look */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  margin-top: var(--sp-2);
  padding: 0 10px;
  background: rgb(var(--warn-rgb) / .14);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
  font: 600 12.5px/1 var(--font-cond);
  letter-spacing: var(--track-micro);
  text-transform: uppercase;
  color: var(--warn);
}
.field__caps .icon { width: 14px; height: 14px; }
.field__foot { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.field__count {                                            /* "0/200"; .is-warn from 180 */
  margin-top: var(--sp-2);
  margin-left: auto;
  font: 500 var(--fs-label)/1.45 var(--font-body);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.field__count.is-warn { color: var(--warn); }

.input--area { height: auto; align-items: stretch; }
.input--area .input__el { height: auto; min-height: calc(4.5em + 2 * var(--sp-3)); padding: var(--sp-3) 14px; line-height: 1.5; resize: vertical; }

.check {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin: var(--sp-1) 0 var(--sp-6);
  font-size: .9375rem;
  line-height: 1.45;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.field--check { margin: var(--sp-1) 0 var(--sp-6); }
.field--check .check { margin-bottom: 0; }
.field--check :is(.field__msg, .field__hint) { margin-left: 32px; }   /* under the label text, past the 20 px box */
.check__input { position: absolute; width: 20px; height: 20px; margin: 0; opacity: 0; }
.check__box {
  --cut: var(--cut-xs);
  --bw: 1px;
  --bd: var(--line-ui);
  --fill: var(--ink-3);
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}
.check__box .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3.2;
  color: #fff;
  opacity: 0;
  transform: scale(.4);
  transition: opacity var(--dur-1) linear, transform var(--dur-2) var(--ease-out);
}
.check:hover .check__box { --bd: var(--text-3); }
.check__input:checked + .check__box { --bd: var(--ember-600); --fill: var(--ember-600); }
.check__input:checked + .check__box .icon { opacity: 1; transform: none; }
.check__input:focus-visible + .check__box { outline: var(--focus); outline-offset: 3px; }
.check__input:disabled + .check__box { opacity: .5; }
.field[data-state="error"] .check__box { --bd: var(--ember-text); }
.check a { color: var(--text-1); text-decoration: underline; text-decoration-color: var(--line-ui); text-underline-offset: 3px; }

.alert {
  --cut: var(--cut-sm);
  --bw: 0px;
  --bd: transparent;
  --tone: var(--ember-text);
  --fill: linear-gradient(90deg, var(--tone) 0 3px, transparent 3px), color-mix(in srgb, var(--tone) 14%, transparent);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding: var(--sp-3) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 3px);
  font-size: var(--fs-small);
  line-height: 1.45;
  color: var(--text-1);
}
.alert:not([hidden]) { animation: nudge .45s var(--ease-out); }   /* account.js restarts it on a repeat error */
.alert .icon { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--tone); }
.alert--info { --tone: var(--info); }
.alert--ok { --tone: var(--ok); }
.alert--warn { --tone: var(--warn); }
.alert--gold { --tone: var(--gold-500); }
@keyframes nudge { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------- 9. Segmented control (4.6): N options, sliding thumb; JS sets --tab (aria state is the fallback) ---------- */
.seg {
  --cut: var(--cut-sm);
  --bw: 1px;
  --bd: var(--line-2);
  --fill: var(--ink-1);
  --n: 2;
  --tab: 0;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  margin-bottom: var(--sp-8);
  padding: var(--sp-1);
}
.seg--3 { --n: 3; }
.seg--4 { --n: 4; }
.seg:has(> .seg__tab:nth-child(2):is([aria-selected="true"], [aria-checked="true"])) { --tab: 1; }
.seg:has(> .seg__tab:nth-child(3):is([aria-selected="true"], [aria-checked="true"])) { --tab: 2; }
.seg:has(> .seg__tab:nth-child(4):is([aria-selected="true"], [aria-checked="true"])) { --tab: 3; }
.seg__tab {
  position: relative;
  z-index: 1;
  min-height: 40px;
  padding: var(--sp-3) 10px;
  font: 700 13px/1 var(--font-display);
  letter-spacing: var(--track-button);
  text-transform: uppercase;
  color: var(--text-2);
  transition: color var(--dur-2) linear;
}
.seg__tab:hover, .seg__tab[aria-selected="true"], .seg__tab[aria-checked="true"] { color: var(--text-1); }
.seg__tab:focus-visible { outline-offset: -4px; }
@media (max-width: 520px) {                                /* phones: "Create account" stays on one line */
  .auth-card { --cut: var(--cut-lg); padding: var(--sp-6) 18px; }
  .auth-card__hud { margin-bottom: var(--sp-5); }
  .seg__tab { padding-inline: 6px; font-size: 12px; letter-spacing: .1em; }
}
.seg__thumb {
  --cut: 6px;                                              /* nests inside the 8 px cut, 4 px in */
  --bw: 1px;
  --bd: var(--line-ui);                                    /* the selected state reads at >= 3:1 */
  --fill: var(--ink-5);
  position: absolute;
  top: var(--sp-1);
  bottom: var(--sp-1);
  left: var(--sp-1);
  z-index: 0;
  isolation: isolate;
  width: calc((100% - 2 * var(--sp-1)) / var(--n));
  transform: translateX(calc(var(--tab) * 100%));
  transition: transform var(--dur-3) var(--ease-out);
  pointer-events: none;
}

/* ---------- 10. Dialogs (4.10): native <dialog class="dialog"> + showModal() ----------
   The resting dialog has no transform, filter, clip or overflow clip, so the toast main.js moves into it stays
   viewport-fixed and whole. Long content scrolls inside .dialog__body; head and actions stay in view. */
.dialog {
  --cut: 22px;
  --bw: 1px;
  --bd: var(--line-2);
  --fill: var(--ink-2);
  --tone: var(--text-2);
  isolation: isolate;
  width: min(480px, calc(100vw - 2 * var(--sp-4)));
  max-width: none;
  max-height: calc(100dvh - 2 * var(--sp-4));
  padding: var(--sp-6);
  border: 0;
  background: transparent;
  color: var(--text-1);
  overflow: visible;
}
.dialog[open] { display: flex; flex-direction: column; animation: kit-rise var(--dur-3) var(--ease-out); }
.dialog::backdrop {
  background: var(--backdrop, rgb(5 5 6 / .72));
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.dialog[data-tone="danger"] { --tone: var(--ember-text); --bd: rgb(var(--ember-rgb) / .7); }
.dialog:is([data-tone="good"], [data-tone="ok"]) { --tone: var(--ok); --bd: rgb(var(--ok-rgb) / .6); }
.dialog[data-tone="gem"] { --tone: var(--diamond); --bd: color-mix(in srgb, var(--diamond) 60%, transparent); }
.dialog:is([data-tone="beta"], [data-tone="gold"]) { --tone: var(--gold-500); --bd: rgb(var(--gold-rgb) / .7); }
.dialog[data-tone="info"] { --tone: var(--info); --bd: rgb(var(--info-rgb) / .6); }

.dialog__form { display: flex; flex-direction: column; min-height: 0; }
.dialog__head { display: flex; flex: none; align-items: center; gap: 14px; margin-bottom: var(--sp-3); }
.dialog__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.dialog__icon .icon { width: 22px; height: 22px; }
.dialog__title { font: 600 1.25rem/1.25 var(--font-display); color: var(--text-1); }
.dialog__body {
  min-height: 0;
  margin: -6px;
  padding: 6px;                                            /* room for focus rings inside the scroller */
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: .9375rem;
  line-height: 1.55;
  color: var(--text-2);
}
.dialog__body b, .dialog__body strong { color: var(--text-1); }
.dialog__body > :last-child { margin-bottom: 0; }
.dialog__actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: var(--sp-6); }
@media (max-width: 520px) { .dialog__actions > .btn { flex: 1 1 auto; } }   /* phones: full rows, no ragged wrap */

/* ---------- 11. Toast (4.11): one [data-toast] per page; site bottom-centre, .toast--top for admin ---------- */
.toast {
  --cut: var(--cut-sm);
  --bw: 1px;
  --bd: var(--line-2);
  --tone: var(--text-3);
  --fill: linear-gradient(90deg, var(--tone) 0 4px, transparent 4px), var(--ink-3);   /* 4 px tone bar */
  position: fixed;
  left: 50%;
  bottom: var(--sp-6);
  z-index: calc(var(--z-drawer) + 100);
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: max-content;
  max-width: min(92vw, 460px);
  padding: var(--sp-3) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 4px);
  font: 500 var(--fs-small)/1.45 var(--font-body);
  color: var(--text-1);
  filter: drop-shadow(var(--shadow-1));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity var(--dur-2) var(--ease-in), transform var(--dur-2) var(--ease-in), visibility 0s linear var(--dur-2);
}
.toast.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out), visibility 0s;
}
.toast:is([data-tone="ok"], [data-tone="good"], [data-tone="success"]) { --tone: var(--ok); }
.toast[data-tone="info"] { --tone: var(--info); }
.toast[data-tone="warn"] { --tone: var(--warn); }
.toast:is([data-tone="danger"], [data-tone="error"]) { --tone: var(--danger); }
.toast:is([data-tone="gold"], [data-tone="beta"]) { --tone: var(--gold-500); }
.toast[data-tone="gem"] { --tone: var(--diamond); }
.toast .icon { width: 18px; height: 18px; color: var(--tone); }
.toast__text { flex: 1 1 auto; min-width: 0; }
.toast__action {
  flex: none;
  min-height: 32px;
  margin: -6px -6px -6px 0;
  padding: 0 var(--sp-2);
  font: 700 12.5px/1 var(--font-cond);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-1);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.toast__action:hover { color: var(--gold-300); }
.toast--top { top: calc(var(--toast-top, 56px) + var(--sp-3)); right: var(--sp-4); bottom: auto; left: auto; transform: translateY(-8px); }
.toast--top.is-visible { transform: none; }

/* ---------- 12. Tracker (4.12): horizontal from 720 px, vertical below (or always, .tracker--vertical) ---------- */
.tracker { display: grid; row-gap: var(--sp-5); }
.tracker__step {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  column-gap: var(--sp-3);
  align-items: start;
  align-content: start;                                    /* VIS-9: a step stretched to its row's tallest keeps its title in line */
}
.tracker__step > :not(.tracker__num) { grid-column: 2; }
.tracker__step:not(:last-child)::after {                  /* connector to the next step */
  content: "";
  position: absolute;
  left: 15px;
  top: 38px;
  bottom: calc(6px - var(--sp-5));
  width: 1px;
  background: var(--line-2);
}
.tracker__num {
  --ring: var(--line-2);
  --well: var(--ink-3);
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--ring);                                 /* ring = own background; the well sits 1 px in */
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  font: italic 700 1.0625rem/1 var(--font-cond);
  color: var(--text-3);
}
.tracker__num::before, .tracker__num::after { content: ""; position: absolute; pointer-events: none; }
.tracker__num::before {
  inset: 1px;
  z-index: -1;
  background: var(--well);
  clip-path: polygon(7.4px 0, 100% 0, 100% calc(100% - 7.4px), calc(100% - 7.4px) 100%, 0 100%, 0 7.4px);
}
.tracker__title { font: 600 .9375rem/1.3 var(--font-body); color: var(--text-1); }
.tracker__text { margin-top: 2px; font-size: var(--fs-small); line-height: 1.45; color: var(--text-2); }
.tracker__here {
  display: none;
  margin-top: var(--sp-1);
  font: 600 var(--fs-micro)/1.2 var(--font-cond);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--gold-300);
}
.tracker__step.is-done .tracker__num { --ring: rgb(var(--ok-rgb) / .55); color: var(--ok); font-size: 0; }   /* the check replaces the numeral */
.tracker__step.is-done .tracker__title { color: var(--text-2); }
.tracker__step.is-done:not(:last-child)::after { background: rgb(var(--ok-rgb) / .55); }
.tracker__step:is(.is-current, [aria-current="step"]) .tracker__num {
  --ring: var(--gold-500);
  --well: color-mix(in srgb, var(--gold-500) 14%, var(--ink-3));
  color: var(--gold-500);
}
.tracker__step:is(.is-current, [aria-current="step"]) .tracker__here { display: block; }
.tracker__step.is-next :is(.tracker__title, .tracker__text) { color: var(--text-3); }
.tracker__step.is-blocked .tracker__num { --ring: var(--ember-text); color: var(--ember-text); font-size: 0; }
.tracker__step:is(.is-done, .is-blocked) .tracker__num::after {
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.tracker__step.is-blocked .tracker__num::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
}
@media (min-width: 720px) {
  .tracker:not(.tracker--vertical) { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); column-gap: var(--sp-4); }
  .tracker:not(.tracker--vertical) .tracker__step { grid-template-columns: minmax(0, 1fr); row-gap: var(--sp-3); }
  .tracker:not(.tracker--vertical) .tracker__step > :not(.tracker__num) { grid-column: 1; }
  .tracker:not(.tracker--vertical) .tracker__step:not(:last-child)::after {
    left: 40px;
    right: calc(8px - var(--sp-4));
    top: 16px;
    bottom: auto;
    width: auto;
    height: 1px;
  }
}

/* ---------- 13. Skeletons (4.13): first load only; the shimmer stops by itself after 7 x 1.4 s ---------- */
.skel {
  position: relative;
  display: block;
  width: var(--w, 100%);
  min-height: 12px;
  overflow: hidden;
  background: var(--ink-3);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--ink-4) 50%, transparent);
  transform: translateX(-100%);
  animation: kit-shimmer 1.4s var(--ease-in-out) 7;
}
.skel--line { height: 12px; }
.skel--line + .skel--line { margin-top: var(--sp-2); }
@keyframes kit-shimmer { to { transform: translateX(100%); } }

/* ---------- 14. Motion preferences (8.4) ---------- */
@keyframes kit-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes kit-fade { from { opacity: 0; } }
html[data-motion="paused"] .skel::after, html[data-motion="paused"] .spin { animation: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover, .btn:active, .card--link:hover { transform: none; }
  .btn:hover::after { transition: none; }                  /* no sheen */
  .card--link:hover .card__media > img, .card--link:hover .card__media > video { transform: none; }
  .alert:not([hidden]) { animation: none; }
  .dialog[open] { animation-name: kit-fade; }
  .toast, .toast.is-visible { transform: translate(-50%, 0); }
  .toast--top, .toast--top.is-visible { transform: none; }
  .spin, .skel::after { animation: none; }
}

/* ---------- 15. Forced colours (Windows contrast themes): painted rings and fills give way to real borders ---------- */
@media (forced-colors: active) {
  :is(.cut, .btn, .card, .chip, .badge, .auth-card, .input, .check__box, .seg, .seg__thumb, .alert, .dialog, .toast)::before,
  :is(.cut, .btn, .card, .chip, .badge, .auth-card, .input, .check__box, .seg, .seg__thumb, .alert, .dialog, .toast)::after { display: none; }
  .btn, .card, .chip, .badge, .auth-card, .input, .check__box, .seg, .alert, .tracker__num { border: 1px solid CanvasText; }
  .dialog, .toast { border: 1px solid CanvasText; background: Canvas; }
  .btn:disabled, .btn[aria-disabled="true"] { border-color: GrayText; color: GrayText; }
  .seg__thumb { border: 2px solid Highlight; }
  .check__input:checked + .check__box { background: Highlight; }
  .check__input:checked + .check__box .icon { color: HighlightText; }
  .tracker__num { clip-path: none; }
  .tracker__num::after, .field__msg::before { forced-color-adjust: none; }   /* glyphs keep the text colour */
}

/* ---------- 16. Chamfer modifiers (last, so they win over a component's own defaults) ---------- */
.cut--sm { --cut: var(--cut-sm); }
.cut--md { --cut: var(--cut-md); }
.cut--xl { --cut: var(--cut-xl); }
.cut--feature { --bd: linear-gradient(160deg, rgb(var(--gold-rgb) / .55), transparent 45%, rgb(var(--ember-rgb) / .45)); }
