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

body {
  background: #f4f1ea;
  color: #1a1a1a;
  font-family: 'Lora', 'Georgia', serif;
  font-size: 15px;
  line-height: 1.6;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
}

/* Masthead */
.masthead {
  text-align: center;
  padding: 10px 0 0;
}

.masthead-rule {
  border: none;
  border-top: 2px solid #1a1a1a;
  margin: 6px 0;
}

.masthead-rule + .masthead-rule {
  border-top-width: 1px;
  margin-top: -4px;
}

.masthead-top {
  display: flex;
  justify-content: space-between;
  font-family: 'IM Fell English', serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 4px 0;
}

.masthead-title {
  font-family: 'Pinyon Script', cursive;
  font-size: clamp(48px, 9vw, 90px);
  font-weight: 400;
  line-height: 1.1;
  margin: 4px 0;
  letter-spacing: 1px;
}

.masthead-subtitle {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.masthead-info {
  font-family: 'IM Fell English', serif;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 4px 0;
}

.masthead-sep {
  margin: 0 8px;
}

.weather-inline {
  letter-spacing: 0.5px;
}

/* Feed Manager */
.feed-manager {
  margin: 16px 0;
  border: 1px solid #ccc;
  background: #ece8df;
}

.feed-toggle {
  cursor: pointer;
  padding: 8px 14px;
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.feed-note {
  padding: 6px 14px;
  font-family: 'IM Fell English', serif;
  font-size: 12px;
  font-style: italic;
  color: #888;
  border-bottom: 1px dotted #ccc;
}

.feed-controls {
  padding: 12px 14px;
  border-top: 1px solid #ccc;
}

.feed-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.feed-input-row input {
  flex: 1;
  min-width: 200px;
  padding: 6px 10px;
  border: 1px solid #999;
  background: #faf8f4;
  font-family: 'Lora', serif;
  font-size: 13px;
}

.feed-input-row select {
  padding: 6px 8px;
  border: 1px solid #999;
  background: #faf8f4;
  font-family: 'Lora', serif;
  font-size: 13px;
}

.feed-input-row button, .preset-btn {
  padding: 6px 14px;
  border: 1px solid #1a1a1a;
  background: #1a1a1a;
  color: #f4f1ea;
  font-family: 'Playfair Display', serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.2s;
}

.feed-input-row button:hover, .preset-btn:hover {
  background: #444;
}

.feed-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.feed-presets-label {
  font-size: 12px;
  font-style: italic;
  color: #666;
}

.preset-btn {
  font-size: 11px;
  padding: 4px 10px;
  background: #555;
}

.reading-pace {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 0;
  border-top: 1px dotted #bbb;
}

.pace-label {
  font-family: 'IM Fell English', serif;
  font-size: 13px;
  font-style: italic;
  color: #555;
  white-space: nowrap;
}

.reading-pace select {
  padding: 5px 8px;
  border: 1px solid #999;
  background: #faf8f4;
  font-family: 'Lora', serif;
  font-size: 13px;
}

#active-feeds {
  list-style: none;
}

#active-feeds li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dotted #bbb;
  font-size: 13px;
}

#active-feeds li:last-child {
  border-bottom: none;
}

.feed-remove {
  background: none;
  border: none;
  color: #900;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 0 4px;
}

/* Sections */
.section {
  margin: 30px 0;
}

.section:first-child {
  margin-top: 0;
}

.section:first-child .section-header {
  border-top: none;
}

.section-header {
  border-top: 3px solid #1a1a1a;
  border-bottom: none;
  padding: 6px 0;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.section-header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.section-source,
.section-count {
  font-family: 'IM Fell English', serif;
  font-size: 11px;
  font-style: italic;
  color: #666;
}

.section-collapsed .articles-grid {
  display: none;
}

.section-collapsed .section-header-left,
.section-collapsed .section-count {
  opacity: 0.5;
}

.section-header:hover .section-header-left,
.section-header:hover .section-count {
  opacity: 0.7;
}

.section-collapsed .section-header:hover .section-header-left,
.section-collapsed .section-header:hover .section-count {
  opacity: 0.6;
}

/* Article Grid - newspaper column layout */
.articles-grid {
  column-count: 3;
  column-gap: 24px;
  column-rule: 1px solid #ccc;
}

@media (max-width: 900px) {
  .articles-grid { column-count: 2; }
}

@media (max-width: 600px) {
  .articles-grid { column-count: 1; }

  .section-title {
    font-size: 14px;
    letter-spacing: 1.5px;
  }

  .section-header {
    flex-wrap: wrap;
    gap: 2px;
  }

  .section-header-left {
    flex-wrap: wrap;
    gap: 4px;
  }

  .masthead-top {
    font-size: 9px;
    letter-spacing: 1px;
  }

  .masthead-info {
    font-size: 11px;
  }

  .feed-controls {
    padding: 10px;
  }
}

/* Articles */
.article {
  break-inside: avoid;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #ddd;
  overflow: hidden;
}

.article-lead {
  break-inside: avoid;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid #1a1a1a;
  column-span: all;
}

.article-lead .article-title {
  font-size: 32px;
  line-height: 1.15;
}

.article-lead .article-summary {
  font-size: 16px;
}


.article-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 4px;
}

.article-title a {
  color: #1a1a1a;
  text-decoration: none;
}

.article-title a:hover {
  text-decoration: underline;
}

.article-meta {
  font-family: 'IM Fell English', serif;
  font-size: 11px;
  color: #777;
  margin-bottom: 8px;
  font-style: italic;
}

.article-lead .article-image {
  width: 50%;
  margin: 0 auto 8px;
  display: block;
  filter: grayscale(100%) contrast(1.2);
  border: 1px solid #ccc;
}

.article:not(.article-lead) .article-thumb {
  float: left;
  width: 90px;
  height: 90px;
  object-fit: cover;
  margin: 4px 12px 8px 0;
  filter: grayscale(100%) contrast(1.2);
  border: 1px solid #ccc;
}

.article-summary {
  font-size: 14px;
  line-height: 1.65;
  text-align: justify;
  hyphens: auto;
}

.article-summary::first-letter {
  font-family: 'Playfair Display', serif;
  font-size: 280%;
  float: left;
  line-height: 0.8;
  margin-right: 6px;
  margin-top: 4px;
  font-weight: 900;
}

.article-lead .article-summary::first-letter {
  font-size: 320%;
}

/* Loading */
.loading-indicator {
  text-align: center;
  padding: 30px;
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: #888;
  font-size: 14px;
}

.loading-indicator::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #aaa;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  font-family: 'IM Fell English', serif;
  font-size: 16px;
  color: #888;
}

.empty-ornament {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Colophon */
/* About */
.about-manager {
  margin: 16px 0;
  border: 1px solid #ccc;
  background: #ece8df;
}

.about-content {
  padding: 14px;
  border-top: 1px solid #ccc;
}

.about-text {
  font-family: 'IM Fell English', serif;
  font-size: 14px;
  line-height: 1.8;
  color: #444;
  max-width: 640px;
}

.about-text p {
  margin-bottom: 10px;
}

.about-sign {
  font-family: 'Pinyon Script', cursive;
  font-size: 18px;
  color: #666;
  margin-top: 12px;
}

.colophon {
  text-align: center;
  padding: 12px 0 30px;
  font-family: 'IM Fell English', serif;
  font-size: 12px;
  font-style: italic;
  color: #999;
}

.colophon-credit {
  font-size: 10px;
  letter-spacing: 1px;
  margin-top: 2px;
  color: #bbb;
}

/* Local Empty */
.local-empty {
  text-align: center;
  padding: 24px 20px;
  font-family: 'IM Fell English', serif;
  font-size: 14px;
  font-style: italic;
  color: #888;
}

/* Edition End */
.edition-end {
  text-align: center;
  padding: 30px 0 10px;
}

.edition-end-rule {
  display: block;
  border-top: 1px solid #1a1a1a;
  margin: 0 auto 12px;
  width: 200px;
}

.edition-end-rule:last-child {
  margin: 12px auto 0;
}

.edition-end-text {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.edition-end-sub {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 13px;
  color: #888;
}

/* Share Button */
.share-btn {
  margin-left: auto;
  padding: 4px 12px;
  border: 1px solid #999;
  background: #faf8f4;
  font-family: 'IM Fell English', serif;
  font-size: 12px;
  font-style: italic;
  color: #555;
  cursor: pointer;
  transition: background 0.2s;
}

.share-btn:hover {
  background: #eee;
}

/* Bias Tags */
.bias-tag {
  display: inline-block;
  font-family: 'Playfair Display', serif;
  font-size: 9px;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.5px;
  padding: 1px 4px;
  border: 1px solid #999;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 2px;
  cursor: help;
}

.bias-L { background: #d4e4f7; color: #1a3a5c; border-color: #a0b8d0; }
.bias-LL { background: #e0ecf5; color: #2c5070; border-color: #b0c8dd; }
.bias-C { background: #e8e8e8; color: #333; border-color: #aaa; }
.bias-LR { background: #f5e0e0; color: #703030; border-color: #d0a0a0; }
.bias-R { background: #f0d0d0; color: #5c1a1a; border-color: #c09090; }

/* Bias Legend */
.bias-legend {
  padding: 8px 14px;
  border-top: 1px dotted #bbb;
  font-family: 'IM Fell English', serif;
  font-size: 12px;
  font-style: italic;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bias-legend-label {
  margin-right: 4px;
}

.bias-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-style: normal;
  font-size: 11px;
}

/* Balance Nudges */
.balance-nudges {
  border-top: 1px dotted #bbb;
  padding: 8px 0;
  margin-top: 8px;
}

.balance-nudge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-family: 'IM Fell English', serif;
  font-size: 12px;
  font-style: italic;
  color: #666;
}

.nudge-text {
  flex: 1;
}

.nudge-add {
  font-size: 10px;
  padding: 3px 8px;
  margin-left: 8px;
  white-space: nowrap;
}

/* Digest Toggle */
#digest-toggle {
  accent-color: #1a1a1a;
}

/* Print styles */
@media print {
  body {
    background: white;
    padding: 0;
    font-size: 12px;
    max-width: none;
  }

  .feed-manager,
  .share-btn,
  #digest-toggle {
    display: none !important;
  }

  .masthead {
    padding: 5px 0;
  }

  .masthead-title {
    font-size: 48px;
  }

  .section {
    margin: 15px 0;
  }

  .articles-grid {
    column-count: 2;
    column-gap: 20px;
  }

  .article {
    break-inside: avoid;
  }

  .article-lead {
    break-inside: avoid;
  }

  .article-lead .article-image {
    width: 40%;
  }

  .article:not(.article-lead) .article-thumb {
    width: 70px;
    height: 70px;
  }

  .article-lead .article-summary {
    columns: 2;
  }

  a[href]::after {
    content: none;
  }
}
