/* absolute clarity wears the elsewhere look: near-black, white, three grays and two accents, the sun and
   the night. nothing is drawn that is not a word, a one-pixel line, or the picture itself. */
:root {
  --bg: #121212; --s1: #ffffff; --s2: #84858c; --s3: #4a4b52; --rule: #2e2e33; --focus: #ffffff;
  --warm: #b17c77; --cool: #6e8494; --field: #000000; color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fafafa; --s1: #121212; --s2: #85858c; --s3: #b9b9bf; --rule: #e4e4e6; --focus: #121212;
    --warm: #9d6460; --cool: #5b7484; --field: #fafafa; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #fafafa; --s1: #121212; --s2: #85858c; --s3: #b9b9bf; --rule: #e4e4e6; --focus: #121212;
  --warm: #9d6460; --cool: #5b7484; --field: #fafafa; color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--s1); overflow: hidden;
  font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1.5; font-weight: 400;
  transition: background 0.7s ease, color 0.7s ease;
}
h1, h2, h3, b, strong { font-weight: 400; }
b { color: var(--warm); }
i { font-style: normal; color: var(--cool); }
a { color: var(--s2); text-decoration: none; }
a:focus-visible { outline: 1px solid var(--focus); outline-offset: 4px; }
@media (hover: hover) { a:hover { color: var(--s1); } }
.g { color: var(--s2); }
.d { color: var(--s3); }
.hint { font-size: 13px; }
.hidden { display: none !important; }

/* the picture: the one thing drawn */
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; object-fit: contain; background: var(--field); display: block; transition: background 0.7s ease; cursor: pointer; }
#videos { position: fixed; left: -9999px; top: 0; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; overflow: hidden; }
#videos video { width: 2px; height: 2px; }

/* the door */
#splash { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 20; cursor: pointer; padding: 16px; transition: background 0.7s ease, color 0.7s ease; }
.splash-inner { max-width: 620px; }
.splash-inner h1 { font-size: 16px; margin: 0 0 6px; }
.splash-inner p { margin: 0 0 18px; }
.splash-inner .hint { margin-top: 28px; }
.begin { letter-spacing: 0.02em; }

/* the status line and the source line, at the top of the controls; the viewer itself carries no text */
.status { font-size: 13px; color: var(--s2); padding: 0 0 2px; min-height: 1.5em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the acts and the switches: a word in brackets, colour and nothing else */
.seg { display: flex; gap: 18px; flex-wrap: wrap; }
.seg button, .act, .switch, button.act, button.switch {
  background: transparent; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--s2); touch-action: manipulation; text-align: left;
}
@media (hover: hover) {
  .switch:hover, .seg button:hover { color: var(--s1); }
  .act:hover, .seg button.act:hover { color: var(--warm); }
  .door:hover, .seg button.door:hover { color: var(--cool); }
}
.act[disabled] { color: var(--s3); cursor: default; }
.switch[aria-checked="true"] { color: var(--s1); }
.door[aria-checked="true"] { color: var(--cool); }
.seg button:focus-visible, .act:focus-visible, .switch:focus-visible { outline: 1px solid var(--focus); outline-offset: 4px; }
.inline { display: flex; gap: 24px; align-items: baseline; flex-wrap: wrap; padding: 12px 0; }
.sect { margin: 0; padding: 18px 0 2px; color: var(--s2); font-size: 13px; font-weight: 400; }

/* the faders */
.ctl { display: block; padding: 12px 0 10px; }
.ctl .row2 { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.ctl label { font-size: 16px; }
.ctl output { font-size: 14px; color: var(--s2); font-variant-numeric: tabular-nums; }
.ctl.warm output { color: var(--warm); }
.ctl.cool output { color: var(--cool); }
.ctl.warm input[type="range"]::-webkit-slider-thumb { background: var(--warm); }
.ctl.cool input[type="range"]::-webkit-slider-thumb { background: var(--cool); }
.ctl.warm input[type="range"]::-moz-range-thumb { background: var(--warm); }
.ctl.cool input[type="range"]::-moz-range-thumb { background: var(--cool); }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 18px; background: transparent; cursor: pointer; margin: 0; display: block; }
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--rule); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; background: var(--s1); margin-top: -5px; border: 0; }
input[type="range"]::-moz-range-track { height: 1px; background: var(--rule); }
input[type="range"]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--s1); border: 0; }
input[type="range"]:focus-visible { outline: 1px solid var(--focus); outline-offset: 4px; }

/* the words you type: a one-pixel line under them, nothing around them, no spinner, no grip */
.field { display: block; color: var(--s2); font-size: 13px; padding: 8px 0 4px; }
.field input, .field textarea { display: block; width: 100%; margin-top: 2px; font: inherit; font-size: 16px; color: var(--s1); background: transparent; border: 0; border-bottom: 1px solid var(--rule); padding: 4px 0; outline: none; resize: none; }
.field input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.field input[type="number"]::-webkit-inner-spin-button, .field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field input:focus-visible, .field textarea:focus-visible { border-bottom-color: var(--focus); }
.field.short { display: inline-block; width: auto; }
.field.short input { width: 120px; }

/* the static edition has no scraper behind it: the ingest form stays out of sight there */
body.static #ingest { display: none; }

/* the controls, a column at the side with one line between it and the picture */
#hud { position: fixed; top: 0; right: 0; height: 100vh; width: min(440px, 100vw); overflow-y: auto; background: var(--bg); border-left: 1px solid var(--rule); padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(40px + env(safe-area-inset-bottom, 0px)); z-index: 25; transition: background 0.7s ease, color 0.7s ease, border-color 0.7s ease; }
#hud .head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
#hud h2 { font-size: 16px; margin: 0; }
#stats { font-size: 13px; color: var(--s2); font-variant-numeric: tabular-nums; padding: 2px 0; }
#stats b { color: var(--warm); font-weight: 400; }
#tags { padding: 2px 0 6px; }
details { font-size: 13px; color: var(--s2); padding: 6px 0; }
details summary { cursor: pointer; list-style: none; color: var(--s2); }
@media (hover: hover) { details summary:hover { color: var(--warm); } }
details summary:focus-visible { outline: 1px solid var(--focus); outline-offset: 4px; }
details summary::-webkit-details-marker { display: none; }
details ul { margin: 6px 0 0; padding-left: 0; list-style: none; max-height: 220px; overflow-y: auto; }
details li { margin: 0 0 4px; }
#jobs { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; color: var(--s2); font-variant-numeric: tabular-nums; }
#jobs li { padding: 4px 0; border-top: 1px solid var(--rule); word-break: break-word; }
#jobs li.running .st { color: var(--cool); }
#jobs li.done .st { color: var(--s1); }
#jobs li.failed .st, #jobs li.cancelled .st { color: var(--s2); }
#jobs .act { font-size: 16px; margin-left: 12px; }
.empty { font-size: 13px; color: var(--warm); padding: 4px 0; }
.foot { margin-top: 44px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--s3); }
@media (pointer: coarse) {
  input[type="range"] { height: 44px; }
  input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -10.5px; }
  input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
  .seg { row-gap: 0; column-gap: 20px; }
  .seg button, .act, .switch { padding: 10px 0; min-height: 44px; }   /* every word in brackets is a 44 px target */
  .ctl { padding: 8px 0 4px; }
  .ctl .row2 { margin-bottom: 0; }
  .field input, .field textarea { padding: 10px 0; }
  details summary { display: flex; align-items: center; min-height: 44px; padding: 0; }
}

/* on a phone the controls are a sheet over the lower part of the picture, which stays in view above; the
   title and [ hide ] stay within reach while the sheet scrolls */
@media (max-width: 640px) {
  #hud { top: auto; bottom: 0; left: 0; right: 0; width: 100%; height: auto; max-height: 74vh; max-height: 74dvh;
         border-left: 0; border-top: 1px solid var(--rule); overscroll-behavior: contain;
         padding: 0 16px calc(28px + env(safe-area-inset-bottom, 0px)); }
  #hud .head { position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 10px 0 4px; margin: 0; }
  .splash-inner .hint { margin-top: 20px; }
}
