/* --------------------------------------------------------------------------
   tally — a commit matrix with a red signal.
   The dark palette is the primary one. Light mode is a deliberate second
   theme, not an automatic inversion.
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;
  --surface-1: #fbf8f6;
  --surface-2: #f4eeeb;
  --page: #efe7e3;
  --ink: #160d0f;
  --ink-2: #5b4a4b;
  --muted: #8a7677;
  --grid: #e2d6d3;
  --axis: #c9b8b6;
  --border: rgba(22, 13, 15, 0.12);
  --border-strong: rgba(200, 16, 46, 0.35);
  --accent: #c8102e;
  --accent-soft: #8f0f22;
  --accent-dim: #f0c9cd;
  --track: #f0dcdc;
  --matrix-0: #ebe3e0;
  --matrix-1: #d98f97;
  --matrix-2: #c95a68;
  --matrix-3: #b83245;
  --matrix-4: #9e1f31;
  --matrix-5: #700a1a;
  --series-red: #ff0000;
  --series-1: #3e06eb;
  --series-2: #8d0466;
  --series-3: #8a63fe;
  --series-4: #7704aa;
  --series-5: #912403;
  --series-6: #9e08df;
  --series-7: #cb0278;
  --series-other: #c2babb;
  --shadow: 0 18px 50px rgba(22, 13, 15, 0.10);
  --glow: 0 0 18px rgba(200, 16, 46, 0.18);
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #100b0c;
    --surface-2: #160f11;
    --page: #070506;
    --ink: #f4e9e7;
    --ink-2: #c3adae;
    --muted: #8a7375;
    --grid: #241417;
    --axis: #3a2427;
    --border: rgba(255, 43, 61, 0.14);
    --border-strong: rgba(255, 43, 61, 0.45);
    --accent: #ff2b3d;
    --accent-soft: #ff6b78;
    --accent-dim: #2a1114;
    --track: #2a1114;
    --matrix-0: #1a1113;
    --matrix-1: #8a1622;
    --matrix-2: #b01a2a;
    --matrix-3: #d92a3c;
    --matrix-4: #ff4d5e;
    --matrix-5: #ff9aa3;
    --series-red: #ff0000;
    --series-1: #5829fe;
    --series-2: #b20481;
    --series-3: #a076fe;
    --series-4: #9803c4;
    --series-5: #ba0d01;
    --series-6: #c610fd;
    --series-7: #ee008e;
    --series-other: #4a4446;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
    --glow: 0 0 24px rgba(255, 43, 61, 0.18);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #100b0c;
  --surface-2: #160f11;
  --page: #070506;
  --ink: #f4e9e7;
  --ink-2: #c3adae;
  --muted: #8a7375;
  --grid: #241417;
  --axis: #3a2427;
  --border: rgba(255, 43, 61, 0.14);
  --border-strong: rgba(255, 43, 61, 0.45);
  --accent: #ff2b3d;
  --accent-soft: #ff6b78;
  --accent-dim: #2a1114;
  --track: #2a1114;
  --matrix-0: #1a1113;
  --matrix-1: #8a1622;
  --matrix-2: #b01a2a;
  --matrix-3: #d92a3c;
  --matrix-4: #ff4d5e;
  --matrix-5: #ff9aa3;
  --series-red: #ff0000;
  --series-1: #5829fe;
  --series-2: #b20481;
  --series-3: #a076fe;
  --series-4: #9803c4;
  --series-5: #ba0d01;
  --series-6: #c610fd;
  --series-7: #ee008e;
  --series-other: #4a4446;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  --glow: 0 0 24px rgba(255, 43, 61, 0.18);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 43, 61, 0.10), transparent 55%),
    var(--page);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="light"] body {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 0, 0, 0.07), transparent 55%),
    var(--page);
}

a {
  color: inherit;
  text-decoration-color: var(--axis);
  text-underline-offset: 3px;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

.page { margin: 0 auto; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* The page-wide period picker sits beside the theme toggle. */
.header-controls {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
}

/* index.html marks the root `.js` before first paint; without scripts the
   buttons that need them stay hidden. */
:root:not(.js) .period-picker,
:root:not(.js) .controls,
:root:not(.js) #theme { display: none; }

/* The same picker, docked to the top edge (the bottom on phones) while the
   header's is out of view. Scroll padding keeps focus and anchors clear of it. */
html { scroll-padding-top: 56px; }

.period-dock {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 10px 8px 16px;
  border: 1px solid var(--border-strong);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: var(--surface-1);
  box-shadow: var(--glow), var(--shadow);
  visibility: hidden;
  transform: translate(-50%, -100%);
  transition: transform 0.2s ease, visibility 0s 0.2s;
}

.period-dock[hidden] { display: none; }

.period-dock.shown {
  visibility: visible;
  transform: translate(-50%, 0);
  transition: transform 0.2s ease;
}

.dock-id {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

@media (max-width: 860px) {
  html { scroll-padding: 0 0 calc(64px + env(safe-area-inset-bottom)); }
  body { padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
  .period-dock {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    justify-content: space-between;
    padding: 6px 14px calc(6px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--border-strong);
    border-radius: 0;
    transform: translateY(100%);
  }
  .period-dock.shown { transform: none; }
  .period-dock .segmented button { min-height: 32px; padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .period-dock,
  .period-dock.shown { transition: none; }
}

@media print {
  .period-dock { display: none; }
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow.accent { color: var(--accent); }

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
}

:root[data-theme="dark"] h1,
:root:where(:not([data-theme="light"])) h1 {
  text-shadow: var(--glow-text);
}

h2 {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h2::before {
  content: "// ";
  color: var(--accent);
}

.asof, .sub {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 12px;
}

.label {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */

.card, .share-card {
  position: relative;
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card {
  padding: 18px 20px;
  margin-bottom: 16px;
}

.matrix-card {
  overflow: hidden;
  border-top: 2px solid var(--accent);
  box-shadow: var(--glow), var(--shadow);
}

.matrix-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(680px 240px at 16% 0%, rgba(255, 43, 61, 0.10), transparent 70%);
}

.matrix-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.018) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.55;
}

.matrix-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
}

.matrix-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.matrix-side {
  min-width: 0;
  padding-left: 24px;
  border-left: 1px solid var(--border);
}

.matrix-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.matrix-head h2 {
  margin-top: 2px;
  color: var(--ink);
  font-size: 15px;
}

.matrix-head .sub { max-width: 48ch; }

.matrix-total {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
}

.matrix-total-value {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  text-shadow: var(--glow-text);
}

.matrix-scroll {
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-color: var(--accent-dim) var(--surface-1);
}

#matrix {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.matrix-cell {
  stroke: none;
  cursor: pointer;
  transition: opacity 120ms ease;
}

.matrix-cell:hover,
.matrix-cell:focus-visible {
  stroke: var(--ink);
  stroke-width: 1.5;
  outline: none;
}

.matrix-cell.selected {
  stroke: var(--ink);
  stroke-width: 2;
}

.matrix-cell[data-level="5"] {
  filter: drop-shadow(var(--glow-mark));
}

/* Away days: a hatch instead of the empty fill, and a band behind the
   date chart's bars. */
:root {
  --away: color-mix(in srgb, var(--accent) 34%, transparent);
  --away-band: color-mix(in srgb, var(--accent) 7%, transparent);
}

.matrix-away-ground { fill: var(--matrix-0); }
.matrix-away-line { stroke: var(--away); stroke-width: 1; }
.matrix-away-swatch {
  background: repeating-linear-gradient(45deg, var(--away) 0 1px, var(--matrix-0) 1px 3px);
}
.matrix-away-key { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; }
.chart-away { fill: var(--away-band); pointer-events: none; }

.matrix-month,
.matrix-weekday {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.matrix-month { text-transform: uppercase; }

/* Day numbers on calendar squares. Each shade gets the text colour with at
   least 4.5:1 contrast in both themes. */
.matrix-date {
  fill: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
}

.matrix-date[data-level="0"] { fill: var(--muted); }
.matrix-date[data-level="4"] { fill: #fff; }
.matrix-date[data-level="5"] { fill: var(--page); }
:root[data-theme="light"] .matrix-date:is([data-level="2"], [data-level="3"]) { fill: #fff; }

.matrix-row {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.matrix-row .matrix-scroll { flex: 1 1 auto; min-width: 0; }

/* The stats beside calendar squares, level with the first row of cells. */
.stat-row.matrix-gutter {
  flex: none;
  display: grid;
  grid-template-columns: auto auto;
  align-content: start;
  gap: 12px 16px;
  margin-top: 38px;
  padding-left: 22px;
  border-left: 1px solid var(--border);
}

.matrix-gutter .stat { display: contents; }
.matrix-gutter dd { text-align: right; }

.matrix-spark {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.matrix-spark[hidden] { display: none; }

.spark-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.spark-head .label { margin: 0; }

.spark-key {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.spark-line {
  width: 18px;
  height: 2px;
  margin-right: 5px;
  border-radius: 2px;
  display: inline-block;
}

.spark-line.daily {
  background: var(--accent-soft);
  opacity: 0.6;
}

.spark-line.average { background: var(--accent); }

#spark {
  display: block;
  width: 100%;
  height: 64px;
  margin-top: 4px;
  overflow: visible;
}

.spark-baseline {
  stroke: var(--border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.spark-area {
  fill: var(--accent);
  opacity: 0.1;
}

.spark-daily {
  fill: none;
  stroke: var(--accent-soft);
  stroke-width: 1.2;
  opacity: 0.55;
  vector-effect: non-scaling-stroke;
}

.spark-average {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(var(--glow-mark));
}

/* Stat rows: small label/value pairs on one line, wrapping when narrow. */

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0;
  font-family: var(--mono);
  line-height: 1.4;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.stat dt {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.stat-meta {
  margin-left: 6px;
  color: var(--muted);
  font-size: 10px;
}

.matrix-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.matrix-legend {
  margin: 0;
  gap: 5px;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.matrix-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  flex: none;
}

.matrix-tooltip { position: absolute; top: 10px; left: 10px; }

/* The day panel under the heatmap: one UTC day's commits. */

.day-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  /* Past the scroll padding, so focus leaves its ring and top clear of the
     docked picker and its shadow. */
  scroll-margin-top: 24px;
}

.day-panel[hidden] { display: none; }
.day-panel:focus { outline: none; }
.day-panel:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* Two classes to sit below the card headings' 27px, which come later. */
.day-panel .day-head h2 {
  margin-top: 2px;
  color: var(--ink);
  font-size: 18px;
}

.day-head .icon-button { flex: none; }

.day-list {
  max-height: 360px;
  margin: 8px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: var(--accent-dim) var(--surface-1);
}

.day-commit {
  display: grid;
  grid-template-columns: 38px minmax(0, 10rem) 6.5rem minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid var(--grid);
  font-size: 12px;
}

.day-time,
.day-sha,
.day-project {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.day-project {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--ink-2);
}

.day-project-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-subject { color: var(--ink); overflow-wrap: anywhere; }

.day-private {
  padding: 7px 0 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Project ranking
   -------------------------------------------------------------------------- */

.side-head h2 { color: var(--ink); }

.project-ranking {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.project-row {
  display: grid;
  grid-template-columns: 18px auto auto minmax(0, 1fr);
  grid-template-areas:
    "rank body body body"
    ".    icon count spark";
  gap: 5px 8px;
  align-items: center;
}

.project-rank {
  grid-area: rank;
  align-self: start;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 16px;
  text-align: right;
}

.project-row > .project-icons { grid-area: icon; display: flex; align-items: center; gap: 6px; }
.project-row .project-icon { width: 20px; height: 20px; }
.project-row .project-favicon { width: 16px; height: 16px; }

.project-icon {
  display: grid;
  box-sizing: border-box;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  overflow: hidden;
  border-radius: 6px;
}

/* A faint tile, so a favicon as dark as the page still shows its edge. */
.project-icon:not(.fallback) {
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.project-icon.fallback {
  border: 1px solid var(--border-strong);
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.2);
}

.project-favicon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 4px;
}

.repo-name .project-icon {
  width: 20px;
  height: 20px;
}

.repo-name .project-favicon {
  width: 16px;
  height: 16px;
}

.project-body { grid-area: body; min-width: 0; }

/* A project name links to its site; it reads as a name until hovered. */
.project-name-link { text-decoration: none; }

.project-name {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.project-label { min-width: 0; }

/* A project's links: the favicon opens its live site, and the forge logo
   beside it, in the page's red, opens the repository. The logo's slot is the
   favicon's size, and is kept empty on rows without one, so both line up. */
.project-links { display: inline-flex; flex: none; align-items: center; gap: 4px; vertical-align: middle; }
.project-site { display: inline-flex; flex: none; border-radius: 6px; }
.project-icon.small { width: 14px; height: 14px; border-radius: 3px; font-size: 7px; }
.project-icon.small .project-favicon { width: 12px; height: 12px; }

.source-link {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

/* The logo is masked on a pseudo-element so the focus ring isn't clipped. */
.source-link::before {
  width: 16px;
  height: 16px;
  background: var(--accent);
  content: "";
  -webkit-mask: var(--glyph) center / contain no-repeat;
  mask: var(--glyph) center / contain no-repeat;
}

.source-link.small { width: 14px; height: 14px; border-radius: 3px; }
.source-link.small::before { width: 12px; height: 12px; }
.source-link.empty::before { content: none; }
.source-link:hover::before { background: var(--accent-soft); }
.source-tangled { --glyph: url("icons/tangled.svg"); }
.source-github { --glyph: url("icons/github.svg"); }

.project-label-part {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
  white-space: pre;
}

.project-meta {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-count {
  grid-area: count;
  display: inline-flex;
  min-width: 5ch;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.project-momentum {
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

.project-momentum.up { color: var(--accent); }
.project-burn { margin-left: 4px; color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: 0.04em; }
.project-momentum.down { color: var(--muted); }
.project-momentum.flat { color: var(--ink-2); }

.side-note { margin-top: 14px; font-size: 11px; }

.side-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.side-link:hover { color: var(--accent-soft); }

/* --------------------------------------------------------------------------
   Hero figures and KPIs
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.share-card { padding: 20px 22px; }

.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.share-value {
  margin: 6px 0 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: 0;
  text-shadow: var(--glow-text);
}

.share-prior { margin-top: 7px; font-size: 11px; }

.meter {
  position: relative;
  height: 9px;
  margin: 13px 0 8px;
}

.meter-track, .meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 5px;
}

.meter-track { width: 100%; background: var(--track); }

.meter-fill {
  width: 0;
  background: var(--accent);
  box-shadow: var(--glow-mark);
  transition: width 300ms ease;
}


/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--page);
}

button {
  padding: 5px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

button:hover { color: var(--ink); background: var(--accent-dim); }

button.active,
button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--surface-1);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.ghost {
  border: 1px solid var(--border);
  background: var(--surface-1);
}

.ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--accent);
  font-size: 15px;
}

.theme-glyph { display: block; width: 16px; height: 16px; margin: auto; }

button:focus-visible,
a:focus-visible,
summary:focus-visible,
.stat dd:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Legends and charts
   -------------------------------------------------------------------------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 14px 0 4px;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend .burn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: none;
}

.legend .burn-toggle:hover { color: var(--ink); }
.legend .burn-toggle[aria-pressed="false"] { opacity: 0.45; text-decoration: line-through; }

/* A legend link's icon is 14 px; its hit box is 24 px, grown up, down and
   away from its neighbour. Negative margins keep the legend's layout. */
.legend .project-links a { box-sizing: content-box; padding: 5px 0; margin: -5px 0; }
.legend .project-links a:first-child { padding-left: 10px; margin-left: -10px; }
.legend .project-links a:last-child { padding-right: 10px; margin-right: -10px; }

.burn-key {
  width: 14px;
  height: 2px;
  background: #ff0000;
  box-shadow: var(--glow-mark);
}

.swatch {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 2px;
  background: var(--swatch, var(--series-1));
}

.chart-wrap {
  position: relative;
  width: 100%;
  margin-top: 6px;
}

#chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 220px;
  overflow: visible;
}

.chart-grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tick { fill: var(--muted); font-family: var(--mono); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-hit { fill: transparent; cursor: crosshair; }
#chart .chart-hit { cursor: pointer; }
/* The token burn pulse: pure red on a page-coloured casing, sharp joins. */
.burn-casing, .burn-pulse {
  fill: none;
  stroke-linejoin: miter;
  stroke-miterlimit: 12;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.burn-casing { stroke: var(--page); stroke-width: 4; opacity: 0.85; }
.burn-pulse { stroke: #ff0000; stroke-width: 1.5; filter: drop-shadow(var(--glow-mark)); }
.chart-hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 1.5; }

.tooltip {
  position: absolute;
  z-index: 5;
  min-width: 168px;
  max-width: 260px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-1);
  color: var(--ink);
  box-shadow: var(--shadow), 0 0 20px rgba(255, 0, 0, 0.18);
  font-size: 12px;
  pointer-events: none;
}

.tooltip .tip-date {
  margin-bottom: 6px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tooltip .tip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tooltip .tip-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink-2);
}

/* Project names are long; cut them short rather than push the count out. */
.tooltip .tip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* What "other" holds, under it and in line with its name. */
.tooltip .tip-sub { padding-left: 18px; }
.tooltip .tip-sub .tip-value { font-weight: 400; }

.tooltip .tip-value {
  color: var(--ink);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.tooltip .tip-key {
  flex: none;
  width: 12px;
  height: 2px;
  border-radius: 1px;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-view {
  max-height: 340px;
  margin-top: 14px;
  overflow: auto;
  scrollbar-color: var(--accent-dim) var(--surface-1);
}

table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }

th, td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--grid);
  text-align: right;
  white-space: nowrap;
}

th:first-child, td:first-child { text-align: left; }

th {
  position: sticky;
  top: 0;
  background: var(--surface-1);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td { color: var(--ink-2); font-variant-numeric: tabular-nums; }
td:first-child { color: var(--ink); }
.table-scroll-note { margin-top: 6px; color: var(--muted); font-size: 10px; }

/* --------------------------------------------------------------------------
   Two-column panels
   -------------------------------------------------------------------------- */

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

/* Cards marked .half pair up on main's grid; everything else spans it. No
   card's content, such as an open wide table, may widen the grid past the
   page. */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

main > * { grid-column: 1 / -1; min-width: 0; }
main > .half { grid-column: auto; min-width: 0; }

/* Repositories: one line each. The rows share one grid, so every bar and
   count starts at the same place. */
#repos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(60px, 22%) auto auto;
  column-gap: 14px;
}

#repos > .sub { grid-column: 1 / -1; }

.repo-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--grid);
}

.repo-row:last-child { border-bottom: 0; }

.repo-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
}

.repo-name .repo-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.repo-name .repo-label:has(.repo-owner) { display: flex; min-width: 0; }
/* The owner keeps its end, next to the name: "…eath.com/atgc". */
.repo-owner { min-width: 2ch; overflow: hidden; text-overflow: ellipsis; direction: rtl; }
.repo-short { flex: none; max-width: calc(100% - 2ch); overflow: hidden; text-overflow: ellipsis; }

/* A hashed repository: its kind, then a short muted hash. */
.repo-hash {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85em;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.repo-count, .repo-lines {
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.repo-count { color: var(--ink); font-weight: 600; text-align: right; }
.repo-owner, .repo-lines { color: var(--muted); font-weight: 400; }
.repo-lines { text-align: right; }

.repo-bar-track {
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--track);
}

.repo-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

/* --------------------------------------------------------------------------
   Recent and status
   -------------------------------------------------------------------------- */

.recent { margin: 6px 0 0; padding: 0; list-style: none; }

.recent li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--grid);
}

.recent li:last-child { border-bottom: 0; }

.recent .dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 8px var(--swatch);
}

.recent .msg { margin: 0; color: var(--ink); }
.recent .meta { margin: 2px 0 0; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.recent .when { color: var(--muted); font-family: var(--mono); font-size: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.recent .sha { color: var(--muted); font-family: var(--mono); font-size: 10px; }

/* Agentic activity: one row per agent, newest first, in a card as tall as
   the stacked charts beside it. It never scrolls: rows that don't fit are
   dropped, so the page keeps the wheel. The fleet chart follows the rows,
   and any spare height stays at the foot of the card. */
.activity-card { display: flex; flex-direction: column; min-width: 0; contain: size; }
.activity-card[hidden] { display: none; }
.activity-frame { position: relative; flex: 0 1 auto; min-height: 0; margin-top: 10px; overflow: clip; }

.activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--grid);
}

.activity-row:last-child { border-bottom: 0; }
.activity-row.is-new { animation: activity-in 1.6s ease-out; }

@keyframes activity-in {
  from { background: var(--accent-dim); }
  to { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .activity-row.is-new { animation: none; }
}

.activity-emoji { font-size: 14px; line-height: 18px; text-align: center; }
.activity-body { min-width: 0; }

.activity-text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 18px;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  margin: 2px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.activity-meta > * + *::before { content: "· "; }
.activity-agent { color: var(--ink-2); }
/* An agent's full handle; a row too narrow for it ends in an ellipsis. */
.agent-handle {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.activity-repo { color: var(--ink-2); }
.activity-project { display: inline-flex; align-items: center; gap: 4px; }

.activity-age,
.activity-live {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.activity-age.fresh { color: var(--accent); }
.activity-live { display: flex; align-items: center; margin: 0; text-transform: uppercase; }
.activity-live.paused .live-dot { background: var(--muted); }
.activity-source { margin: 8px 0 0; }
.activity-source a { color: inherit; }

@media (max-width: 860px) {
  .activity-card { contain: none; }
  .activity-frame { flex: none; }
}

.status-grid { margin: 8px 0 10px; }

.notice {
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-1);
}

.method { margin-top: 10px; color: var(--ink-2); font-size: 12px; }
.method summary { cursor: pointer; color: var(--accent); font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.method p { max-width: 78ch; }

.loading { opacity: 0.55; transition: opacity 150ms ease; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .matrix-layout { grid-template-columns: 1fr; }
  .matrix-side {
    padding-top: 18px;
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
  .project-ranking {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px 20px;
  }
}

@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page { padding: 20px 14px 48px; }
  .card-head { flex-direction: column; }
  .matrix-foot { flex-direction: column; align-items: flex-start; }
  .day-commit { grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; }
  .day-subject { grid-column: 1 / -1; }
  .project-ranking { grid-template-columns: 1fr; }
  .share-head { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media print {
  :root { --page: #ffffff; --surface-1: #ffffff; --surface-2: #ffffff; }
  .controls, .icon-button, .side-link, .contact-card { display: none; }
  .card, .share-card { break-inside: avoid; box-shadow: none; }
}

/* --------------------------------------------------------------------------
   Editorial pass: flat, serif, numbers first.
   -------------------------------------------------------------------------- */

:root {
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Courier Prime", "Nimbus Mono PS", "Courier New", monospace;
  --mono: "Courier Prime", "Nimbus Mono PS", "Courier New", monospace;
  --page: #fbf2ef;
  --surface-1: #fff8f6;
  --surface-2: #fdeeea;
  --ink: #120202;
  --ink-2: #4a1a16;
  --muted: #82534d;
  --grid: #f0d6d0;
  --axis: #e0b4ab;
  --border: rgba(18, 2, 2, 0.16);
  --border-strong: rgba(212, 0, 0, 0.6);
  --accent: #d40000;
  --accent-soft: #a30000;
  --accent-dim: #ffd6d6;
  --track: #f3d9d4;
  --matrix-0: #f5e1dc;
  --matrix-1: #ff7171;
  --matrix-2: #e00000;
  --matrix-3: #c00000;
  --matrix-4: #9c0000;
  --matrix-5: #7a0000;
  --glow-text: 0 0 18px rgba(255, 0, 0, 0.2);
  --glow-mark: 0 0 5px rgba(255, 0, 0, 0.45);
  --shadow: none;
  --glow: none;
  --radius: 0;
}

:root[data-theme="dark"] {
  --page: #080202;
  --surface-1: #110404;
  --surface-2: #170606;
  --ink: #fff3f1;
  --ink-2: #ffc2bb;
  --muted: #c08a84;
  --grid: #2c0a0a;
  --axis: #4a1010;
  --border: rgba(255, 30, 30, 0.22);
  --border-strong: rgba(255, 0, 0, 0.75);
  --accent: #ff0000;
  --accent-soft: #ff5c5c;
  --accent-dim: #420000;
  --track: #2a0606;
  --matrix-0: #1c0606;
  --matrix-1: #900000;
  --matrix-2: #ae0000;
  --matrix-3: #cd0000;
  --matrix-4: #ed0000;
  --matrix-5: #ff3b3b;
  --glow-text: 0 0 22px rgba(255, 0, 0, 0.6);
  --glow-mark: 0 0 8px rgba(255, 0, 0, 0.9);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #080202;
    --surface-1: #110404;
    --surface-2: #170606;
    --ink: #fff3f1;
    --ink-2: #ffc2bb;
    --muted: #c08a84;
    --grid: #2c0a0a;
    --axis: #4a1010;
    --border: rgba(255, 30, 30, 0.22);
    --border-strong: rgba(255, 0, 0, 0.75);
    --accent: #ff0000;
    --accent-soft: #ff5c5c;
    --accent-dim: #420000;
    --track: #2a0606;
    --matrix-0: #1c0606;
    --matrix-1: #900000;
    --matrix-2: #ae0000;
    --matrix-3: #cd0000;
    --matrix-4: #ed0000;
    --matrix-5: #ff3b3b;
    --glow-text: 0 0 22px rgba(255, 0, 0, 0.6);
    --glow-mark: 0 0 8px rgba(255, 0, 0, 0.9);
  }
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
}

.page {
  max-width: 1440px;
  padding: 30px 34px 80px;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* Sits in the page's top padding so the header controls keep their place. */
.site-header { position: relative; }

.contact-card {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.contact-card a { color: var(--muted); text-decoration: none; }
.contact-card a + a::before { content: "·"; margin: 0 8px; color: var(--muted); }
.contact-card a:hover,
.contact-card a:focus-visible { color: var(--accent); }

.site-header h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
  white-space: nowrap;
}

.eyebrow,
.label,
.stat dt,
.side-head .eyebrow {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow.accent { color: var(--accent); }

/* A card with a fixed window says so, quietly, instead of a picker. */
.eyebrow.period-fixed { color: var(--muted); cursor: help; }

/* The update time sits under the picker, flush right, and takes no width
   of its own, so the controls are only as wide as the picker. When the
   title leaves no room, the controls wrap under it, still flush right. */
.header-controls { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; margin-left: auto; }
.header-controls .asof { flex-basis: 100%; width: 0; min-width: 100%; text-align: right; }

.asof {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.intro {
  max-width: 60ch;
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
}

.intro a { color: var(--accent); }

.live-dot {
  width: 5px;
  height: 5px;
  margin-right: 7px;
  border-radius: 0;
  box-shadow: var(--glow-mark);
  animation: none;
}

.card,
.matrix-card,
.share-card {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.card {
  margin: 0;
  padding: 26px 0;
  border-top: 1px solid var(--border);
}

.matrix-card {
  padding-top: 22px;
  border-top: 2px solid var(--accent);
}

.matrix-card::before,
.matrix-card::after { display: none; }

.matrix-layout {
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
}

.matrix-side {
  padding-left: 28px;
  border-left: 1px solid var(--border);
}

.matrix-head {
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 20px;
}

.matrix-head h2,
.side-head h2,
.card h2,
.chart-card h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

.matrix-scroll { margin-top: 20px; }

#matrix { min-width: 700px; }

/* Until app.js fills them, the heatmap, its stats and the project list hold
   the size they draw at for 90 days, so the page below doesn't jump. The
   numbers follow renderMatrix; 90 days span 13 or 14 weeks. */
.matrix-main { container: matrix / inline-size; }
#matrix:empty { min-width: 0; height: calc(18px + 7 * min((100cqw - 30px) / 13.5, 39px)); }
#matrix-stats:empty { min-height: 40px; }
#matrix-legend:empty { min-height: 12px; }
#project-ranking:empty { min-height: 347px; }

@media (min-width: 621px) and (max-width: 980px) {
  #project-ranking:empty { min-height: 206px; }
}

@container matrix (min-width: 605px) {
  #matrix:empty { height: calc(18px + 7 * min((100cqw - 240px) / 13.5, 39px)); }
  #matrix-stats:empty { min-height: 0; }
}


.matrix-foot {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.matrix-legend { font-size: 10px; letter-spacing: 0.1em; }

.matrix-note {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.matrix-spark { margin-top: 10px; padding-top: 8px; }

/* The commit totals under the stats in the gutter, or one more row in the
   foot when there is no gutter. */
.matrix-row:has(> .totals) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  column-gap: 24px;
}
.matrix-row:has(> .totals) > .matrix-scroll { grid-row: 1 / span 2; }
.matrix-row > .totals { grid-column: 2; padding: 18px 0 0 22px; border-left: 1px solid var(--border); }
.matrix-row > .totals .totals-list { margin-top: 8px; }
.matrix-row > .totals .totals-list .stat { gap: 16px; padding: 4px 0; border-bottom: 0; }
.matrix-foot > .totals { display: flex; width: 100%; min-width: 0; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.matrix-foot > .totals .totals-list { flex-direction: row; flex-wrap: wrap; gap: 6px 16px; margin: 0; }
.matrix-foot > .totals .totals-list .stat { padding: 0; border: 0; }
.spark-head .label { color: var(--muted); }
#spark { height: 54px; }

/* The sidebar's title and its period picker share a row, wrapping when
   the column is narrow. */
.side-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.project-ranking { gap: 0 20px; margin-top: 0; }

.project-row {
  padding: 6px 0;
  border-bottom: 1px solid var(--grid);
}

.project-row:last-child { border-bottom: 0; }

.project-rank { font-size: 10px; }
.project-name { color: var(--ink); font-size: 13px; font-weight: 500; }
.project-meta { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; }
.project-blurb {
  color: var(--ink-2);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
.project-count { color: var(--ink); font-family: var(--mono); font-size: 12px; }
.side-link { color: var(--accent); font-size: 11px; letter-spacing: 0.12em; }

.hero {
  border-top: 1px solid var(--border);
}

.share-card {
  padding: 26px 0 24px;
}

.totals-list {
  flex-direction: column;
  gap: 0;
  margin-top: 10px;
}

.totals-list .stat {
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--grid);
}

.totals-list .stat:last-child { border-bottom: 0; }

.share-value {
  margin: 4px 0 0;
  color: var(--accent);
  text-shadow: var(--glow-text);
  font-family: var(--serif);
  font-size: clamp(58px, 7vw, 82px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.9;
}

.share-head { align-items: center; margin-bottom: 8px; }
.meter { height: 3px; margin-top: 14px; border-radius: 0; }
.meter-track, .meter-fill { border-radius: 0; }
.share-sub { margin-top: 10px; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.03em; }

/* Share trend: a quiet line under the meter, not a second headline. */

.share-trend {
  position: relative;
  margin-top: 12px;
}

#share-spark {
  display: block;
  width: 100%;
  height: 40px;
  overflow: visible;
}

.share-trend-line {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.share-trend-cursor {
  stroke: var(--muted);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.share-trend-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.chart-card { border-top: 1px solid var(--border); }
.card-head { align-items: flex-end; }
.chart-card .legend { margin-top: 14px; }
.chart-wrap { margin-top: 8px; }
.controls { gap: 10px; }
.ghost, .segmented {
  border-radius: 0;
  background: transparent;
}
.ghost { border: 1px solid var(--border); color: var(--ink-2); font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.segmented { border: 1px solid var(--border); padding: 0; }
.segmented button { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.segmented button.active { background: var(--accent); color: var(--page); box-shadow: var(--glow-mark); }

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--border);
}

.two-col > .card {
  padding: 24px 0;
  border-top: 0;
}

.two-col > .card + .card {
  padding-left: 36px;
  border-left: 1px solid var(--border);
}

.two-col > .card:has(+ .card:not([hidden])),
.half:has(+ .half) { padding-right: 36px; }
.half + .half { padding-left: 36px; border-left: 1px solid var(--border); }

/* A card whose partner is hidden takes the whole row. */
.half:has(+ .half[hidden]),
.half[hidden] + .half { grid-column: 1 / -1; padding-right: 0; padding-left: 0; border-left: 0; }

/* The share and the recent commits share a column beside the
   repositories. */
.side-stack { display: flex; flex-direction: column; min-width: 0; }
.side-stack > .hero { border-top: 0; }
.side-stack .share-card { padding-top: 0; }

@media (max-width: 1100px) {
  #repos { grid-template-columns: minmax(0, 1fr) minmax(40px, 18%) auto auto; }
}

.recent { margin-top: 2px; }
.recent li { padding: 6px 0; }
.recent .msg { color: var(--ink); font-size: 13px; }
.recent .meta, .recent .when { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.03em; }
.recent .dot { box-shadow: none; }
.recent .recent-more { color: var(--ink-2); }
.recent .recent-tail { white-space: nowrap; }

.status { padding-top: 22px; }
#status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 24px; }
#status > details { flex-basis: 100%; }
.method { margin-top: 14px; }
.method summary { color: var(--muted); font-size: 11px; letter-spacing: 0.1em; }
.method p { color: var(--muted); font-size: 11px; max-width: 70ch; }
.status > .sub { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; }

.site-footer {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.site-footer p { display: flex; flex-wrap: wrap; gap: 4px 2ch; margin: 0; }
.site-footer a { white-space: nowrap; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .matrix-layout { grid-template-columns: 1fr; gap: 24px; }
  .matrix-side {
    padding-top: 20px;
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 860px) {
  main, .two-col { grid-template-columns: 1fr; }
  .two-col > .card + .card,
  .half + .half { padding-left: 0; border-left: 0; border-top: 1px solid var(--border); }
  .two-col > .card:has(+ .card:not([hidden])),
  .half:has(+ .half) { padding-right: 0; }
  .share-value { font-size: 58px; }
}

@media (max-width: 620px) {
  .page { padding: 22px 16px 50px; }
  .card-head { align-items: flex-start; }
  .share-head { align-items: flex-start; }
  .site-header { flex-wrap: wrap; }
  .contact-card { position: static; order: 1; flex-basis: 100%; }
  .site-header h1 { font-size: 28px; }
  .header-controls { flex-basis: 100%; }
  #repos { grid-template-columns: minmax(0, 1fr) 44px auto auto; column-gap: 10px; }
}

h2::before { content: none; }
.two-col { align-items: start; }

@font-face {
  font-family: "Courier Prime";
  src: url("fonts/courier-prime-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Courier Prime";
  src: url("fonts/courier-prime-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}


.site-header h1,
.matrix-head h2,
.side-head h2,
.card h2,
.chart-card h2,
.matrix-total-value,
.share-value {
  font-kerning: none;
  font-variant-ligatures: none;
  font-feature-settings: "kern" 0, "liga" 0;
}

/* --------------------------------------------------------------------------
   Time-of-day wheel
   -------------------------------------------------------------------------- */

.wheel-layout {
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  margin-top: 8px;
}

#wheel {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.wheel-ring { fill: none; }

.wheel-ring-label {
  paint-order: stroke;
  stroke: var(--page);
  stroke-width: 3px;
}

.wheel-total {
  fill: var(--ink);
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 860px) {
  .wheel-layout { grid-template-columns: 1fr; }
  .wheel-wrap { max-width: 440px; margin: 0 auto; }
}

/* --------------------------------------------------------------------------
   Project sparklines: twelve weeks under each project, one shared scale
   -------------------------------------------------------------------------- */

.project-spark {
  display: block;
  grid-area: spark;
  width: 100%;
  height: 20px;
}

.project-spark-bar { fill: var(--accent); }
.project-spark-empty { fill: var(--track); }

/* --------------------------------------------------------------------------
   Commit types
   -------------------------------------------------------------------------- */

#types {
  display: block;
  width: 100%;
  height: auto;
  min-height: 200px;
  overflow: visible;
}

.type-band {
  stroke: var(--page);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.types-cursor {
  stroke: var(--ink-2);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.types-note { margin-top: 8px; color: var(--muted); font-family: var(--mono); font-size: 10px; }

/* --------------------------------------------------------------------------
   Project timelines: one mirrored lane per project on a shared day axis
   -------------------------------------------------------------------------- */

.timelines-wrap { margin-top: 12px; }

.timeline-lane {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  outline: none;
}

.timeline-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.timeline-label .project-icon { width: 20px; height: 20px; }
.timeline-label .project-favicon { width: 16px; height: 16px; }
.timeline-text { display: grid; gap: 2px; min-width: 0; line-height: 1.25; }

.timeline-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-meta {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-plot { display: block; width: 100%; height: 34px; overflow: visible; }
.timeline-axis { height: 22px; }
.timeline-span { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.violin { fill: var(--accent); fill-opacity: 0.78; }
.timeline-release line { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; }
.timeline-release text { fill: var(--ink-2); font-family: var(--mono); font-size: 10px; stroke: var(--page); stroke-width: 3; stroke-linejoin: round; paint-order: stroke; text-transform: none; }
.timeline-lane:hover .violin,
.timeline-lane:focus-visible .violin { fill-opacity: 1; }
.timeline-lane:hover .timeline-name,
.timeline-lane:focus-visible .timeline-name { color: var(--accent); }
.timeline-lane:focus-visible { box-shadow: inset 2px 0 0 var(--accent); }

.timelines-cursor {
  position: absolute;
  background: var(--ink-2);
  opacity: 0.14;
  pointer-events: none;
}

@media (max-width: 620px) {
  .timeline-lane { grid-template-columns: minmax(0, 1fr); padding-top: 6px; }
  .timeline-axis-row { padding-top: 0; }
  .timeline-axis-row .timeline-label { display: none; }
  .timeline-plot { height: 26px; }
  .timeline-axis { height: 22px; }
}

/* --------------------------------------------------------------------------
   Commits by date and by time, stacked beside agentic activity
   -------------------------------------------------------------------------- */

.chart-pair { align-items: stretch; }
.chart-pair > .card { min-width: 0; }
.chart-pair .card-head { flex-wrap: wrap; gap: 10px; }
.chart-pair .wheel-layout { grid-template-columns: 1fr; gap: 14px; }
.chart-pair .wheel-wrap { width: 100%; max-width: 320px; margin: 0 auto; }

/* One header, one legend: the wheel on top, the date chart below it. */
.when-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 18px; }
.when-label { margin: 0 0 6px; }

/* With no activity card the stacked card takes the row, and its two
   charts sit side by side under the same header. */
.chart-pair:has(> .activity-card[hidden]) { grid-template-columns: minmax(0, 1fr); }

.chart-pair:has(> .activity-card[hidden]) .when-body {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 36px;
}

@media (max-width: 860px) {
  .chart-pair:has(> .activity-card[hidden]) .when-body { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------------------------------------
   Written to landed
   -------------------------------------------------------------------------- */

.gap-layout { margin-top: 10px; }

#gap {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.gap-dots { fill: var(--accent); }
.gap-dot { fill: var(--accent); }
.gap-dot.slow { fill-opacity: 1; stroke: var(--page); stroke-width: 1; }
.gap-quantile { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; }
.gap-quantile-label { fill: var(--ink-2); }
.gap-limit-plate { fill: var(--page); }
.gap-limit { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip .tip-subject { max-width: 240px; color: var(--ink); font-size: 12px; line-height: 1.35; }
.tooltip .tip-dates { margin-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 10px; }

.gap-stats { margin-top: 10px; }
.gap-cursor { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; }

/* --------------------------------------------------------------------------
   Fleet
   -------------------------------------------------------------------------- */

/* The activity card's typical day: average running at once, and the peak. */
.fleet { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.fleet-wrap { margin-top: 8px; }
#fleet { display: block; width: 100%; height: auto; overflow: visible; }
.fleet-area { fill: var(--accent); fill-opacity: 0.22; }
.fleet-line { fill: none; stroke: #ff0000; stroke-width: 1.5; stroke-linejoin: round; filter: drop-shadow(var(--glow-mark)); }
.fleet-peak { fill: none; stroke: var(--accent); stroke-width: 1; stroke-opacity: 0.5; stroke-linejoin: round; }
.fleet-stats { margin-top: 10px; }

/* Pulls: merged in the accent, closed and open recede. */
.pulls-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px 32px; margin-top: 14px; }
.pulls-grid figure { margin: 0; min-width: 0; }
.pulls-card svg { display: block; width: 100%; height: auto; overflow: visible; }
.pulls-merged { fill: var(--accent); background: var(--accent); }
.pulls-closed { fill: var(--series-other); background: var(--series-other); }
.pulls-open { fill: var(--surface-2); stroke: var(--muted); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--muted); }
.pulls-median { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; }
.pulls-stats { margin-top: 14px; }
@media (max-width: 620px) { .pulls-grid { grid-template-columns: minmax(0, 1fr); } }
.churn-grid { position: relative; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px 32px; margin-top: 14px; }
.churn-grid figure { margin: 0; min-width: 0; }
.churn-card svg { display: block; width: 100%; height: auto; overflow: visible; }
.churn-tests-line { fill: none; stroke: var(--series-3); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.churn-tests-dot { fill: var(--series-3); stroke: var(--surface-1); stroke-width: 2; }
.churn-end { fill: var(--ink-2); }
.churn-stats { margin-top: 14px; }
@media (max-width: 620px) { .churn-grid { grid-template-columns: minmax(0, 1fr); } }
