/* stats.luciaos.com — one stylesheet, no imports, no webfonts.
 *
 * The identity is the family's: warm cream paper, warm near-black ink,
 * one rust accent, an editorial serif on display text over a system
 * sans for prose.  The tokens are luce.luciaos.com's, copied rather
 * than imported — three sites on three roots cannot share a file, and
 * a stylesheet that fetched another host's would be exactly the kind
 * of third-party request this page exists to not make.
 *
 * The chart colors are the one addition.  Three sites need three
 * hues that a reader can tell apart, including one who cannot see
 * colour the usual way, so they are not chosen by eye: each mode's
 * three were run through a validator for lightness, chroma, contrast
 * against its own paper, and separation under protanopia,
 * deuteranopia and tritanopia.  Light passes at worst ΔE 17.1 and
 * dark at 10.1, against a floor of 8.  Do not nudge them by hand —
 * re-run the check.
 *
 *   luce     rust    the accent the family already wears
 *   loom     blue
 *   luciaos  plum
 */

:root {
  color-scheme: light;
  --ink: #1e1b16;
  --ink-soft: #5b5547;
  --ink-faint: #8a8275;
  --paper: #faf8f4;
  --paper-soft: #f2eee5;
  --paper-raised: #fffefb;
  --line: #e5dfd3;
  --line-soft: #eeeadf;
  --accent: #a34e21;
  --accent-soft: #f4e7da;
  --link: #a34e21;
  --shadow: rgba(30, 27, 22, 0.08);

  --luce: #c2571c;
  --loom: #2a78d6;
  --luciaos: #8d3c6a;
  /* The de-emphasis gray: context, never a series. */
  --quiet: #b3aa99;

  --serif: "Didot", "Bodoni 72", "Playfair Display", Georgia,
    "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;

  --page: 68rem;
  --bar: 3.5rem;
}

/* The dark theme is designed, not inverted: the same warm ground an
 * f-stop down, cream ink, and the three series hues re-stepped for it
 * rather than lightened arithmetically. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #ece5d8;
    --ink-soft: #b9af9d;
    --ink-faint: #93897a;
    --paper: #17140f;
    --paper-soft: #211d16;
    --paper-raised: #1d1913;
    --line: #302a20;
    --line-soft: #272218;
    --accent: #d97c45;
    --accent-soft: #2d2118;
    --link: #d97c45;
    --shadow: rgba(0, 0, 0, 0.5);

    --luce: #c96c33;
    --loom: #4a8ad2;
    --luciaos: #b96694;
    --quiet: #6d6455;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ece5d8;
  --ink-soft: #b9af9d;
  --ink-faint: #93897a;
  --paper: #17140f;
  --paper-soft: #211d16;
  --paper-raised: #1d1913;
  --line: #302a20;
  --line-soft: #272218;
  --accent: #d97c45;
  --accent-soft: #2d2118;
  --link: #d97c45;
  --shadow: rgba(0, 0, 0, 0.5);

  --luce: #c96c33;
  --loom: #4a8ad2;
  --luciaos: #b96694;
  --quiet: #6d6455;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.6 var(--sans);
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code { font: 0.875em var(--mono); }

/* ------------------------------------------------------------ the bar */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: var(--bar);
  padding: 0 1.5rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.mark {
  font: 600 0.9rem/1 var(--sans);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.tabs { flex: 1; }

.tab {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.tab.here { color: var(--accent); }

.tools { display: flex; align-items: center; gap: 1rem; }

.cross {
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.cross:hover { color: var(--accent); }

#theme {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink-faint);
}

#theme:hover { color: var(--accent); }

/* ----------------------------------------------------------- the page */

main {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.hero { margin-bottom: 2rem; }

h1 {
  font: 400 clamp(1.9rem, 4.5vw, 2.6rem)/1.15 var(--serif);
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
}

h2 {
  font: 400 1.35rem/1.2 var(--serif);
  margin: 0 0 0.35rem;
}

.lead {
  max-width: 44rem;
  margin: 0 0 0.75rem;
  color: var(--ink-soft);
}

.since,
.note {
  font-size: 0.875rem;
  color: var(--ink-faint);
  max-width: 46rem;
  margin: 0 0 1rem;
}

.since { margin: 0; }

/* ------------------------------------------------------- the controls */

.controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.range {
  font: 0.8rem/1 var(--sans);
  letter-spacing: 0.02em;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink-soft);
  cursor: pointer;
}

.range:hover { border-color: var(--ink-faint); color: var(--ink); }

.range.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------------------------------------------------------- the tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.tile {
  padding: 1rem 1.1rem 0.9rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.tile .label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}

.tile .value {
  display: block;
  font: 400 2rem/1 var(--serif);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.tile .under {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.tile svg { display: block; margin-top: 0.6rem; overflow: visible; }

/* --------------------------------------------------------- the panels */

.panel { margin-bottom: 2.75rem; }

.chart {
  margin: 0;
  padding: 1rem 1rem 0.5rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.plot { position: relative; }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }

/* Recessive by design: the data is the only thing allowed to be loud. */
.grid { stroke: var(--line); stroke-width: 1; }
.axis { fill: var(--ink-faint); font: 0.7rem var(--sans); }
.axis-value { font-variant-numeric: tabular-nums; }

.series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.wash { stroke: none; opacity: 0.1; }
.cap { stroke: var(--paper-raised); stroke-width: 2; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }

.legend i {
  width: 0.85rem;
  height: 0.2rem;
  border-radius: 999px;
  background: currentColor;
}

.key-luce { color: var(--luce); }
.key-loom { color: var(--loom); }
.key-luciaos { color: var(--luciaos); }
.key-quiet { color: var(--quiet); }

/* The legend's text is ink; only the key carries the hue. */
.legend span b { font-weight: 400; color: var(--ink-soft); }

/* --------------------------------------------------------- the hover */

.crosshair { stroke: var(--ink-faint); stroke-width: 1; opacity: 0.5; }

.dot { stroke: var(--paper-raised); stroke-width: 2; }

.tip {
  position: absolute;
  pointer-events: none;
  min-width: 8rem;
  padding: 0.5rem 0.65rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  box-shadow: 0 2px 12px var(--shadow);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink);
  transform: translate(-50%, calc(-100% - 0.75rem));
  transition: opacity 0.08s linear;
}

.tip[hidden] { display: none; }

.tip .when {
  display: block;
  color: var(--ink-faint);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.tip .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-variant-numeric: tabular-nums;
}

.tip .row i {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: currentColor;
  margin-right: 0.35rem;
  flex: none;
}

.tip .row span { display: inline-flex; align-items: center; color: var(--ink-soft); }
.tip .row b { font-weight: 500; color: var(--ink); }

/* ---------------------------------------------------------- the lists */

.lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 2rem;
  margin-bottom: 2.75rem;
}

.rows { display: flex; flex-direction: column; gap: 0.4rem; }

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  position: relative;
  padding: 0.3rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

/* The bar is the row's own background, so the label sits on the data
 * rather than beside it and the list needs no second column of chart. */
.row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--share, 0%);
  background: var(--accent-soft);
  border-radius: 0.25rem;
}

.row > * { position: relative; }

.row .what {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.row .what a { color: inherit; text-decoration: none; }
.row .what a:hover { color: var(--accent); text-decoration: underline; }

.row .what em {
  font-style: normal;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-right: 0.45rem;
}

.row .count {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------- the table */

.table { margin-top: 0.9rem; }

.table summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.table summary:hover { color: var(--accent); }

.table .scroll { overflow-x: auto; margin-top: 0.75rem; }

table { border-collapse: collapse; font-size: 0.8rem; width: 100%; }

th, td {
  text-align: right;
  padding: 0.25rem 0.7rem;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

th {
  font-weight: 500;
  color: var(--ink-faint);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------- the rest */

.empty {
  padding: 1.25rem;
  background: var(--paper-soft);
  border: 1px dashed var(--line);
  border-radius: 0.5rem;
  color: var(--ink-faint);
  font-size: 0.875rem;
  margin: 0;
}

footer {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-faint);
}

footer p { max-width: 46rem; margin: 0 0 0.6rem; }
footer .fine { font-size: 0.8rem; }

@media (max-width: 34rem) {
  .top { gap: 0.75rem; padding: 0 1rem; }
  .cross { display: none; }
  main { padding: 1.75rem 1rem 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
