/* SPDX-License-Identifier: MIT
   Trackball tab: the cradle in section with ball, bearings, and retainer. Layout, panel,
   .seg, .toggles, .dims, .btn and the viewer overlays come from site.css. */

:root {
  --tb-cradle: #C9CFC4;    /* printed cup and housing */
  --tb-retainer: #7E8C83;  /* clip-on ring, darker so it reads apart from the cup */
  --tb-ball: #B8862B;      /* the ball: the subject of the sheet, in the signal family */
  --tb-ball-cut: #8A6418;  /* the ball where the section plane cuts it */
  --tb-bearing: #F2F0E8;   /* ZrO2 bearings */
  --tb-cut: #1E5A3E;       /* section faces */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --tb-cradle: #9AA59D; --tb-retainer: #5E6C63; --tb-ball: #D5A640; --tb-ball-cut: #8E6C22; --tb-bearing: #E6E4DC; --tb-cut: #5FB487; }
}
:root[data-theme="dark"] { --tb-cradle: #9AA59D; --tb-retainer: #5E6C63; --tb-ball: #D5A640; --tb-ball-cut: #8E6C22; --tb-bearing: #E6E4DC; --tb-cut: #5FB487; }

.trackball .stage canvas:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
.trackball .mono { font-family: var(--mono); font-size: .95em; }

/* HUD */
.trackball .tb-hud { pointer-events: none; }
.trackball .tb-files { margin: 4px 0 0; font: 500 14px/1.3 var(--mono); overflow-wrap: anywhere; }

/* tools */
.trackball .tb-tools { flex-direction: column; align-items: flex-end; left: 12px; }
.trackball .tb-tool-row, .trackball .tb-clip-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.trackball .tb-clip-row { background: color-mix(in srgb, var(--sheet) 88%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; }
.trackball .tb-clip-row input[type=range] { width: min(200px, 36vw); }
.trackball .tb-clip-at { font: 500 12px var(--mono); font-variant-numeric: tabular-nums; min-width: 12ch; text-align: right; }
.trackball .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* panel */
.trackball .tb-panel section { display: grid; gap: 8px; }
.trackball .tb-panel section h2 { margin: 0; }
.trackball .tb-panel .tb-sub { margin-top: 6px; }
.trackball .tb-lede { margin: 8px 0 0; color: var(--muted); font-size: 13px; text-wrap: pretty; }
.trackball .tb-text { margin: 0; font-size: 13px; text-wrap: pretty; }
.trackball .tb-hint { margin: 0; font-size: 12px; color: var(--muted); }
.trackball .tb-off { opacity: .5; cursor: default; }
.trackball .tb-panel .seg { justify-self: start; }

.trackball .tb-file { display: grid; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.trackball .tb-file:first-of-type { border-top: 0; padding-top: 0; }
.trackball .tb-file-meta { font: 500 11px var(--mono); color: var(--muted); }
.trackball .tb-file .actions { gap: 6px; }

.trackball .tb-previews ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.trackball .tb-previews a { display: grid; gap: 4px; text-decoration: none; color: var(--muted); font-size: 11px; }
.trackball .tb-previews img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--stage);
                              border: 1px solid var(--line); border-radius: var(--radius); }
.trackball .tb-previews a:hover img { border-color: var(--ink); }

@media (max-width: 860px) {
  .trackball .tb-previews ul { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (max-width: 520px) {
  .trackball .tb-files { font-size: 12px; }
  .trackball .tb-tools { right: 8px; left: 8px; bottom: 8px; }
  .trackball .tb-clip-at { min-width: 0; }
}

/* variant switch: three equal cells across the panel */
.trackball .tb-panel .tb-variants { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); justify-self: stretch; }
.trackball .tb-variants span { padding: 7px 4px; text-align: center; white-space: nowrap; border-right: 1px solid var(--line); }
.trackball .tb-variants label:last-child span { border-right: 0; }
