:root {
  --color-black: #000;
  --color-bg: #FAF3C2;
  --color-text: #262626;
  --color-text-secondary: #595959;
  --color-surface: #fff;
  --color-accent: #EDD11F;
  --color-border: #000;
  --color-border-soft: rgba(0, 0, 0, 0.12);
  --font-sans: 'Source Sans Pro', Helvetica, Arial, sans-serif;
  --font-display: 'Inter', 'Source Sans Pro', Helvetica, Arial, sans-serif;

  /* Monochrome ordinal ramp for the patterns page's sentiment chart — one hue,
     monotone lightness (validated: adjacent ΔL, light-end contrast 3.14:1
     against this page's actual cream bg). Darker=negative, lighter=positive.
     Deliberately distinct from the main feed's yellow/black/cream. */
  --color-diverging-neg: #1a1a1a;
  --color-diverging-neu: #59554a;
  --color-diverging-pos: #8f8874;
  --color-mono-bar: #262626;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
}

.header {
  text-align: center;
  padding: 30px 0 20px;
  border-bottom: 2px solid var(--color-text);
  box-shadow: 0 3px 0 var(--color-accent);
  margin-bottom: 24px;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.5px;
  font-size: 2.6rem;
  line-height: 1.1;
  color: var(--color-black);
}

.site-intro {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: var(--color-text);
  margin: 10px 0 8px;
  line-height: 1.4;
}

.site-tagline {
  font-family: var(--font-sans);
  font-style: italic;
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin: 2px 0;
  line-height: 1.3;
}

.site-tagline-small {
  font-family: var(--font-sans);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin: 2px 0;
  line-height: 1.3;
  opacity: 0.85;
}

.site-date {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.site-freshness {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.news-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 20px 60px;
}

/* Feed: a plain single-column list of entries. No cards, no shadows,
   no arbitrary "featured" sizing — every entry gets the same treatment. */
.feed {
  display: flex;
  flex-direction: column;
}

.entry {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 28px 0;
  border-bottom: 1px solid var(--color-border-soft);
  transition: background-color 0.15s ease;
}

.entry:hover {
  background-color: rgba(0, 0, 0, 0.025);
}

/* The year is the one piece of information every entry exists to report —
   give it real presence: a solid tag, not just another line of gray text. */
.entry-year {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-black);
  background-color: var(--color-accent);
  padding: 5px 10px;
  border-radius: 3px;
  white-space: nowrap;
}

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

.entry-text {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.55;
  overflow-wrap: break-word;
  margin-bottom: 10px;
}

.entry-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  letter-spacing: 0.2px;
  color: var(--color-text-secondary);
}

.entry-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

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

.entry-author:hover {
  text-decoration: underline;
}

.entry-metric {
  display: flex;
  align-items: center;
  gap: 4px;
}

.entry-original {
  color: var(--color-text-secondary);
  text-decoration: none;
  margin-left: auto;
}

.entry-original:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

@media (max-width: 560px) {
  .entry {
    flex-direction: column;
    gap: 10px;
  }

  .entry-year {
    align-self: flex-start;
  }

  .entry-original {
    margin-left: 0;
  }
}

#loading {
  text-align: center;
  padding: 40px;
  margin: 20px 0;
  font-style: italic;
  color: var(--color-text-secondary);
}

.empty-state {
  text-align: center;
  width: 100%;
  padding: 40px 20px;
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-style: italic;
}

.error {
  text-align: center;
  width: 100%;
  padding: 40px 20px;
  color: #a33;
  font-family: var(--font-sans);
}

.refresh-button {
  font-family: var(--font-sans);
  font-weight: 600;
  background-color: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-black);
  border-radius: 5px;
  padding: 12px 24px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-button:hover {
  background-color: var(--color-accent);
}

@media (max-width: 768px) {
  .site-title {
    font-size: 2.2rem;
  }

  .header {
    padding: 20px 0;
  }
}

/* Time capsule widget: a single random prediction, reshuffleable — a small
   hook into the dataset itself rather than another static blurb. */
.capsule-box {
  max-width: 720px;
  margin: 0 auto 20px;
  padding: 4px 20px 14px;
  border-left: 3px solid var(--color-accent);
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0 6px 6px 0;
}

.capsule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 2px;
}

.capsule-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-secondary);
}

.capsule-shuffle {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.8rem;
  background: none;
  border: 1px solid var(--color-border-soft);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--color-text);
  transition: all 0.15s ease;
}

.capsule-shuffle:hover {
  background-color: var(--color-accent);
  border-color: var(--color-black);
}

.capsule-box .entry {
  padding: 14px 0 4px;
  border-bottom: none;
}

.capsule-box .entry:hover {
  background-color: transparent;
}

/* Quiet link out of the main feed's minimalism, into the patterns page */
.site-patterns-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.site-patterns-link:hover {
  color: var(--color-black);
}

/* ==========================================================================
   Patterns page — a separate, secondary view. Not part of the main feed's
   minimalism; this is where "charts are fine" lives instead.
   ========================================================================== */

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.back-link:hover {
  color: var(--color-black);
}

.patterns-hero {
  text-align: center;
  margin: 20px 0 40px;
}

.patterns-hero .value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3rem;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--color-black);
}

.patterns-hero .label {
  color: var(--color-text-secondary);
  margin-top: 6px;
}

.patterns-hero .sub {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 4px;
}

.patterns-section {
  margin-bottom: 44px;
}

.patterns-section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.patterns-section-note {
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.patterns-callout {
  font-size: 0.98rem;
  line-height: 1.5;
  margin-top: 18px;
  padding: 14px 18px;
  border-left: 3px solid var(--color-accent);
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0 6px 6px 0;
}

/* Secondary/aside finding — same shape as the primary callout, but a quiet
   border instead of the accent color, which stays reserved for the headline
   takeaway of each section. */
.patterns-callout-secondary {
  border-left-color: var(--color-border-soft);
  color: var(--color-text-secondary);
  font-size: 0.92rem;
}

/* Ranking bars — single monochrome hue, reused for themes + every "top 5"
   section (years, people, organizations, places, authors). One consistent
   component instead of a bespoke chart per finding. */
.theme-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  text-decoration: none;
  color: inherit;
}
.theme-bar-row:hover .bar-label { color: var(--color-black); text-decoration: underline; }
.theme-bar-row:hover .bar-fill { background: var(--color-black); }
.theme-bar-row .bar-label {
  flex: 0 0 150px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-bar-row .bar-track { flex: 1; position: relative; height: 18px; }
.theme-bar-row .bar-fill {
  position: absolute;
  top: 1px; left: 0; height: 16px;
  background: var(--color-mono-bar);
  border-radius: 0 4px 4px 0;
}
.theme-bar-row .bar-value {
  flex: 0 0 70px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Compact rank row: used for the "top 5" findings (years, people, orgs,
   places, authors) — narrower label column than the theme bars since names
   here are short, plus a leading rank numeral. */
.rank-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.rank-row .rank-num {
  flex: 0 0 18px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}
.rank-row .bar-label {
  flex: 0 0 130px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-row .bar-track { flex: 1; position: relative; height: 16px; }
.rank-row .bar-fill {
  position: absolute;
  top: 0; left: 0; height: 14px;
  background: var(--color-mono-bar);
  border-radius: 0 3px 3px 0;
}
.rank-row .bar-value {
  flex: 0 0 40px;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Most-liked predictions: a compact text list, not a bar (the finding here
   is the post itself, not a count comparison). */
.liked-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-soft);
}
.liked-row:last-child { border-bottom: none; }
.liked-row .liked-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}
.liked-row .liked-year {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--color-black);
}
.liked-row .liked-text {
  font-size: 0.92rem;
  line-height: 1.45;
}

/* Diverging sentiment-by-era bar */
.div-legend {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}
.div-legend .item { display: flex; align-items: center; gap: 6px; }
.div-legend .dot { width: 10px; height: 10px; border-radius: 3px; }

.div-row { margin-bottom: 20px; }
.div-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.div-header strong { color: var(--color-black); }

.div-bar {
  position: relative;
  display: flex;
  align-items: center;
  height: 20px;
}
.div-bar .seg { height: 16px; }
.div-bar .seg-neg { background: var(--color-diverging-neg); border-radius: 4px 0 0 4px; }
.div-bar .seg-neu-l,
.div-bar .seg-neu-r { background: var(--color-diverging-neu); }
.div-bar .seg-pos { background: var(--color-diverging-pos); border-radius: 0 4px 4px 0; }
.div-bar .axis {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 1px;
  background: var(--color-black);
  opacity: 0.4;
}

@media (max-width: 560px) {
  .theme-bar-row .bar-label {
    flex-basis: 96px;
    font-size: 0.78rem;
  }
}
