:root {
  --bg: #fff;
  --band: #f5f5f5;
  --card: #f5f5f5;
  --chip: #fff;
  --text: #0a0a0a;
  --muted: #5f5f5f;
  --rule: #e8e8e8;
  --accent: #0a0a0a;
  --on-accent: #fff;
  color-scheme: light dark;
}

/* One colour per topic, used for the icon and label on each card. */
.nature {
  --tone: #17703f;
}

.science {
  --tone: #1d5fbf;
}

.health {
  --tone: #b3305b;
}

.community {
  --tone: #a35a00;
}

@media (prefers-color-scheme: dark) {
  .nature {
    --tone: #6fd39a;
  }

  .science {
    --tone: #8ab4ff;
  }

  .health {
    --tone: #ff8fb1;
  }

  .community {
    --tone: #f5b660;
  }

  :root {
    --bg: #0a0a0a;
    --band: #141414;
    --card: #171717;
    --chip: #262626;
    --text: #f5f5f5;
    --muted: #a8a8a8;
    --rule: #262626;
    --accent: #f5f5f5;
    --on-accent: #0a0a0a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.wrap {
  max-width: 66rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999rem;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 2;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
}

header {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 2rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.site-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Tap targets are at least 44px high. */
.site-name,
.bar nav a {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.7rem 0;
}

.bar nav a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.bar nav a:hover {
  color: var(--text);
}

.button,
.pager a {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.button {
  margin-left: auto;
}

.hero {
  padding: 3rem 0;
  background: var(--band);
}

h1 {
  max-width: 20ch;
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero p {
  max-width: 34rem;
  margin: 1rem 0 0;
  color: var(--muted);
}

h2 {
  margin: 3rem 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr));
  gap: 1rem;
}

article,
.source {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  border-radius: 1rem;
  background: var(--card);
}

article h3,
.source h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

article h3 a,
.source h2 a {
  text-decoration: none;
}

/* The headline link covers the whole card, so the card is the tap target. */
article h3 a::after,
.source h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 1rem;
}

article:hover h3 a,
.source:hover h2 a {
  text-decoration: underline;
}

article p,
.source p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

article img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
}

.topic {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--tone);
  font-size: 0.8rem;
  font-weight: 600;
}

.icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.5rem;
  border-radius: 0.6rem;
  background: var(--chip);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* Above the headline link's cover, so it can be tapped on its own. */
.meta a {
  position: relative;
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.meta a:hover {
  border-color: var(--text);
}

.sources {
  margin-top: 3rem;
}

.prose {
  max-width: 40rem;
}

.prose p {
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
}

.pager [rel="next"] {
  margin-left: auto;
}

footer {
  margin-top: 4rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}

footer p {
  margin: 0.25rem 0;
}

footer .bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
}

footer .legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.prose li {
  color: var(--muted);
}

.prose .operator {
  margin-top: 3rem;
  font-size: 0.875rem;
}
