/* =============================================================
   XPixel - /score clinic scorecard
   Uses the site's own tokens, buttons, fields, chips and progress
   bar. Mobile first: one column, 56px answer targets, no hover-only
   states. Only this page loads it.
   ============================================================= */

.score-wrap { max-width: 38rem; margin-inline: auto; }
.score-pane { display: grid; gap: var(--space-300); min-width: 0; animation: score-in 360ms var(--ease) both; }
.score-pane[hidden] { display: none; }
@keyframes score-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.score h1, .score h2 { letter-spacing: var(--tracking-tight); line-height: var(--lh-heading); }
.score h1 { font-size: clamp(2.125rem, 1.4rem + 3.2vw, 3.25rem); margin-block-start: var(--space-100); }
.score h2:focus, .score h1:focus { outline: none; }
.score .lead { max-width: 34rem; }

/* ---- Lead form ------------------------------------------------------------- */
.score-form { display: grid; gap: var(--space-200); margin-block-start: var(--space-100); }
.score-error { margin: 0; font-size: var(--fs-xs); line-height: var(--lh-snug); color: var(--alert); max-width: none; }
.score-error[hidden] { display: none; }
.score-hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.score-consent { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: var(--space-100); min-height: var(--tap-target); padding-block-start: var(--space-50); }
.score-consent input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.score-consent label { font-size: var(--fs-body); line-height: var(--lh-snug); color: var(--fg); cursor: pointer; }
.score-fine { margin: calc(var(--space-100) * -1) 0 0; font-size: var(--fs-sm); color: var(--muted); max-width: none; }
.score-fine a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.score-start { min-height: 3.25rem; padding-inline: var(--space-300); justify-self: stretch; }
@media (min-width: 40em) { .score-start { justify-self: start; } }

/* ---- Questions ------------------------------------------------------------- */
.score-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-200); }
.score-top .btn-ghost { margin-inline-start: calc(var(--space-100) * -1); }
.score-count { font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: var(--tracking-mono); color: var(--muted); }
.score-progress { height: 6px; }
.score-q { display: grid; gap: var(--space-200); justify-items: start; margin-block-start: var(--space-100); }
.score-q h2 { font-size: clamp(1.625rem, 1.2rem + 1.8vw, 2.25rem); }
.score-options { display: grid; gap: var(--space-100); width: 100%; margin-block-start: var(--space-100); }
.score-opt {
  display: flex; align-items: center; gap: var(--space-200);
  width: 100%; min-height: 3.5rem; padding: var(--space-100) var(--space-200);
  text-align: start; font: inherit; font-size: var(--fs-body); line-height: var(--lh-snug); color: var(--fg);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: border-color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
}
.score-opt:hover { border-color: var(--fg); }
.score-opt:active { transform: scale(0.99); }
.score-opt:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.score-opt-dot {
  position: relative; flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  transition: border-color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
}
.score-opt-dot::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--accent-ink);
  transform: scale(0); transition: transform var(--duration-fast) var(--ease);
}
.score-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.score-opt[aria-pressed="true"] .score-opt-dot { border-color: transparent; background: var(--accent-gradient); }
.score-opt[aria-pressed="true"] .score-opt-dot::after { transform: scale(1); }
.score-next { display: flex; justify-content: flex-end; }
.score-next[hidden] { display: none; }

/* ---- Results --------------------------------------------------------------- */
.score-result { --tier: var(--muted); }
.score-result[data-tier="1"] { --tier: #D41F34; }
.score-result[data-tier="2"] { --tier: #F26527; }
.score-result[data-tier="3"] { --tier: #66BC46; }
.score-summary { display: grid; gap: var(--space-200); padding: var(--space-300); border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-card); }
.score-total { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-100) var(--space-200); }
.score-num { margin: 0; max-width: none; font-size: clamp(3.5rem, 2.4rem + 5vw, 5rem); font-weight: var(--weight-semibold); letter-spacing: -0.04em; line-height: 1; color: var(--fg); font-variant-numeric: tabular-nums; }
.score-out { font-size: 0.4em; font-weight: var(--weight-regular); letter-spacing: 0; color: var(--muted); }
.score-tier {
  display: inline-flex; align-items: center; gap: var(--space-75); margin: 0; max-width: none;
  padding: var(--space-75) var(--space-200); border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--tier) 14%, var(--surface)); color: var(--fg);
  font-size: var(--fs-sm); font-weight: var(--weight-medium); line-height: 1.2;
}
.score-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tier); flex: none; }
.score-bar { height: 10px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.score-bar > i { display: block; height: 100%; background: var(--tier); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 900ms var(--ease); }
.score-result h2 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); margin-block-start: var(--space-100); }

.score-cats { list-style: none; margin: var(--space-100) 0 0; padding: 0; display: grid; gap: var(--space-200); }
.score-cat { display: grid; gap: var(--space-75); }
.score-cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-200); font-size: var(--fs-body); color: var(--fg); font-weight: var(--weight-medium); }
.score-cat-head span:last-child { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: var(--weight-regular); color: var(--muted); font-variant-numeric: tabular-nums; }
/* One segment per point (--n is the area's maximum, set in score.js), so "5 of 9" shows exactly 5 filled blocks.
   The gradient spans the whole track and the fill reveals it from the left, so the colour also says how far along it is. */
.score-cat-bar {
  --n: 10; --gap: 3px;
  height: 10px; background: var(--surface-3);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--n) - var(--gap)), transparent calc(100% / var(--n) - var(--gap)) calc(100% / var(--n)));
          mask: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--n) - var(--gap)), transparent calc(100% / var(--n) - var(--gap)) calc(100% / var(--n)));
}
.score-cat-bar > i { display: block; height: 100%; background: var(--flow-gradient); clip-path: inset(0 calc(100% - var(--p, 0) * 100%) 0 0); transition: clip-path 900ms var(--ease) 150ms; }

.score-next-step { display: grid; gap: var(--space-75); padding: var(--space-300); border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid var(--line); margin-block-start: var(--space-100); }
.score-next-step h3 { font-size: var(--fs-lead); letter-spacing: var(--tracking-tight); }
.score-next-step p { margin: 0; color: var(--fg-2); max-width: none; line-height: var(--lh-snug); }
.score-book-line { margin: var(--space-100) 0 0; color: var(--muted); max-width: none; }
.score-book { min-height: 3.25rem; padding-inline: var(--space-300); justify-self: stretch; }
@media (min-width: 40em) { .score-book { justify-self: start; } }
.score-ts { min-height: 0; }
.score-save { margin: 0; font-size: var(--fs-sm); line-height: var(--lh-snug); color: var(--alert); max-width: none; }
.score-save[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .score-pane { animation: none; }
  .score-bar > i, .score-cat-bar > i, .score-opt, .score-opt-dot, .score-opt-dot::after { transition: none; }
}
