/* === The Trigger · One Hundred Years === */
/* Mortality record + legal document aesthetic */

@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Space+Mono:wght@400;700&family=Source+Serif+4:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  --ink:        #0D0D0D;
  --ink-2:      #1A1A2E;
  --ink-3:      #1F1F33;
  --rule:       #2A2A3E;
  --vellum:     #E8E8F0;
  --vellum-dim: #8899AA;
  --muted:      #667788;
  --muted-2:    #445566;

  /* The two data colors — the visual argument */
  --red:        #C0392B;    /* mortality red — homicide data */
  --red-soft:   rgba(192,57,43,0.15);
  --blue:       #2E86AB;    /* law blue — legislative data */
  --blue-soft:  rgba(46,134,171,0.15);
  --amber:      #E8A838;    /* repealed / absent laws — the gap */
  --amber-soft: rgba(232,168,56,0.12);
  --gold:       #C9A84C;    /* series mark only */
  --suicide:    #4A90D9;    /* suicide line — distinct from law blue */
  --green:      #5A9A6A;    /* validation / pass */

  --serif:  "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --display: "Playfair Display", Georgia, serif;
  --mono:   "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* Light theme */
[data-theme="light"] {
  --ink:        #F5F5F8;
  --ink-2:      #EEEEF4;
  --ink-3:      #E4E4EC;
  --rule:       #D0D0DC;
  --vellum:     #1A1A2E;
  --vellum-dim: #445566;
  --muted:      #667788;
  --muted-2:    #99AABB;
  --red:        #B03020;
  --blue:       #1E7090;
  --amber:      #D09030;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--ink);
  color: var(--vellum);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; }

/* Subtle grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(rgba(136,153,170,0.02) 1px, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
  z-index: 100;
}

a { color: var(--blue); text-decoration: none; border-bottom: 1px solid rgba(46,134,171,0.3); }
a:hover { color: var(--vellum); border-bottom-color: var(--vellum); }

/* === Shell === */
.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 48px 80px;
}

/* === Masthead === */
.masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--rule);
  align-items: end;
}
.masthead .series {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.masthead h1 {
  font-family: var(--display);
  font-size: 64px;
  font-weight: 900;
  line-height: 0.92;
  margin: 0;
  letter-spacing: -0.015em;
}
.masthead h1 em {
  font-style: italic;
  color: var(--red);
}
.masthead .sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--vellum-dim);
  max-width: 680px;
  margin-top: 14px;
  line-height: 1.4;
}
.masthead .meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: right;
  line-height: 1.8;
}
.masthead .meta .k { color: var(--muted-2); }
.masthead .meta .v { color: var(--vellum-dim); }

/* === Tabs === */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--rule);
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 18px 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: default;
  text-decoration: none;
  border-right: none;
  border-left: none;
  border-top: none;
}
a.tab { border-bottom-color: transparent; }
a.tab:hover { color: var(--vellum); border-bottom-color: transparent; }
.tab.active {
  color: var(--vellum);
  border-bottom-color: var(--red);
}

/* === Stat row === */
.statrow {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border-bottom: 1px solid var(--rule);
}
.statrow.four { grid-template-columns: repeat(4, 1fr); }
.statrow.six { grid-template-columns: repeat(6, 1fr); }
.stat {
  background: var(--ink);
  padding: 18px 22px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat .label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}
.stat .value {
  font-family: var(--display); font-size: 32px; font-weight: 500;
  line-height: 1.05; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stat .value .unit {
  font-family: var(--mono); font-size: 12px;
  color: var(--muted); margin-left: 4px;
  vertical-align: 4px; letter-spacing: 0.08em;
}
.stat .foot {
  font-family: var(--mono); font-size: 10px; color: var(--muted-2);
}
.stat .value.red { color: var(--red); }
.stat .value.blue { color: var(--blue); }

/* === Section === */
.section {
  margin-top: 48px;
}
.section-head {
  display: flex; align-items: baseline; gap: 18px;
  margin-bottom: 14px;
}
.section-head .label {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--red); white-space: nowrap;
}
.section-head .rule {
  flex: 1; height: 1px; background: var(--rule);
}
.section-head .aside {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.section-title {
  font-family: var(--display);
  font-size: 40px; font-weight: 500;
  line-height: 1.05; margin: 0;
  letter-spacing: -0.01em;
  max-width: 880px;
}
.section-title em { color: var(--red); font-style: italic; }
.section-lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--vellum-dim);
  max-width: 720px;
  margin: 14px 0 0;
  line-height: 1.42;
}

/* === Footer === */
.bb-foot {
  margin-top: 64px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

/* === Splash === */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #0D0D0D;
  transition: opacity 500ms;
}
.splash.out { opacity: 0; pointer-events: none; }
.splash-number {
  font-variant-numeric: tabular-nums;
  animation: fadeSlideIn 800ms ease both;
}
.splash-label { animation: fadeSlideIn 600ms ease 2s both; }
.splash-title { animation: fadeSlideIn 600ms ease 3.5s both; }
.splash-thesis { animation: fadeSlideIn 600ms ease 4s both; }
.splash-enter { animation: fadeSlideIn 600ms ease 5.5s both; cursor: pointer; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Two-column layout === */
.twocol {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
  align-items: start;
}

/* === Chart containers === */
.chart-wrap {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 22px 0;
}
.chart-wrap svg { display: block; width: 100%; height: auto; }

/* === Confidence badges === */
.conf-high { color: var(--green); }
.conf-cand { color: var(--amber); }
.conf-spec { color: var(--red); }

/* === Responsive === */
@media (max-width: 1100px) {
  .twocol { grid-template-columns: 1fr; }
  .shell { padding: 0 24px 60px; }
  .masthead h1 { font-size: 44px; }
  .statrow.six { grid-template-columns: repeat(3, 1fr); }
}
