:root {
  color-scheme: light;
  --ink: #16231e;
  --muted: #65706a;
  --paper: #f4f0e7;
  --surface: rgba(255, 253, 248, 0.78);
  --line: #d8d0c2;
  --green: #185341;
  --green-dark: #0f3a2e;
  --gold: #bc8244;
  --visited: #909690;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(24, 83, 65, 0.1), transparent 27rem),
    radial-gradient(circle at 96% 12%, rgba(188, 130, 68, 0.1), transparent 24rem),
    var(--paper);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input { font: inherit; }

.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;
}

.discover-hero,
main,
footer {
  width: min(1280px, calc(100% - 44px));
  margin-inline: auto;
}

.discover-hero {
  min-height: 430px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.42fr);
  gap: clamp(48px, 10vw, 150px);
  align-items: center;
  padding: clamp(58px, 9vw, 112px) 0 64px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.discover-hero h1 {
  margin: 0;
  font: 500 clamp(3.2rem, 7vw, 6.5rem)/0.9 Georgia, "Times New Roman", serif;
  letter-spacing: -0.06em;
}

.lede {
  max-width: 720px;
  margin: 27px 0 0;
  color: #3d4843;
  font: clamp(1.05rem, 1.7vw, 1.28rem)/1.58 Georgia, "Times New Roman", serif;
}

.privacy-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.progress-orbit {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.progress-ring {
  --progress: 0deg;
  width: clamp(190px, 22vw, 270px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--gold) var(--progress), rgba(24, 83, 65, 0.12) 0);
  box-shadow: 0 26px 70px rgba(32, 45, 39, 0.12);
}

.progress-ring::before {
  grid-area: 1 / 1;
  width: calc(100% - 15px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper);
  content: "";
}

.progress-ring > div {
  z-index: 1;
  grid-area: 1 / 1;
  display: grid;
  gap: 2px;
}

.progress-ring strong {
  font: 500 clamp(2.6rem, 5vw, 4.2rem)/1 Georgia, "Times New Roman", serif;
  letter-spacing: -0.05em;
}

.progress-ring span,
.progress-orbit > p {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-orbit > p { margin: 0; }
.progress-orbit > p span { margin-inline: 6px; }

.explore-toolbar {
  position: sticky;
  z-index: 30;
  top: var(--global-nav-height, 64px);
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 15px 0;
  background: color-mix(in srgb, var(--paper) 91%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(15px);
}

.filter-tabs {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.filter-tabs button {
  min-height: 36px;
  padding: 7px 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 850;
}

.filter-tabs button span { margin-left: 4px; opacity: 0.72; font-variant-numeric: tabular-nums; }
.filter-tabs button[aria-pressed="true"] { color: white; background: var(--green); box-shadow: 0 4px 12px rgba(15, 58, 46, 0.18); }

.discover-search input {
  width: 100%;
  min-height: 43px;
  padding: 9px 13px 9px 38px;
  color: var(--ink);
  background:
    linear-gradient(45deg, transparent 46%, var(--muted) 47% 53%, transparent 54%) 18px 24px / 7px 7px no-repeat,
    radial-gradient(circle at 16px 17px, transparent 5px, var(--muted) 5.5px 6.5px, transparent 7px) no-repeat,
    rgba(255, 255, 255, 0.52);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.discover-search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(24, 83, 65, 0.1); }

.next-page-button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 9px 14px;
  color: white;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.77rem;
  font-weight: 900;
}

.next-page-button:hover { background: var(--green-dark); }
.next-page-button b { color: #f1ca97; font-size: 1rem; }
.next-page-button:disabled { opacity: 0.45; cursor: default; }

.result-summary {
  margin: 20px 0 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.discover-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px 34px;
  align-items: start;
  padding: 34px 0 72px;
}

.discover-group {
  min-width: 0;
  border-top: 2px solid var(--ink);
}

.discover-group[data-category="witnesses"],
.discover-group[data-category="articles"] { grid-column: span 2; }

.discover-group[data-category="witnesses"] .discover-list,
.discover-group[data-category="articles"] .discover-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 26px; }

.discover-group > header {
  display: grid;
  gap: 9px;
  padding: 17px 0 15px;
  border-bottom: 1px solid var(--line);
}

.discover-group h2 {
  margin: 0;
  font: 500 clamp(1.45rem, 2.3vw, 2.05rem)/1.08 Georgia, "Times New Roman", serif;
  letter-spacing: -0.03em;
}

.discover-group header > p {
  max-width: 56ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.group-count {
  margin: 0 0 4px !important;
  color: var(--gold) !important;
  font-size: 0.65rem !important;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.discover-list { display: grid; grid-template-columns: minmax(0, 1fr); }

.discover-item {
  min-width: 0;
  min-height: 41px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 16px;
  gap: 9px;
  align-items: center;
  padding: 8px 2px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.visit-mark {
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
}

.discover-item-title {
  overflow: hidden;
  font: 0.8rem/1.25 Arial, Helvetica, sans-serif;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discover-arrow { color: var(--gold); opacity: 0; transform: translateX(-5px); transition: inherit; }
.discover-item:hover,
.discover-item:focus-visible { color: var(--green); outline: none; transform: translateX(3px); }
.discover-item:hover .discover-arrow,
.discover-item:focus-visible .discover-arrow { opacity: 1; transform: none; }

.discover-item.is-visited { color: var(--visited); opacity: 0.48; }
.discover-item.is-visited .visit-mark { display: grid; place-items: center; color: white; background: var(--visited); border-color: var(--visited); }
.discover-item.is-visited .visit-mark::after { content: "✓"; font-size: 0.48rem; font-weight: 900; }
.discover-item.is-visited:hover,
.discover-item.is-visited:focus-visible { color: var(--green); opacity: 0.82; }

.empty-state {
  padding: 75px 20px 100px;
  text-align: center;
}

.empty-state h2 { margin: 0; font: 500 clamp(2rem, 4vw, 3.5rem)/1.08 Georgia, "Times New Roman", serif; }
.empty-state > p:last-child { color: var(--muted); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 25px 0 44px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}

footer p { margin: 0; }
footer a { color: var(--green); font-weight: 850; }

[hidden] { display: none !important; }

@media (max-width: 1020px) {
  .discover-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explore-toolbar { grid-template-columns: 1fr auto; }
  .filter-tabs { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 720px) {
  .discover-hero,
  main,
  footer { width: min(100% - 28px, 1280px); }
  .discover-hero { min-height: 0; grid-template-columns: 1fr; gap: 38px; padding: 42px 0; }
  .discover-hero h1 { font-size: clamp(3.25rem, 16vw, 5.2rem); }
  .progress-orbit { grid-template-columns: auto 1fr; justify-items: start; text-align: left; }
  .progress-ring { width: 145px; }
  .explore-toolbar { position: static; grid-template-columns: 1fr; }
  .filter-tabs { width: 100%; justify-self: stretch; overflow-x: auto; }
  .filter-tabs button { flex: 1 0 auto; }
  .next-page-button { justify-content: space-between; }
  .discover-grid { grid-template-columns: 1fr; gap: 38px; }
  .discover-group[data-category="witnesses"],
  .discover-group[data-category="articles"] { grid-column: span 1; }
  .discover-group[data-category="witnesses"] .discover-list,
  .discover-group[data-category="articles"] .discover-list { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .discover-item,
  .discover-arrow { transition: none; }
}
