/* AllBankComplaints.com — design tokens per the dataviz skill's reference palette
   (references/palette.md). Light values on :root; dark values re-declared
   under both the OS media query AND the [data-theme="dark"] toggle scope,
   per the skill's guidance, so the manual toggle (static/js/theme.js) wins
   over the OS setting in both directions. */

:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --surface-2: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --series-blue: #2a78d6;
  --series-blue-soft: rgba(42, 120, 214, 0.14);
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --status-good-bg: rgba(12, 163, 12, 0.12);
  --status-warning-bg: rgba(250, 178, 25, 0.16);
  --status-serious-bg: rgba(236, 131, 90, 0.14);
  --status-critical-bg: rgba(208, 59, 59, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --surface-2: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --series-blue: #3987e5;
    --series-blue-soft: rgba(57, 135, 229, 0.18);
    --status-good: #0ca30c;
    --status-warning: #fab219;
    --status-serious: #ec835a;
    --status-critical: #e66767;
    --status-good-bg: rgba(12, 163, 12, 0.18);
    --status-warning-bg: rgba(250, 178, 25, 0.16);
    --status-serious-bg: rgba(236, 131, 90, 0.18);
    --status-critical-bg: rgba(230, 103, 103, 0.16);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --surface-2: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --series-blue: #3987e5;
  --series-blue-soft: rgba(57, 135, 229, 0.18);
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #e66767;
  --status-good-bg: rgba(12, 163, 12, 0.18);
  --status-warning-bg: rgba(250, 178, 25, 0.16);
  --status-serious-bg: rgba(236, 131, 90, 0.18);
  --status-critical-bg: rgba(230, 103, 103, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Editorial serif for headlines, system sans for everything else — no
   external font request (fully self-hosted static site, see the Privacy
   page's "no third-party" claim), just a distinct display face the OS
   already ships. */
h1, h2, h3, .brand, .spotlight-ratio-value, .stat-card-value {
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { color: var(--series-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 14px;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* --- nav / footer --- */
header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  position: sticky; top: 0; z-index: 10;
}
header.site .wrap { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 16px; }
.brand { font-size: 1.2rem; color: var(--text-primary); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-accent { color: var(--series-blue); }

nav.site-nav { display: flex; gap: 22px; align-items: center; }
nav.site-nav a { color: var(--text-secondary); font-weight: 500; font-size: 0.92rem; padding: 4px 0; border-bottom: 2px solid transparent; }
nav.site-nav a:hover { color: var(--text-primary); text-decoration: none; }
nav.site-nav a.active { color: var(--text-primary); border-bottom-color: var(--series-blue); }
#theme-toggle {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary);
  border-radius: 6px; padding: 5px 10px; font-size: 0.85rem; cursor: pointer; white-space: nowrap;
}

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-2); cursor: pointer; padding: 0;
}
.nav-toggle span { display: block; width: 16px; height: 2px; background: var(--text-secondary); margin: 0 auto; }

footer.site { border-top: 1px solid var(--border); margin-top: 56px; padding: 40px 0 32px; color: var(--text-muted); font-size: 0.85rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 28px; }
.footer-brand p { max-width: 320px; margin: 10px 0 0; }
.footer-brand .brand { font-size: 1.05rem; }
.footer-col { display: flex; flex-direction: column; gap: 9px; }
.footer-col h3 { font-family: inherit; font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 0 0 2px; }
.footer-col a { color: var(--text-secondary); }
.footer-col a:hover { color: var(--text-primary); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 32px; padding-top: 20px; }
.footer-bottom p { max-width: 720px; margin: 0 0 8px; }

main { padding: 32px 0 16px; }

h1 { font-size: 1.9rem; margin: 0 0 6px; line-height: 1.2; }
h2 { font-size: 1.4rem; margin: 40px 0 14px; line-height: 1.25; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
.subtitle { color: var(--text-secondary); margin: 0 0 24px; max-width: 640px; }
.updated { color: var(--text-muted); font-size: 0.82rem; }
.crumb { margin: 0 0 18px; font-size: 0.88rem; }
.crumb a { color: var(--text-secondary); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head h2 { margin-bottom: 8px; }
.see-all { font-size: 0.88rem; font-weight: 600; white-space: nowrap; }

/* --- buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 8px;
  padding: 11px 20px; font-size: 0.94rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--series-blue); color: #fff; }
.btn-primary:hover { background: var(--series-blue-strong, var(--series-blue)); filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-1); }
.btn-small { padding: 7px 14px; font-size: 0.85rem; }

/* --- status badge: color + icon + text, never color alone (dataviz skill) --- */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 3px 10px; font-size: 0.82rem; font-weight: 600;
  white-space: nowrap;
}
.status-good { color: var(--status-good); background: var(--status-good-bg); }
/* warning's own hex is sub-3:1 on the light surface by design (palette.md) —
   text uses a darkened gold on light mode; dark mode's step already clears
   9.49:1, so it can use --status-warning directly. */
.status-warning { color: #8a6100; background: var(--status-warning-bg); }
.status-serious { color: var(--status-serious); background: var(--status-serious-bg); }
.status-critical { color: var(--status-critical); background: var(--status-critical-bg); }
.status-unknown { color: var(--text-muted); background: var(--gridline); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .status-warning { color: var(--status-warning); }
}
:root[data-theme="dark"] .status-warning { color: var(--status-warning); }

/* --- leaderboard table --- */
table.leaderboard { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.leaderboard th {
  text-align: left; font-weight: 600; color: var(--text-muted); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--gridline);
}
table.leaderboard td { padding: 12px 10px; border-bottom: 1px solid var(--gridline); vertical-align: middle; }
table.leaderboard tr:hover td { background: var(--surface-1); }
table.leaderboard td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.rank { color: var(--text-muted); font-variant-numeric: tabular-nums; width: 2ch; }
.company-name { font-weight: 600; }
.category-badge {
  display: inline-block; font-size: 0.72rem; color: var(--text-muted); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px; margin-left: 8px; text-transform: capitalize; vertical-align: middle;
}

/* --- sparkline --- */
.spark { display: block; width: 100%; max-width: 240px; height: 56px; }
.spark-baseline { stroke: var(--baseline); stroke-width: 1; }
.spark-area { fill: var(--series-blue-soft); stroke: none; }
.spark-line { fill: none; stroke: var(--series-blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark-point { fill: var(--series-blue); opacity: 0.5; }
.spark-point-current { fill: var(--series-blue); }
.spark-point:hover, .spark-point-current:hover { opacity: 1; }

/* --- company page --- */
.company-header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.company-header.with-icon { align-items: center; }
.stat-row { display: flex; gap: 32px; flex-wrap: wrap; margin: 20px 0 28px; }
.stat-tile .stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-tile .stat-value { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value-of { font-size: 1rem; font-weight: 500; color: var(--text-muted); }

/* --- company "about" block: verified business description + contact/social links, see
   CLAUDE.md's "Company profiles" section for how these are sourced (real research, omitted
   rather than guessed when not confidently verifiable) --- */
.about-block { margin: 14px 0 4px; max-width: 640px; }
.about-text { font-size: 1rem; color: var(--text-secondary); margin: 0 0 12px; }

/* Address and social/web are two visually separate blocks, not one run-together line —
   each its own bordered card, same visual language as .stat-tile/.category-card. */
.info-blocks { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 8px; }
.info-block {
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1);
  padding: 12px 16px; min-width: 200px; flex: 1 1 220px;
}
.info-block-label {
  font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600; margin-bottom: 6px;
}
.info-block-line { color: var(--text-secondary); font-size: 0.88rem; margin: 0; }
.info-block-link { display: block; font-size: 0.88rem; font-weight: 600; margin: 2px 0; }

/* --- product bar list --- */
.bar-list { list-style: none; margin: 0; padding: 0; }
.bar-list li { margin-bottom: 12px; }
.bar-list .bar-label { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 4px; }
.bar-list .bar-label .count { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bar-track { height: 10px; background: var(--gridline); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--series-blue); border-radius: 5px; }

/* --- word cloud --- */
.wordcloud { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 20px 0; }
.wordcloud .w { color: var(--series-blue); font-weight: 600; line-height: 1; }
.wordcloud .w:nth-child(3n+2) { color: var(--text-primary); font-weight: 500; }
.wordcloud .w:nth-child(4n+3) { color: var(--text-secondary); font-weight: 400; }
table.exact { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 8px; }
table.exact th { text-align: left; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--gridline); }
table.exact td { padding: 6px 8px; border-bottom: 1px solid var(--gridline); }
table.exact td.num { text-align: right; font-variant-numeric: tabular-nums; }
details.exact-toggle summary { cursor: pointer; color: var(--series-blue); font-size: 0.85rem; margin-top: 4px; }

/* --- flow table --- */
table.flow { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.flow th { text-align: left; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--gridline); }
table.flow td { padding: 7px 8px; border-bottom: 1px solid var(--gridline); }
table.flow td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- insights / cluster small multiples --- */
.cluster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin: 20px 0; }
.cluster-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--surface-1); }
.cluster-card svg { width: 100%; height: 140px; display: block; }
.cluster-card .dot-bg { fill: var(--gridline); }
.cluster-card .dot-fg { fill: var(--series-blue); }
.cluster-card .cluster-label { font-weight: 600; margin: 8px 0 2px; font-size: 0.92rem; }
.cluster-card .cluster-meta { color: var(--text-muted); font-size: 0.78rem; }
.cluster-caveat {
  border: 1px solid var(--status-warning); background: var(--status-warning-bg); border-radius: 8px;
  padding: 10px 14px; font-size: 0.85rem; color: var(--text-primary); margin: 16px 0;
}

.empty-state { color: var(--text-muted); font-size: 0.9rem; border: 1px dashed var(--border); border-radius: 8px; padding: 16px; }

.callout {
  border-left: 3px solid var(--series-blue); background: var(--series-blue-soft);
  padding: 10px 16px; border-radius: 0 8px 8px 0; font-size: 0.88rem; margin: 20px 0;
}

/* --- homepage: hero --- */
.hero { display: flex; align-items: center; gap: 32px; padding: 12px 0 8px; flex-wrap: wrap; }
.hero-text { max-width: 620px; flex: 1 1 420px; }
.hero-graphic { flex: 1 1 280px; max-width: 380px; }
.hero-motif { width: 100%; height: auto; display: block; }
.hero-motif-bar { fill: var(--series-blue); }
.hero-motif-line { fill: none; stroke: var(--series-blue); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 5 6; opacity: 0.55; }
.hero-motif-dot { fill: var(--series-blue); }
.eyebrow {
  color: var(--series-blue); font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; margin: 0 0 12px;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 16px; }
.hero-sub { color: var(--text-secondary); font-size: 1.08rem; margin: 0 0 24px; }
.hero-sub em { color: var(--text-primary); font-style: normal; font-weight: 600; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }

/* --- homepage: stat strip --- */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 36px 0 8px; }
.stat-card { border: 1px solid var(--border); border-radius: 10px; padding: 18px; background: var(--surface-1); }
.stat-card-value { font-size: 2.1rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card-label { color: var(--text-muted); font-size: 0.82rem; margin-top: 8px; }

/* --- homepage: spotlight --- */
.spotlight-card {
  display: flex; gap: 24px; justify-content: space-between; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 12px; padding: 24px 28px;
  background: linear-gradient(135deg, var(--series-blue-soft), transparent 60%);
}
.spotlight-main h3 { font-size: 1.5rem; margin: 10px 0 6px; }
.spotlight-main h3 a { color: var(--text-primary); }
.spotlight-main h3 a:hover { color: var(--series-blue); }
.spotlight-detail { color: var(--text-secondary); max-width: 480px; margin: 10px 0 14px; }
.spotlight-ratio { text-align: center; flex-shrink: 0; }
.spotlight-ratio-value { font-size: 3rem; line-height: 1; color: var(--series-blue); }
.spotlight-ratio-label { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 4px 0 10px; }

/* --- category teaser grid (homepage) + directory cards (/categories/) --- */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 18px; }
.category-card {
  display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; background: var(--surface-1); color: var(--text-primary); transition: border-color 0.15s ease, transform 0.15s ease;
}
.category-card:hover { border-color: var(--series-blue); text-decoration: none; transform: translateY(-2px); }
/* Icons are inlined Tabler Icons SVGs (stroke="currentColor") — sized here rather than relying
   on their baked-in 24x24 attributes, and tinted with the series-blue accent (a plain
   currentColor on --text-primary read too flat next to the bold label text below it). */
.category-card-icon { color: var(--series-blue); }
.category-card-icon svg { width: 28px; height: 28px; display: block; }
.category-card-label { font-weight: 600; margin-top: 4px; }
.category-card-count { color: var(--text-muted); font-size: 0.8rem; }
.category-card-desc { color: var(--text-secondary); font-size: 0.85rem; margin-top: 2px; }
/* The /categories/ directory page's cards carry a description line the homepage teaser
   doesn't — a bit more breathing room per card. */
.category-grid-large { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.category-grid-large .category-card { padding: 20px; gap: 6px; }

/* --- category page header icon (categories/<slug>/) --- */
.category-icon { color: var(--series-blue); flex-shrink: 0; }
.category-icon svg { width: 32px; height: 32px; display: block; }

/* --- about page intro illustration ---
   unDraw SVG (MIT-equivalent free license, no attribution required — see
   static/img/illustrations/LICENSE-undraw.txt), full-color, not currentColor-
   based like the category icons, so a plain <img> is correct here (no need to
   inline the markup). */
.about-intro { display: flex; gap: 32px; align-items: center; margin-bottom: 8px; }
.about-intro > div { flex: 1 1 380px; }
.about-illustration { flex: 1 1 280px; max-width: 320px; width: 100%; height: auto; }
@media (max-width: 720px) {
  .about-illustration { display: none; }
}

/* --- company page synopsis --- */
.synopsis {
  font-size: 1.05rem; color: var(--text-primary); max-width: 640px; margin: 14px 0 4px;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  nav.site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    align-items: stretch; gap: 0; background: var(--surface-1); border-bottom: 1px solid var(--border);
    padding: 8px 20px 16px;
  }
  nav.site-nav.open { display: flex; }
  nav.site-nav a { padding: 10px 0; border-bottom: 1px solid var(--border); }
  nav.site-nav a.active { border-bottom-color: var(--border); }
  #theme-toggle { margin-top: 10px; align-self: flex-start; }
  header.site .wrap { position: relative; }
}

@media (max-width: 640px) {
  table.leaderboard .hide-mobile { display: none; }
  .stat-row { gap: 20px; }
  .hero h1 { font-size: 1.9rem; }
  .hero-graphic { display: none; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .spotlight-card { padding: 20px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
