/* Isovist's shared look: the tokens, the navigation rail and the common controls.
   Every page loads this first. Light and dark come from one set of tokens: each is
   written once with light-dark(), and the theme switch only changes color-scheme. */

:root {
  color-scheme: light dark;

  /* Surfaces, from the window's back to what floats over it. */
  --iso-canvas: light-dark(#f4f5f7, #0c0e11);
  --iso-surface: light-dark(#ffffff, #14171b);
  --iso-raised: light-dark(#ffffff, #1b1f25);
  --iso-sunken: light-dark(#eceef2, #0f1215);
  --iso-hover: light-dark(rgba(16, 24, 40, 0.045), rgba(255, 255, 255, 0.055));
  --iso-pressed: light-dark(rgba(16, 24, 40, 0.085), rgba(255, 255, 255, 0.095));
  --iso-rail: light-dark(#e9ebef, #090a0d);
  --iso-scrim: light-dark(rgba(22, 28, 38, 0.32), rgba(0, 0, 0, 0.58));

  /* Lines. */
  --iso-line: light-dark(rgba(16, 24, 40, 0.09), rgba(255, 255, 255, 0.075));
  --iso-line-strong: light-dark(rgba(16, 24, 40, 0.17), rgba(255, 255, 255, 0.15));

  /* Text. */
  --iso-text: light-dark(#14181f, #e9ebee);
  --iso-muted: light-dark(#5b6472, #9ba3ae);
  --iso-faint: light-dark(#8a93a0, #6b7380);

  /* The accent: the cyan of an isovist wedge. */
  --iso-accent: light-dark(#0878a8, #56c1dc);
  --iso-accent-strong: light-dark(#066792, #7cd3e8);
  --iso-accent-soft: light-dark(rgba(8, 120, 168, 0.1), rgba(86, 193, 220, 0.13));
  --iso-accent-line: light-dark(rgba(8, 120, 168, 0.35), rgba(86, 193, 220, 0.4));
  --iso-on-accent: light-dark(#ffffff, #04212a);

  /* Meaning. Each has a text colour and a soft fill for pills and banners. */
  --iso-good: light-dark(#12804a, #6dd29a);
  --iso-good-soft: light-dark(rgba(18, 128, 74, 0.11), rgba(109, 210, 154, 0.13));
  --iso-warn: light-dark(#a35f00, #efb450);
  --iso-warn-soft: light-dark(rgba(196, 122, 0, 0.13), rgba(239, 180, 80, 0.13));
  --iso-bad: light-dark(#c2332f, #f27a76);
  --iso-bad-soft: light-dark(rgba(194, 51, 47, 0.1), rgba(242, 122, 118, 0.13));
  --iso-busy: light-dark(#5b4bd6, #a79cff);
  --iso-busy-soft: light-dark(rgba(91, 75, 214, 0.1), rgba(167, 156, 255, 0.14));
  --iso-idle-soft: light-dark(rgba(16, 24, 40, 0.06), rgba(255, 255, 255, 0.07));

  /* Shape, depth and motion. */
  --iso-radius-s: 6px;
  --iso-radius: 9px;
  --iso-radius-l: 14px;
  --iso-shadow-1: 0 1px 2px light-dark(rgba(16, 24, 40, 0.06), rgba(0, 0, 0, 0.4));
  --iso-shadow-2: 0 1px 2px light-dark(rgba(16, 24, 40, 0.05), rgba(0, 0, 0, 0.4)),
    0 6px 20px -4px light-dark(rgba(16, 24, 40, 0.12), rgba(0, 0, 0, 0.5));
  --iso-shadow-3: 0 2px 6px light-dark(rgba(16, 24, 40, 0.06), rgba(0, 0, 0, 0.4)),
    0 24px 60px -12px light-dark(rgba(16, 24, 40, 0.28), rgba(0, 0, 0, 0.7));
  --iso-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --iso-fast: 0.12s;
  --iso-rail-width: 68px;

  --iso-font: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --iso-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* The shell's frame: a rail on the left, the page beside it. ---------------------------- */

body.iso {
  margin: 0;
  display: grid;
  grid-template-columns: var(--iso-rail-width) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--iso-canvas);
  color: var(--iso-text);
  font: 13px/1.45 var(--iso-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

isovist-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 0 10px;
  box-sizing: border-box;
  background: var(--iso-rail);
  border-right: 1px solid var(--iso-line);
  font: 13px/1.3 var(--iso-font);
  user-select: none;
  z-index: 5;
}

isovist-nav .iso-mark {
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #16202b, #0b1016);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 1px 3px rgba(0, 0, 0, 0.25);
  text-decoration: none;
}
isovist-nav .iso-mark svg { width: 22px; height: 22px; display: block; }

isovist-nav a.iso-area, isovist-nav button.iso-tool {
  all: unset;
  box-sizing: border-box;
  width: 56px;
  padding: 7px 0 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-radius: 9px;
  color: var(--iso-muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  cursor: pointer;
  transition: background var(--iso-fast), color var(--iso-fast);
}
isovist-nav a.iso-area:hover, isovist-nav button.iso-tool:hover { background: var(--iso-hover); color: var(--iso-text); }
isovist-nav a.iso-area[aria-current="page"] { color: var(--iso-accent); background: var(--iso-accent-soft); }
isovist-nav a.iso-area:focus-visible, isovist-nav button.iso-tool:focus-visible,
isovist-nav .iso-mark:focus-visible { outline: 2px solid var(--iso-accent); outline-offset: 1px; }
isovist-nav svg.iso-icon { width: 19px; height: 19px; }
isovist-nav .iso-fill { flex: 1; }
isovist-nav button.iso-tool { padding: 8px 0; }

svg.iso-icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Simple pages (a list of cameras to open, or nothing to show yet). --------------------- */

.iso-plain { min-width: 0; padding: 30px clamp(20px, 4vw, 56px) 60px; }
.iso-plain h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.012em; margin: 0 0 4px; }
.iso-plain .iso-lead { color: var(--iso-muted); margin: 0 0 26px; max-width: 64ch; font-size: 13.5px; }
.iso-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.iso-card {
  display: block;
  background: var(--iso-surface);
  border: 1px solid var(--iso-line);
  border-radius: var(--iso-radius-l);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--iso-shadow-1);
  transition: transform 0.18s var(--iso-ease), box-shadow 0.18s var(--iso-ease), border-color var(--iso-fast);
}
a.iso-card:hover { transform: translateY(-2px); box-shadow: var(--iso-shadow-2); border-color: var(--iso-line-strong); }
a.iso-card:focus-visible { outline: 2px solid var(--iso-accent); outline-offset: 2px; }
.iso-card .iso-shot { aspect-ratio: 16 / 9; background: var(--iso-sunken) center / cover no-repeat; display: block; width: 100%; object-fit: cover; }
.iso-card .iso-body { padding: 12px 14px 13px; }
.iso-card .iso-title { font-weight: 600; font-size: 13.5px; }
.iso-card .iso-sub { color: var(--iso-muted); font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.iso-card.iso-dim { opacity: 0.6; }

.iso-empty {
  max-width: 460px;
  margin: 12vh auto 0;
  text-align: center;
  color: var(--iso-muted);
}
.iso-empty .iso-badge {
  width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 15px;
  display: grid; place-items: center;
  background: var(--iso-accent-soft); color: var(--iso-accent);
}
.iso-empty .iso-badge svg { width: 24px; height: 24px; }
.iso-empty h2 { color: var(--iso-text); font-size: 16px; font-weight: 640; margin: 0 0 6px; letter-spacing: -0.005em; }
.iso-empty p { margin: 0 0 6px; font-size: 13px; line-height: 1.55; }
.iso-empty code { font: 12px var(--iso-mono); background: var(--iso-idle-soft); padding: 1.5px 5px; border-radius: 4px; color: var(--iso-text); }
.iso-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  color: var(--iso-accent); font-weight: 550; text-decoration: none; border-radius: 6px; padding: 2px 4px;
}
.iso-link:hover { text-decoration: underline; }
.iso-link:focus-visible { outline: 2px solid var(--iso-accent); outline-offset: 2px; }
