/* robotdescription.com/gallery — layered on style.css; uses its tokens so light and dark both work. */

[hidden] { display: none !important; }
.wrap.wide, body.gallery .topbar .wrap, body.gallery .footer .wrap { max-width: 1180px; }
.g-muted { color: var(--faint); }
.g-ok { color: var(--good); font-weight: 700; }
.g-bad { color: var(--warm); font-weight: 700; }
.g-note { font-size: 14.5px; color: var(--muted); margin: 0 0 12px; max-width: 760px; }
.g-warn { color: var(--warm); }
.button { cursor: pointer; font-family: inherit; }
.button:focus-visible, .g-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- index */
.g-masthead { padding-top: 48px; }
.g-masthead h1 { margin-bottom: 14px; }
.g-stats { margin: 16px 0 0; font-size: 15px; color: var(--muted); }
.g-stats strong { color: var(--ink); }
.g-section { padding-top: 40px; }
.g-section h2 { font-size: 24px; margin-bottom: 14px; }

.g-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.g-chip {
  appearance: none; cursor: pointer; font: 500 13.5px/1 var(--mono); color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px;
}
.g-chip span { color: var(--faint); margin-left: 3px; }
.g-chip:hover { border-color: var(--faint); color: var(--ink); }
.g-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.g-chip[aria-pressed="true"] span { color: var(--accent); }

.g-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.g-card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--ink);
}
.g-card:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.g-thumb { aspect-ratio: 4 / 3; background: var(--code-bg); border-bottom: 1px solid var(--line); display: grid; place-items: center; }
.g-thumb-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.g-thumb-ph { width: 100%; height: 100%; display: grid; place-items: center; }
.g-thumb-ph span { font: 600 34px/1 var(--mono); color: var(--faint); letter-spacing: 0.04em; }
.g-card-body { padding: 13px 15px 15px; }
.g-card h3 { margin: 0 0 2px; font-size: 17px; }
.g-maker { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.g-facts { margin: 0 0 8px; font: 12.5px/1.3 var(--mono); color: var(--muted); }
.g-tags { margin: 0 0 9px; display: flex; flex-wrap: wrap; gap: 5px; }
.g-tag { font: 12px/1 var(--mono); padding: 4px 8px; border-radius: 999px; background: var(--code-bg); color: var(--muted); }
.g-badges { margin: 0; }
.g-badge { display: inline-block; font-size: 12.5px; line-height: 1.35; padding: 3px 8px; border-radius: 6px; }
.g-badge code { background: none; padding: 0; font-size: 1em; overflow-wrap: normal; }
.g-badge.ok { background: var(--good-soft); color: var(--good); }
.g-badge.bad { background: var(--warm-soft); color: var(--warm); }

table.corpus { font-size: 13.5px; }
table.corpus th, table.corpus td { padding: 8px 10px; white-space: nowrap; }
table.corpus td.dropped { white-space: normal; min-width: 150px; color: var(--muted); }
table.corpus th.num, table.corpus td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.corpus th.c, table.corpus td.c { text-align: center; }
table.corpus tbody tr:hover { background: var(--bg); }

/* ---------- viewer page */
.v-page { padding-bottom: 8px; }
.crumbs { padding-top: 22px; font-size: 14px; color: var(--muted); }
.v-head { padding-top: 14px; }
.v-head h1 { font-size: clamp(28px, 4.6vw, 42px); margin-bottom: 8px; }
.v-sub { margin: 0 0 14px; color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.provenance {
  margin: 0 0 18px; padding: 11px 15px; border-radius: 10px; font-size: 15px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}

.v-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.v-stage {
  position: relative; aspect-ratio: 4 / 3; min-height: 340px; max-height: 78vh;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.v-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.v-stage canvas:active { cursor: grabbing; }
.v-status {
  z-index: 1; position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px;
  color: var(--muted); font: 14px var(--mono); pointer-events: none;
}
.v-status.hidden { display: none; }
.v-status.error { color: var(--warm); }
.v-notice {
  margin-top: 12px; background: var(--warm-soft); color: var(--ink); border: 1px solid var(--warm); border-radius: 10px;
  padding: 10px 14px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere;
}
.v-notice strong { color: var(--warm); }
.v-notice ul { margin: 4px 0 0; padding-left: 18px; }
.v-notice code { font-size: 12px; }
.v-hint { z-index: 1; position: absolute; left: 12px; bottom: 9px; margin: 0; font: 12px var(--mono); color: var(--faint); pointer-events: none; }
.v-nojs { margin: 0; padding: 20px; color: var(--muted); }

.v-panel { position: relative; align-self: stretch; }
.v-panel-inner {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.v-actions { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.v-actions .button { padding: 6px 12px; font-size: 14px; }
.v-actions .button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.v-count { margin-left: auto; font: 12px var(--mono); color: var(--muted); text-align: right; }
.v-joints { flex: 1; min-height: 0; overflow: auto; padding: 6px 12px 12px; }
.v-joint { padding: 8px 0 4px; border-bottom: 1px solid var(--line); }
.v-joint:last-child { border-bottom: 0; }
.v-joint label { display: flex; justify-content: space-between; gap: 8px; font: 12.5px/1.3 var(--mono); color: var(--muted); }
.v-joint label span:first-child { overflow-wrap: anywhere; color: var(--ink); }
.v-joint output { white-space: nowrap; font-variant-numeric: tabular-nums; }
.v-joint input[type="range"] { width: 100%; margin: 6px 0 2px; accent-color: var(--accent); }

/* ---------- Pose | Simulate toggle */
.v-card { min-width: 0; }
.v-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding-bottom: 8px; min-height: 42px; }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.seg button {
  appearance: none; border: 0; background: none; cursor: pointer; border-radius: 7px;
  font: 550 14px/1.2 var(--sans); color: var(--muted); padding: 6px 13px;
}
.seg button:hover:not(:disabled) { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.seg button:disabled { opacity: 0.55; cursor: not-allowed; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.v-modenote { margin: 0; font-size: 13.5px; color: var(--muted); flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.v-modenote.bad { color: var(--warm); }
.v-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.v-count output { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- tabs under the viewport */
.g-tabs { margin-top: 18px; }
.g-tabs .tablist { overflow-x: auto; }
.g-tabs .tab { white-space: nowrap; }
.g-tabs .panel > .g-note { padding: 0 16px; }
.report { padding: 14px 16px 6px; background: var(--bg); }
.report h4 { margin: 18px 0 8px; font: 600 12.5px/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.report h4:first-child { margin-top: 0; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.report p { font-size: 15px; }
table.kv th { width: 32%; background: var(--surface); text-transform: none; letter-spacing: 0; font: 600 13.5px var(--sans); color: var(--ink); }
table.kv td.num { text-align: left; font-variant-numeric: tabular-nums; }

/* ---------- small screens */
@media (max-width: 900px) {
  .v-grid { grid-template-columns: minmax(0, 1fr); }
  .v-panel { align-self: auto; }
  .v-panel-inner { position: static; max-height: 320px; }
  .report-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .g-masthead { padding-top: 32px; }
  .v-stage { min-height: 300px; aspect-ratio: 1 / 1; }
  .g-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .g-card-body { padding: 10px 11px 12px; }
  .g-card h3 { font-size: 15.5px; }
  .v-hint { display: none; }
  .g-badge { font-size: 11.5px; }
}

/* ---------- ?thumb=1: the page shrinks to the bare canvas so docs/thumbs.py can capture 640x480 exactly */
html.thumb body > :not(main), html.thumb .topbar { display: none; }
html.thumb main > :not(.v-grid), html.thumb .v-panel, html.thumb .g-tabs, html.thumb .v-hint, html.thumb .v-notice, html.thumb .v-toolbar { display: none; }
html.thumb body, html.thumb main.wrap { margin: 0; padding: 0; max-width: none; background: transparent; }
html.thumb .v-grid { display: block; }
html.thumb .v-stage { position: fixed; inset: 0; width: auto; height: auto; max-height: none; min-height: 0; aspect-ratio: auto; border: 0; border-radius: 0; background: transparent; }
