/* unlikely.place — Jurisdiction Matrices
   Built on the Unlikely Professionals brand system (unlikely.style) */

:root {
  --ink: #1a1a1a;
  --ink-light: #4a4a4a;
  --ink-lighter: #7a7a7a;
  --ink-faint: #b0b0b0;
  --bg: #fffff8;
  --bg-warm: #fafaf2;
  --bg-card: #f7f6f0;
  --bg-panel: #f5f4ee;
  --accent: #8b0000;
  --accent-muted: #b85450;
  --rule: #e0ddd4;
  --rule-strong: #c8c4b8;
  --gold: #c9a227;
  --green: #5a8a5a;
  --teal: #4a9a7a;
  --purple: #7a6a9a;
  --blue: #5a7a9a;
  --sienna: #9a7a6a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ===== STICKY NAV ===== */
.sticky-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(26, 26, 26, 0.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,248,0.08);
  padding: 0 32px;
  height: 48px;
  display: flex;
  align-items: center;
}
.nav-brand {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fffff8;
  margin-right: 40px;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.nav-links {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-links a {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,248,0.5);
  text-decoration: none;
  padding: 14px 14px;
  white-space: nowrap;
  transition: color 0.2s;
  letter-spacing: 0.3px;
}
.nav-links a:hover { color: #fffff8; }
.nav-links a.active { color: #fffff8; border-bottom: 2px solid var(--accent-muted); }

/* ===== BANDS & CONTAINERS ===== */
.band { width: 100%; position: relative; }
.band--cream { background: var(--bg); }
.band--warm { background: var(--bg-warm); }
.band--dark { background: var(--ink); color: #fffff8; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 48px;
}
.container--narrow { max-width: 980px; }
.container--hero { padding: 140px 48px 80px; }

/* ===== HERO ===== */
.hero-kicker {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,255,248,0.45);
  margin-bottom: 18px;
}
.hero-title {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 300;
  font-size: clamp(34px, 4.5vw, 56px);
  letter-spacing: -0.5px;
  line-height: 1.12;
  max-width: 900px;
}
.hero-sub {
  font-size: clamp(16px, 1.5vw, 19px);
  color: rgba(255,255,248,0.6);
  margin-top: 22px;
  max-width: 740px;
  line-height: 1.7;
}
.hero-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,248,0.35);
  margin-top: 28px;
  letter-spacing: 0.5px;
}

/* ===== SECTION HEADERS ===== */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
  margin-bottom: 28px;
  position: relative;
}
.section-head::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  border-bottom: 0.5px solid var(--ink-lighter);
}
.band--dark .section-head { border-bottom-color: rgba(255,255,248,0.3); }
.band--dark .section-head::after { border-bottom-color: rgba(255,255,248,0.1); }
.section-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: clamp(13px, 1.2vw, 15px);
  color: var(--ink-faint);
}
.band--dark .section-num { color: rgba(255,255,248,0.35); }
.section-title {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 300;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.3px;
}
.section-note {
  font-size: clamp(16px, 1.4vw, 18px);
  color: var(--ink-light);
  margin-bottom: 36px;
  max-width: 720px;
  line-height: 1.7;
}
.band--dark .section-note { color: rgba(255,255,248,0.6); }

.sub-label {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-lighter);
  margin: 40px 0 14px;
}
.band--dark .sub-label { color: rgba(255,255,248,0.45); }

/* ===== BRANCH CARDS (index) ===== */
.branch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}
.branch-card {
  display: block;
  background: var(--bg-warm);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--card-accent, var(--ink));
  padding: 24px 26px 22px;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.branch-card:hover {
  background: var(--bg-card);
  border-color: var(--rule-strong);
  transform: translateY(-2px);
}
.branch-card .b-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.branch-card .b-name {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.2px;
  margin-bottom: 2px;
}
.branch-card .b-region {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.branch-card .b-desc {
  font-size: 14.5px;
  color: var(--ink-light);
  line-height: 1.55;
}
.branch-card .b-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-lighter);
  margin-top: 14px;
  padding-top: 10px;
  border-top: 0.5px solid var(--rule);
}

/* ===== MATRIX CONTENT (converted markdown) ===== */
.matrix-content { max-width: none; }
.matrix-content > p:first-child { font-size: 15px; color: var(--ink-light); }

.matrix-content h1 { display: none; } /* replaced by hero */

.matrix-content h2 {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 300;
  font-size: clamp(26px, 2.6vw, 34px);
  letter-spacing: -0.3px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
  margin: 64px 0 20px;
  position: relative;
  scroll-margin-top: 64px;
}
.matrix-content h2::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  border-bottom: 0.5px solid var(--ink-lighter);
}

.matrix-content h3 {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-lighter);
  margin: 44px 0 14px;
  scroll-margin-top: 64px;
}

.matrix-content h4 {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  font-size: 19px;
  margin: 32px 0 10px;
  scroll-margin-top: 64px;
}

.matrix-content p { margin: 0 0 16px; max-width: 900px; }
.matrix-content ul, .matrix-content ol { margin: 0 0 18px; padding-left: 26px; max-width: 900px; }
.matrix-content li { margin-bottom: 8px; }
.matrix-content li > ul, .matrix-content li > ol { margin-top: 8px; margin-bottom: 0; }

.matrix-content a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(139,0,0,0.25); }
.matrix-content a:hover { border-bottom-color: var(--accent); }

.matrix-content strong { font-weight: 600; }

.matrix-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  background: var(--bg-panel);
  border: 1px solid var(--rule);
  padding: 1px 5px;
  border-radius: 2px;
}

.matrix-content blockquote {
  border-left: 3px solid var(--rule-strong);
  padding: 4px 0 4px 20px;
  margin: 0 0 18px;
  color: var(--ink-light);
}

.matrix-content hr {
  border: none;
  border-top: 0.5px solid var(--rule-strong);
  margin: 56px 0;
}

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0 28px;
  border-bottom: 2px solid var(--ink);
}
.matrix-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  min-width: 680px;
}
.matrix-content thead tr {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.matrix-content th {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-light);
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}
.matrix-content td {
  padding: 8px 12px;
  vertical-align: top;
  min-width: 34px;
}
.matrix-content tbody tr { border-bottom: 0.5px solid var(--rule); }
.matrix-content tbody tr:last-child { border-bottom: none; }
.matrix-content tbody tr:hover { background: var(--bg-warm); }
.matrix-content td:first-child { white-space: nowrap; }

/* footnote superscripts inside matrix cells */
.matrix-content sup { font-size: 0.7em; color: var(--accent); }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--ink);
  color: rgba(255,255,248,0.5);
  padding: 40px 48px;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.4px;
}
.site-footer .foot-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.site-footer a { color: rgba(255,255,248,0.7); text-decoration: none; }
.site-footer a:hover { color: #fffff8; }
.site-footer .foot-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,248,0.3);
}

/* ===== LEGEND CHIPS (index) ===== */
.legend-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 6px;
}
.legend-chip {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--bg-warm);
  border: 1px solid var(--rule);
  padding: 12px 16px;
  flex: 1 1 220px;
}
.legend-chip .glyph {
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
}
.legend-chip .l-body { font-size: 13.5px; color: var(--ink-light); line-height: 1.5; }
.legend-chip .l-body strong { color: var(--ink); font-weight: 600; }

/* ===== SEMANTIC GLYPH COLORS (data-ink: color encodes tier) ===== */
.gy-named   { color: #5a8a5a; }  /* published product-specific rule */
.gy-allowed { color: #c9a227; }  /* published general mechanism */
.gy-unpub   { color: #a09c90; }  /* nothing published — discretion */
.gy-enf     { color: #5a8a5a; }  /* WV: code enforced */
.gy-permit  { color: #c9a227; }  /* WV: permit-only */
.gy-none    { color: #b85450; }  /* WV: no regime */
.gy-flood   { color: #5a7a9a; }  /* flood overlay */

/* glyph-only matrix cells: centered, enlarged — scannable at a glance */
.matrix-content td.gcell {
  text-align: center;
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
}
.matrix-content td.gcell sup,
.matrix-content td.gcell { font-variant-position: normal; }

/* ===== ON THIS PAGE (wayfinding) ===== */
.toc-band { border-bottom: 1px solid var(--rule); }
.toc-band .toc-container { padding: 44px 48px 40px; }
.toc-sections {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 2;
}
.toc-sections a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule-strong); }
.toc-sections a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.toc-sep { color: var(--ink-faint); margin: 0 4px; }
.toc-juris { margin-top: 2px; }
.toc-chip {
  display: inline-block;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 12px;
  color: var(--ink-light);
  background: var(--bg-warm);
  border: 1px solid var(--rule);
  padding: 3px 10px;
  margin: 0 6px 6px 0;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.toc-chip:hover { border-color: var(--accent-muted); color: var(--accent); }

/* ===== STATEWIDE-FRAME BLOCKS (h2 + ul: hanging blocks, not bullet walls) ===== */
.matrix-content h2 + ul {
  list-style: none;
  padding-left: 0;
  max-width: 900px;
}
.matrix-content h2 + ul > li {
  border-left: 2px solid var(--rule-strong);
  padding-left: 18px;
  margin-bottom: 16px;
}
.matrix-content h2 + ul > li > ul {
  list-style: disc;
  padding-left: 22px;
  margin-top: 8px;
}

/* ===== DOSSIER HEADINGS (real anchors, not whisper-labels) ===== */
.matrix-content h3.dossier {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.2px;
  text-transform: none;
  color: var(--ink);
  border-bottom: 0.5px solid var(--rule-strong);
  padding-bottom: 6px;
  margin: 52px 0 14px;
}

/* ===== FOOTNOTES (reference-size, out of the reading line) ===== */
.matrix-content .footnotes {
  font-size: 13.5px;
  color: var(--ink-light);
  margin: -8px 0 32px;
  max-width: 900px;
}
.matrix-content .footnotes p { margin-bottom: 6px; font-size: 12px; }
.matrix-content .footnotes p strong {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-lighter);
}
.matrix-content .footnotes ol { padding-left: 22px; margin-bottom: 0; }
.matrix-content .footnotes li { margin-bottom: 5px; line-height: 1.5; }

/* ===== UP STATUS COLUMN ===== */
.up-yes { color: #5a8a5a; }
.up-no  { color: #b85450; }
.matrix-content td.up-cell {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 0;
}
.matrix-content th.up-head { text-align: center; }

/* ===== WIDE TABLES: sticky jurisdiction column + prose-cell typography ===== */
.matrix-content table.wide th:first-child,
.matrix-content table.wide td:first-child {
  position: sticky;
  left: 0;
  background: var(--bg);
  z-index: 1;
  border-right: 1px solid var(--rule);
}
.matrix-content table.wide thead th:first-child { background: var(--bg); }
.matrix-content table.wide tbody tr:hover td:first-child { background: var(--bg-warm); }
.matrix-content table.wide td:last-child:not(.up-cell),
.matrix-content table.wide.has-up td:nth-last-child(2) {
  font-size: 13.5px;
  line-height: 1.55;
  min-width: 340px;
  white-space: normal;
}
/* two-column prose tables (Tier 2/3): reading typography in the wide cell */
.matrix-content table:not(.wide) td:last-child:not(.up-cell),
.matrix-content table:not(.wide).has-up td:nth-last-child(2) {
  font-size: 14px;
  line-height: 1.6;
}
.matrix-content table:not(.wide) td:first-child { min-width: 150px; }

/* ===== FLOATING LEGEND ===== */
.legend-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.legend-fab {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fffff8;
  background: rgba(26, 26, 26, 0.95);
  border: 1px solid rgba(255,255,248,0.15);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 12px rgba(26,26,26,0.25);
  transition: background 0.2s;
}
.legend-fab:hover { background: rgba(26, 26, 26, 1); }
.fab-glyphs { font-size: 12px; letter-spacing: 2px; }
.legend-panel {
  width: min(440px, calc(100vw - 48px));
  max-height: min(70vh, 640px);
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  box-shadow: 0 6px 32px rgba(26,26,26,0.22);
  padding: 20px 24px 18px;
}
.legend-panel .glyph-row { grid-template-columns: 26px 96px 1fr; padding: 4px 0; }
.legend-panel .g-glyph { font-size: 15px; }
.legend-panel .g-name { font-size: 11.5px; }
.legend-panel .g-desc { font-size: 13px; line-height: 1.5; }
.legend-panel .glyph-group { padding: 10px 0 12px; }
.legend-panel .glyph-matrix { margin-bottom: 14px; }
.legend-panel .g-products { font-size: 12.5px; }
.legend-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.legend-close {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-lighter);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
}
.legend-close:hover { color: var(--accent); }

@media (max-width: 640px) {
  .legend-float { right: 12px; bottom: 12px; }
  .legend-panel { max-height: 60vh; }
  .legend-panel .glyph-row { grid-template-columns: 24px 1fr; }
  .legend-panel .g-desc { grid-column: 2; }
}

@media print {
  .legend-float { display: none; }
}

/* ===== GLYPH LEGEND (canonical, all branches) ===== */
.glyph-band .glyph-container { padding: 56px 48px; }
.g-heading {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-lighter);
  margin-bottom: 20px;
}
.glyph-matrix {
  border-top: 2px solid var(--ink);
  margin-bottom: 22px;
}
.glyph-group {
  border-bottom: 0.5px solid var(--rule-strong);
  padding: 14px 0 16px;
}
.glyph-group:last-child { border-bottom: 2px solid var(--ink); }
.g-label {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.glyph-row {
  display: grid;
  grid-template-columns: 34px 110px 1fr;
  gap: 0 14px;
  align-items: baseline;
  padding: 5px 0;
}
.g-glyph {
  font-size: 17px;
  color: var(--ink);
  text-align: center;
  line-height: 1;
}
.g-name {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink);
}
.g-desc {
  font-size: 14.5px;
  color: var(--ink-light);
  line-height: 1.55;
}
.g-products {
  font-size: 13.5px;
  color: var(--ink-light);
  line-height: 1.6;
}
.g-products .g-label { display: inline; }

@media (max-width: 640px) {
  .glyph-band .glyph-container { padding: 40px 20px; }
  .glyph-row { grid-template-columns: 28px 1fr; }
  .g-desc { grid-column: 2; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .container { padding: 80px 28px; }
  .container--hero { padding: 110px 28px 64px; }
  .branch-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-brand { display: none; }
}
@media (max-width: 640px) {
  .container { padding: 60px 20px; }
  .container--hero { padding: 96px 20px 56px; }
  .branch-grid { grid-template-columns: 1fr; }
  .sticky-nav { padding: 0 12px; }
  .nav-links a { padding: 14px 8px; font-size: 10px; }
  .site-footer { padding: 32px 20px; }
}

@media print {
  .sticky-nav { display: none; }
  .band--dark { background: #fff; color: var(--ink); }
  .hero-sub, .hero-meta, .hero-kicker { color: var(--ink-light); }
}
