/* Liberty Guard dashboard. Apple design tokens on liquid glass surfaces.
   One accent (Action Blue), weights 400 / 600 / 700 only, hairlines not borders,
   no chrome shadows, state written as plain words. */

:root,
html[data-theme='light'] {
  --primary: #0066cc;
  --primary-focus: #0071e3;
  --ink: #1d1d1f;
  --ink-80: #333333;
  --ink-48: #7a7a7a;
  --hairline: #e0e0e0;
  --danger: #ff3b30;
  --on-primary: #ffffff;
  --replay-trail: #0066cc;
  --replay-flagged: #ff3b30;
  --replay-start: #34c759;
}

html[data-theme='dark'] {
  --primary: #2997ff;              /* Action Blue disappears on dark: sky link blue */
  --primary-focus: #2997ff;
  --ink: #ededf0;
  --ink-80: #cccccc;
  --ink-48: #a1a1a6;
  --hairline: rgba(255, 255, 255, 0.12);
  --danger: #ff453a;
  --on-primary: #ffffff;
  --replay-trail: #2997ff;
  --replay-flagged: #ff453a;
  --replay-start: #30d158;
}

:root {
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-base: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-xxxl: 48px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --font: system-ui, -apple-system, 'SF Pro Text', Inter, 'Segoe UI', Roboto, sans-serif;
  --size-title2: 40px;
  --size-title3: 28px;
  --size-headline: 20px;
  --size-body: 17px;
  --size-callout: 15px;
  --size-caption: 13px;
  --size-micro: 11px;
  /* Apple: no drop shadows on chrome. The glass keeps its rim, loses the shadow. */
  --glass-shadow: 0 0 0 transparent;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--size-body);
  font-weight: 400;
  line-height: 1.47;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--primary-focus);
  outline-offset: 2px;
}

h1 {
  font-size: var(--size-title2);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: var(--space-xl) 0 var(--space-base);
}
h2 {
  font-size: var(--size-headline);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-md);
}

.topbar {
  position: sticky;
  top: var(--space-md);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-base);
  max-width: 1120px;
  margin: var(--space-md) auto 0;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-xl);
}
.brand { color: var(--ink); font-weight: 700; font-size: var(--size-headline); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: var(--space-base); font-size: var(--size-callout); }
.who { color: var(--ink-48); }

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-base) var(--space-xl) var(--space-xxxl);
}

footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-xl) var(--space-xxl);
  color: var(--ink-48);
  font-size: var(--size-micro);
}

.crumbs { margin: var(--space-xl) 0 0; font-size: var(--size-callout); color: var(--ink-48); }
.lead { font-size: var(--size-headline); color: var(--ink-80); margin: 0 0 var(--space-xl); }
.muted { color: var(--ink-48); }
.fine { font-size: var(--size-caption); color: var(--ink-48); }
.error { color: var(--danger); font-weight: 600; }

.hero {
  max-width: 560px;
  margin: 12vh auto 0;
  text-align: center;
}
.hero h1 { font-size: 56px; }

.pill {
  display: inline-block;
  padding: var(--space-md) var(--space-xl);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
  font: 600 var(--size-body) var(--font);
  cursor: pointer;
  transition: transform 150ms ease-out;
}
.pill:hover { text-decoration: none; }
.pill:active { transform: scale(0.95); }
.pill.small { padding: var(--space-sm) var(--space-lg); font-size: var(--size-callout); }

.card {
  padding: var(--space-lg);
  margin: 0 0 var(--space-xl);
  border-radius: var(--radius-lg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-xl);
}
.tile { display: block; color: var(--ink); margin: 0; }
.tile:hover { text-decoration: none; }
.tile p { margin: var(--space-xs) 0 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-base);
  margin: 0 0 var(--space-xl);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-base) var(--space-lg);
  border-radius: var(--radius-lg);
}
.stat .label { font-size: var(--size-caption); font-weight: 600; color: var(--ink-48); }
.stat .value { font-size: var(--size-title3); font-weight: 700; letter-spacing: -0.01em; }
.stat .value.small { font-size: var(--size-headline); }

/* Children of a glass panel paint no surface or border of their own:
   rows are separated by spacing and weight. */
table { width: 100%; border-collapse: separate; border-spacing: 0 var(--space-xs); }
th {
  text-align: left;
  font-size: var(--size-caption);
  font-weight: 600;
  color: var(--ink-48);
  padding: 0 var(--space-md) var(--space-xs) 0;
}
td { padding: var(--space-xs) var(--space-md) var(--space-xs) 0; vertical-align: top; }
td:first-child { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

dl {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: var(--space-sm) var(--space-xl);
  margin: 0;
}
dt { font-weight: 600; color: var(--ink-80); }
dd { margin: 0; }

ul { margin: 0; padding-left: var(--space-lg); }
.timeline { list-style: none; padding: 0; display: grid; gap: var(--space-sm); }

pre {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  font: var(--size-caption) / 1.5 ui-monospace, 'SF Mono', Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.replay svg { width: 100%; height: auto; display: block; }
.replay .trail { fill: none; stroke: var(--replay-trail); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.replay .flagged { fill: none; stroke: var(--replay-flagged); stroke-width: 4; stroke-linecap: round; }
.replay .start { fill: var(--replay-start); }
.replay .marker { fill: var(--ink); }
.controls { display: flex; align-items: center; gap: var(--space-base); margin-top: var(--space-md); }
.controls input[type=range] { flex: 1; accent-color: var(--primary); }

@media (max-width: 640px) {
  main, footer { padding-left: var(--space-base); padding-right: var(--space-base); }
  .topbar { margin: var(--space-sm) var(--space-base) 0; padding: var(--space-md) var(--space-base); }
  h1 { font-size: var(--size-title3); }
  .hero h1 { font-size: var(--size-title2); }
  dl { grid-template-columns: 1fr; gap: var(--space-xs); }
  dd { margin-bottom: var(--space-sm); }
  table { font-size: var(--size-callout); }
}

@media (prefers-reduced-motion: reduce) {
  .pill { transition: none; }
}
