:root {
  --bg: #f7f5f0;
  --ink: #14171a;
  --muted: #6b6b6b;
  --rule: #d8d4cc;
  --accent: #b3261e;
  --max-width: 64ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --ink: #ece9e2;
    --muted: #9a978f;
    --rule: #2a2a28;
    --accent: #ff6f61;
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  height: 100dvh;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(1rem, 4vh, 3rem) clamp(1rem, 5vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.75rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand {
  font-weight: 700;
  color: var(--ink);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.tab {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  font: inherit;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tab:hover { color: var(--ink); border-color: var(--ink); }

.tab[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.story {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1 1 auto;
  min-height: 0;
  justify-content: center;
}

.category {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.headline {
  font-size: clamp(1.75rem, 5vw, 3rem);
  line-height: 1.15;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.summary {
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

.byline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--rule);
  padding-top: 0.75rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.link:hover { text-decoration: underline; }
.link[hidden] { display: none; }

.empty {
  margin: auto;
  font-style: italic;
  color: var(--muted);
  text-align: center;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty[hidden] { display: none; }
