/* AsoKite, matching CRA Scan's design pass (Dec 2026) and zipistudios.com:
 *   1. Orange and red mean risk. Buttons are ink, links are blue. Orange stays only as the brand mark,
 *      the scan brackets, the menu's current-page marker and the recommended plan's border, as in CRA Scan.
 *   2. Cool neutral surfaces, so the warm risk colours stand out.
 *   3. Sentence-case labels; no arrows on links.
 * Text >= 4.5:1 on its background; metadata never below 13px.
 * Fonts are self-hosted: General Sans (UI and headings, 400/500/600) and IBM Plex Mono (data only). Light theme. */

@font-face {
  font-family: "General Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 700;
  src: url("fonts/GeneralSans-Variable.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  /* surfaces */
  --paper: #ffffff;          /* website background */
  --paper-alt: #f8f9fb;      /* alternate website sections */
  --app-bg: #eff1f4;         /* the app page: white cards on a cool tint */
  --surface: #ffffff;        /* cards, panels, inputs */
  --surface-2: #eef0f4;      /* hover, table heads, quiet fills */
  /* text */
  --ink: #1b1f24;
  --ink-hover: #3a424d;
  --silver: #3d444d;
  --muted: #5b6470;
  --faint: #7d8794;          /* marks and input borders */
  --line: #e3e6ea;
  --line-strong: #cfd4da;
  /* ember */
  --accent: #e57f50;         /* brand orange: logo mark, brackets, menu marker, recommended plan */
  --accent-hover: #ce6e42;
  --on-accent: #150a07;      /* label on orange */
  --accent-text: #174ea6;    /* links and accent text (blue) */
  --accent-soft: #e8f0fc;    /* highlighted rows and boxes (blue tint) */
  /* amber = opportunity / medium; fills use --coin, text uses --coin-ink */
  --coin: #eda100;
  --coin-soft: #fbeede;
  --coin-ink: #7b5d32;
  /* state */
  --good: #177a36;
  --good-soft: #e9f4e9;
  --warn: #7b5d32;
  --warn-soft: #fbeede;
  --bad: #b3263a;
  --bad-soft: #ffebec;
  --bad-hover: #8f1d2e;
  /* the app's dark side menu */
  --chrome: #14181d;
  --chrome-ink: #ffffff;
  --chrome-muted: #c3c9d1;
  --chrome-hover: rgb(255 255 255 / 0.08);
  --chrome-current: rgb(255 255 255 / 0.16);
  --chrome-line: rgb(255 255 255 / 0.14);
  /* type */
  --f-display: "General Sans", "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --f-body: "General Sans", "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --text-meta: 0.8125rem;    /* 13px floor */
  /* shape and depth: only the product window floats */
  --r-sm: 4px;
  --r-md: 6px;
  --shadow: 0 1px 2px rgb(20 24 29 / 0.06), 0 10px 28px -10px rgb(20 24 29 / 0.16);
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-underline-offset: 0.2em; }
a:hover { color: var(--ink); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; }
.mono { font-family: var(--f-mono); font-size: max(0.92em, 13px); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.eyebrow { color: var(--accent-text); font-size: 0.9375rem; font-weight: 600; }
.wrap { max-width: 76rem; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* buttons: 4px radius, ember fill with a dark label, no shadow */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 2.75rem; padding: 0 1rem;
  color: var(--ink); font: 600 0.9375rem/1 var(--f-body); text-decoration: none; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--faint); border-radius: var(--r-md);
  cursor: pointer; transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.btn:hover { color: var(--ink); background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { color: #ffffff; background: var(--ink); border-color: var(--ink); }
.btn-primary:not(:disabled):hover { color: #ffffff; background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-ghost { background: var(--surface); }
.btn-sm { min-height: 2rem; padding: 0 0.75rem; font-size: 0.875rem; }
.btn-quiet { color: var(--silver); font-weight: 500; background: transparent; border-color: transparent; }
.btn-quiet:hover { color: var(--ink); background: var(--surface-2); }
.linkbtn { padding: 0; color: var(--accent-text); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em; background: none; border: 0; cursor: pointer; }
.linkbtn:hover { color: var(--ink); }

/* inputs: 4px radius, neutral-10 border */
input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%; min-height: 2.75rem; padding: 0 0.75rem;
  color: var(--ink); font: 400 1.0625rem var(--f-body);
  background: var(--surface); border: 1px solid var(--faint); border-radius: var(--r-md);
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
label { font-weight: 600; font-size: 0.9375rem; }
.field { display: grid; gap: 4px; min-width: 0; }

/* logo: square with a letter and the live-text name */
.logo { display: inline-flex; align-items: center; gap: 8px; min-height: 2.75rem; color: var(--ink); font-weight: 600; text-decoration: none; }
.logo-mark { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; color: #ffffff; font-size: 0.95rem; font-weight: 600; background: var(--ink); border-radius: var(--r-sm); }
.logo-mark::before { content: "A"; }
.logo-product { color: var(--muted); font-weight: 400; }

/* panels */
.card { min-width: 0; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); }
.card-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 0.875rem; }
.card-head h3 { font-size: 1.125rem; }

/* badges: sans, 13px, 4px radius */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 0.0625rem 0.5rem; font-family: var(--f-body); font-size: var(--text-meta); font-weight: 600; line-height: 1.6; white-space: nowrap; border-radius: var(--r-sm); }
.chip.critical, .chip.high { color: var(--bad); background: var(--bad-soft); }
.chip.critical { color: #ffffff; background: var(--bad); }
.chip.medium { color: var(--warn); background: var(--warn-soft); }
.chip.low { color: var(--silver); background: var(--surface-2); }
.chip.good { color: var(--good); background: var(--good-soft); }
.chip.plain { color: var(--silver); background: var(--surface-2); }
.chip.coin { color: var(--coin-ink); background: var(--coin-soft); }

/* score ring */
.ring { position: relative; flex: none; width: 132px; height: 132px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.ring .val { fill: none; stroke-width: 10; stroke-linecap: butt; transition: stroke-dashoffset 300ms var(--ease); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .big { font-size: 2.6rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .of { color: var(--muted); font-size: var(--text-meta); }

/* meters: plain measures are neutral ink; colour only for state */
.meter { min-width: 40px; height: 8px; overflow: hidden; background: var(--surface-2); border-radius: 2px; }
.meter > i { display: block; height: 100%; background: var(--ink); transition: width 300ms var(--ease); }
.cats { display: grid; gap: 10px; }
.cat { display: grid; grid-template-columns: 100px minmax(0, 1fr) 30px; gap: 10px; align-items: center; font-size: 0.9375rem; }
.cat .v { text-align: right; font-variant-numeric: tabular-nums; }

/* fix list: rows with a severity rule, like CRA findings */
.actions { display: grid; gap: 8px; }
.action { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); }
.action .stripe { grid-row: span 3; width: 3px; background: var(--faint); }
.action[data-sev=critical] .stripe, .action[data-sev=high] .stripe { background: var(--bad); }
.action[data-sev=medium] .stripe { background: var(--coin); }
.action[data-sev=low] .stripe { background: var(--line-strong); }
.action .a-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.action .a-title { font-weight: 600; }
.action .a-detail { color: var(--muted); font-size: 0.9375rem; }
.action .a-fix { font-size: 0.9375rem; }
.action .a-fix b { color: var(--ink); }

/* tables: CRA table heads */
.table-wrap { position: relative; overflow-x: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); }
table { width: 100%; font-size: 0.9375rem; border-collapse: collapse; }
th { padding: 0.75rem 1rem; color: var(--muted); font-size: var(--text-meta); font-weight: 600; text-align: left; white-space: nowrap; background: var(--paper-alt); border-bottom: 1px solid var(--line-strong); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
td { padding: 0.75rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.rank { font-family: var(--f-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.rank.none { color: var(--muted); font-weight: 400; }
.delta { margin-left: 6px; font-family: var(--f-mono); font-size: var(--text-meta); }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.mini-icons { display: flex; }
.mini-icons img { width: 24px; height: 24px; margin-left: -6px; background: var(--surface-2); border: 2px solid var(--surface); border-radius: var(--r-sm); }
.mini-icons img:first-child { margin-left: 0; }
.where { display: flex; gap: 3px; }
.where span { display: grid; place-items: center; width: 22px; height: 22px; color: var(--muted); font-family: var(--f-mono); font-size: var(--text-meta); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.where span.on { color: #ffffff; background: var(--ink); border-color: var(--ink); }
.bar-cell { display: grid; grid-template-columns: minmax(40px, 64px) 28px; gap: 8px; align-items: center; }
.bar-cell .v { font-size: var(--text-meta); text-align: right; font-variant-numeric: tabular-nums; }

/* toasts and tooltip */
.toasts { position: fixed; z-index: 100; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; color: #ffffff; font-size: 0.9375rem; background: var(--ink); border-radius: var(--r-md); }
.toast.err { background: var(--bad); }
.tip { position: fixed; z-index: 200; max-width: 18rem; padding: 0.375rem 0.625rem; color: #ffffff; font-size: var(--text-meta); font-weight: 500; white-space: nowrap; pointer-events: none; background: var(--ink); border-radius: var(--r-sm); }

/* loading: a sweeping bar, no shimmer */
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-bar { display: block; height: 6px; overflow: hidden; background: var(--surface-2); border-radius: 999px; }
.progress-bar::after { display: block; width: 40%; height: 100%; content: ""; background: var(--ink); border-radius: inherit; animation: sweep 1.4s var(--ease) infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* signature move: scan brackets around the product frame */
.bracketed { position: relative; }
.bracketed::before, .bracketed::after, .bracketed > .br-b::before, .bracketed > .br-b::after {
  position: absolute; width: 28px; height: 28px; content: ""; pointer-events: none;
  border-color: var(--accent); border-style: solid; border-width: 0;
}
.bracketed::before { top: -10px; left: -10px; border-top-width: 3px; border-left-width: 3px; }
.bracketed::after { top: -10px; right: -10px; border-top-width: 3px; border-right-width: 3px; }
.bracketed > .br-b::before { bottom: -10px; left: -10px; border-bottom-width: 3px; border-left-width: 3px; }
.bracketed > .br-b::after { bottom: -10px; right: -10px; border-bottom-width: 3px; border-right-width: 3px; }

/* ── Motion (Dec 2026) ──
 * Short, and tied to something the person just did: opening a report, switching a
 * tab, pressing a button. A report "builds" once when it opens (#pane.fresh, set by
 * dashboard.js for about a second); sorting, filtering and editing inside a tab do
 * not replay it. Off with reduced motion; nothing new here loops. */
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color 150ms var(--ease), border-color 150ms var(--ease), transform 140ms var(--ease); }
  .btn:not(:disabled):active { transform: scale(0.97); }
  .filters button, .sugg button, .auth-tabs button, .tabs a, .game, .side-links a, .side-links button {
    transition: color 120ms linear, background-color 120ms linear, border-color 120ms linear, box-shadow 120ms linear;
  }

  /* A tab or report opening: the pane rises in, then its figures build. */
  #pane.fresh, #main > .empty, .pv-grid { animation: rise-in 280ms var(--ease) both; }
  .fresh .kpi { animation: rise-in 320ms var(--ease) both; }
  .fresh .kpi:nth-child(2) { animation-delay: 50ms; }
  .fresh .kpi:nth-child(3) { animation-delay: 100ms; }
  .fresh .kpi:nth-child(4) { animation-delay: 150ms; }

  /* The score ring draws from empty to the score (circumference of r=56 is 351.86). */
  .fresh .ring .val, .pv-side .ring .val { animation: ring-in 800ms var(--ease) 120ms both; }
  .fresh .cats .meter > i, .pv-side .cats .meter > i { transform-origin: left; animation: grow-x 520ms var(--ease) 200ms both; }
  .fresh .cats .cat:nth-child(2) .meter > i, .pv-side .cats .cat:nth-child(2) .meter > i { animation-delay: 260ms; }
  .fresh .cats .cat:nth-child(3) .meter > i, .pv-side .cats .cat:nth-child(3) .meter > i { animation-delay: 320ms; }
  .fresh .cats .cat:nth-child(4) .meter > i, .pv-side .cats .cat:nth-child(4) .meter > i { animation-delay: 380ms; }

  /* Things that appear because of a click or an event. */
  tr.detail td { animation: fade-in 180ms linear both; }
  .toast { animation: toast-in 260ms var(--ease) both; }
  dialog[open] { animation: dialog-in 200ms var(--ease) both; }
  dialog[open]::backdrop { animation: fade-in 200ms linear both; }

  @keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }
  @keyframes fade-in { from { opacity: 0; } }
  @keyframes grow-x { from { transform: scaleX(0); } }
  @keyframes ring-in { from { stroke-dashoffset: 351.86; } }
  @keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
  @keyframes dialog-in { from { opacity: 0; transform: scale(0.97); } }
}
