/* Shared visual contract for the robot landscape hub, topic pages, and source registry.
   Static HTML/CSS only — no runtime framework. See design.md for the contract. */

:root {
  --fg: #111318;
  --muted: #59616d;
  --line: #252a31;
  --line-soft: #d7dce2;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #f0f3f6;
  --accent: #1558b0;
  --manual: #176b3a;
  --press: #8a5a00;
  --analyst: #6b3fa0;
  --research: #0b6e75;
  --unknown: #737b86;
  --max-width: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, sans-serif; }
header, main, footer { max-width: var(--max-width); margin: 0 auto; padding: 0 1rem; }
header { padding-top: 1.5rem; text-align: center; }
main { overflow-wrap: break-word; }
footer { margin: 2.5rem auto 3rem; font-size: 13px; color: var(--muted); }

h1 { margin: 0.2rem 0; font-size: 1.7rem; }
h2 { margin: 2.2rem 0 0.6rem; font-size: 1.2rem; border-bottom: 1px solid var(--line); padding-bottom: 0.25rem; }
h3 { margin: 1.2rem 0 0.4rem; font-size: 1rem; }
p.lede, .note { text-align: center; color: var(--muted); max-width: 46rem; margin: 0.4rem auto 1rem; }
.lede--left { text-align: left; margin-left: 0; margin-right: 0; }
.note--left { text-align: left; margin-left: 0; margin-right: 0; }
a { color: var(--accent); }
a:visited { color: #4a3f9e; }

/* Breadcrumb (topic pages) */
.breadcrumb { text-align: left; font-size: 13px; color: var(--muted); margin: 1rem 0 0; }
.breadcrumb a { color: var(--muted); }

/* Navigation */
nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem 1.25rem; margin: 0.75rem 0 1.5rem; font-size: 14px; }
nav a { color: inherit; }

/* Cards and grids */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); padding: 0.7rem 0.8rem; }
.card b { display: block; }
.card .n { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; margin: 0.15rem 0; }
.card small { color: var(--muted); }
.card p { margin: 0.25rem 0 0; }
.card ul { margin: 0.3rem 0 0 1.1rem; padding: 0; }
.card-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.card-link:visited { color: inherit; }
.card-link:hover { border-color: var(--accent); background: #fbfdff; }
.card-action { margin-top: auto; padding-top: 0.6rem; color: var(--accent); font-size: 12.5px; font-weight: 600; }

/* Hub coverage totals. Values are derived from the canonical topic pages and
   checked by scripts/check_landscape.py, never maintained as independent data. */
.stat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.75rem; margin: 1rem 0 0.6rem; }
.stat-card { min-width: 0; background: var(--surface); border-top: 3px solid var(--line); border-bottom: 1px solid var(--line-soft); padding: 0.65rem 0.7rem 0.75rem; }
.stat-card dt { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat-card dd { margin: 0; }
.stat-card .n { color: var(--fg); font-size: 1.75rem; font-weight: 650; font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.025em; line-height: 1.2; }
.stat-detail { min-height: 2.8em; color: var(--muted); font-size: 12px; line-height: 1.35; }
.stats-note { margin: 0 0 1rem; color: var(--muted); font-size: 12.5px; text-align: right; }
.stats-note time { color: var(--fg); font-variant-numeric: tabular-nums; }

/* Tables */
.scroll { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; font-size: 13.5px; background: var(--surface); font-variant-numeric: tabular-nums lining-nums; }
th, td { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 0.4rem 0.5rem; text-align: left; vertical-align: top; }
th:last-child, td:last-child { border-right: none; }
thead th { background: var(--surface-alt); text-align: center; font-weight: 600; border-bottom: 2px solid var(--line); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }
th[scope="row"] { text-align: left; font-weight: 600; white-space: nowrap; }
caption { caption-side: bottom; text-align: left; padding: 0.55rem 0.6rem 0; color: var(--muted); font-size: 12.5px; }
caption a { color: inherit; }

/* Sticky header + metric column inside the overflow wrapper */
.scroll th[scope="row"] { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.scroll thead th { position: sticky; top: 0; z-index: 2; }
.scroll thead th[scope="col"]:first-child { left: 0; z-index: 3; background: var(--surface-alt); }

/* Row-group separators */
tr.group-head th { background: var(--surface-alt); text-align: left; font-weight: 700; border-top: 2px solid var(--line); border-bottom: 1px solid var(--line); }

/* Table variants */
.data-table--deep th[scope="row"] { min-width: 200px; }
.data-table--single th[scope="row"] { min-width: 210px; }

/* Evidence markers (legible without color) */
.ev { font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.ev-m { color: var(--manual); }
.ev-r { color: var(--research); }
.ev-p { color: var(--press); }
.ev-a { color: var(--analyst); }
.ev-u { color: var(--unknown); }
.ev:hover { text-decoration: underline; }
.ev-muted { color: var(--muted); font-weight: 400; }
.derived { color: var(--muted); font-size: 11.5px; }

/* Media */
.tennis-lead { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr); gap: 0.75rem; margin: 1rem 0; align-items: stretch; }
.media-panel { margin: 0; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.media-panel video, .media-panel img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #080a0d; }
.media-panel figcaption { padding: 0.55rem 0.65rem; color: var(--muted); font-size: 12.5px; }
.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.media-card { margin: 0; background: var(--surface); border: 1px solid var(--line); }
.media-card video, .media-card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #080a0d; }
.media-card figcaption { padding: 0.55rem 0.65rem; }
.media-card b { display: block; }
.media-card small { color: var(--muted); }
figure { margin: 0; }

/* Research paper pins — 4 across on desktop, then wrap. */
.paper-masonry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
  align-items: start;
}
.paper-pin {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.paper-pin video,
.paper-pin img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #080a0d;
}
.paper-body { padding: 0.65rem 0.75rem 0.8rem; }
.paper-body h3 {
  margin: 0.2rem 0 0.3rem;
  font-size: 1rem;
  border: none;
  padding: 0;
}
.paper-meta { margin: 0; font-size: 12px; color: var(--muted); }
.paper-venue { color: var(--research); font-weight: 700; }
.paper-body p { margin: 0.3rem 0 0; font-size: 13.5px; }
.paper-boundary {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 12px;
  border-left: 3px solid var(--line);
  padding-left: 0.45rem;
}
.paper-links { margin: 0.5rem 0 0; font-size: 12.5px; }
.paper-links a { color: inherit; }
.paper-kind {
  display: inline-block;
  margin-left: 0.2rem;
  border: 1px solid var(--line-soft);
  padding: 0 0.3rem;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.paper-pin--text .paper-body { padding-top: 0.85rem; }

.catalog-year { margin: 1rem 0 1.4rem; }
.catalog-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  columns: 2;
  column-gap: 1.25rem;
}
.catalog-list li {
  break-inside: avoid;
  border-bottom: 1px solid var(--line-soft);
  padding: 0.32rem 0;
  font-size: 13.5px;
}
.catalog-list .venue { color: var(--muted); font-size: 12.5px; }

/* Asset links (engineering models) */
.asset-list { list-style: none; margin: 0.5rem 0 1rem; padding: 0; }
.asset-list li { border: 1px solid var(--line-soft); border-left: 3px solid var(--accent); background: var(--surface); padding: 0.4rem 0.6rem; margin: 0.35rem 0; font-size: 13.5px; }
.asset-list .fmt { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.asset-list .lic { color: var(--muted); font-size: 12px; }

/* Robot catalog and engineering-model states */
.robot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 0.75rem; margin: 0.75rem 0 1.25rem; padding: 0; list-style: none; }
.robot-card { background: var(--surface); border: 1px solid var(--line); padding: 0.75rem 0.8rem; }
.robot-card h4 { margin: 0 0 0.4rem; font-size: 1rem; }
.robot-card p { margin: 0.5rem 0 0; color: var(--muted); }
.robot-card .lic { font-size: 12px; color: var(--muted); }
.model-legend { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.75rem 0 1rem; }
.model-state { display: inline-flex; align-items: center; width: fit-content; border: 1px solid var(--line-soft); padding: 0.12rem 0.4rem; font-size: 11.5px; font-weight: 700; line-height: 1.35; }
.model-state--preview { border-color: var(--accent); color: var(--accent); background: #edf4fc; }
.model-state--source { border-color: var(--manual); color: var(--manual); background: #edf7f0; }
.model-state--access { border-color: var(--press); color: var(--press); background: #fbf5e8; }
.model-state--none { border-color: var(--unknown); color: var(--unknown); background: var(--surface-alt); }
.model-state--live { border-color: var(--accent); color: var(--accent); background: #edf4fc; }

/* Model gallery (topics/models.html).
   Each card is a static render plus, once the viewer script loads, an
   interactive stage. Exactly one card is live at a time. */
h2 .count, h3 .count { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.robot-preview { margin: 0.5rem 0 0; font-size: 13px; font-weight: 600; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; padding: 0; list-style: none; }
.model-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); }
.model-card.has-error { border-color: var(--press); }
.model-frame { position: relative; aspect-ratio: 4 / 3; background: var(--surface-alt); border-bottom: 1px solid var(--line-soft); overflow: hidden; }
.model-poster { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The canvas fades in only once the model is assembled; until then the
   static render underneath is the better picture. */
.model-canvas { position: absolute; inset: 0; opacity: 0; transition: opacity 0.25s ease; }
.model-card.is-ready .model-canvas { opacity: 1; }
.model-nopreview { position: absolute; inset: 0; display: flex; align-items: center; margin: 0; padding: 1rem 1.1rem; color: var(--muted); font-size: 12.5px; }
.model-stage { position: absolute; left: 0.5rem; bottom: 0.5rem; border: 1px solid var(--line); background: var(--surface); color: var(--accent); font: 600 12.5px/1.4 system-ui, sans-serif; padding: 0.3rem 0.6rem; cursor: pointer; }
.model-stage:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.model-body { padding: 0.7rem 0.8rem 0.8rem; }
.model-body h4 { margin: 0; font-size: 1rem; }
.model-variant { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.model-status { margin: 0.35rem 0 0; color: var(--muted); font-size: 12.5px; min-height: 2.6em; }
.model-card.has-error .model-status { color: var(--press); }
.model-meta, .model-links, .model-note { margin: 0.35rem 0 0; font-size: 12.5px; }
.model-meta { color: var(--muted); }
.model-meta .fmt { font-family: ui-monospace, monospace; font-size: 11.5px; }
.model-meta .lic { color: var(--muted); }
.model-note { color: var(--muted); border-left: 3px solid var(--line-soft); padding-left: 0.5rem; }
.model-nosheet { color: var(--unknown); }
.model-controls { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
[hidden] { display: none !important; }
.model-controls button { border: 1px solid var(--line-soft); background: var(--surface-alt); color: inherit; font: 12.5px/1.4 system-ui, sans-serif; padding: 0.25rem 0.5rem; cursor: pointer; }
.model-controls button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: #edf4fc; }

/* Vendor filter, injected by assets/models.js (absent without JavaScript). */
.model-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 1rem 0 0; }
.model-filter__label { font-size: 12.5px; color: var(--muted); margin-right: 0.15rem; }
.model-filter button { border: 1px solid var(--line-soft); background: var(--surface); color: inherit; font: 12.5px/1.4 system-ui, sans-serif; padding: 0.25rem 0.55rem; cursor: pointer; }
.model-filter button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: #edf4fc; font-weight: 600; }

/* Claim boundary and source links */
.claim-boundary { margin: 1rem 0; padding: 0.75rem 0.85rem; border-left: 4px solid var(--line); background: var(--surface); }
.source-links { margin: 0.5rem 0 1rem; text-align: center; }
.source-links a { color: inherit; }
ul.tight { margin: 0.3rem 0 0.8rem 1.2rem; }

/* Source registry (sources.html) */
.source-group { margin: 1.4rem 0; }
.source-list { list-style: none; margin: 0.5rem 0 1.5rem; padding: 0; }
.source-list li { border: 1px solid var(--line-soft); border-left: 4px solid var(--line); background: var(--surface); padding: 0.5rem 0.65rem; margin: 0.4rem 0; }
.source-list .marker { font-weight: 700; }
.source-list .url { font-family: ui-monospace, monospace; font-size: 12.5px; word-break: break-all; display: block; margin: 0.15rem 0; }
.source-list .meta { color: var(--muted); font-size: 12.5px; display: block; }
.source-list .meta b { color: var(--fg); font-weight: 600; }
.reseller { color: var(--press); font-weight: 600; }

/* Claim-grade badges (paper -> body map) */
.grade { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; padding: 0.1rem 0.4rem; border: 1px solid currentColor; border-radius: 2px;
  white-space: nowrap; }
.grade--eval { color: var(--research); }
.grade--home { color: var(--press); }
.grade--none { color: var(--unknown); }

/* Focus visibility */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Responsive */
@media (max-width: 1100px) {
  .paper-masonry { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid--3, .grid--4, .grid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .tennis-lead, .media-grid { grid-template-columns: 1fr; }
  .paper-masonry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-list { columns: 1; }
  nav { justify-content: flex-start; }
  .stats-note { text-align: left; }
}
@media (max-width: 520px) {
  .paper-masonry { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  header, main, footer { padding: 0 0.75rem; }
  .model-grid, .grid, .grid--3, .grid--4, .grid--5, .stat-grid { grid-template-columns: 1fr; }
  .tennis-lead, .media-grid { grid-template-columns: 1fr; }
  .paper-masonry { grid-template-columns: 1fr; }
  .stat-detail { min-height: 0; }
  table { font-size: 13px; }
}

/* Print */
@media print {
  body { background: #fff; color: #000; }
  header { text-align: left; }
  nav, .breadcrumb, footer { display: none; }
  .scroll { overflow: visible; border: none; }
  .scroll th[scope="row"], .scroll thead th, .scroll thead th[scope="col"]:first-child { position: static; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .ev { color: #000; }
  caption { color: #000; }
  .card, .stat-card, .media-panel, .media-card, .paper-pin, .claim-boundary, .source-list li, .asset-list li { border-color: #000; }
  .media-panel video, .media-panel img, .media-card video, .media-card img, .paper-pin video, .paper-pin img { background: #fff; }
  .paper-masonry { grid-template-columns: 1fr 1fr; }
  .paper-pin { break-inside: avoid; }
  .model-card { border-color: #000; break-inside: avoid; }
  .model-grid { grid-template-columns: 1fr 1fr; }
  .model-stage, .model-controls, .model-canvas, .model-filter { display: none; }
  .model-frame { border-color: #000; }
  .model-status, .model-meta, .model-note, .model-nosheet { color: #000; }
}
