*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f5;
  --border: #e5e5e0;
  --text: #1a1a1a;
  --text-muted: #666660;
  --accent: #c0392b;
  --accent-light: #fdf3f2;
  --rank-bg: #1a1a1a;
  --rank-text: #ffffff;
  --followup-bg: #f7f5f0;
  --followup-border: #d4c9a8;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 860px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

/* Header */
header {
  border-bottom: 1px solid var(--text);
  padding: 12px 24px 10px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.header-inner h1 { flex-shrink: 0; }
.header-inner .date-nav { flex-shrink: 0; margin-left: auto; }

header h1 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Date nav */
.date-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-nav button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}

.date-nav button:hover:not(:disabled) {
  background: var(--bg-alt);
}

.date-nav button:disabled {
  opacity: 0.3;
  cursor: default;
}

#date-display {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 180px;
  text-align: center;
}

/* Style switcher */
.style-switcher {
  display: inline-flex;
  gap: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  position: relative;
}

.style-switcher[hidden] { display: none; }

.style-btn {
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 3px 11px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.style-btn:hover:not(.is-active) {
  color: var(--text);
}

.style-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.style-btn.is-active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* Main content */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

#loading {
  color: var(--text-muted);
  padding: 48px 0;
  text-align: center;
}

.error {
  color: var(--accent);
  padding: 24px 0;
}

/* Stories */
.stories-section {
  display: flex;
  flex-direction: column;
}

.story {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.story .story-body {
  flex: 1;
  min-width: 0;
}

.story:first-child {
  padding-top: 0;
}

.story h2 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

/* Thumbnails */
.thumb {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-alt);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: var(--rank-bg);
  color: var(--rank-text);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 3px;
  flex-shrink: 0;
  padding: 0 4px;
}

.summary {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 10px;
}

ul.summary-bullets {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

ul.summary-bullets li {
  padding-left: 14px;
  position: relative;
}

ul.summary-bullets li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* Sources */
details {
  margin-top: 8px;
}

.sources-toggle {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.sources-toggle::-webkit-details-marker { display: none; }

.sources-toggle::before {
  content: '+ ';
  font-weight: 700;
}

details[open] .sources-toggle::before {
  content: '− ';
}

.source-tags {
  display: inline-flex;
  gap: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.source-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 1.6;
}

.sources {
  list-style: none;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sources li {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.paper {
  font-weight: 700;
  color: var(--text);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 2px;
}

.translation {
  color: var(--text-muted);
  font-style: italic;
}

/* Follow-ups */
.followups-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--text);
}

.followups-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.followup {
  background: var(--followup-bg);
  border-left: 3px solid var(--followup-border);
  padding: 16px 18px;
  margin-bottom: 16px;
  border-radius: 0 4px 4px 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.followup .story-body {
  flex: 1;
  min-width: 0;
}

.followup h3 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.followup-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.covered-dates {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.date-link {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  cursor: pointer;
}

.date-link:hover {
  color: var(--text);
}

/* Responsive */
@media (max-width: 600px) {
  header { padding: 14px 16px 12px; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  #date-display { min-width: unset; text-align: left; }
  main { padding: 24px 16px 48px; }
}
