/* Elm City Explorer design tokens. One source for every page.
   Rules: neutral dark grays, one blue accent, the system sans, no gradients,
   no glows, no textures, sentence-case labels. Components live in each page's
   own stylesheet (index.html inline; site.css for the article pages). */
:root {
  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-xs: 12px;  --text-sm: 13px;  --text-base: 14px; --text-md: 16px;
  --text-lg: 18px;  --text-xl: 22px;  --text-2xl: 28px;  --text-3xl: 36px;

  /* Surfaces, darkest to lightest */
  --bg-0: #121212;  --bg-1: #181818;  --bg-2: #202020;  --bg-3: #2a2a2a;
  --border-1: #2a2a2a; --border-2: #383838; --border-3: #4a4a4a;

  /* Text */
  --text-1: #ededed; --text-2: #b3b3b3; --text-3: #949494; --text-4: #5e5e5e;

  /* One accent: links, focus, active and selected states */
  --accent: #79a6f6; --accent-hover: #9dbdf8; --accent-soft: rgba(121,166,246,0.12);
  --link: var(--accent);

  /* Status colors: text and 1px borders only, never fills */
  --success: #7bbd80; --warning: #d4a44c; --error: #e2736b;
  --success-soft: rgba(123,189,128,0.12); --error-soft: rgba(226,115,107,0.12);

  /* Controls */
  --btn-bg: var(--bg-2); --btn-fg: var(--text-1); --btn-border: var(--border-3);
  --btn-primary-bg: #f0f0f0; --btn-primary-fg: #121212; --btn-primary-hover: #ffffff;
  --radius-control: 6px; --radius-panel: 8px;
  --shadow-panel: 0 8px 24px rgba(0,0,0,0.45);
  --focus-ring: 2px solid var(--accent);
  --scrim: rgba(0,0,0,0.6);

  /* Spacing */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --transition: 120ms ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans); font-size: var(--text-base); line-height: 1.5;
  color: var(--text-1); background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
a:hover { color: var(--accent-hover); }
strong { font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Focus: one visible ring everywhere, no glow. */
:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

/* Buttons. Default, primary (the one filled button on a surface), ghost
   (borderless), plus size and icon variants. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 12px; min-height: 32px;
  font-size: var(--text-sm); font-weight: 500; line-height: 1.2;
  border: 1px solid var(--btn-border); border-radius: var(--radius-control);
  background: var(--btn-bg); color: var(--btn-fg);
  cursor: pointer; user-select: none; white-space: nowrap; text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn:hover { background: var(--bg-3); border-color: var(--border-3); color: var(--text-1); }
.btn:active { background: var(--bg-3); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
/* A tour already taken is dimmed (class, not inline style, so it stays visible under :disabled). */
.btn.active, .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: var(--btn-primary-bg); font-weight: 600; }
.btn-primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); color: var(--btn-primary-fg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-2); border-color: transparent; color: var(--text-1); }
.btn-danger { color: var(--error); }
.btn-danger:hover { border-color: var(--error); color: var(--error); }
.btn-success { color: var(--success); }
.btn-success:hover { border-color: var(--success); color: var(--success); }
.btn-sm { padding: 3px 9px; min-height: 26px; font-size: var(--text-xs); }
.btn-lg { padding: 9px 16px; min-height: 40px; font-size: var(--text-base); }
.btn-icon { padding: 0; width: 32px; min-width: 32px; }
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn:not(:first-child) { margin-left: -1px; }
.btn-group .btn:hover, .btn-group .btn:focus-visible, .btn-group .btn.active { z-index: 1; }

/* Square close button used by every panel and dialog. */
.close-btn, .modal-close, .detail-close, .chat-close, .sos-close, .net-close, .hood-close,
.about-close, .qa-close, .insights-close, .inv-close, .brief-collapse {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--radius-control); background: transparent;
  color: var(--text-3); font-size: 20px; line-height: 1; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.close-btn:hover, .modal-close:hover, .detail-close:hover, .chat-close:hover, .sos-close:hover,
.net-close:hover, .hood-close:hover, .about-close:hover, .qa-close:hover, .insights-close:hover,
.inv-close:hover, .brief-collapse:hover { background: var(--bg-3); color: var(--text-1); }

/* Form controls */
.input, input[type="text"], input[type="search"], select, textarea {
  background: var(--bg-2); border: 1px solid var(--border-3); border-radius: var(--radius-control);
  color: var(--text-1); padding: 8px 10px; font-size: var(--text-base);
}
.input:focus, input[type="text"]:focus, input[type="search"]:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
kbd {
  display: inline-block; padding: 1px 5px; border: 1px solid var(--border-3); border-radius: 4px;
  background: var(--bg-2); color: var(--text-2); font-family: var(--font-sans); font-size: 11px; line-height: 1.4;
}

/* Small labels (stat captions, section labels): sentence case, no tracking. */
.label { font-size: var(--text-xs); color: var(--text-3); }
.stat-val, .num { font-variant-numeric: tabular-nums; }

/* Color swatch for a group: a small square, never a glowing dot. */
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* Visually hidden, still read by screen readers. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.sr-only:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; padding: 12px 20px; margin: 0; overflow: visible; clip: auto; background: var(--btn-primary-bg); color: var(--btn-primary-fg); z-index: 99999; border-radius: var(--radius-control); font-size: var(--text-base); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
