/* Sightline. A porch at dusk: slate-blue dark, warm lamp-amber for whatever is seen.
   The picture is the page. Everything else stays quiet around it. */
:root {
  color-scheme: dark;
  --dusk: #16202b; --dusk-deep: #0f1720; --slate: #223040; --rule: #33465a;
  --paper: #f3efe6; --soft: #a9b6c4; --lamp: #f2b544; --person: #f2b544; --animal: #58cfa9; --vehicle: #7db8ff; --alarm: #ff8f7a;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  background: var(--dusk); color: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2 { font-weight: 650; letter-spacing: -.02em; margin: 0; }
p { line-height: 1.55; margin: 0; }
a { color: var(--lamp); }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 12px max(18px, env(safe-area-inset-left)); border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: -.02em; color: var(--paper); text-decoration: none; margin-right: auto; }
nav { display: flex; gap: 4px; }
nav button { border: 0; background: none; padding: 9px 13px; border-radius: 9px; color: var(--soft); font-size: 15px; min-height: 44px; }
nav button[aria-current=page] { background: var(--slate); color: var(--paper); font-weight: 600; }

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 18px 40px; }
.lede { color: var(--soft); max-width: 56ch; margin-top: 8px; }
.stack { display: grid; gap: 14px; }

/* Signed out: one lamp-lit card on the dark. */
.door { max-width: 430px; margin: 9vh auto 0; display: grid; gap: 18px; }
.door h1 { font-size: 34px; }
.door img { width: 56px; height: 56px; }
.field { display: grid; gap: 6px; font-size: 14px; color: var(--soft); }
.field input, .field select { height: 46px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--rule); background: var(--dusk-deep); color: var(--paper); font-size: 16px; }
.go { height: 48px; padding: 0 20px; border: 0; border-radius: 11px; background: var(--lamp); color: #1b1404; font-weight: 700; font-size: 16px; }
.plain { height: 44px; padding: 0 16px; border: 1px solid var(--rule); border-radius: 10px; background: transparent; font-size: 15px; }
.plain.danger { color: var(--alarm); border-color: #6b3f3a; }
.problem { color: var(--alarm); font-size: 14.5px; min-height: 1.4em; }

/* Cameras: a wall of windows. */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 20px; }
.window { display: grid; gap: 14px; align-content: space-between; min-height: 132px; padding: 16px; text-align: left; border: 1px solid var(--rule); border-radius: 14px; background: linear-gradient(160deg, var(--slate), var(--dusk-deep)); }
.window:hover:not(:disabled) { border-color: var(--lamp); }
.window strong { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--soft); }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--animal); }
.state.off::before { background: #6b7887; }

/* Live: the picture, then one row of controls. */
.live-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.live-head h1 { font-size: 22px; margin-right: auto; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100dvh - 250px); background: #05080b; border-radius: 14px; overflow: hidden; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage video { object-fit: contain; }
.stage video.back { visibility: hidden; }
.veil { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--soft); background: #05080bcc; }
.strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.seen { font-size: 15px; font-weight: 600; margin-right: auto; }
.chips { display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rule); background: transparent; font-size: 14.5px; color: var(--soft); }
.chip::before { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--c); }
.chip[aria-pressed=true] { color: var(--paper); border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.chip[aria-pressed=true]::before { background: var(--c); }
.quiet { font-size: 13.5px; color: var(--soft); }

/* History: a log, newest first. */
.day { margin: 22px 0 8px; font-size: 14px; color: var(--soft); font-weight: 600; }
.log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.log li { display: grid; grid-template-columns: 5.5em 1fr auto; gap: 12px; align-items: baseline; padding: 11px 2px; border-bottom: 1px solid var(--rule); font-size: 15px; }
.log time { color: var(--soft); }
.tag { font-size: 13px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--c, var(--rule)); color: var(--c, var(--soft)); }

.card { border: 1px solid var(--rule); border-radius: 14px; padding: 18px; background: var(--dusk-deep); display: grid; gap: 12px; }
.card h2 { font-size: 17px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row > :first-child { margin-right: auto; }
.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; line-height: 1.5; }
.link-box { width: 100%; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--rule); background: var(--dusk); font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); padding: 11px 16px; border-radius: 11px; background: var(--paper); color: #16202b; font-size: 14.5px; font-weight: 600; max-width: 90vw; }

@media (max-width: 620px) {
  .brand { width: 100%; }
  nav { width: 100%; justify-content: space-between; }
  .stage { max-height: none; border-radius: 0; margin: 0 -18px; width: auto; }
  .log li { grid-template-columns: 4.6em 1fr; }
  .log .tag { grid-column: 2; justify-self: start; }
}
