:root {
  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Fira Code", Menlo, Monaco, Consolas, "Courier New", monospace;
  --font-base: 1rem;               /* 16px */
  --font-scale: 1.25;               /* major third */
  --line-height: 1.5;
  --measure: 65ch;                  /* optimal line length */

  /* Color palette */
  --accent: #006D77;
  --accent-light: #009688;
  --accent-dark: #004F5A;
  --bg: #ffffff;
  --bg-muted: #f7fafc;
  --text: #111111;
  --text-muted: #555555;
  --border: #e2e8f0;
  --link: var(--accent);
  --link-hover: var(--accent-dark);
  --pill-good: #2e7d32;   /* dark green */
  --pill-warn: #c17900;   /* amber */
  --pill-bad: #c41c00;    /* red */

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 24px rgba(0,0,0,0.12);

  /* Spacing */
  --space-xxs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-xxl: 3rem;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* Reset & base */
*, *::before, *::after {
  box-sizing: border-box;
}
html {
  font-family: var(--font-sans);
  font-size: var(--font-base);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
}
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
}

/* Typography helpers */
h1 { font-size: calc(var(--font-base) * var(--font-scale) * var(--font-scale) * var(--font-scale)); margin: var(--space-lg) 0 var(--space-md); }
h2 { font-size: calc(var(--font-base) * var(--font-scale) * var(--font-scale)); margin: var(--space-lg) 0 var(--space-md); }
h3 { font-size: calc(var(--font-base) * var(--font-scale)); margin: var(--space-md) 0 var(--space-sm); }
p, .prose { max-width: var(--measure); margin: 0 0 var(--space-md); }
a { color: var(--link); text-decoration: underline; text-underline-offset: .15em; }
a:hover, a:focus { color: var(--link-hover); text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header */
header {
  background: var(--bg-muted);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}
header h1 {
  margin: 0;
  font-weight: 600;
}
header h1 a {
  color: var(--text);
  text-decoration: none;
}
header .tagline {
  margin: var(--space-xs) 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
header nav {
  margin-top: var(--space-sm);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
header nav a {
  font-weight: 500;
  padding: var(--space-xxs) var(--space-xs);
  border-radius: var(--radius-sm);
}
header nav a:hover,
header nav a:focus-visible {
  background: var(--accent-light);
  color: #fff;
}
header .disclosure {
  margin-top: var(--space-sm);
  padding: var(--space-xxs) var(--space-xs);
  font-size: 0.75rem;
  background: #fafafa;
  border-left: 4px solid var(--accent);
  color: var(--text-muted);
}

/* Main layout */
main {
  padding: var(--space-md);
}
section {
  margin-bottom: var(--space-xl);
}

/* Card system */
article.belief,
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  transition: transform .15s ease, box-shadow .15s ease;
}
article.belief:hover,
.card:hover,
article.belief:focus-within,
.card:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Hero (identity) card */
.hero {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.hero img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.hero .info {
  flex: 1;
}
.hero .info h2 {
  margin: 0;
}
.hero .info p {
  margin: var(--space-xxs) 0 0;
  color: var(--text-muted);
}

/* Stat component */
.stat {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  font-variant-numeric: tabular-nums;
}
.stat .n {
  font-weight: 600;
  font-size: 1.25rem;
}
.stat .l {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Tags & pills */
.tag {
  display: inline-block;
  background: var(--bg-muted);
  color: var(--text);
  padding: var(--space-xxs) var(--space-xs);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}
.pill {
  display: inline-block;
  padding: var(--space-xxs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
}
.pill.good   { background: var(--pill-good); }
.pill.warn   { background: var(--pill-warn); }
.pill.bad    { background: var(--pill-bad); }

/* Quote */
blockquote.quote {
  border-left: 4px solid var(--accent);
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
  font-style: italic;
  color: var(--text-muted);
}

/* Prose */
.prose {
  line-height: 1.7;
  color: var(--text);
}
.prose h2,
.prose h3 {
  margin-top: var(--space-lg);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: 0.95rem;
}
th,
td {
  padding: var(--space-sm);
  border: 1px solid var(--border);
  text-align: left;
}
th {
  background: var(--bg-muted);
  font-weight: 600;
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: var(--space-sm) 0;
}
.chips .chip {
  background: var(--bg-muted);
  color: var(--text);
  padding: var(--space-xxs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

/* Grid helpers */
.grid2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}
@media (min-width: 600px) {
  .grid2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Sparkline SVG */
svg.spark {
  width: 100%;
  height: 40px;
  overflow: visible;
}
svg.spark path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

/* Buttons */
button.btn,
a.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .2s ease, transform .1s ease;
}
button.btn:hover,
a.btn:hover,
button.btn:focus-visible,
a.btn:focus-visible {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
button.btn:active,
a.btn:active {
  background: var(--accent);
  transform: translateY(0);
}

/* Footer */
footer {
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: var(--space-md);
  border-top: 1px solid var(--border);
  text-align: center;
}
footer a {
  color: var(--text-muted);
}
footer a:hover,
footer a:focus-visible {
  color: var(--text);
}

/* Accessibility focus outline for all interactive elements */
a, button, input, textarea, select {
  outline: none;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Mobile‑first tweaks */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}

/* Dark mode (optional, respects user preference) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --bg-muted: #1e1e1e;
    --text: #e5e5e5;
    --text-muted: #bbbbbb;
    --border: #333333;
    --link: #66d9ef;
    --link-hover: #a5e1ff;
  }
  header, footer {
    background: var(--bg-muted);
    border-color: var(--border);
  }
  article.belief,
  .card {
    background: #1a1a1a;
    border-color: var(--border);
  }
  blockquote.quote {
    border-left-color: var(--accent);
    background: #1f1f1f;
  }
}