/* ============================================================
   OIXLY — open threat intelligence
   One stylesheet. No framework, no build step.

   Type: a single monospace stack, on purpose. Indicators are IPs,
   hashes and URLs; tabular figures make them scannable and
   comparable down a column, which a proportional face destroys.
   Weight, size and tracking carry the hierarchy instead.

   Vertical padding uses longhand throughout. Shorthand like
   `padding: 64px 0` zeroes the horizontal padding and collapses
   the container gutter on mobile.
   ============================================================ */

:root {
  --bg: #0a0e17;
  --bg-raised: #111725;
  --bg-sunken: #070a11;
  --line: #1e2738;
  --line-bright: #2c3850;

  --ink: #e4eaf4;
  --ink-dim: #93a1b8;
  --ink-faint: #5e6b82;

  /* Lifted from the logo's own blue (#00a0e0) rather than chosen separately —
     a teal UI around a blue mark reads as two brands. Raised in value to clear
     4.5:1 against the background; measured at 9.7:1. */
  --accent: #38c6f4;
  --accent-dim: rgba(56, 198, 244, 0.13);

  --critical: #ff4d6d;
  --high: #ff9e3d;
  --medium: #ffd23f;
  --low: #6fd3a0;
  --none: #5e6b82;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono",
          Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: 20px;
  --radius: 6px;
  --shell: 1400px;
}

/* ---------------- scrollbars ---------------- */

/* Firefox */
* {
  scrollbar-color: var(--line-bright) transparent;
}

/* WebKit / Blink (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-bright);
  border-radius: 6px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
::-webkit-scrollbar-corner {
  background: transparent;
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.shell {
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* Present to assistive tech, removed from the visual layout. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------------- header ---------------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunken);
  position: sticky;
  top: 0;
  z-index: 30;
}

.head-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-block: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark { display: block; height: 30px; width: auto; }
.brand-name span { color: var(--accent); }

/* ---------------- founder ---------------- */

.founder {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-block: 24px 8px;
}

.founder-photo {
  width: 200px;
  height: 200px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  object-fit: cover;
  display: block;
}

.founder-name { font-size: 18px; margin-bottom: 2px; color: var(--ink); }

.founder-role {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.founder-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.founder-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tagline {
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.head-nav {
  margin-left: auto;
  display: flex;
  gap: 18px;
  align-items: center;
}
.head-nav a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
}
.head-nav a:hover, .head-nav a[aria-current] { color: var(--accent); }

/* ---------------- summary strip ---------------- */

.summary {
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunken);
  padding-block: 18px;
}

.summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: var(--ink-faint);
  font-size: 12px;
  margin-bottom: 14px;
}
.summary-line strong { color: var(--ink); font-weight: 600; }

/* The ribbon: one bar per day, straight from the manifest.
   It is both the density chart and the range selector. */
.ribbon {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 56px;
  overflow-x: auto;
  scrollbar-width: thin;
}

/* Header row: quick range presets on the left, a clear action on the right. */
.ribbon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ribbon-presets { display: flex; gap: 6px; }
.ribbon-preset {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ribbon-preset:hover { color: var(--ink); border-color: var(--line-bright); }
.ribbon-preset.is-active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.ribbon-clear {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.ribbon-clear:hover { color: var(--critical); border-color: var(--critical); }

/* The live readout: the primary way to identify a day, especially on touch
   where there is no hover state. */
.ribbon-readout {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-height: 22px;
  margin-bottom: 8px;
  font-size: 13px;
}
.ribbon-hint { color: var(--ink-faint); font-size: 12px; }
.ribbon-date { color: var(--ink); font-size: 14px; }
.ribbon-count { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }
.ribbon-delta { font-size: 12px; font-variant-numeric: tabular-nums; }
.ribbon-delta.is-up { color: var(--high); }
.ribbon-delta.is-down { color: var(--low); }
.ribbon-peak { font-size: 12px; color: var(--accent); }

.ribbon-breakdown { display: flex; gap: 10px; flex-wrap: wrap; }
.ribbon-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.ribbon-dot { width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.ribbon-chip.sev-critical .ribbon-dot { background: var(--critical); }
.ribbon-chip.sev-high     .ribbon-dot { background: var(--high); }
.ribbon-chip.sev-medium   .ribbon-dot { background: var(--medium); }
.ribbon-chip.sev-low      .ribbon-dot { background: var(--low); }

/* Severity stack inside each bar, so the bar's colour shows the real mix. */
.ribbon-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  overflow: hidden;
  pointer-events: none;
}
.ribbon-seg { display: block; width: 100%; height: var(--seg, 0); }
.ribbon-seg.sev-critical { background: var(--critical); }
.ribbon-seg.sev-high     { background: var(--high); }
.ribbon-seg.sev-medium   { background: var(--medium); }
.ribbon-seg.sev-low      { background: var(--low); }

.ribbon-bar.is-peak::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* On a narrow screen the strip scrolls horizontally; the scroll container owns
   the overflow so the ticks scroll in lockstep with the bars. */
.ribbon-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}
.ribbon-scroll .ribbon { overflow-x: visible; }

.ribbon-ticks {
  position: relative;
  height: 16px;
  margin-top: 4px;
}
.ribbon-tick {
  position: absolute;
  left: var(--at, 0);
  font-size: 10px;
  color: var(--ink-faint);
  transform: translateX(-2px);
  white-space: nowrap;
}
.ribbon-tick::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  width: 1px;
  height: 4px;
  background: var(--line-bright);
}

.ribbon-bar {
  position: relative; /* anchors the peak marker */
  flex: 1 1 auto;
  min-width: 5px;
  height: var(--h, 10%);
  border: 0;
  border-radius: 2px;
  /* The colour comes from the severity stack inside, not the bar itself. */
  background: transparent;
  opacity: 0.62;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.ribbon-bar:hover,
.ribbon-bar:focus-visible { opacity: 1; transform: scaleY(1.06); }
.ribbon-bar.is-selected { opacity: 1; }
.ribbon-bar.is-selected .ribbon-stack {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}
.ribbon-bar:hover { opacity: 1; transform: scaleY(1.06); }
.ribbon-bar.is-selected { opacity: 1; }
/* Fallback colour if a bar somehow renders without its severity stack. */
.ribbon-bar:empty.sev-critical { background: var(--critical); }
.ribbon-bar:empty.sev-high { background: var(--high); }
.ribbon-bar:empty.sev-medium { background: var(--medium); }
.ribbon-bar:empty.sev-low { background: var(--low); }

.ribbon-legend {
  display: flex;
  justify-content: space-between;
  color: var(--ink-faint);
  font-size: 11px;
  margin-top: 6px;
}

/* ---------------- stats ---------------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-block: 18px;
}

.stat {
  background: var(--bg-raised);
  padding: 14px 16px;
}
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-label {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stat.critical .stat-value { color: var(--critical); }
.stat.high .stat-value { color: var(--high); }

/* ---------------- layout ---------------- */

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding-block: 24px 60px;
}

body.drawer-open { overflow: hidden; }

/* Backdrop is desktop-hidden; the mobile block below turns it into a tappable
   dimming layer while the drawer is open. */
.sidebar-backdrop { display: none; }

.sidebar-head { display: none; }   /* shown only in the mobile drawer */
.sidebar-done { display: none; }   /* shown only in the mobile drawer */

.sidebar {
  position: sticky;
  top: 84px;
  align-self: start; /* don't stretch to the grid row (the tall feed) */
  /* A sticky element taller than the viewport cannot stick — the browser has
     to scroll it to reveal the bottom. Cap it to the viewport, make it a flex
     column, and let only the facets scroll so Reset stays pinned and always
     reachable regardless of how many category filters exist. */
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}

.facet-scroll {
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 4px;
  min-height: 0; /* let the flex child actually shrink and scroll */
}

.sidebar > #reset {
  flex-shrink: 0;
  margin-top: 12px;
}

.facet-group { margin-bottom: 22px; }

.facet-group h2 {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
  font-weight: 600;
}

.facet-list { display: flex; flex-direction: column; gap: 2px; }

.facet {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  width: 100%;
  background: none;
  border: 0;
  border-radius: 4px;
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  cursor: pointer;
  text-align: left;
}
.facet:hover { background: var(--bg-raised); color: var(--ink); }
.facet.is-active { background: var(--accent-dim); color: var(--accent); }
.facet-count { color: var(--ink-faint); font-size: 11px; }
.facet.is-active .facet-count { color: var(--accent); }

.date-range { display: flex; gap: 6px; align-items: center; }
.date-range input {
  flex: 1;
  min-width: 0;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  padding: 5px 6px;
  color-scheme: dark;
}

.btn {
  background: var(--bg-raised);
  border: 1px solid var(--line-bright);
  border-radius: 4px;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  padding: 7px 12px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-dim);
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  text-decoration: none;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------- toolbar ---------------- */

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-wrap { position: relative; flex: 1 1 260px; }

.search-wrap input {
  width: 100%;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font: inherit;
  padding: 9px 34px 9px 12px;
}
.search-wrap input::placeholder { color: var(--ink-faint); }
.search-wrap input:focus { border-color: var(--accent); outline: none; }

.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: var(--ink-faint);
  font: inherit;
  cursor: pointer;
  padding: 4px 6px;
}
.search-clear:hover { color: var(--ink); }

.result-count { color: var(--ink-faint); font-size: 12px; }
.toolbar-actions { display: flex; gap: 6px; margin-left: auto; }

.filter-toggle { display: none; }

/* ---------------- progress ---------------- */

.progress { margin-bottom: 14px; }
.progress-track {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}
.progress-text { color: var(--ink-faint); font-size: 11px; margin-top: 5px; }

/* ---------------- cards ---------------- */

.feed { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-left: 2px solid var(--none);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card.sev-critical { border-left-color: var(--critical); }
.card.sev-high { border-left-color: var(--high); }
.card.sev-medium { border-left-color: var(--medium); }
.card.sev-low { border-left-color: var(--low); }

.card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.badges { display: flex; gap: 6px; flex-shrink: 0; }

.badge {
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--line-bright);
  color: var(--ink-dim);
  white-space: nowrap;
}
.sev-tag.sev-critical { color: var(--critical); border-color: var(--critical); }
.sev-tag.sev-high { color: var(--high); border-color: var(--high); }
.sev-tag.sev-medium { color: var(--medium); border-color: var(--medium); }
.sev-tag.sev-low { color: var(--low); border-color: var(--low); }

.card-summary {
  color: var(--ink-dim);
  margin-top: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.fields {
  display: grid;
  grid-template-columns: minmax(90px, max-content) minmax(0, 1fr);
  gap: 2px 14px;
  margin-top: 12px;
  font-size: 12px;
}
.fields dt { color: var(--ink-faint); }
.fields dd { color: var(--ink); overflow-wrap: anywhere; }

.card-action {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-dim);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.action-label {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding-top: 2px;
}

.iocs { margin-top: 12px; }
.iocs-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 5px;
}
.ioc-list { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; }
.ioc {
  display: inline-block;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 7px;
  font-size: 12px;
  color: var(--ink);
  overflow-wrap: anywhere;
  user-select: all;
}
.ioc-more { color: var(--ink-faint); font-size: 11px; align-self: center; }

.card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-faint);
}
.card-actions { display: flex; gap: 6px; margin-left: auto; }

/* ---------------- placeholder / pagination / toast ---------------- */

.placeholder {
  border: 1px dashed var(--line-bright);
  border-radius: var(--radius);
  padding-block: 56px;
  padding-inline: 24px;
  text-align: center;
  color: var(--ink-dim);
}
.placeholder h3 { font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.placeholder p { font-size: 13px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.page-info { color: var(--ink-faint); font-size: 12px; }
.page-nav { display: flex; gap: 3px; flex-wrap: wrap; }
.page-btn {
  min-width: 32px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-dim);
  font: inherit;
  font-size: 12px;
  padding: 5px 9px;
  cursor: pointer;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.is-current { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: 0.35; cursor: default; }
.page-gap { color: var(--ink-faint); padding: 5px 2px; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: var(--bg-raised);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 60;
  max-width: calc(100vw - 40px);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.success { border-color: var(--low); }
.toast.error { border-color: var(--critical); }

/* ---------------- back to top ---------------- */

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--bg-raised);
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
  z-index: 40;
}
.to-top.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.to-top:hover { border-color: var(--accent); color: var(--accent); }
.to-top svg { width: 18px; height: 18px; pointer-events: none; }

/* ---------------- prose pages ---------------- */

.prose { max-width: 760px; padding-block: 40px 80px; }
.prose h1 { font-size: 24px; letter-spacing: 0.02em; margin-bottom: 8px; }
.prose h2 {
  font-size: 15px;
  margin-top: 36px;
  margin-bottom: 10px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.prose h3 { font-size: 13px; margin-top: 22px; margin-bottom: 6px; }
.prose p, .prose li { color: var(--ink-dim); margin-bottom: 10px; }
.prose ul, .prose ol { padding-left: 20px; margin-bottom: 14px; }
.prose code {
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.prose pre {
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin-bottom: 16px;
  font-size: 12px;
}
.prose pre code { border: 0; padding: 0; background: none; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 16px;
}
.prose th, .prose td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}
.prose th { color: var(--ink); background: var(--bg-raised); font-weight: 600; }
.prose td { color: var(--ink-dim); }
.lede { color: var(--ink); font-size: 14px; margin-bottom: 20px; }

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 22px 34px;
  color: var(--ink-faint);
  font-size: 12px;
}
.site-foot a { color: var(--ink-dim); }
.foot-row { display: flex; gap: 8px 20px; flex-wrap: wrap; }

/* ---------------- responsive ---------------- */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 0; }

  .filter-toggle { display: inline-block; }

  .sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(340px, 90vw);
    background: var(--bg-raised);
    border-left: 1px solid var(--line);
    padding: 0;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 50;
  }
  .sidebar.is-open { transform: translateX(0); }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 12, 0.6);
    z-index: 49;              /* under the drawer (50), over everything else */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;     /* now it can receive the closing tap */
  }

  /* A sticky header with the title and a large, obvious close control, so the
     drawer can always be dismissed — previously the only ways out were Escape
     (no keyboard on a phone) and re-tapping a toggle that had scrolled away. */
  .sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
  }
  .sidebar-title { margin: 0; font-size: 15px; }
  .sidebar-close {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--ink-dim);
    font-size: 22px;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
  }
  .sidebar-close:hover, .sidebar-close:focus-visible {
    background: var(--bg-sunken);
    color: var(--ink);
  }
  .sidebar > .facet-scroll { flex: 1; overflow-y: auto; padding: 16px 20px 0; min-height: 0; }
  .sidebar > #reset,
  .sidebar > .sidebar-done { margin: 10px 20px 0; }
  .sidebar > .sidebar-done { display: block; margin-bottom: 20px; }



  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .toolbar-actions { margin-left: 0; width: 100%; }

  .founder { grid-template-columns: 1fr; gap: 18px; }
  .founder-photo { width: 160px; height: 160px; }
  .card-head { flex-direction: column; gap: 8px; }
  .fields { grid-template-columns: 1fr; gap: 0 0; }
  .fields dt { margin-top: 6px; }
}

@media (max-width: 520px) {
  .tagline { display: none; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .ribbon { height: 44px; }
  /* Comfortable tap targets: bars stop shrinking and the strip scrolls. A 5px
     bar is impossible to hit with a fingertip. */
  .ribbon-bar { min-width: 8px; }
  /* Filters were effectively undiscoverable on a phone: the control sat below
     the stats, ribbon, cards and search box, styled like the JSON/CSV buttons
     next to it. Promote it to a full-width primary control so it reads as the
     way into filtering. */
  .filter-toggle {
    display: block;
    width: 100%;
    order: -1;               /* ahead of JSON/CSV in the toolbar row */
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
    padding: 11px 16px;
  }
  .filter-toggle::before { content: '☰  '; }
  .filter-toggle.has-active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
  }
  .toolbar-actions { flex-wrap: wrap; }

  /* "Use the data" wrapped onto three lines at this width. Keeping each link on
     one line fixes that but overflows the viewport, so let the nav scroll
     horizontally instead — all four links stay reachable and nothing clips. */
  .head-nav {
    gap: 16px;
    font-size: 13px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }
  .head-nav::-webkit-scrollbar { display: none; }
  .head-nav a { white-space: nowrap; flex: 0 0 auto; }

  /* Oldest/Newest collided with the legend text; the ribbon labels already
     convey direction, so drop the end captions and keep the explanation. */
  .ribbon-legend span:first-child,
  .ribbon-legend span:last-child { display: none; }
  .ribbon-legend { justify-content: center; text-align: center; }

  .ribbon-head { gap: 8px; }
  .ribbon-preset { padding: 6px 14px; font-size: 13px; }
  .ribbon-readout { font-size: 13px; gap: 4px 10px; }
  .ribbon-date { font-size: 13px; }
}

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