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

:root {
  --bg: #0f1727;
  --surface: #162038;
  --ink: #ecebe3;
  --muted: #8d97aa;
  --hairline: #28324a;
  --accent: #e63946;
  --accent-soft: #2b1a1d;
  --tag-bg: #1c2740;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --max-width: 880px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
header {
  border-bottom: 1px solid var(--hairline);
  padding: 16px 32px 14px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.header-row-top {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-size: inherit;
  font-weight: 400;
  line-height: 0.9;
}

.wordmark-sg {
  font-size: 32px;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.wordmark-news {
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* Style switcher */
.style-switcher {
  margin-left: auto;
  display: inline-flex;
  gap: 2px;
  background: var(--tag-bg);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px;
}

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

.style-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

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

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

.style-btn.is-active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* Date nav */
.date-nav {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.date-nav button {
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}

.date-nav button:hover:not(:disabled) {
  background: var(--tag-bg);
  border-color: var(--muted);
}

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

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

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

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

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

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

.story {
  padding: 44px 0;
  border-bottom: 1px solid var(--hairline);
  display: grid;
  grid-template-columns: 130px 200px 1fr;
  gap: 32px;
  align-items: start;
}

.story-rank {
  padding-top: 4px;
  padding-right: 14px;
  overflow: visible;
}

.rank-numeral {
  font-family: var(--font-display);
  font-size: 110px;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  line-height: 0.82;
  letter-spacing: -0.05em;
  display: block;
}

.story .thumb {
  width: 200px;
  height: 200px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--tag-bg);
  flex-shrink: 0;
}

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

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

.story-body h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 14px;
}

.summary {
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.6;
  margin: 0 0 10px;
}

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

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

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

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

.sources-toggle {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 4px;
}

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

.sources-toggle::before {
  content: '+';
  font-weight: 700;
  margin-right: 6px;
}

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

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

.source-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--tag-bg);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.6;
}

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

.sources li {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.paper {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 6px;
}

.section {
  font-size: 10px;
  background: var(--tag-bg);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 6px;
  color: var(--muted);
}

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

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

.followups-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

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

.followup .thumb {
  width: 90px;
  height: 90px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--tag-bg);
  flex-shrink: 0;
}

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

.followup h3 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 4px;
}

.followup-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0 0 8px;
}

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

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

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

/* Mobile */
@media (max-width: 700px) {
  header { padding: 14px 18px 12px; }
  .header-row-top { flex-direction: column; align-items: flex-start; gap: 12px; }
  .style-switcher { margin-left: 0; }
  #date-display { min-width: auto; text-align: center; }
  main { padding: 24px 18px 48px; }

  .story {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "thumb thumb"
      "rank  body";
    gap: 12px 14px;
    padding: 28px 0;
  }
  .story .thumb {
    grid-area: thumb;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
  .story-rank {
    grid-area: rank;
    padding: 0;
  }
  .story-body { grid-area: body; padding-top: 6px; }

  .rank-numeral {
    font-size: 64px;
    line-height: 0.85;
    letter-spacing: -0.04em;
  }

  .story-body h2 {
    font-size: 22px;
    margin-bottom: 12px;
  }

  .summary { font-size: 14.5px; }

  .followup { padding: 14px; }
  .followup .thumb { width: 64px; height: 64px; }
}
