/* FOIA Records Database — hand-written, no build step. */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2430;
  --border: #2b3441;
  --text: #e6edf3;
  --muted: #96a1ad;
  --accent: #4a9eff;
  --accent-soft: #1f3a5c;
  --warn: #f0b429;
  --radius: 10px;
  --wrap: 1140px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fa;
    --surface: #fff;
    --surface-2: #eef1f5;
    --border: #d6dbe2;
    --text: #1a2028;
    --muted: #5a6673;
    --accent: #0b62d0;
    --accent-soft: #e2edfd;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.6 system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}
.nowrap {
  white-space: nowrap;
}
.sr-only,
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  clip: auto;
  display: inline-block;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
}

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

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}
.brand:hover {
  text-decoration: none;
}
.brand-logo {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}
.site-nav {
  display: flex;
  gap: 18px;
  font-size: 0.94rem;
}
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-inner p {
  margin: 2px 0;
}

/* ---------- hero + search ---------- */

.hero {
  position: relative;
  padding: 48px 0 8px;
  overflow: hidden;
}
/* Soft radial wash so the hero reads as a distinct band under the header. */
.hero-glow {
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 420px;
  background:
    radial-gradient(
      60% 70% at 22% 30%,
      color-mix(in srgb, var(--accent) 26%, transparent),
      transparent 70%
    ),
    radial-gradient(
      45% 60% at 88% 10%,
      color-mix(in srgb, var(--accent) 14%, transparent),
      transparent 70%
    );
  pointer-events: none;
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
}
.hero-kicker {
  margin: 0 0 10px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  font-size: clamp(1.7rem, 4.2vw, 2.9rem);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  line-height: 1.12;
}
.lede {
  color: var(--muted);
  margin: 0 0 18px;
  max-width: 56ch;
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hero-stats li {
  display: flex;
  flex-direction: column;
}
.hero-stats strong {
  font-size: 1.35rem;
  line-height: 1.1;
}
.hero-stats span {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-art {
  display: grid;
  place-items: center;
  filter: drop-shadow(0 18px 36px color-mix(in srgb, var(--accent) 30%, transparent));
}
.hero-art img {
  width: clamp(140px, 20vw, 220px);
  height: auto;
}
.search {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.search input {
  flex: 1 1 320px;
  min-width: 0;
  padding: 13px 14px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.search input:focus-visible,
select:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.search button,
.button {
  padding: 13px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.search button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.hint {
  color: var(--muted);
  font-size: 0.88rem;
  min-height: 1.4em;
  margin: 8px 0 0;
}

/* ---------- carousel ---------- */

.carousel {
  margin-top: 34px;
}
.carousel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.carousel-head h2 {
  font-size: 1.15rem;
  margin: 0 0 12px;
}
.carousel-controls {
  display: flex;
  gap: 6px;
}
.carousel-controls button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
}
.carousel-controls button:disabled {
  opacity: 0.4;
  cursor: default;
}

.carousel-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  margin: 0;
  padding: 4px 4px 14px;
  list-style: none;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.carousel-slide {
  flex: 0 0 clamp(260px, 42%, 420px);
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.carousel-slide[aria-hidden="true"] {
  opacity: 0.55;
}
.slide-agency {
  margin: 0 0 6px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}
.carousel-slide h3 {
  margin: 0 0 8px;
  font-size: 1.03rem;
  line-height: 1.35;
}
.slide-blurb {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.slide-meta {
  margin: 0;
  display: flex;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--muted);
}
.carousel-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 2px;
}
.carousel-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
}
.carousel-dots span[data-active="true"] {
  background: var(--accent);
}

/* ---------- results table ---------- */

.results {
  position: relative;
  margin-top: 34px;
}
.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.results-head h2 {
  font-size: 1.15rem;
  margin: 0;
}
.count {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.9rem;
}
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}
select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  max-width: 240px;
}

table.records {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}
table.records th,
table.records td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.records thead th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom-width: 2px;
}
table.records tbody tr:hover {
  background: var(--surface-2);
}
.row-summary {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
td.empty {
  text-align: center;
  color: var(--muted);
  padding: 34px 12px;
}
tr.is-weak td:first-child a::after {
  content: "weak match";
  margin-left: 8px;
  font-size: 0.7rem;
  color: var(--warn);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--warn);
  padding: 0 5px;
  border-radius: 10px;
}

/* ---------- record + prose ---------- */

.record,
.prose {
  padding-top: 32px;
  max-width: 860px;
}
.record h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0 0 18px;
  line-height: 1.3;
}
.breadcrumb {
  margin: 0 0 10px;
  font-size: 0.9rem;
}
.record-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 0 0 24px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.record-meta dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.record-meta dd {
  margin: 3px 0 0;
  font-size: 0.92rem;
}
.ai-summary {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 22px;
}
.ai-summary h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.ai-summary p {
  margin: 0 0 8px;
}
.context ul,
.related ul,
.api-list {
  padding-left: 20px;
}
.context li,
.related li {
  margin-bottom: 8px;
}
.support {
  margin-top: 40px;
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- donate ---------- */

.donate {
  margin-top: 14px;
}
.donate-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.donate-amounts button {
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.donate-amounts button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.donate-amounts input {
  width: 92px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.donate-status {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.3em;
}
.donate-status.is-error {
  color: var(--warn);
}

@media (max-width: 640px) {
  table.records thead {
    display: none;
  }
  table.records tr {
    display: block;
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
  }
  table.records td {
    display: block;
    border: 0;
    padding: 3px 0;
  }
  table.records td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--muted);
  }
}

/* ---------- carousel slide media ---------- */

.slide-media {
  display: block;
  aspect-ratio: 16 / 9;
  margin: -18px -18px 14px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface-2);
}
.slide-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.slide-media--empty {
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.45;
}

/* ---------- hover card ---------- */

.hovercard {
  position: absolute;
  z-index: 40;
  width: min(380px, calc(100vw - 32px));
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgb(0 0 0 / 45%);
  overflow: hidden;
  pointer-events: none;
}
.hovercard[hidden] {
  display: none;
}
.hovercard-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}
.hovercard-img[hidden] {
  display: none;
}
.hovercard-body {
  padding: 12px 14px 14px;
}
.hovercard-agency {
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.hovercard-body h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
  line-height: 1.35;
}
.hovercard-summary {
  margin: 0 0 10px;
  font-size: 0.87rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hovercard-link {
  font-size: 0.86rem;
  font-weight: 600;
}
