/* verus design system: tokens and components. Dark is the primary theme; light is the
   same page by day. Warm neutrals, ink, one cobalt accent and one signal orange.
   Shapes carry meaning: filled holds, hatched does not hold, a dashed outline is unknown. */

/* @tokens:start: the design system's tokens, design/verus/tokens.json, value for value. */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --paper: #14130f;
  --paper-2: #1f1d18;
  --paper-3: #2a2721;
  --mark: #3b372d;
  --line: #2e2b24;
  --line-strong: #777266;
  --ink: #ece7db;
  --ink-2: #b4aea1;
  --ink-3: #8f897c;
  --ink-4: #3e3a32;
  --accent: #8094ff;
  --accent-hover: #9cabff;
  --on-accent: #0f0e0b;
  --signal: #e8875a;
  --on-signal: #0f0e0b;
  --code: #0f0e0b;
  --scrim: #0a0907b3;
  --shadow-float: 0 1px 2px #0000004d, 0 16px 40px #00000080;
}
[data-theme="light"] {
  color-scheme: light;
  --paper: #f2efe8;
  --paper-2: #e8e4da;
  --paper-3: #dedad0;
  --mark: #dcd5c3;
  --line: #d9d3c5;
  --line-strong: #847e70;
  --ink: #1a1915;
  --ink-2: #4c493f;
  --ink-3: #635f54;
  --ink-4: #c8c2b3;
  --accent: #2440d8;
  --accent-hover: #1c34b8;
  --on-accent: #ffffff;
  --signal: #a3420e;
  --on-signal: #ffffff;
  --code: #e8e4da;
  --scrim: #1a191566;
  --shadow-float: 0 1px 2px #1a19151a, 0 16px 40px #1a191526;
}
:root {
  --font-sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px;
  --space-8: 32px; --space-12: 48px; --space-16: 64px; --space-24: 96px;
  --radius-xs: 2px; --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}
/* @tokens:end */

/* The type scale. No italics, no capitals for labels, no negative tracking. */
.vs-display { font: 500 56px/60px var(--font-sans); text-wrap: balance; }
.vs-h1 { font: 500 40px/44px var(--font-sans); text-wrap: balance; }
.vs-h2 { font: 500 28px/34px var(--font-sans); text-wrap: balance; }
.vs-title { font: 500 18px/24px var(--font-sans); }
.vs-lede { font: 400 19px/30px var(--font-sans); color: var(--ink-2); }
.vs-body { font: 400 15px/24px var(--font-sans); }
.vs-small { font: 400 13px/20px var(--font-sans); }
.vs-label { font: 500 13px/18px var(--font-sans); color: var(--ink-3); }
.vs-caption { font: 400 12px/18px var(--font-mono); color: var(--ink-3); }
.vs-code-text { font: 400 13px/20px var(--font-mono); }

/* ——— Mark: the logo and the mascot ———
   Three legal tests, the claim at the bottom, as verus draws a proof run.
   States: idle, working, asking, holds, fails, off. Sizes: xs 16, sm 20, md 32, lg 64, xl 120. */
.vs-mark { --vs-stroke: .9; display: inline-block; flex: none; width: 20px; height: 20px; overflow: visible; vertical-align: middle; }
.vs-mark[data-size="xs"] { width: 16px; height: 16px; --vs-stroke: 1.2; }
.vs-mark[data-size="md"] { width: 32px; height: 32px; --vs-stroke: .9; }
.vs-mark[data-size="lg"] { width: 64px; height: 64px; --vs-stroke: .7; }
.vs-mark[data-size="xl"] { width: 120px; height: 120px; --vs-stroke: .6; }
.vs-mark rect { transform-box: fill-box; transform-origin: center; fill: var(--ink); stroke: var(--ink-3); stroke-width: 0; }
.vs-mark .vs-mark__claim { fill: var(--accent); stroke: var(--accent); }
.vs-mark .vs-mark__hatch { fill: var(--ink-2); stroke: none; }

/* idle: still most of the time. Now and then it reads its proof again, as the homepage's
   build view does: the bars clear, then an unseen sweep crosses the mark. Each test's dashed
   outline is drawn as the sweep crosses it, in the sweep's direction, and the test is
   answered (filled) as the sweep leaves its far edge, so the answers come from the top down and the claim is last. It reads left to
   right, rests, then reads back right to left. A 18s loop with reads at 3s and
   12s, 2.1s each. The traces show only in idle. */
.vs-mark__trace { display: none; }
.vs-mark[data-state="idle"] .vs-mark__trace { display: inline; fill: none; stroke: var(--ink); stroke-width: var(--vs-stroke); stroke-dasharray: 1.1 .8; stroke-opacity: 0; animation: 18s linear infinite; }
.vs-mark[data-state="idle"] .vs-mark__trace--fact { animation-name: vs-idle-trace-fact; }
.vs-mark[data-state="idle"] .vs-mark__trace--rule { animation-name: vs-idle-trace-rule; }
.vs-mark[data-state="idle"] .vs-mark__trace--claim { animation-name: vs-idle-trace-claim; }
.vs-mark[data-state="idle"] .vs-mark__fact { animation: vs-idle-fact 18s linear infinite; }
.vs-mark[data-state="idle"] .vs-mark__rule { animation: vs-idle-rule 18s linear infinite; }
.vs-mark[data-state="idle"] .vs-mark__claim { animation: vs-idle-claim 18s linear infinite; }
@keyframes vs-idle-fact { 0% { fill-opacity: 1; } 16.667% { fill-opacity: 1; } 18.333% { fill-opacity: 0; } 24.259% { fill-opacity: 0; } 25.093% { fill-opacity: 1; } 66.667% { fill-opacity: 1; } 68.333% { fill-opacity: 0; } 74.259% { fill-opacity: 0; } 75.093% { fill-opacity: 1; } 100% { fill-opacity: 1; } }
@keyframes vs-idle-trace-fact { 0% { stroke-opacity: 0; clip-path: inset(0 100% 0 0); } 21.241% { stroke-opacity: 0; clip-path: inset(0 100% 0 0); } 21.296% { stroke-opacity: 1; clip-path: inset(0 100% 0 0); } 24.259% { stroke-opacity: 1; clip-path: inset(0); } 25.093% { stroke-opacity: 0; clip-path: inset(0); } 71.241% { stroke-opacity: 0; clip-path: inset(0 0 0 100%); } 71.296% { stroke-opacity: 1; clip-path: inset(0 0 0 100%); } 74.259% { stroke-opacity: 1; clip-path: inset(0); } 75.093% { stroke-opacity: 0; clip-path: inset(0); } 100% { stroke-opacity: 0; clip-path: inset(0); } }
@keyframes vs-idle-rule { 0% { fill-opacity: 1; } 16.667% { fill-opacity: 1; } 18.333% { fill-opacity: 0; } 25.741% { fill-opacity: 0; } 26.574% { fill-opacity: 1; } 66.667% { fill-opacity: 1; } 68.333% { fill-opacity: 0; } 75.741% { fill-opacity: 0; } 76.574% { fill-opacity: 1; } 100% { fill-opacity: 1; } }
@keyframes vs-idle-trace-rule { 0% { stroke-opacity: 0; clip-path: inset(0 100% 0 0); } 19.759% { stroke-opacity: 0; clip-path: inset(0 100% 0 0); } 19.815% { stroke-opacity: 1; clip-path: inset(0 100% 0 0); } 25.741% { stroke-opacity: 1; clip-path: inset(0); } 26.574% { stroke-opacity: 0; clip-path: inset(0); } 69.759% { stroke-opacity: 0; clip-path: inset(0 0 0 100%); } 69.815% { stroke-opacity: 1; clip-path: inset(0 0 0 100%); } 75.741% { stroke-opacity: 1; clip-path: inset(0); } 76.574% { stroke-opacity: 0; clip-path: inset(0); } 100% { stroke-opacity: 0; clip-path: inset(0); } }
@keyframes vs-idle-claim { 0% { fill-opacity: 1; } 16.667% { fill-opacity: 1; } 18.333% { fill-opacity: 0; } 27.222% { fill-opacity: 0; } 28.056% { fill-opacity: 1; } 66.667% { fill-opacity: 1; } 68.333% { fill-opacity: 0; } 77.222% { fill-opacity: 0; } 78.056% { fill-opacity: 1; } 100% { fill-opacity: 1; } }
@keyframes vs-idle-trace-claim { 0% { stroke-opacity: 0; clip-path: inset(0 100% 0 0); } 18.278% { stroke-opacity: 0; clip-path: inset(0 100% 0 0); } 18.333% { stroke-opacity: 1; clip-path: inset(0 100% 0 0); } 27.222% { stroke-opacity: 1; clip-path: inset(0); } 28.056% { stroke-opacity: 0; clip-path: inset(0); } 68.278% { stroke-opacity: 0; clip-path: inset(0 0 0 100%); } 68.333% { stroke-opacity: 1; clip-path: inset(0 0 0 100%); } 77.222% { stroke-opacity: 1; clip-path: inset(0); } 78.056% { stroke-opacity: 0; clip-path: inset(0); } 100% { stroke-opacity: 0; clip-path: inset(0); } }

/* working: a proof running. Tests are asked from the claim up, drawn as outlines,
   and answered from the top down, filled. */
.vs-mark[data-state="working"] rect { stroke-width: var(--vs-stroke); fill-opacity: 0; stroke-opacity: 0; animation: 2.4s linear infinite; }
.vs-mark[data-state="working"] .vs-mark__claim { animation-name: vs-work-claim; }
.vs-mark[data-state="working"] .vs-mark__rule { animation-name: vs-work-rule; }
.vs-mark[data-state="working"] .vs-mark__fact { animation-name: vs-work-fact; }
@keyframes vs-work-claim { 0% { stroke-opacity: 0; fill-opacity: 0; } 5%, 72% { stroke-opacity: 1; fill-opacity: 0; } 78%, 92% { stroke-opacity: 1; fill-opacity: 1; } 100% { stroke-opacity: 0; fill-opacity: 0; } }
@keyframes vs-work-rule { 0%, 14% { stroke-opacity: 0; fill-opacity: 0; } 20%, 56% { stroke-opacity: 1; fill-opacity: 0; } 62%, 92% { stroke-opacity: 1; fill-opacity: 1; } 100% { stroke-opacity: 0; fill-opacity: 0; } }
@keyframes vs-work-fact { 0%, 28% { stroke-opacity: 0; fill-opacity: 0; } 34%, 40% { stroke-opacity: 1; fill-opacity: 0; } 46%, 92% { stroke-opacity: 1; fill-opacity: 1; } 100% { stroke-opacity: 0; fill-opacity: 0; } }

/* asking: a fact is missing. The top test is a dashed outline in signal, and the claim waits. */
.vs-mark[data-state="asking"] .vs-mark__fact { fill: none; stroke: var(--signal); stroke-width: var(--vs-stroke); stroke-dasharray: 1.1 .8; animation: vs-ask 1.8s ease-in-out infinite; }
.vs-mark[data-state="asking"] .vs-mark__claim { fill: none; stroke: var(--ink-3); stroke-width: var(--vs-stroke); }
@keyframes vs-ask { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* holds: done. The answers settle from the top down and the claim turns accent. */
.vs-mark[data-state="holds"] rect { animation: vs-settle .42s var(--ease-out) both; }
.vs-mark[data-state="holds"] .vs-mark__rule { animation-delay: .1s; }
.vs-mark[data-state="holds"] .vs-mark__claim { animation: vs-settle .42s var(--ease-out) .2s both, vs-claim-on .3s ease-out .45s both; }
@keyframes vs-settle { from { transform: translateY(-1.5px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes vs-claim-on { from { fill: var(--ink); } to { fill: var(--accent); } }

/* fails: does not hold. The claim is hatched, and gives one short shake. */
.vs-mark[data-state="fails"] .vs-mark__claim { stroke: var(--ink-2); stroke-width: var(--vs-stroke); animation: vs-shake .38s ease-in-out .1s both; }
@keyframes vs-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-.9px); } 50% { transform: translateX(.9px); } 75% { transform: translateX(-.45px); } }

/* off: revoked, disabled, signed out. */
.vs-mark[data-state="off"] rect { fill: var(--ink-4); stroke: none; }

@media (prefers-reduced-motion: reduce) {
  .vs-mark rect { animation: none !important; }
  .vs-mark__trace { display: none !important; }
  .vs-mark[data-state="working"] rect { stroke-opacity: 1; }
  .vs-mark[data-state="working"] .vs-mark__fact { fill-opacity: 1; }
}

/* ——— Button ——— */
.vs-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-4); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: transparent; color: var(--ink); font: 500 14px/1 var(--font-sans); text-decoration: none; white-space: nowrap; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: scale 150ms ease-out, background-color 150ms ease-out, border-color 150ms ease-out; }
.vs-btn svg { width: 16px; height: 16px; flex: none; }
.vs-btn:active { scale: .97; }
.vs-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vs-btn--primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.vs-btn--quiet { border-color: transparent; color: var(--ink-2); padding: 0 var(--space-2); }
.vs-btn--danger { color: var(--signal); }
.vs-btn--sm { height: 30px; padding: 0 var(--space-3); font-size: 13px; }
.vs-btn--lg { height: 48px; padding: 0 22px; font-size: 16px; }
.vs-btn[disabled] { opacity: .45; cursor: not-allowed; }
@media (hover: hover) {
  .vs-btn:hover { border-color: var(--ink-3); background: var(--paper-2); }
  .vs-btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .vs-btn--quiet:hover { border-color: transparent; color: var(--ink); }
}

/* ——— Field ——— */
.vs-field { display: grid; gap: 6px; }
.vs-field > span { font: 500 13px/18px var(--font-sans); color: var(--ink-2); }
.vs-field > small { font: 400 13px/20px var(--font-sans); color: var(--ink-3); }
.vs-input { width: 100%; height: 36px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font: 400 15px/22px var(--font-sans); }
textarea.vs-input { height: auto; min-height: 84px; padding: var(--space-2) var(--space-3); resize: vertical; }
.vs-input::placeholder { color: var(--ink-3); }
.vs-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* ——— Verdict: a shape and a word ——— */
.vs-verdict { display: inline-flex; align-items: center; gap: var(--space-2); font: 500 13px/18px var(--font-sans); color: var(--ink); white-space: nowrap; }
.vs-verdict__shape { flex: none; width: 10px; height: 10px; border-radius: var(--radius-xs); }
.vs-verdict[data-verdict="holds"] .vs-verdict__shape { background: var(--accent); }
.vs-verdict[data-verdict="not"] .vs-verdict__shape { border: 1px solid var(--ink-2); background: repeating-linear-gradient(-45deg, var(--ink-2) 0 1px, transparent 1px 3px); }
.vs-verdict[data-verdict="unknown"] .vs-verdict__shape { border: 1px dashed var(--ink-3); }
.vs-verdict[data-verdict="unknown"] { color: var(--ink-2); }
.vs-verdict[data-verdict="needs"] .vs-verdict__shape { background: var(--signal); border-radius: 50%; }
.vs-verdict[data-verdict="needs"] { color: var(--signal); }
.vs-verdict[data-verdict="draft"] .vs-verdict__shape { border: 1px solid var(--ink-3); }
.vs-verdict[data-verdict="draft"] { color: var(--ink-2); }

/* ——— Quoted fact ——— */
.vs-quote { background: var(--mark); color: var(--ink); padding: 1px 3px; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ——— Code ——— */
.vs-code { border-radius: var(--radius-md); background: var(--code); overflow: hidden; }
.vs-code__head { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-2) var(--space-2) 0 var(--space-3); }
.vs-code__tab { padding: 6px var(--space-2); border: 0; border-bottom: 1px solid transparent; background: none; color: var(--ink-3); font: 500 13px/18px var(--font-sans); cursor: pointer; }
.vs-code__tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.vs-code__head .vs-btn { margin-left: auto; }
.vs-code pre { margin: 0; padding: var(--space-4); overflow-x: auto; font: 400 13px/20px var(--font-mono); color: var(--ink); white-space: pre; }
.vs-code .tok-k { color: var(--accent); }
.vs-code .tok-s { color: var(--ink-2); }
.vs-code .tok-c { color: var(--ink-3); }

/* ——— Table: rows on hairlines, no box ——— */
.vs-table { width: 100%; border-collapse: collapse; font: 400 14px/20px var(--font-sans); }
.vs-table th { padding: var(--space-2) var(--space-3) var(--space-2) 0; text-align: left; font: 500 13px/18px var(--font-sans); color: var(--ink-3); border-bottom: 1px solid var(--line); }
.vs-table td { padding: var(--space-3) var(--space-3) var(--space-3) 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.vs-table td:last-child, .vs-table th:last-child { padding-right: 0; text-align: right; }
.vs-table .num { font-variant-numeric: tabular-nums; }

/* ——— Nav ——— */
.vs-nav { display: flex; flex-direction: column; gap: 2px; width: 220px; padding: var(--space-6) var(--space-3); background: var(--paper); border-right: 1px solid var(--line); }
.vs-nav__brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--space-2) var(--space-6); font: 500 17px/1 var(--font-sans); color: var(--ink); text-decoration: none; }
.vs-nav__item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 var(--space-2); border-radius: var(--radius-sm); color: var(--ink-2); font: 400 14px/20px var(--font-sans); text-decoration: none; }
.vs-nav__item svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.vs-nav__item[aria-current="page"] { background: var(--paper-3); color: var(--ink); }
@media (hover: hover) { .vs-nav__item:hover { background: var(--paper-2); color: var(--ink); } }

/* ——— Dialog ——— */
.vs-scrim { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: var(--space-4); background: var(--scrim); }
.vs-dialog { width: min(480px, 100%); display: grid; gap: var(--space-4); padding: var(--space-6); border-radius: var(--radius-lg); background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow-float); animation: vs-in .2s var(--ease-out) both; }
.vs-dialog__foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding-top: var(--space-2); }
@keyframes vs-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .vs-dialog { animation: none; } }
