@import url('https://fonts.googleapis.com/css2?family=Commissioner:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,500;6..72,700&display=swap');

:root {
  --paper: #f5f1e8;
  --ink: #0b1215;
  --muted: #687075;
  --line: #bec3bd;
  --panel: #fbf8f1;
  --cyan: #08bae4;
  --red: #ff2a24;
  --blue: #006bd6;
  --lime: #8ae600;
  --shadow: rgba(13, 22, 25, .12);
}

[data-theme="night"] {
  --paper: #071014;
  --ink: #f5f1e8;
  --muted: #9ca9ad;
  --line: #334146;
  --panel: #0c181d;
  --shadow: rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Commissioner", sans-serif; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

.masthead { position: sticky; z-index: 20; top: 0; height: 66px; display: grid; grid-template-columns: 66px 1fr auto; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 93%, transparent); backdrop-filter: blur(16px); }
.brand, .section-name { display: flex; align-items: center; text-decoration: none; }
.brand { justify-content: center; border-right: 1px solid var(--line); }
.section-name { padding: 0 20px; font-weight: 700; letter-spacing: .13em; font-size: 12px; }
.masthead nav { display: flex; }
.masthead button { width: 66px; border: 0; border-left: 1px solid var(--line); background: transparent; cursor: pointer; font-weight: 700; }
.masthead button:hover { background: var(--ink); color: var(--paper); }
.pf-mark { position: relative; display: block; width: 25px; height: 25px; }
.pf-mark i { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: var(--cyan); }
.pf-mark i:nth-child(1) { left: 7px; top: 0; background: var(--red); }
.pf-mark i:nth-child(2) { left: 0; top: 7px; }
.pf-mark i:nth-child(3) { right: 0; top: 7px; }
.pf-mark i:nth-child(4) { left: 7px; bottom: 0; background: var(--red); }

.grid-paper { background-image: linear-gradient(color-mix(in srgb, var(--line) 22%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--line) 22%, transparent) 1px, transparent 1px); background-size: 40px 40px; }
.hero { min-height: 530px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr); border-bottom: 1px solid var(--line); }
.hero > div { padding: clamp(42px, 7vw, 110px); display: flex; flex-direction: column; justify-content: flex-end; }
.hero > div:first-child { border-right: 1px solid var(--line); }
.section-code { margin: 0 0 24px; font: 600 11px/1.2 "Commissioner"; letter-spacing: .17em; color: var(--blue); }
h1, h2 { font-family: "Newsreader", serif; letter-spacing: -.035em; }
h1 { max-width: 900px; margin: 0; font-size: clamp(58px, 8.4vw, 132px); line-height: .84; }
.lead { max-width: 720px; margin: 36px 0 0; font-size: clamp(17px, 1.5vw, 23px); line-height: 1.5; color: var(--muted); }
.hero-metric span { font-family: "Newsreader", serif; font-size: clamp(60px, 7vw, 112px); line-height: .9; color: var(--red); }
.hero-metric small { max-width: 260px; margin-top: 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }

.pulse { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.pulse article { min-height: 145px; padding: 30px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; }
.pulse article:last-child { border-right: 0; }
.pulse span { font-family: "Newsreader", serif; font-size: clamp(33px, 4vw, 60px); }
.pulse small { text-transform: uppercase; letter-spacing: .12em; font-size: 10px; color: var(--muted); }

.source-section, .catalog-section { padding: 72px clamp(22px, 5vw, 80px); border-bottom: 1px solid var(--line); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.section-title h2 { margin: 0; font-size: clamp(44px, 6vw, 84px); }
.section-title p { margin: 0; color: var(--muted); }
.source-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.source-card { min-height: 210px; padding: 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-decoration: none; display: flex; flex-direction: column; transition: transform .18s ease, background .18s ease; }
.source-card:hover { transform: translate(-4px, -4px); background: var(--panel); box-shadow: 4px 4px 0 var(--red); }
.source-card strong { font-size: 12px; letter-spacing: .12em; color: var(--blue); }
.source-card h3 { margin: auto 0 20px; font-family: "Newsreader", serif; font-size: 25px; line-height: 1; }
.source-card p { display: flex; justify-content: space-between; margin: 0; color: var(--muted); font-size: 11px; }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 26px; }
.filters label { display: flex; align-items: center; min-height: 64px; background: var(--paper); }
.filters label > span { padding: 0 18px; text-transform: uppercase; letter-spacing: .1em; font-size: 10px; color: var(--muted); }
.filters input, .filters select { min-width: 0; flex: 1; height: 62px; border: 0; background: transparent; outline: 0; padding: 0 18px; }
.catalog-table-wrap { overflow: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 940px; }
th, td { padding: 17px 16px; border-bottom: 1px solid var(--line); text-align: left; }
th { position: sticky; top: 0; background: var(--panel); text-transform: uppercase; letter-spacing: .1em; font-size: 10px; }
td { font-size: 13px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--cyan); color: #041115; }
td:first-child { font-family: ui-monospace, monospace; font-size: 10px; color: var(--muted); }
.load-more { display: block; width: 100%; height: 56px; margin-top: 12px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.load-more:hover { background: var(--ink); color: var(--paper); }

.api-strip { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 30px; padding: 56px clamp(22px, 5vw, 80px); background: #091216; color: #f5f1e8; border-left: 10px solid var(--red); }
.api-strip h2 { margin: 0; font-size: 56px; }
.api-strip p { color: #9aa8ad; }
.api-strip code { color: var(--cyan); overflow-wrap: anywhere; }
.api-strip a { padding: 16px; border: 1px solid #435055; text-decoration: none; }

.drawer { position: fixed; z-index: 50; inset: 0 0 0 auto; width: min(430px, 100%); padding: 22px; color: var(--ink); background: var(--paper); border-left: 1px solid var(--line); box-shadow: -20px 0 80px var(--shadow); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.drawer button { border: 0; background: transparent; font-size: 28px; cursor: pointer; }
.drawer a { display: block; padding: 15px 0; border-bottom: 1px solid var(--line); text-decoration: none; }

dialog { width: min(1120px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: clamp(24px, 5vw, 72px); color: var(--ink); background: var(--paper); border: 1px solid var(--line); box-shadow: 0 40px 100px rgba(0,0,0,.34); }
dialog::backdrop { background: rgba(3, 9, 12, .72); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 20px; top: 15px; border: 0; background: transparent; font-size: 34px; cursor: pointer; }
dialog h2 { margin: 0 0 12px; font-size: clamp(38px, 5vw, 72px); line-height: .95; }
#dialog-description { max-width: 760px; color: var(--muted); line-height: 1.55; }
.dialog-meta { display: flex; flex-wrap: wrap; gap: 1px; margin: 30px 0; background: var(--line); border: 1px solid var(--line); }
.dialog-meta span { flex: 1; min-width: 150px; padding: 14px; background: var(--paper); font-size: 11px; }
#chart { display: block; width: 100%; height: 360px; background: #fff; border: 1px solid #d6d8d4; }
.chart-note, .citation { color: var(--muted); font-size: 11px; line-height: 1.5; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }
.dialog-actions a, .dialog-actions button { padding: 12px 15px; border: 1px solid var(--line); background: transparent; text-decoration: none; font-size: 11px; font-weight: 700; cursor: pointer; }
.dialog-actions a:hover, .dialog-actions button:hover { background: var(--red); color: #fff; border-color: var(--red); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero > div { min-height: 390px; padding: 44px 24px; }
  .hero > div:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .pulse { grid-template-columns: repeat(2, 1fr); }
  .source-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr; }
  .api-strip { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .section-name { padding: 0 12px; font-size: 10px; }
  .masthead button { width: 50px; }
  .masthead button:first-child { display: none; }
  .source-grid { grid-template-columns: 1fr; }
  .source-card { min-height: 160px; }
  .pulse article { padding: 20px; }
}
