/* Telcoin Network benchmarks: site stylesheet. Dark theme, no build step. */

/* Colour, type and spacing tokens */
:root {
  color-scheme: dark;

  --page: #080821;
  --card: #0c1238;
  --zebra: #0b183c;
  --elevated: #0e2255;
  --border: #1a3372;

  --heading: #ffffff;
  --text: #c9cfed;
  --muted: #9298b5;

  --cyan: #14c8ff;
  --cyan-hover: #7de8ff;
  /* Blues are for borders and gradients only; they are too dark for text. */
  --blue: #4967ff;
  --violet: #5533ff;

  --green: #02c39a;
  --amber: #ffba00;
  --red: #ff6568;

  /* Solid badge fills (status colour mixed into the card colour) */
  --green-bg: #0b2442;
  --amber-bg: #2e2a30;
  --amber-line: #795e1f;
  --red-bg: #2e1e3f;
  --red-line: #79374e;

  --sans: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 12px;
  --gutter: 16px;
}

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

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

body {
  margin: 0;
  background-color: var(--page);
  background-image: radial-gradient(60rem 28rem at 50% -8rem, rgba(85, 51, 255, 0.18), transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--heading); line-height: 1.25; font-weight: 600; margin: 0 0 0.5rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
img, svg, video { max-width: 100%; }

code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--zebra); border: 1px solid var(--border); border-radius: 4px; padding: 0.05em 0.35em; overflow-wrap: anywhere; }
pre { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }

/* Links and keyboard focus */
a { color: var(--cyan); text-decoration: none; text-underline-offset: 0.18em; }
a:hover { color: var(--cyan-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--cyan-hover); outline-offset: 2px; border-radius: 2px; }

/* Page layout */
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter); }

.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.5rem; padding: 1.25rem 0; margin-bottom: 2rem; border-bottom: 1px solid var(--border);
}
.site-header nav a { font-weight: 500; }

.wordmark { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--heading); font-weight: 600; letter-spacing: 0.01em; }
.wordmark::before {
  content: ""; width: 0.75rem; height: 0.75rem; border-radius: 3px; flex: none;
  background: linear-gradient(135deg, var(--blue), var(--violet));
}
a.wordmark:hover { color: var(--heading); text-decoration: none; }

.intro { max-width: 65ch; font-size: 1.05rem; margin-bottom: 2.5rem; }

.section { margin: 3rem 0; }
.section > h2 { padding-bottom: 0.5rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.section > p { max-width: 70ch; }

.footer { margin-top: 4rem; padding: 2rem 0 3rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
.footer p { margin: 0 0 0.5rem; }

/* Small helpers */
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.note {
  max-width: 70ch; margin: 1rem 0; padding: 0.6rem 0.9rem; font-size: 0.92rem;
  background: var(--card); border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0;
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Landing page: list of runs as cards */
ol.runs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }

.run-card {
  display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; padding: 1.25rem;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.run-card:hover, .run-card:focus-within {
  background: var(--elevated); border-color: var(--blue);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.run-date { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.run-title { margin: 0; font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.run-meta { margin: 0; font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; }
.run-meta + .run-meta { margin-top: -0.35rem; }

.run-kpi {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; margin-top: auto; padding-top: 0.5rem;
  font-family: var(--mono); font-size: 1.75rem; font-weight: 500; color: var(--heading); font-variant-numeric: tabular-nums;
}
.run-kpi-label { font-family: var(--sans); font-size: 0.8rem; font-weight: 400; color: var(--muted); }

/* Status badges */
.badge {
  display: inline-block; width: max-content; padding: 0.1rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--elevated); color: var(--text);
  font-size: 0.72rem; font-weight: 600; line-height: 1.5; letter-spacing: 0.05em; text-transform: uppercase; vertical-align: middle;
}
.badge-aborted { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.badge-superseded { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.badge-complete { color: var(--green); background: var(--green-bg); border-color: transparent; font-weight: 500; }

/* Run page: header and headline numbers */
.run-header { margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.run-header h1 { margin-bottom: 0.4rem; }
.run-header p { max-width: 70ch; margin-bottom: 0.6rem; }
.run-header .badge { margin: 0.25rem 0 0.75rem; }

.kpi-tiles {
  display: grid; gap: 0.75rem; margin: 1.5rem 0 2rem;
  /* At most four columns; fewer tiles stretch to fill the row. */
  grid-template-columns: repeat(auto-fit, minmax(max(10rem, calc((100% - 2.25rem) / 4)), 1fr));
}
.kpi-tile {
  display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; padding: 1rem 1.1rem;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
.kpi-value {
  font-family: var(--mono); font-size: clamp(1.5rem, 4.5vw, 2.25rem); font-weight: 500; line-height: 1.1;
  color: var(--heading); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.kpi-unit { display: inline-block; white-space: nowrap; font-family: var(--mono); font-size: 0.85rem; color: var(--text); margin-left: 0.25rem; }
.kpi-label { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.kpi-window { font-size: 0.75rem; color: var(--muted); }

/* Tables: wide tables scroll inside their own box, never the page */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 0.6rem 0.8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
thead th {
  color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap; background: var(--card);
}
tbody th { color: var(--heading); font-weight: 500; }
tbody tr:nth-child(even) { background: var(--zebra); }
tbody tr:last-child > * { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }

/* Other networks: transposed table, row labels stay visible while scrolling sideways */
.other-networks td { min-width: 15rem; }
.other-networks tr > :first-child {
  position: sticky; left: 0; z-index: 1; min-width: 9rem; max-width: 14rem;
  background: var(--card); color: var(--heading); font-weight: 500; box-shadow: 1px 0 0 var(--border);
}
.other-networks tbody tr:nth-child(even) > :first-child { background: var(--zebra); }
.other-networks thead th { position: sticky; top: 0; z-index: 2; }
.other-networks thead th:first-child { z-index: 3; }

/* Charts: inline SVG scales with the column width */
.chart {
  display: block; width: 100%; margin: 1rem 0 0.25rem; padding: 0.75rem;
  font-family: var(--mono); color: var(--muted);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
.chart svg, svg.chart { display: block; width: 100%; height: auto; }
.chart-caption { margin: 0.4rem 0 1.5rem; font-size: 0.82rem; color: var(--muted); max-width: 70ch; }

/* Collapsible raw data */
details.data { margin: 1rem 0; }
details.data > summary {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; list-style: none;
  padding: 0.35rem 0.8rem; border: 1px solid var(--border); border-radius: 8px;
  color: var(--cyan); font-size: 0.88rem; font-weight: 500;
}
details.data > summary::-webkit-details-marker { display: none; }
details.data > summary::before { content: "\25B8"; transition: transform 0.15s ease; }
details.data[open] > summary::before { transform: rotate(90deg); }
details.data > summary:hover { color: var(--cyan-hover); border-color: var(--blue); background: var(--elevated); }
details.data[open] > summary { margin-bottom: 0.75rem; }

/* Caveats and methodology lists */
.caveats ul, ul.caveats { padding-left: 0; }
.caveats li {
  list-style: none; margin: 0.6rem 0; padding: 0.35rem 0 0.35rem 0.9rem; max-width: 75ch;
  border-left: 3px solid var(--amber);
}
.methodology ol { list-style: decimal; padding-left: 1.5rem; max-width: 75ch; line-height: 1.75; }
.methodology li { margin-bottom: 0.6rem; padding-left: 0.25rem; }
.methodology li::marker { color: var(--muted); font-family: var(--mono); }

/* Link to the archived full report, with its file size */
.report-link {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; margin: 0.5rem 0 1rem;
  padding: 0.75rem 1.1rem; background: var(--card); border: 1px solid var(--blue); border-radius: var(--radius);
  font-size: 1.05rem; font-weight: 600;
}
.report-link:hover { background: var(--elevated); }
.report-link .muted, .report-link small { font-size: 0.82rem; font-weight: 400; color: var(--muted); }

/* Banner for notices on the site's own pages */
.banner {
  margin: 0 0 1.5rem; padding: 0.8rem 1rem; color: var(--text);
  background: var(--card); border: 1px solid var(--amber); border-radius: var(--radius);
}
.banner strong { color: var(--amber); }

/* Wider screens: two-column run list */
@media (min-width: 720px) {
  ol.runs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Below 720px the headline tiles go two across (this also covers phones) */
@media (max-width: 719px) {
  .kpi-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phones */
@media (max-width: 480px) {
  h1 { font-size: 1.6rem; }
  ol.runs { grid-template-columns: minmax(0, 1fr); }
  .kpi-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .kpi-tile { padding: 0.8rem; }
  .run-card { padding: 1rem; }
  .site-header { margin-bottom: 1.5rem; }
}

/* Users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Print: plain black on white */
@media print {
  :root { color-scheme: light; }
  *, *::before, *::after { background: transparent !important; color: #000 !important; box-shadow: none !important; }
  body { background: #fff !important; }
  a { text-decoration: underline; }
  .site-header nav, details.data > summary::before { display: none; }
  .table-wrap { overflow: visible; }
  .run-card, .kpi-tile, .chart, .table-wrap, .banner { border-color: #999 !important; break-inside: avoid; }
}
