/* Let Occ Flow: this page's adaptations of the design system VR-Robo's
   demo uses (css/system.css; owner, 2026-10-28: "follow projects/vr-robo
   and the SuperMimic demo page"), laid out as VR-Robo's demo is: the
   cyclorama stage, a bare title with a legend key, a segmented track at
   the top centre, a pill opening to a dense list at the top right, the dark
   ego card bottom left, and the dock bottom centre
   (projects/occ-flow/docs/design.md, "Design system"). */

:root { --dot: #4675cb; }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; outline: none; }
.top-right, #demo-title, #modes, .inset, .legend, #dock { transition: opacity 0.5s var(--ease); }
body:not(.is-ready) :is(.top-right, #modes, .inset, .legend, #dock) { opacity: 0; }

/* ---------------------------------------------------------------- title */

#demo-title { position: absolute; top: var(--pad-top); left: var(--pad-left); z-index: var(--z-headline); }
#demo-title a { color: inherit; text-decoration: none; }
#demo-title h1 { font: 600 17px/1.2 var(--display); letter-spacing: -0.015em; color: var(--ink); margin: 0 0 8px 4px; }
#demo-title a:hover h1 { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
#demo-title .sub { position: relative; display: flex; align-items: center; padding: 4px; border-radius: 999px; width: max-content; }
#demo-title .sub::before { background: linear-gradient(rgba(118, 118, 128, 0.12), rgba(118, 118, 128, 0.12)), var(--mat); }
#demo-title .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--dot);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25); }
.status { margin: 8px 0 0 6px; font: 400 11px/1.4 var(--mono); letter-spacing: 0.02em; color: var(--ink2); }

/* ---------------------------------------------------------------- modes, top centre */

#modes { position: absolute; top: var(--pad-top); left: 50%; transform: translateX(-50%); z-index: var(--z-chrome);
  display: flex; gap: 2px; padding: 4px; border-radius: 999px; }
#modes::before, #dock .views { background: linear-gradient(rgba(118, 118, 128, 0.12), rgba(118, 118, 128, 0.12)), var(--mat); }
/* The system's toggles are ON unless .off; here aria state decides. */
.toggle[aria-checked="false"], .toggle[aria-pressed="false"] { background: transparent; color: var(--ink2); box-shadow: none; }
.toggle[aria-checked="false"]:hover, .toggle[aria-pressed="false"]:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink); }

/* ---------------------------------------------------------------- scene picker, top right */

.top-right { position: absolute; top: var(--pad-top); right: var(--pad-right); z-index: var(--z-hint);
  display: flex; align-items: flex-start; gap: 8px; }
#controls { position: relative; width: 280px; border-radius: 22px; }
#controls:not([open]) { width: 240px; border-radius: 999px; }
#controls summary { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 14px;
  cursor: pointer; list-style: none; font: 500 13px/1 var(--text); color: var(--ink); }
#controls summary::-webkit-details-marker { display: none; }
#controls summary::before { content: ""; width: 5px; height: 5px; margin: 0 4px 0 2px; flex: none;
  border: solid var(--ink2); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform 0.3s var(--ease); }
#controls[open] summary::before { transform: rotate(45deg); }
#scene-short { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); font-weight: 400; }
.scenario-menu { padding: 2px 8px 10px; max-height: min(62vh, 560px); overflow-y: auto; animation: rise 0.28s var(--ease); }
.scenario-options { display: flex; flex-direction: column; gap: 2px; }
.scenario-options button { text-align: left; padding: 9px 10px; border: none; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--ink2); transition: background 0.2s var(--ease), color 0.2s var(--ease); }
.scenario-options strong, .scenario-options span { display: block; }
.scenario-options strong { font: 500 14px/1.25 var(--text); color: var(--ink); }
.scenario-options span { margin-top: 3px; font: 400 12px/1.3 var(--text); }
.scenario-options button:hover { background: rgba(0, 0, 0, 0.04); }
.scenario-options button[aria-pressed="true"], .scenario-options button[aria-pressed="true"]:hover { background: var(--ink); color: rgba(255, 255, 255, 0.6); }
.scenario-options button[aria-pressed="true"] strong { color: #fff; }
body.is-loading .scenario-options button[aria-pressed="true"] strong::after { content: " · loading"; font-weight: 400; color: rgba(255, 255, 255, 0.6); }

/* ---------------------------------------------------------------- front camera: the dark ego card */

/* The renderer draws the camera into .inset-frame (js/app.js, renderInset);
   the card's header is the system's dark glass. */
.inset { position: absolute; left: var(--pad-left); bottom: calc(var(--dock-bottom) + var(--dock-h) + 14px); z-index: var(--z-chrome);
  margin: 0; width: 260px; border-radius: 16px 16px 0 0; box-shadow: var(--lift); }
/* Only the header and the rules between frames are dark glass: each frame
   is a clear window onto the canvas, which draws the camera there, so the
   card has no backing of its own and square lower corners, as the frames. */
.inset header { height: 36px; display: flex; align-items: center; padding: 0 14px; border-radius: 16px 16px 0 0;
  background: rgba(29, 29, 31, 0.9); -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur); }
.inset header > span { font: 500 12px/1 var(--text); color: rgba(245, 245, 247, 0.85); }
/* The three views in one column (owner, 2026-10-28). */
.inset-frames { display: grid; grid-template-columns: 1fr; }
.inset-frame { position: relative; aspect-ratio: 16 / 7; }
.inset-frame + .inset-frame { border-top: 2px solid rgba(29, 29, 31, 0.9); }
.inset-frame span { position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 6px;
  background: rgba(29, 29, 31, 0.72); color: #f5f5f7; font: 500 10.5px/1.3 var(--text); }

/* ---------------------------------------------------------------- legend, bottom right */

.legend { position: absolute; right: var(--pad-right); bottom: calc(var(--dock-bottom) + var(--dock-h) + 14px); z-index: var(--z-chrome);
  width: 240px; padding: 14px 16px 12px; border-radius: 20px; }
.classes, .kinds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.classes li, .kinds li { display: flex; align-items: center; gap: 7px; font: 400 12px/1.25 var(--text); color: var(--ink2); }
.classes i, .kinds i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ramp > i { display: block; height: 8px; border-radius: 4px; }
.ramp p { display: flex; justify-content: space-between; margin-top: 6px; font: 400 11px/1 var(--mono); letter-spacing: 0.02em; color: var(--ink2); }
.ramp-occupancy > i { background: linear-gradient(90deg, #48487e, #8a90c0 45%, #f0f6e4); }
.ramp-flow { display: flex; gap: 12px; align-items: center; }
.ramp-flow > i { width: 54px; height: 54px; flex: none; border-radius: 50%; }
.ramp-flow p { display: block; margin: 0; font: 400 11.5px/1.4 var(--text); letter-spacing: 0; }
.kinds { margin-top: 10px; }
.kind-ground { background: #575142; }
.kind-moving { background: #e0707a; }
body:not([data-mode="semantic"]) .classes, body:not([data-mode="flow"]) .ramp-flow,
body:not([data-mode="occupancy"]) .ramp-occupancy { display: none; }
.counts { margin-top: 12px; padding-top: 10px; border-top: 0.5px solid var(--hair); font: 400 11px/1.4 var(--mono); color: var(--ink2); }
.counts b { font-weight: 500; color: var(--ink); white-space: nowrap; }

/* ---------------------------------------------------------------- the dock */

#dock { position: absolute; bottom: var(--dock-bottom); left: 0; right: 0; margin-inline: auto; z-index: var(--z-chrome);
  width: max-content; max-width: calc(100% - var(--pad-left) - var(--pad-right)); height: var(--dock-h);
  display: flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 999px; }
#dock :focus-visible { outline-offset: -2px; }
#dock .play svg { width: 16px; height: 16px; fill: currentColor; }
#dock .play[data-playing="true"] .icon-play, #dock .play[data-playing="false"] .icon-pause { display: none; }
#dock .track { position: relative; display: flex; align-items: center; }
#dock input[type=range] { width: 260px; }
/* One tick per 2 Hz keyframe under the track. */
#dock .ticks { position: absolute; left: 10px; right: 10px; top: calc(50% + 7px); height: 4px; pointer-events: none; }
#dock .ticks i { position: absolute; top: 0; width: 1px; height: 3px; background: var(--hair); }
#dock .ticks i.whole { height: 4px; background: var(--ink2); opacity: 0.5; }
#dock .time { min-width: 6ch; margin: 0 4px 0 10px; text-align: right; font: 400 11px/1 var(--mono); letter-spacing: 0.02em;
  color: var(--ink2); font-variant-numeric: tabular-nums; }
#dock .pill { height: 40px; padding: 0 12px; border: none; border-radius: 999px; cursor: pointer; background: transparent;
  color: var(--ink); font: 500 13px/1 var(--mono); transition: background 0.2s var(--ease); }
#dock .pill:hover { background: rgba(0, 0, 0, 0.05); }
#dock .views { display: flex; gap: 2px; padding: 3px; border-radius: 999px; }
#dock .views .toggle { height: 30px; padding: 0 12px; }

/* The data credit, under the counts. */
.legend .credit { margin-top: 8px; font: 400 10.5px/1.4 var(--text); color: var(--ink2); }
.legend .credit a { color: inherit; }
.legend .credit a:hover { color: var(--ink); }
/* The car's credit shows once its model has loaded (js/car.js, body.has-truck). */
body:not(.has-truck) .car-credit { display: none; }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 900px) {
  :root { --dock-h: 48px; }
  #modes { top: calc(var(--pad-top) + 96px); }
  #dock input[type=range] { width: 160px; }
  .legend { display: none; }
}
/* Phones, as VR-Robo's demo lays them out (owner, 2026-10-28: "following
   projects/vr-robo"): no title block; the mode track takes the top left and
   the picker shrinks to its "Scene" pill at the top right, opening to the
   system's narrow-screen sheet above the dock; the camera card spans the
   width above the dock with its three views in one row. The views stay
   inside the card: the canvas draws each at its frame's rectangle
   (js/app.js, renderInset), so a scrolled-off frame would draw outside. */
@media (max-width: 640px) {
  #demo-title, #scene-short { display: none; }
  #controls, #controls:not([open]) { width: auto; }
  #controls[open] .scenario-menu { position: fixed; left: var(--pad-left); right: var(--pad-right);
    bottom: calc(var(--dock-bottom) + var(--dock-h) + 10px); max-height: 56dvh; overflow-y: auto;
    padding: 12px 8px; border-radius: 22px; background: var(--mat-dense);
    box-shadow: var(--mat-line), var(--lift); -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur); }
  body:has(#controls[open]) .inset { visibility: hidden; }
  #modes { top: var(--pad-top); left: var(--pad-left); transform: none; }
  #modes .toggle { height: 30px; padding: 0 12px; }
  .inset { left: var(--pad-left); right: var(--pad-right); width: auto; bottom: calc(var(--dock-bottom) + var(--dock-h) + 10px); }
  .inset header { height: 32px; }
  .inset-frames { grid-template-columns: repeat(3, 1fr); }
  .inset-frame { aspect-ratio: 4 / 3; }
  .inset-frame + .inset-frame { border-top: 0; border-left: 2px solid rgba(29, 29, 31, 0.9); }
  #dock .speed, #dock .views, #dock .sep:nth-of-type(3) { display: none; }
  #dock input[type=range] { width: 120px; }
}
@media (max-width: 400px) { #dock input[type=range] { width: 96px; } }
@media (max-width: 360px) {
  #modes .toggle { padding: 0 9px; }
  #dock .time { display: none; }
}
/* The narrowest phones: the closed picker keeps only its chevron (its
   summary keeps the "Scene" label for assistive tech). */
@media (max-width: 340px) {
  #controls:not([open]) summary { font-size: 0; padding: 0 13px; }
}
@media (max-width: 640px) and (max-height: 640px) { .inset { display: none; } }
/* Finger-sized dock buttons on touch screens, as VR-Robo's. */
@media (pointer: coarse) { #dock .pill { height: 44px; } }

/* ---------------------------------------------------------------- captures */

/* Clip rendering (js/app.js, ?capture): the stage alone. */
body.is-capture :is(#demo-title, .top-right, #modes, .inset, .legend, #dock) { display: none !important; }
body.is-capture { background: #f6f6fc; }
