:root {
  color-scheme: light;
  --text: #171717;
  --muted: #666;
  --rule: #ddd;
  --soft-rule: #ececec;
  --green: #287a44;
  --red: #bc3f32;
}

* {
  box-sizing: border-box;
}

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

body {
  background: #fff;
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

main {
  margin: 40px auto;
  max-width: 860px;
  padding: 0 18px;
}

header {
  margin-bottom: 48px;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 7px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin-bottom: 10px;
}

.dek {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 22px;
  max-width: 650px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filter {
  appearance: none;
  background: #fff;
  border: 1px solid #aaa;
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 7px 10px;
}

.filter span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-left: 3px;
}

.filter:hover,
.filter:focus-visible {
  border-color: var(--text);
  outline: none;
}

.filter.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.filter.active span {
  color: #bbb;
}

section + section {
  margin-top: 48px;
}

.section-head {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.section-head h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 0;
}

.section-head p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 0;
}

.story {
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 18px;
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 19px 0 22px;
}

.rank {
  color: #999;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding-top: 4px;
}

.meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 0;
  margin-bottom: 5px;
}

.meta span + span::before {
  color: #aaa;
  content: "·";
  margin: 0 7px;
}

h3 {
  font-size: clamp(18px, 3.4vw, 21px);
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.25;
  margin-bottom: 7px;
}

h3 a {
  color: inherit;
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

h3 a:hover,
h3 a:focus-visible {
  text-decoration: underline;
}

.story-body > p {
  margin-bottom: 8px;
  max-width: 750px;
}

.why {
  color: var(--muted);
  font-size: 13px;
}

.why span {
  color: var(--green);
  font-weight: 600;
  margin-right: 4px;
}

.related {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  margin-top: 10px;
}

.related a,
.signals a {
  color: var(--text);
  font-size: 13px;
  text-decoration-color: #aaa;
  text-underline-offset: 3px;
}

.related a:hover,
.related a:focus-visible,
.signals a:hover,
.signals a:focus-visible {
  text-decoration-color: var(--text);
}

.related a::after {
  color: #999;
  content: " ↗";
  font-size: 11px;
}

.empty {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  padding: 20px 0;
}

.signals {
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}

.signals > p {
  max-width: 700px;
}

.sources {
  color: var(--muted);
  font-size: 13px;
}

footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 14px;
}

@media (max-width: 600px) {
  main {
    margin-top: 24px;
  }

  header {
    margin-bottom: 38px;
  }

  .section-head p {
    display: none;
  }

  .story {
    gap: 10px;
    grid-template-columns: 22px minmax(0, 1fr);
    padding: 17px 0 20px;
  }

  .rank {
    font-size: 11px;
  }

  footer {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .filter {
    transition: background-color 100ms ease, border-color 100ms ease, color 100ms ease;
  }
}
