:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --accent: #2f5d50;
  --border: #e4e2dc;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

header,
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  padding-top: 48px;
}

header h1 {
  margin: 0;
  font-size: 2.25rem;
}

/* Subject buttons */

#subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}

#subjects button {
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

#subjects button:hover {
  border-color: var(--accent);
}

#subjects button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Article cards */

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  padding-bottom: 64px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  margin-bottom: 10px;
}

.card span {
  padding: 0 16px;
}

.card span:first-child {
  padding-top: 16px;
}

.card-subject {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.card-date {
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Article page */

.back {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.back:hover {
  text-decoration: underline;
}

#article {
  max-width: 760px;
  margin: 32px auto 80px;
}

.article-picture {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 28px;
}

.article-subject {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

#article h1 {
  margin: 8px 0;
  font-size: 2.25rem;
  line-height: 1.2;
}

.article-date {
  margin: 0 0 24px;
  color: var(--muted);
}

.article-summary {
  margin: 0 0 28px;
  font-size: 1.15rem;
  white-space: pre-wrap;
}

.download-button {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.download-button:hover {
  opacity: 0.9;
}