:root {
  --paper: #f3ecd9;
  --paper-dark: #e9dfc4;
  --ink: #241f16;
  --ink-soft: #4a4030;
  --rule: #241f16;
  --desk: #2c2620;
  --accent: #7a2e1d;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: "Libre Baskerville", Georgia, serif;
  overflow-x: hidden;
}

body {
  padding: 32px 16px 60px;
  min-height: 100vh;
}

img {
  max-width: 100%;
}

#root {
  max-width: 1120px;
  margin: 0 auto;
}

.loading, .error-box {
  color: var(--paper);
  text-align: center;
  font-style: italic;
  font-size: 1.1rem;
  padding: 120px 20px;
  letter-spacing: 0.5px;
}

.error-box h2 {
  font-family: "Playfair Display", serif;
  color: var(--paper);
  margin-bottom: 8px;
}

/* ---------- Masthead ---------- */

.masthead {
  background: var(--paper);
  padding: 28px 32px 18px;
  text-align: center;
  border: 1px solid #c9bd98;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
}

.masthead .kicker {
  font-family: "Libre Baskerville", serif;
  font-style: italic;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.masthead h1 {
  font-family: "Abril Fatface", "Playfair Display", serif;
  font-size: 3.6rem;
  margin: 6px 0 4px;
  line-height: 1.1;
  letter-spacing: 1px;
  color: var(--ink);
}

.masthead .tagline {
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.masthead .rule-double {
  border-top: 3px double var(--rule);
  margin: 10px 0 8px;
}

.masthead .meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-soft);
  padding-top: 4px;
}

/* ---------- Spread ---------- */

.spread {
  display: flex;
  gap: 0;
  margin-top: 10px;
  background: var(--paper-dark);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  position: relative;
}

.spread::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.35) 10%, rgba(0,0,0,0.35) 90%, transparent);
  box-shadow: -3px 0 6px rgba(0,0,0,0.15), 3px 0 6px rgba(0,0,0,0.15);
}

.page {
  flex: 1 1 50%;
  min-width: 0;
  background: var(--paper);
  padding: 26px 30px 20px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.page-number {
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-top: 1px solid #c9bd98;
  margin-top: 18px;
  padding-top: 8px;
}

/* ---------- Section header ---------- */

.section-header {
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  padding-bottom: 6px;
  margin-bottom: 14px;
  border-bottom: 3px double var(--rule);
  color: var(--ink);
}

/* ---------- Lead story ---------- */

.lead-story h2 {
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: 2.15rem;
  line-height: 1.12;
  margin: 4px 0 10px;
}

.lead-story img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  filter: sepia(0.35) contrast(1.05) grayscale(0.1);
  border: 1px solid #c9bd98;
  margin-bottom: 4px;
}

.lead-story figcaption {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-style: italic;
  margin-bottom: 12px;
}

.lead-story .body-text {
  font-size: 1.02rem;
  line-height: 1.55;
  column-count: 2;
  column-gap: 22px;
}

.lead-story .body-text p:first-letter {
  font-family: "Playfair Display", serif;
  font-size: 2.6rem;
  font-weight: 900;
  float: left;
  line-height: 0.8;
  padding: 4px 6px 0 0;
}

/* ---------- Category tag ---------- */

.category-tag {
  display: inline-block;
  font-size: 0.62rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: "Libre Baskerville", serif;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 2px 8px;
  transform: rotate(-1.5deg);
  margin-bottom: 6px;
}

/* ---------- Secondary stories ---------- */

.story-grid {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 18px;
  justify-content: space-between;
}

.story {
  border-top: 1px solid #c9bd98;
  padding-top: 14px;
}

.story h3 {
  font-family: "Playfair Display", serif;
  font-size: 1.18rem;
  line-height: 1.25;
  margin: 2px 0 8px;
}

.story .story-inner {
  display: flex;
  gap: 12px;
}

.story img {
  width: 108px;
  height: 84px;
  object-fit: cover;
  flex-shrink: 0;
  filter: sepia(0.35) contrast(1.05) grayscale(0.1);
  border: 1px solid #c9bd98;
}

.story .story-text p {
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 6px;
}

.source-link {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.source-link:hover {
  border-bottom-color: var(--accent);
}

/* ---------- Colophon / footer ---------- */

.colophon {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 3px double var(--rule);
  text-align: center;
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.colophon .manual-refresh {
  display: block;
  margin-top: 6px;
  font-size: 0.68rem;
  color: var(--ink-soft);
}

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .masthead h1 {
    font-size: 2.8rem;
  }

  .spread {
    flex-direction: column;
  }

  .spread::after {
    display: none;
  }

  .page {
    border-bottom: 3px double var(--rule);
  }

  .lead-story .body-text {
    column-count: 1;
  }

  .story .story-inner {
    flex-direction: column;
  }

  .story img {
    width: 100%;
    height: 160px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px 10px 40px;
  }

  .masthead {
    padding: 20px 16px 14px;
  }

  .masthead h1 {
    font-size: 2.1rem;
  }

  .masthead .tagline {
    font-size: 0.85rem;
  }

  .masthead .meta-row {
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .page {
    padding: 18px 16px 16px;
  }

  .lead-story h2 {
    font-size: 1.55rem;
  }

  .lead-story img {
    max-height: 180px;
  }

  .story h3 {
    font-size: 1.05rem;
  }
}

@media (min-width: 1600px) {
  #root {
    max-width: 1280px;
  }

  .masthead h1 {
    font-size: 4rem;
  }
}
