/*
 * Fitts design tokens (SPEC §5). The only source of colors, radii, borders, shadows and
 * fonts in the app. Mock sites (src/renderer/mock/sites) use their own styles.
 */
:root {
  /* Color · §5.1 */
  --paper: #fbfaf7;
  --card: #ffffff;
  --ink: #16161d;
  --ink-2: #2e2e38;
  --muted: #5a5a66;
  --surface-2: #f3f1ec;
  --cobalt: #3d5afe;
  --cobalt-ink: #2a3fd6;
  --cobalt-deep: #1b2ba8;
  --cobalt-tint: #e8ecff;
  --coral: #ff6b5b;
  --coral-tint: #ffe2de;
  --coral-ink: #9e2a1e;
  --sun: #ffc53d;
  --sun-tint: #fff4d6;
  --sun-ink: #6e4a00;
  --mint: #2bd9a0;
  --mint-tint: #ddf8ee;
  --mint-ink: #0b6b4b;
  --lilac: #b69cff;
  --lilac-tint: #efe9ff;
  --lilac-ink: #4a2fb0;
  --wine: #7a1f3d;
  --danger: #d92d20;
  --danger-ink: #b42318;
  --danger-tint: #fff7f6;
  --neutral-tint: #f0efea;
  --neutral-ink: #3a3a44;
  --scrim: rgba(22, 22, 29, 0.62);

  /* App colors from the design references that are not in the §5.1 table */
  --ink-faint: #8a8a93; /* dashed borders, hollow status dots; never text (3.4:1) */
  --track: #e2dfd8; /* progress-bar tracks */
  --code-caption: #b8b8c2; /* file:line caption on the ink diff block */
  --disabled-ink: #6b6b74; /* disabled segment text on surface-2 */

  /* Fixed-purpose colors named in the spec */
  --diff-del: #ff9c90; /* §6.5 code diff, removed lines */
  --diff-add: #7ff0c8; /* §6.5 code diff, added lines */
  --avatar-hi: #8a9bff; /* §5.4 Fitts avatar gradient */
  --avatar-lo: #2235c4;

  /* Radius · §5.3 */
  --radius-tag: 6px; /* tiny tags: NOW / WITH FIX, pointing-at chip */
  --radius-label: 8px; /* emblem layer tag and formula label */
  --radius-row: 10px; /* list rows, toolbar buttons, URL field, inline cards */
  --radius-control: 12px;
  --radius-card: 14px; /* chat cards, Welcome CTA */
  --radius-sheet: 16px; /* finding panel, project menu */
  --radius-panel: 18px;
  --radius-hero: 22px;
  --radius-emblem: 28px;
  --radius-pill: 999px;
  --radius-bubble: 16px 16px 4px 16px; /* user chat bubble (§6.6) */

  /* Border width · §5.3 */
  --border-hairline: 1px;
  --border-panel: 1.5px;
  --border-modal: 2px;

  /* Elevation · §5.3 (hard offset shadows) */
  --shadow-button: 2px 2px 0 var(--ink);
  --shadow-panel: 3px 3px 0 var(--ink);
  --shadow-hero: 4px 4px 0 var(--ink);
  --shadow-danger: 6px 6px 0 var(--danger);

  /* Type · §5.2 */
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-sans: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;

  /* Motion · §5.3 */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --duration-panel: 180ms;
}

/* The run report's styles. Colors, radii, borders, shadows and fonts come only from tokens.css
   (a copy of the app's; tests/tokens.test.ts fails when they drift). Works from 320 px up. */

@font-face {
  font-family: 'Geist';
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Geist-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/GeistMono-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-weight: 200 800;
  font-display: swap;
  src: url('fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2-variations');
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 2px;
}
[id] {
  scroll-margin-top: 1rem;
}
a {
  color: var(--cobalt-ink);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--cobalt-deep);
}
code,
pre {
  font-family: var(--font-mono);
  font-size: 0.88em;
}
code {
  overflow-wrap: anywhere;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
}
h3 {
  margin: 0.25rem 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
}
h4 {
  margin: 1.25rem 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
}
p {
  margin: 0 0 0.75rem;
}
ul,
ol {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
}
li + li {
  margin-top: 0.25rem;
}
.wrap {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 16px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.small {
  color: var(--muted);
  font-size: 0.875rem;
}
.block {
  display: block;
}
.lead {
  max-width: 44rem;
  color: var(--ink-2);
  font-size: 1.05rem;
}

/* The skip link sits where it shows, invisible until focused. */
.skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 16px;
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--card);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
}
.skip:focus {
  opacity: 1;
  pointer-events: auto;
  color: var(--card);
}

/* On the site: the bar back to it. */
.bar {
  border-bottom: var(--border-panel) solid var(--ink);
  background: var(--card);
}
.bar-in {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
}
.brand:hover {
  color: var(--ink);
}
.bar-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  font-weight: 600;
}
.m-cobalt {
  fill: none;
  stroke: var(--cobalt);
  stroke-linecap: round;
}
.m-ink {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
}
.m-coral {
  fill: var(--coral);
}
.m-handle {
  fill: var(--card);
  stroke: var(--cobalt);
}

/* The top: what run this is, and its numbers. */
.top {
  padding: 40px 0 8px;
}
.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--cobalt-ink);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.meta {
  color: var(--muted);
}
.brief {
  max-width: 44rem;
  margin: 1rem 0;
  padding: 12px 16px;
  border-left: 4px solid var(--cobalt);
  border-radius: 0 var(--radius-row) var(--radius-row) 0;
  background: var(--cobalt-tint);
}
.brief p {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.brief .who {
  color: var(--ink-2);
  font-size: 0.875rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 1.5rem 0 1rem;
}
.stat {
  padding: 14px 16px;
  border: var(--border-panel) solid var(--ink);
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow-button);
}
.stat dt {
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 600;
}
.stat dd {
  margin: 0;
}
.num {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
}
.note {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}
.math {
  color: var(--ink-2);
}
.toc ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.toc li + li {
  margin-top: 0;
}
.toc a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border: var(--border-hairline) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.toc a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

main section {
  padding: 40px 0 8px;
}
.card {
  margin: 0 0 16px;
  padding: 16px;
  border: var(--border-panel) solid var(--ink);
  border-radius: var(--radius-panel);
  background: var(--card);
  box-shadow: var(--shadow-panel);
}
@media (min-width: 640px) {
  .card {
    padding: 24px;
  }
}
.prose p:last-child {
  margin-bottom: 0;
}

/* Chips and severity, as in the app (§5.1). */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.5rem;
}
.chip,
.sev {
  display: inline-flex;
  align-items: center;
  padding: 1px 10px;
  border-radius: var(--radius-pill);
  background: var(--neutral-tint);
  color: var(--neutral-ink);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.6;
  vertical-align: middle;
}
.chip-good {
  background: var(--mint-tint);
  color: var(--mint-ink);
}
.sev-4 {
  background: var(--wine);
  color: var(--card);
}
.sev-3 {
  background: var(--coral-tint);
  color: var(--coral-ink);
}
.sev-2 {
  background: var(--sun-tint);
  color: var(--sun-ink);
}
.where {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

/* The App Map tree. */
.tree {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.tree .tree {
  margin-top: 6px;
  padding-left: 14px;
  border-left: var(--border-hairline) dashed var(--ink-faint);
}
.tree li + li {
  margin-top: 8px;
}
.node {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}
.node code {
  font-weight: 600;
}
.tally {
  color: var(--ink-2);
  font-size: 0.875rem;
}
.map details,
.map p,
.map ul {
  margin: 4px 0 0;
}
summary {
  min-height: 24px;
  cursor: pointer;
  color: var(--cobalt-ink);
  font-weight: 600;
}

/* Screens with the element outlined. */
.shot {
  margin: 16px 0 0;
}
.shot svg {
  display: block;
  width: 100%;
  height: auto;
  border: var(--border-hairline) solid var(--ink);
  border-radius: var(--radius-row);
  background: var(--paper);
}
.shot svg,
.shot .frame {
  overflow: hidden;
  contain: paint;
}
.shot svg.whole {
  max-height: 460px;
}
.shot figcaption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.875rem;
}
.pair {
  display: grid;
  gap: 12px;
}
@media (min-width: 720px) {
  .pair {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
  }
}
.pair .small {
  margin: 0 0 4px;
}
.outline {
  fill: var(--cobalt-tint);
  fill-opacity: 0.35;
  stroke: var(--cobalt);
  stroke-linejoin: round;
}
.box {
  fill: none;
  stroke: var(--cobalt);
}

.noticed li::marker {
  color: var(--cobalt);
}
.steps li {
  padding-left: 2px;
}
.pairs {
  display: grid;
  gap: 8px;
  margin: 0.5rem 0 0;
}
.pairs div {
  display: grid;
  gap: 2px;
}
@media (min-width: 640px) {
  .pairs div {
    grid-template-columns: 9rem minmax(0, 1fr);
  }
}
.pairs dt {
  color: var(--ink-2);
  font-weight: 600;
}
.pairs dd {
  margin: 0;
}

pre {
  position: relative;
  max-width: 100%;
  margin: 8px 0 0;
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: var(--radius-row);
  background: var(--ink);
  color: var(--card);
  line-height: 1.5;
  white-space: pre;
}
details.code {
  margin-top: 1rem;
}
pre.diff {
  max-height: 28rem;
}
.diff .add {
  color: var(--diff-add);
}
.diff .del {
  color: var(--diff-del);
}
.sign {
  display: inline-block;
  width: 1.25em;
}
.fix {
  margin-top: 1.25rem;
  padding-top: 0.25rem;
  border-top: var(--border-hairline) solid var(--track);
}
.lesser {
  padding-left: 0;
  list-style: none;
}
.lesser li + li {
  margin-top: 12px;
  padding-top: 12px;
  border-top: var(--border-hairline) solid var(--track);
}

/* Tables scroll inside themselves on a phone. */
.table {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  border: var(--border-panel) solid var(--ink);
  border-radius: var(--radius-card);
  background: var(--card);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th,
td {
  padding: 8px 10px;
  border-bottom: var(--border-hairline) solid var(--track);
  text-align: left;
  vertical-align: top;
}
thead th {
  background: var(--surface-2);
  white-space: nowrap;
}
tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}
.n {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.phases {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding: 0;
  list-style: none;
}
.phases li + li {
  margin-top: 0;
}

.foot {
  margin-top: 48px;
  padding: 24px 0 40px;
  border-top: var(--border-panel) solid var(--ink);
  color: var(--ink-2);
  font-size: 0.9rem;
}
