@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@600;700;800;900&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&family=Source+Serif+4:ital,wght@0,400;0,500;1,400&family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ============================================================
   Dispatch Log — a live record of AI routing human labor.
   Palette: cool manifest paper + steel + one hazard-orange signal.
   Type: Archivo (mast/headlines), IBM Plex Sans (UI), IBM Plex Mono
   (data fields — everything that reads like a manifest entry),
   Source Serif 4 upright (testimony — the human voice breaking
   through the system).
   ============================================================ */

:root {
  --paper:      #ECEEF0;
  --surface:    #FFFFFF;
  --ink:        #14181D;
  --muted:      #5B6470;
  --faint:      #8B93A0;
  --rule:       #D3D7DB;
  --rule-dark:  #B6BCC3;

  --accent:     #FF5A1F;
  --accent-ink: #B23E10;
  --accent-bg:  #FFEDE4;

  --negative:    #3D4A5C;
  --negative-bg: #E4E8EC;

  --radius: 3px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: inherit; }

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Masthead --- */

.navbar {
  background: var(--paper) !important;
  border-bottom: 1px solid var(--rule) !important;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.navbar-brand {
  font-family: 'IBM Plex Mono', monospace !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  letter-spacing: 0.02em;
  color: var(--ink) !important;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.navbar-brand .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: pulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .navbar-brand .live-dot { animation: none; }
}

.btn-dispatch {
  display: inline-block;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.btn-dispatch:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
  color: #fff;
}

/* ============================================================
   Map page — the homepage IS the map. Everything below overlays
   a full-viewport canvas; the click-to-reveal panel is the primary
   way stories surface, not a scrolling list.
   ============================================================ */

body.map-page {
  height: 100vh;
  overflow: hidden;
}

body.map-page .navbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: rgba(236, 238, 240, 0.92) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

body.map-page main {
  height: 100vh;
}

.map-stage {
  position: relative;
  width: 100%;
  height: 100vh;
}

.map-canvas-full {
  position: absolute;
  inset: 0;
  background: #DCE2E5;
}

.map-canvas-full.map-canvas-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem;
  background:
    repeating-linear-gradient(135deg, #E3E7EA, #E3E7EA 10px, #DCE1E4 10px, #DCE1E4 20px);
}

.map-canvas-missing code {
  background: var(--surface);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  color: var(--accent-ink);
}

.map-overlay-top {
  position: absolute;
  top: 4.75rem;
  left: 1.5rem;
  z-index: 20;
  max-width: 26rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: 0 4px 20px rgba(20, 24, 29, 0.1);
}

.map-page-title {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1.9rem;
  letter-spacing: -0.015em;
  line-height: 1.12;
  color: var(--ink);
  margin: 0 0 0.4rem;
}

.map-page-sub {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--ink);
  font-size: 0.95rem;
  margin: 0;
}

.map-overlay-cities {
  position: absolute;
  top: 4.75rem;
  right: 1.5rem;
  z-index: 20;
  width: 260px;
  max-width: calc(100vw - 3rem);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 2px 14px rgba(20, 24, 29, 0.1);
  padding: 1rem 1rem 0.9rem;
}

.map-overlay-heading {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.25;
  margin: 0 0 0.6rem;
}

.map-overlay-heading .glyph { margin-right: 0.3rem; }

.city-list-overlay {
  list-style: none;
  margin: 0;
  padding: 0;
}

.city-list-overlay li {
  border-bottom: 1px solid var(--rule);
}

.city-list-overlay li:last-child { border-bottom: none; }

.city-list-overlay .city-list-jump {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
}

.city-list-overlay .city-list-jump:hover .city-name {
  text-decoration: underline;
}

.city-list-overlay .city-name {
  font-weight: 600;
  font-size: 0.86rem;
}

.city-list-overlay .city-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent-ink);
  white-space: nowrap;
}

.map-stat-chip {
  position: absolute;
  bottom: 1.25rem;
  left: 1.5rem;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  font-size: 0.76rem;
  color: var(--muted);
  display: flex;
  gap: 0.4rem;
  box-shadow: 0 2px 10px rgba(20, 24, 29, 0.08);
}

.map-stat-chip .dot { color: var(--rule-dark); }

.map-stat-link {
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}

.map-stat-link:hover { text-decoration: underline; }

.map-empty-cta {
  position: absolute;
  bottom: 1.25rem;
  right: 1.5rem;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  text-align: right;
  box-shadow: 0 2px 10px rgba(20, 24, 29, 0.08);
}

.map-empty-cta p {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

/* --- Click-to-reveal city panel --- */

.city-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  box-shadow: 4px 0 24px rgba(20, 24, 29, 0.12);
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.city-panel.open {
  transform: translateX(0);
}

.city-panel-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 1.2rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  z-index: 2;
}

.city-panel-close:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.city-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 3.25rem 1.75rem 1.5rem;
}

.city-panel-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.city-panel-city {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.1;
  margin: 0 0 0.75rem;
}

.city-panel-stats {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.6rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--rule);
}

.city-panel-stats .boss-stat { font-size: 1.5rem; }

.city-panel-split {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
}

.city-panel-task-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.city-panel-headline {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1.2;
  color: var(--accent-ink);
  margin: 0 0 0.9rem;
}

.city-panel-desc {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.98rem;
  line-height: 1.6;
  color: #262B31;
  margin: 0 0 1.1rem;
}

.city-panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.city-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
}

.city-panel-boss {
  display: inline-block;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.4rem 0.65rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.city-panel-boss:hover { border-color: var(--ink); }

/* Scrollable list of a city's reports — title + excerpt so as many as
   possible are visible at once. Each row is a plain link to that report's
   own page, where the full text and comment thread live. */

.city-panel-stories {
  display: flex;
  flex-direction: column;
  margin: 0 -1.75rem;
}

.city-panel-story {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.9rem 1.75rem;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.city-panel-story:last-child {
  border-bottom: 1px solid var(--rule);
}

.city-panel-story:hover,
.city-panel-story:focus-visible {
  background: var(--paper);
}

.city-panel-story .city-panel-headline {
  display: block;
  font-size: 1.05rem;
  margin: 0;
}

.city-panel-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.city-panel-preview-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.1rem;
}

.city-panel-view-full-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.city-panel-comment-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--faint);
  padding-left: 0.5rem;
  border-left: 1px solid var(--rule);
}

/* Laptop/desktop: the panel becomes a bottom drawer — a compact header
   strip on the left, and every report as a fixed-width preview card in a
   horizontally-scrolling row on the right. */
@media (min-width: 641px) {
  .city-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: min(40vh, 360px);
    min-height: 220px;
    border-right: none;
    border-top: 1px solid var(--rule);
    box-shadow: 0 -6px 28px rgba(20, 24, 29, 0.14);
    transform: translateY(100%);
  }

  .city-panel.open {
    transform: translateY(0);
  }

  .city-panel-body {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 1.5rem;
    height: 100%;
    overflow: hidden;
    padding: 1.75rem 2rem;
  }

  .city-panel-head {
    flex: 0 0 200px;
    width: 200px;
    overflow-y: auto;
    border-right: 1px solid var(--rule);
    padding-right: 1.25rem;
  }

  .city-panel-stories {
    flex: 1;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    padding-bottom: 0.25rem;
  }

  .city-panel-story {
    flex: 0 0 280px;
    width: 280px;
    height: 200px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1rem;
    scroll-snap-align: start;
  }
}

@media (max-width: 640px) {
  .map-overlay-top { max-width: calc(100vw - 3rem); top: 4.5rem; }
  .map-overlay-cities { display: none; }
  .city-panel { width: 100%; max-width: 100vw; }
  .city-panel-body { padding: 3.25rem 1.25rem 1.5rem; }
  .city-panel-stories { margin: 0 -1.25rem; }
  .city-panel-story { padding: 0.9rem 1.25rem; }
}

/* --- Hero --- */

.hero {
  padding: 1.75rem 0 1.25rem;
}

.hero-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0.4rem 0 0.4rem;
  max-width: 30ch;
}

.hero-sub {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 0;
  max-width: 46ch;
}

/* --- Stat strip --- */

.stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 1.25rem 0 0;
  overflow: hidden;
}

.stat-strip .stat {
  flex: 1 1 120px;
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--rule);
}

.stat-strip .stat:last-child { border-right: none; }

.stat-strip .stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-strip .stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* --- Map hero / departures board --- */

.map-hero {
  margin: 2rem 0 2.5rem;
}

.map-heading {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: 0.15rem;
}

.map-heading .glyph { margin-right: 0.35rem; }

.map-subheading {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.map-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.map-canvas-wrap {
  flex: 1 1 420px;
  min-width: 0;
  border-right: 1px solid var(--rule);
}

.map-canvas {
  height: 360px;
  background: #DCE2E5;
}

.map-canvas-missing {
  height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  text-align: center;
  padding: 1.5rem;
  background:
    repeating-linear-gradient(135deg, #E3E7EA, #E3E7EA 10px, #DCE1E4 10px, #DCE1E4 20px);
}

.map-canvas-missing code {
  background: var(--surface);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  color: var(--accent-ink);
}

.city-rail {
  flex: 0 1 280px;
  display: flex;
  flex-direction: column;
}

.city-rail-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.7rem 1rem 0.5rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}

.city-list {
  list-style: none;
  counter-reset: city;
  margin: 0;
  padding: 0;
  flex: 1;
}

.city-list li {
  counter-increment: city;
  border-bottom: 1px solid var(--rule);
}

.city-list li:last-child { border-bottom: none; }

.city-list li a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.1s;
}

.city-list li a:hover {
  background: var(--accent-bg);
}

.city-list .rank {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--faint);
  width: 1.4em;
  flex-shrink: 0;
}

.city-list .city-name {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
}

.city-list .city-country {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  color: var(--faint);
  text-transform: uppercase;
}

.city-list .city-count {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--accent-ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.map-note,
.map-cta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--rule);
  margin: 0;
}

.map-cta a {
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}

.map-cta a:hover { text-decoration: underline; }

.map-info {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  max-width: 240px;
}

.map-info strong {
  font-family: 'Archivo', sans-serif;
  font-size: 0.85rem;
}

.map-info ul {
  margin: 0.4rem 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
}

.map-info li { margin-bottom: 0.15rem; }

.map-info a {
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
}

/* --- Task manifest (city page) --- */

.task-manifest {
  list-style: none;
  counter-reset: task;
  margin: 0.9rem 0 0;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: 46rem;
}

.task-manifest li {
  counter-increment: task;
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}

.task-manifest li:last-child { border-bottom: none; }

.task-manifest li::before {
  content: counter(task, decimal-leading-zero);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--accent-ink);
  flex-shrink: 0;
}

.task-manifest .task-text {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

/* --- Filter tokens (category) --- */

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.category-pills .pill {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.32rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.category-pills .pill:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.category-pills .pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* --- Sort tabs --- */

.sort-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
  width: fit-content;
}

.sort-tabs a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  text-decoration: none;
  color: var(--muted);
  background: var(--surface);
  border-right: 1px solid var(--rule);
}

.sort-tabs a:last-child { border-right: none; }

.sort-tabs a:hover { color: var(--ink); }

.sort-tabs a.active {
  color: var(--paper);
  background: var(--negative);
}

/* --- Search --- */

.search-form {
  display: flex;
  gap: 0;
  margin-bottom: 1.75rem;
  max-width: 460px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.search-input {
  flex: 1;
  border: none;
  padding: 0.55rem 0.85rem;
  background: var(--surface);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.88rem;
}

.search-input:focus {
  outline: none;
  background: #fff;
}

.search-btn {
  border: none;
  border-left: 1px solid var(--rule);
  padding: 0.55rem 1rem;
  background: var(--surface);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  color: var(--muted);
}

.search-btn:hover {
  background: var(--ink);
  color: var(--paper);
}

/* --- Feed / work-order cards --- */

.feed {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 46rem;
}

.empty-state {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 2rem 0;
}

.empty-state a {
  color: var(--accent-ink);
  font-weight: 600;
}

.form-hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.74rem;
  color: var(--faint);
  margin-top: 0.3rem;
}

/* --- Verdict indicator (would-work-again) --- */

.badge-again {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-again::before {
  content: '';
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

.badge-yes {
  color: var(--accent-ink);
}

.badge-yes::before {
  background: var(--accent);
  border-radius: 1px;
}

.badge-no {
  color: var(--negative);
}

.badge-no::before {
  background: transparent;
  border: 1.5px solid var(--negative);
  border-radius: 1px;
}

/* --- Story type tag (worked for AI vs. real-world encounter) --- */

.type-tag {
  display: inline-flex;
  align-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.type-tag-worked { background: var(--accent-bg); color: var(--accent-ink); }
.type-tag-encountered { background: var(--negative-bg); color: var(--negative); }

.upvote-btn {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.15rem 0.55rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  margin-left: auto;
}

.upvote-btn:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.upvote-btn.voted {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-bg);
}

/* --- Forms --- */

.form-page { max-width: 640px; }

.form-page h1 {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
}

.story-form .form-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}

.story-form .form-control,
.story-form .form-select {
  border-color: var(--rule);
  border-radius: var(--radius);
  font-family: 'IBM Plex Sans', sans-serif;
}

.story-guide {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}

.story-guide-lead {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.story-guide ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: #3A3F46;
}

.story-guide li {
  margin-bottom: 0.2rem;
}

/* Two-state toggle for which kind of AI story this is — the first choice
   on the form. */
.type-toggle {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px;
}

.type-toggle-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.type-toggle-option:has(input:checked) {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(20, 24, 29, 0.12);
}

.type-toggle-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 480px) {
  .type-toggle { flex-direction: column; width: 100%; }
}

/* Google Places Autocomplete dropdown — restyle to match the manifest look
   rather than the default Google widget chrome. */
.pac-container {
  font-family: 'IBM Plex Sans', sans-serif;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(20, 24, 29, 0.12);
  margin-top: 2px;
}

.pac-item {
  font-size: 0.86rem;
  padding: 0.4rem 0.6rem;
  border-color: var(--rule);
}

.pac-item-query {
  font-size: 0.86rem;
  color: var(--ink);
}

.pac-icon { display: none; }

.story-form .form-control:focus,
.story-form .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* --- Numeric stat readout (city panel header, etc.) --- */

.boss-stat {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.boss-stat-label {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

/* --- Reply thread --- */

.reply-thread {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--rule);
}

/* No accounts means no way to show who's replying to whom, so every reply
   renders flat and aligned — nesting still exists one level deep in the
   data, it just isn't visually distinguished. */
.reply-item {
  display: flex;
  gap: 0.6rem;
  padding: 0.55rem 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--paper);
}

.reply-body { flex: 1; }

.reply-composer textarea {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.88rem;
  resize: vertical;
}

.reply-composer textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.toggle-thread-btn,
.text-btn {
  background: none;
  border: none;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--muted);
  font-size: 0.76rem;
  cursor: pointer;
  padding: 0;
}

.toggle-thread-btn:hover,
.text-btn:hover {
  color: var(--accent-ink);
  text-decoration: underline;
}

.reply-submit-btn {
  background: var(--ink) !important;
  border: none !important;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem !important;
  border-radius: var(--radius) !important;
}

/* --- Story permalink page: styled like a Reddit post + comments --- */

.reddit-page-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.reddit-back {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}

.reddit-back:hover { color: var(--ink); }

.reddit-post {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1.5rem;
}

.reddit-post-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.reddit-dot { color: var(--faint); }

.reddit-time,
.reddit-location {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  color: var(--muted);
}

.reddit-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 0.85rem;
}

.reddit-body {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1rem;
  line-height: 1.65;
  color: #262B31;
  margin: 0 0 1.1rem;
  white-space: pre-wrap;
}

.reddit-post .badge-again { margin-bottom: 1.1rem; }

.reddit-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.reddit-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.reddit-pill:hover { border-color: var(--accent); color: var(--accent-ink); }

.reddit-actions .upvote-btn.reddit-pill.voted {
  color: var(--accent-ink);
  background: var(--accent-bg);
  border-color: var(--accent);
}

.reddit-comments { margin-top: 1.5rem; }

/* The comments pill in the action bar is the single entry point for
   opening the thread — the reply partial's own toggle stays in the DOM
   (story.js still drives it) but is hidden here to avoid a duplicate CTA. */
body.story-page #comments > .reply-thread-wrapper > .toggle-thread-btn {
  display: none;
}

@media (max-width: 640px) {
  .reddit-page-wrap { padding: 1.25rem 0.85rem 2.5rem; }
  .reddit-post { padding: 1rem 1.1rem 1.25rem; }
}

/* --- Footer --- */

footer {
  border-top: 1px solid var(--rule);
  background: var(--surface);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem !important;
}

/* --- Archive (/stories) — the crawlable index of every report --- */

.archive-page { max-width: 720px; }

.archive-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.15;
  margin: 0.2rem 0 0.6rem;
}

.archive-lead { margin-bottom: 2rem; }
.archive-lead a { color: var(--accent-ink); font-weight: 600; }

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-item {
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
}

.archive-item:last-child { border-bottom: 1px solid var(--rule); }

.archive-item-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.archive-item-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.25;
  color: var(--accent-ink);
  margin: 0.45rem 0 0;
}

.archive-item-link:hover .archive-item-title { text-decoration: underline; }

.archive-item-meta {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0.4rem 0 0.5rem;
}

.archive-item-meta .dot { color: var(--rule-dark); }

.archive-item-body {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #262B31;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
