/* Declared AI use in arXiv mathematics: layout, theme tokens and chart chrome. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-sunk: #f1f0ec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #6b6a65;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --border-strong: rgba(11, 11, 11, 0.2);
  --link: #1c5cab;
  --focus: #2a78d6;
  --wash: rgba(11, 11, 11, 0.05);
  --band: rgba(42, 120, 214, 0.08);
  --shadow: 0 6px 20px rgba(11, 11, 11, 0.12);
  --note-bg: #fbf3df;
  --note-border: rgba(201, 133, 0, 0.35);
  --note-accent: #c98500;
  --note-ink: #3d2e00;
  --error-bg: #fdecec;
  --error-ink: #7a1414;

  /* Status series: used for declared use and unclear cases only, in every chart, tile and legend. */
  --declared: #2a78d6;
  --unclear: #a24509;

  /* Use categories: their own colours (validated for 3:1 against the surface; the four most frequent
   * separate under simulated colour-vision deficiency), each line also with its own dash pattern. */
  --u-writing: #816bd8;
  --u-proof-generation: #05a388;
  --u-exploration: #886108;
  --u-proof-search: #8d1c5f;
  --u-coding: #1c6402;
  --u-literature: #117780;
  --u-verification: #ce514d;
  --u-formalization: #8a9500;
  --u-problem-generation: #b668c8;
  --u-gray: #77756f;

  /* Volume bars are neutral, so blue always means declared use. */
  --bar: #8b8983;
  --bar-active: #52514e;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-sunk: #232321;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-3: #9d9b94;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);
    --link: #86b6ef;
    --focus: #6da7ec;
    --wash: rgba(255, 255, 255, 0.07);
    --band: rgba(57, 135, 229, 0.14);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    --note-bg: #221d10;
    --note-border: rgba(201, 133, 0, 0.4);
    --note-accent: #c98500;
    --note-ink: #f1e3bd;
    --error-bg: #2d1414;
    --error-ink: #f6c9c9;

    --declared: #3987e5;
    --unclear: #d16022;

    --u-writing: #927eec;
    --u-proof-generation: #19aa8e;
    --u-exploration: #906606;
    --u-proof-search: #af3e7c;
    --u-coding: #4a9c36;
    --u-literature: #2ea3b5;
    --u-verification: #e06c64;
    --u-formalization: #8f9b10;
    --u-problem-generation: #b86ccb;
    --u-gray: #9d9b94;

    --bar: #7f7d77;
    --bar-active: #c3c2b7;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: break-word;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 24px;
}

.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;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.skip-link:focus {
  top: 12px;
}

/* Header */

.site-header {
  padding-block: 48px 24px;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(1.625rem, 1.15rem + 1.9vw, 2.375rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0 0 10px;
  max-width: 64ch;
  color: var(--ink-2);
  font-size: 1.0625rem;
}

.key-finding {
  max-width: 72ch;
  margin: 14px 0 12px;
  padding: 2px 0 2px 12px;
  border-left: 4px solid var(--declared);
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
}

.key-finding:empty {
  display: none;
}

.coverage {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.875rem;
}

main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 48px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Disclaimer */

.disclaimer {
  padding: 14px 20px 12px 18px;
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-left: 4px solid var(--note-accent);
  border-radius: 12px;
  color: var(--note-ink);
}

.disclaimer h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 1rem;
  line-height: 1.3;
}

.disclaimer-icon {
  flex: none;
  color: var(--note-accent);
}

.disclaimer ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 1.25em;
  font-size: 0.9375rem;
}

.disclaimer-more {
  margin-top: 8px;
  font-size: 0.875rem;
}

.disclaimer-more summary {
  width: fit-content;
  font-weight: 600;
  cursor: pointer;
}

.disclaimer-more p {
  max-width: 90ch;
  margin: 6px 0 0;
}

/* Loading and error state */

.status {
  margin: 0;
  padding: 14px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--ink-2);
}

.status.is-error {
  border: 1px solid var(--error-ink);
  background: var(--error-bg);
  color: var(--error-ink);
  font-weight: 600;
}

.status.is-error a {
  color: inherit;
}

/* Controls */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 24px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-label {
  padding: 0;
  margin-bottom: 4px;
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.control-scope {
  flex: 1 1 260px;
  max-width: 420px;
}

select {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
}

.segmented .options {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-sunk);
}

.segmented label,
.chip {
  position: relative;
}

.segmented input,
.chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented .options > label > span {
  display: block;
  padding: 5px 12px;
  border-radius: 7px;
  color: var(--ink-2);
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: nowrap;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--border-strong), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.segmented input:disabled {
  cursor: not-allowed;
}

.segmented input:disabled + span {
  color: var(--ink-3);
  text-decoration: line-through;
  opacity: 0.7;
}

.control-help {
  margin-top: -12px;
  padding-inline: 4px;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.control-help p {
  margin: 0;
}

.control-help p + p {
  margin-top: 2px;
}

/* Summary tiles */

.section-head {
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 1.1875rem;
  line-height: 1.3;
}

.section-sub {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

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

.tile p {
  margin: 0;
}

.tile-label {
  display: flex;
  align-items: center;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
}

.tile-value {
  margin: 4px 0 2px !important;
  font-size: 1.75rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.tile-sub {
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.tile-avg {
  margin-top: 4px !important;
  padding-top: 4px;
  border-top: 1px solid var(--grid);
  color: var(--ink-2);
}

.notes {
  margin: 12px 0 0;
  padding-left: 1.2em;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.notes li + li {
  margin-top: 2px;
}

/* Legends and keys */

.line-key,
.chip-key {
  display: inline-block;
  flex: none;
  overflow: visible;
  vertical-align: middle;
}

.line-key {
  margin-right: 7px;
}

.line-key line,
.chip-key line {
  stroke: var(--c, var(--ink-3));
  stroke-width: 2.5;
}

.key-declared line {
  stroke: var(--declared);
}

.key-unclear line {
  stroke: var(--unclear);
  stroke-dasharray: 6 4;
}

.band-key {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 10px;
  margin-right: 7px;
  border-radius: 2px;
  background: var(--declared);
  opacity: 0.22;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.legend li {
  display: flex;
  align-items: center;
}

/* Chart cards */

.charts {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chart {
  margin: 0;
  padding: 16px 20px 12px;
  min-width: 0;
}

.chart-head {
  margin-bottom: 4px;
}

.chart-title {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.35;
}

.chart-sub {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.chart-note {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.chart-options {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 24px;
  margin-top: 12px;
}

.chips-field {
  flex: 1 1 320px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 0.8125rem;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.chip.is-on {
  background: var(--surface-sunk);
  color: var(--ink);
}

.chip:not(.is-on) .chip-key {
  opacity: 0.35;
}

.chip:hover {
  border-color: var(--ink-3);
}

.chip:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.chip-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.text-button {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 0.8125rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.chart-body {
  position: relative;
  margin-top: 10px;
  min-height: 120px;
}

.chart-body svg {
  display: block;
  overflow: visible;
  touch-action: pan-y;
}

.chart-body > svg {
  width: 100%;
  height: auto;
}

.chart-body > svg:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 4px;
}

.chart-empty {
  margin: 0;
  padding: 36px 12px;
  color: var(--ink-2);
  text-align: center;
}

.gridline {
  stroke: var(--grid);
  stroke-width: 1;
}

.baseline {
  stroke: var(--axis);
  stroke-width: 1;
}

.tick-label {
  fill: var(--ink-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.annot-line {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.7;
}

.annot-label {
  fill: var(--ink-3);
  font-size: 11px;
}

.end-label {
  fill: var(--ink-2);
  font-size: 12px;
}

.end-label .value {
  fill: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.end-key {
  stroke-width: 2.5;
}

.band-incomplete {
  fill: var(--band);
}

.hatch-line {
  stroke: var(--axis);
  stroke-width: 1.5;
}

.hover-wash {
  fill: var(--wash);
}

.bar {
  fill: var(--bar);
}

.bar.partial {
  fill: var(--surface);
  stroke: var(--bar);
  stroke-width: 1.5;
}

.bar.active {
  fill: var(--bar-active);
  stroke: none;
}

.crosshair {
  stroke: var(--ink-3);
  stroke-width: 1;
}

.ci-band {
  fill: var(--c);
  opacity: 0.16;
}

.ci-whisker {
  fill: none;
  stroke: var(--c);
  stroke-width: 1.5;
  opacity: 0.55;
}

.series {
  fill: none;
  stroke: var(--c);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.series.dashed {
  stroke-width: 2.25;
  stroke-linecap: butt;
}

.series-group {
  transition: opacity 120ms ease;
}

.series-group.dim {
  opacity: 0.15;
}

.dot {
  fill: var(--c);
  stroke: var(--surface);
  stroke-width: 2;
}

.dot.hollow {
  fill: var(--surface);
  stroke: var(--c);
}

/* Tooltip */

.tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 15;
  min-width: 170px;
  max-width: min(300px, 90vw);
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.8125rem;
  line-height: 1.45;
  pointer-events: none;
}

.tt-title {
  margin: 0 0 4px;
  font-weight: 600;
}

.tt-row {
  display: grid;
  grid-template-columns: 20px auto 1fr;
  align-items: center;
  column-gap: 7px;
}

.tt-row .line-key {
  margin: 0;
}

.tt-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tt-name {
  color: var(--ink-2);
}

.tt-note {
  margin: 4px 0 0;
  color: var(--ink-3);
}

/* Data tables */

.table-view {
  margin-top: 8px;
}

.table-view summary {
  width: fit-content;
  color: var(--link);
  font-size: 0.875rem;
  cursor: pointer;
}

.table-wrap {
  max-height: 360px;
  margin-top: 8px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.table-wrap th,
.table-wrap td {
  padding: 4px 10px;
  border-bottom: 1px solid var(--grid);
  text-align: right;
  white-space: nowrap;
}

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

.table-wrap thead th {
  position: sticky;
  top: 0;
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-weight: 600;
}

.table-wrap tbody th {
  font-weight: 400;
}

/* Method and footer */

.method {
  padding: 20px 24px;
}

.method p {
  max-width: 78ch;
  margin: 10px 0 0;
  color: var(--ink-2);
}

.refs {
  display: grid;
  gap: 6px;
  max-width: 78ch;
  margin: 14px 0 0;
  padding-left: 1.2em;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.method .policy {
  font-size: 0.875rem;
}

.repo-link {
  display: inline-block;
  margin-top: 12px;
}

.site-footer {
  padding-block: 20px 40px;
  border-top: 1px solid var(--border);
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.site-footer p {
  margin: 4px 0;
}

.site-footer a {
  color: var(--ink-2);
}

.model-info {
  font-size: 0.75rem;
}

/* Wide screens: the filter bar stays in view; anchors and focus scroll clear of it. */
@media (min-width: 720px) {
  html {
    scroll-padding-top: 104px;
  }

  .controls {
    position: sticky;
    top: 8px;
    z-index: 20;
  }
}

@media (max-width: 719px) {
  .wrap {
    padding-inline: 16px;
  }

  .site-header {
    padding-block: 28px 16px;
  }

  .key-finding {
    font-size: 1.0625rem;
  }

  .controls {
    gap: 12px 16px;
  }

  .control-scope {
    flex-basis: 100%;
    max-width: none;
  }

  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile {
    padding: 12px;
  }

  .tile-value {
    font-size: 1.375rem;
  }

  .chart {
    padding: 14px 12px 10px;
  }

  .chart-options .segmented,
  .chart-options .segmented .options {
    width: 100%;
  }

  .chart-options .segmented .options {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .chart-options .segmented .options > label > span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    white-space: normal;
    text-align: center;
  }

  .method {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* Forced colours: keep series colours and dash patterns so legends still match the lines. */
@media (forced-colors: active) {
  .series,
  .dot,
  .bar,
  .ci-band,
  .ci-whisker,
  .end-key,
  .line-key,
  .chip-key,
  .band-key {
    forced-color-adjust: none;
  }
}
