/* DanceCredit fan page. Tokens in OKLCH; dark is the default scene (phone at night, straight out of
   TikTok), light mirrors it. Brand: electric green (hue 158). Props/tips: hot pink (hue 352). */

@font-face {
  font-family: "Space Grotesk";
  src: url("/static/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: oklch(0.165 0.018 160);
  --surface: oklch(0.215 0.022 160);
  --surface-2: oklch(0.265 0.026 160);
  --line: oklch(0.36 0.03 160);
  --ink: oklch(0.97 0.012 160);
  --ink-2: oklch(0.82 0.025 160);          /* secondary text, 9:1 on bg */
  --brand: oklch(0.87 0.2 155);            /* electric green */
  --brand-strong: oklch(0.92 0.17 155);
  --on-brand: oklch(0.2 0.05 160);         /* ink on green, 11:1 */
  --props: oklch(0.74 0.19 352);           /* hot pink for tips/props */
  --on-props: oklch(0.18 0.04 352);
  --warn: oklch(0.85 0.14 85);
  --danger: oklch(0.72 0.18 28);
  --focus: oklch(0.92 0.17 155);

  --font: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-md: 1rem;
  --text-lg: 1.1875rem;
  --text-xl: 1.5rem;
  --text-display: 2.75rem;
  --text-verdict: 2.5rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --radius: 12px;
  --radius-sm: 8px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);   /* ease-out-quint */
  --dur: 220ms;

  --z-skip: 50;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: oklch(1 0 0);
    --surface: oklch(0.965 0.012 160);
    --surface-2: oklch(0.93 0.018 160);
    --line: oklch(0.82 0.025 160);
    --ink: oklch(0.2 0.03 160);
    --ink-2: oklch(0.42 0.03 160);          /* 8:1 on white */
    --brand: oklch(0.86 0.21 152);          /* same electric green as a surface */
    --brand-strong: oklch(0.46 0.13 158);   /* green for text/borders on white, 6.5:1 */
    --on-brand: oklch(0.2 0.05 160);
    --props: oklch(0.56 0.22 356);
    --on-props: oklch(1 0 0);               /* 5.2:1 */
    --warn: oklch(0.5 0.12 75);
    --danger: oklch(0.52 0.19 28);
    --focus: oklch(0.46 0.13 158);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* hidden must win over component display rules */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.55;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

.sprite { position: absolute; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor;
        stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 2rem; height: 2rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden;
                   clip-path: inset(50%); white-space: nowrap; }

a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
/* headings get focus from script so screen readers announce the new state; no ring for that */
[tabindex="-1"]:focus { outline: none; }

.skip { position: absolute; left: var(--space-4); top: -100px; z-index: var(--z-skip);
        background: var(--brand); color: var(--on-brand); padding: var(--space-2) var(--space-4);
        border-radius: var(--radius-sm); font-weight: 700; text-decoration: none; }
.skip:focus { top: var(--space-4); }

/* ---------- header / footer ---------- */

.top, .foot, .page {
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding-inline: max(var(--space-4), env(safe-area-inset-left)) max(var(--space-4), env(safe-area-inset-right));
}
.top {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding-block: var(--space-4);
}
.brand { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none;
         min-height: 44px; font-weight: 700; font-size: var(--text-lg); letter-spacing: -0.01em; }
.brand-tag {
  display: inline-block; background: var(--brand); color: var(--on-brand);
  font-weight: 700; padding: 0.05em 0.4em 0.1em; border-radius: 6px; transform: rotate(-4deg);
  font-size: var(--text-md); line-height: 1.3;
}
.brand-tag.small { font-size: var(--text-xs); }
.top-link { color: var(--ink-2); font-size: var(--text-sm); text-underline-offset: 4px;
            min-height: 44px; display: inline-flex; align-items: center; }
.top-link:hover { color: var(--ink); }

.page { flex: 1; padding-block: var(--space-5) var(--space-8); outline: none; }

.foot { padding-block: var(--space-6) calc(var(--space-6) + env(safe-area-inset-bottom));
        color: var(--ink-2); font-size: var(--text-sm); border-top: 1px solid var(--line); }
.foot p { margin: 0; display: flex; align-items: center; gap: var(--space-2); }

/* ---------- type ---------- */

.display {
  font-size: var(--text-display);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
.hl {
  background: var(--brand); color: var(--on-brand);
  padding: 0 0.12em; border-radius: 6px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.title { font-size: var(--text-xl); line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 var(--space-3);
         font-weight: 700; text-wrap: balance; }
.lede { font-size: var(--text-lg); color: var(--ink-2); margin: 0 0 var(--space-6); max-width: 34ch;
        text-wrap: pretty; }
.lede.small { font-size: var(--text-md); margin-bottom: var(--space-5); max-width: none; overflow-wrap: anywhere; }
.help { font-size: var(--text-sm); color: var(--ink-2); margin: var(--space-2) 0 0; }
.note { font-size: var(--text-sm); color: var(--ink-2); margin: var(--space-5) 0 0; max-width: 60ch; }

/* ---------- form ---------- */

.check { display: block; }
.label { display: block; font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--space-2); }
.field-row { display: flex; flex-direction: column; gap: var(--space-3); }

input[type="url"] {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--space-4);
  font: inherit;
  font-size: var(--text-md);              /* 16px: no iOS zoom */
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}
input[type="url"]::placeholder { color: var(--ink-2); opacity: 1; }
input[type="url"]:hover { border-color: var(--ink-2); }
input[type="url"]:focus-visible { outline: none; border-color: var(--focus); background: var(--surface-2); }
input[type="url"][aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-weight: 600; font-size: var(--text-sm); margin: var(--space-2) 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 52px; padding: 0 var(--space-5);
  font: inherit; font-weight: 700; font-size: var(--text-md); letter-spacing: -0.005em;
  border-radius: var(--radius-sm); border: 2px solid transparent;
  cursor: pointer; text-decoration: none; touch-action: manipulation; user-select: none;
  -webkit-tap-highlight-color: transparent;   /* :active scale is the tap feedback */
  transition: transform 120ms var(--ease-out), background-color var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); }
@media (prefers-color-scheme: light) {
  .btn-primary:hover { background: oklch(0.8 0.2 152); }
}
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); background: var(--surface); }
.btn-props { background: var(--props); color: var(--on-props); }
.btn-props:hover { filter: brightness(1.08); }
.btn-link { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-link:hover { border-color: var(--ink); }

.upload { width: 100%; position: relative; }
.upload:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }

.or { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) 0;
      color: var(--ink-2); font-size: var(--text-sm); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- progress ---------- */

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.steps li {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 52px; padding: 0 var(--space-4);
  background: var(--surface); border-radius: var(--radius-sm);
  color: var(--ink-2);
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.steps li[data-state="active"] { color: var(--ink); background: var(--surface-2); font-weight: 600; }
.steps li[data-state="done"] { color: var(--ink); }
.step-meta { margin-left: auto; font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--ink-2); }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); flex: none; position: relative; }
.steps li[data-state="done"] .dot { background: var(--brand); border-color: var(--brand); }
.steps li[data-state="done"] .dot::after {
  content: ""; position: absolute; inset: 2px 3px 4px 3px;
  border: solid var(--on-brand); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0.75);
}
.steps li[data-state="active"] .dot { border-color: var(--brand); }
.steps li[data-state="active"] .dot::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--brand); animation: pulse 1.4s var(--ease-out) infinite;
}
@keyframes pulse { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(1.5); opacity: 0; } }
.status { margin: var(--space-4) 0 0; font-weight: 600; }

/* ---------- result ---------- */

.verdict {
  background: var(--brand); color: var(--on-brand);
  border-radius: var(--radius); padding: var(--space-5) var(--space-5) var(--space-6);
  margin-bottom: var(--space-5);
}
.verdict[data-tone="maybe"] { background: var(--warn); color: oklch(0.2 0.04 85); }
.verdict[data-tone="none"] { background: var(--surface-2); color: var(--ink); }
.verdict-kicker { margin: 0 0 var(--space-2); font-weight: 700; font-size: var(--text-sm); }
.verdict-title { font-size: var(--text-verdict); line-height: 1.04; letter-spacing: -0.03em; margin: 0;
                 font-weight: 700; text-wrap: balance; outline: none; overflow-wrap: anywhere; }
.verdict-text { margin: var(--space-3) 0 0; font-size: var(--text-lg); max-width: 40ch; text-wrap: pretty; }

.candidates { display: grid; gap: var(--space-3); }
.candidate { background: var(--surface); border-radius: var(--radius); padding: var(--space-5); }
.candidate-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
                  gap: var(--space-1) var(--space-3); }
.candidate-name { margin: 0; font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.015em;
                  overflow-wrap: anywhere; }
.candidate-name.anon { font-size: var(--text-lg); color: var(--ink-2); font-weight: 600; }
.candidate-meta { margin: 0; color: var(--ink-2); font-size: var(--text-sm); }
.match { margin-top: var(--space-4); }
.match-bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
/* drawn at its value right away: the level is information, it must not wait for an animation */
.match-bar span { display: block; height: 100%; width: 100%; background: var(--brand-strong);
                  transform-origin: left; }
.match-text { margin: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.candidate-notes { margin: var(--space-3) 0 0; font-size: var(--text-sm); color: var(--ink-2); }
.candidate-notes:empty { display: none; }
.candidate-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }
.candidate-actions:empty { display: none; }
.candidate-actions .btn { flex: 1 1 12rem; }

.warnings { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.warnings li { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm);
               color: var(--ink-2); background: var(--surface); padding: var(--space-3) var(--space-4);
               border-radius: var(--radius-sm); }
.warnings .icon { color: var(--warn); margin-top: 0.1em; }
.again { margin-top: var(--space-6); width: 100%; }

/* ---------- error ---------- */

.problem { background: var(--surface); border-radius: var(--radius); padding: var(--space-5);
           border: 2px solid var(--danger); }
.problem .icon { color: var(--danger); margin-bottom: var(--space-2); }
.problem p { margin: 0; color: var(--ink-2); font-size: var(--text-lg); max-width: 40ch; }
.problem-actions { display: grid; gap: var(--space-3); margin-top: var(--space-5); }

/* ---------- how it works ---------- */

.how { margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px solid var(--line);
       scroll-margin-top: var(--space-5); }
.how-list { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--space-3); max-width: 62ch; color: var(--ink-2); }
.how-list strong { color: var(--ink); }
.how-list li::marker { color: var(--brand-strong); font-weight: 700; }

/* ---------- stage transitions ---------- */

/* only switches animate; the first paint is plain so nothing depends on an animation running */
.stage.enter { animation: rise 320ms var(--ease-out) both; }
/* movement only, never opacity: if a background tab pauses the animation, content is still fully visible */
@keyframes rise { from { transform: translateY(10px); } to { transform: none; } }
#stage-result .verdict { animation: pop 420ms var(--ease-out) both; }
@keyframes pop { from { transform: scale(0.96); } to { transform: none; } }

/* ---------- larger screens ---------- */

@media (min-width: 40rem) {
  :root { --text-display: 4rem; --text-verdict: 3.25rem; }
  .field-row { flex-direction: row; }
  .field-row input { flex: 1; min-width: 0; }
  .field-row .btn { flex: none; }
  .upload { width: auto; }
  .problem-actions { display: flex; flex-wrap: wrap; }
  .again { width: auto; }
  .verdict { padding: var(--space-6) var(--space-6) var(--space-7); }
}

@media (prefers-reduced-motion: reduce) {
  .stage.enter, #stage-result .verdict { animation: none; }
  .steps li[data-state="active"] .dot::before { animation: none; opacity: 0.5; }
  .btn { transition: none; }
  .btn:active { transform: none; }
}
