@import url("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap");

:root {
  --bg-page: #e7e1d1;
  --bg-sheet: #f8f4e8;
  --bg-sheet-alt: #efe8d4;
  --bg-well: #ffffff;
  --ink: #1b1a17;
  --ink-soft: #45423a;
  --ink-faint: #7c7563;
  --ink-invert: #f8f4e8;
  --rule: #201e19;
  --rule-soft: rgba(32, 30, 25, 0.28);
  --rule-hair: rgba(32, 30, 25, 0.16);
  --accent: #8a1f11;
  --accent-soft: rgba(138, 31, 17, 0.08);
  --accent-ink: #8a1f11;
  --shadow-sheet: 0 1px 2px rgba(27, 26, 23, 0.06), 0 18px 40px -20px rgba(27, 26, 23, 0.35);
  --font-display: "Lora", Georgia, "Times New Roman", serif;
  --font-body: "PT Serif", Georgia, "Times New Roman", serif;
  --sheet-max: 1180px;
  --sheet-pad: clamp(1rem, 2.5vw, 2.25rem);
  --bg-selection: rgba(138, 31, 17, 0.16);
}

[data-theme="dark"] {
  --bg-page: #17150f;
  --bg-sheet: #221f19;
  --bg-sheet-alt: #2a2520;
  --bg-well: #1c1913;
  --ink: #d9d0bd;
  --ink-soft: #b0a790;
  --ink-faint: #7f7663;
  --ink-invert: #221f19;
  --rule: #b0a790;
  --rule-soft: rgba(217, 208, 189, 0.22);
  --rule-hair: rgba(217, 208, 189, 0.12);
  --accent: #cc9a56;
  --accent-soft: rgba(204, 154, 86, 0.12);
  --accent-ink: #dcae6d;
  --shadow-sheet: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -22px rgba(0, 0, 0, 0.55);
  --bg-selection: rgba(204, 154, 86, 0.25);
}

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

::selection {
  background-color: var(--bg-selection);
  color: inherit;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  margin: 0;
  background-color: var(--bg-page);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-container {
  max-width: var(--sheet-max);
  margin: 0 auto;
  padding: 1.25rem var(--sheet-pad) 4rem;
}

.newspaper-sheet {
  background: var(--bg-sheet);
  box-shadow: var(--shadow-sheet);
  padding: var(--sheet-pad);
}

.masthead {
  position: relative;
  text-align: center;
  padding-bottom: 0.45rem;
}

.masthead-eyebrow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.66rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 0.35rem;
}

.masthead-eyebrow-left {
  text-align: left;
}

.masthead-eyebrow-center {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  letter-spacing: 0.11em;
}

.masthead-eyebrow-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  text-align: right;
  justify-self: end;
}

#theme-toggle {
  width: auto;
  height: auto;
  padding: 0.2rem;
  color: var(--ink-faint);
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

#theme-toggle:hover {
  color: var(--accent-ink);
}

.theme-toggle-icon .sun {
  display: none;
}

.theme-toggle-icon .moon {
  display: inline-block;
}

[data-theme="dark"] .theme-toggle-icon .sun {
  display: inline-block;
}

[data-theme="dark"] .theme-toggle-icon .moon {
  display: none;
}

.masthead-brand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 0.15rem 0 0.15rem;
}

.masthead-brand-copy {
  text-align: center;
}

.masthead-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.5rem, 5vw, 3.85rem);
  letter-spacing: 0;
  margin: 0;
  line-height: 1.02;
  -webkit-text-stroke: 1.2px currentColor;
  text-shadow: 0.5px 0 0 currentColor;
}

.masthead-tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  margin: 0.15rem 0 0;
}

.masthead-cat {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.65rem;
  line-height: 1.1;
  color: var(--ink-faint);
  white-space: pre;
  display: block;
}

.masthead-rule-thick {
  border: none;
  border-top: 4px double var(--rule);
  margin: 1.1rem 0 0.32rem;
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--rule-soft);
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  position: relative;
}

.filter-options {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.filter-mobile-trigger {
  display: none;
}

.source-filter,
.interest-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  font-style: italic;
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: normal;
  margin-right: 0.6rem;
}

.filter-label::after {
  content: ":";
}

.filter-btn {
  background-color: var(--bg-sheet-alt);
  border: 1px solid var(--rule-soft);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.filter-btn:hover {
  color: var(--ink);
  background-color: var(--bg-well);
  border-color: var(--rule);
}

.filter-btn.active {
  color: var(--ink-invert);
  background-color: var(--accent);
  border-color: var(--accent);
}

.no-stories-message {
  display: none;
  text-align: center;
  padding: 3rem 1rem;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-hair);
}

.newspaper-columns {
  column-count: 3;
  column-gap: 1.6rem;
  column-rule: 1px solid var(--rule-hair);
}

.story {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin: 0 0 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule-hair);
}

.story:last-child {
  border-bottom: none;
}

.story.is-lead,
.story.is-feature {
  column-span: all;
  padding: 1.1rem 0 1rem;
  border-bottom: 1px solid var(--rule-soft);
  margin-bottom: 1.5rem;
}

.story.is-lead::before,
.story.is-feature::before {
  display: block;
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.story.is-lead::before {
  content: "• Top Story";
}

.story.is-feature::before {
  content: "• Featured";
}

.story-headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.32;
  letter-spacing: 0.005em;
  margin: 0 0 0.4rem;
}

.story-headline a {
  transition: color 0.15s ease;
}

.story-headline a:hover {
  color: var(--accent-ink);
}

.story.is-lead .story-headline {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.1;
  margin: 0 0 0.5rem;
}

.story.is-feature .story-headline {
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
}

.story:not(.is-lead):not(.is-feature) .story-headline {
  font-size: 1rem;
  line-height: 1.22;
}

.story-byline {
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}

.story-source-sep {
  margin: 0 0.35em;
}

.story-source-link {
  color: var(--accent-ink);
  border-bottom: 1px solid transparent;
}

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

.story-deck {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0 0 0.7rem;
}

.story.is-lead .story-deck,
.story.is-feature .story-deck {
  font-size: 0.98rem;
  margin: 0.15rem 0 0.85rem;
}

.story-body {
  font-size: 0.92rem;
  line-height: 1.55;
}

.story:not(.is-lead):not(.is-feature) .story-body {
  font-size: 0.9rem;
}

.story.is-lead .story-body,
.story.is-feature .story-body {
  font-size: 0.98rem;
}

.story.is-lead .story-body {
  column-count: 2;
  column-gap: 1.75rem;
}

.story-body p {
  margin: 0 0 0.6em;
}

.story-body p:last-child {
  margin-bottom: 0;
}

.story.is-lead .story-body > p:first-child::first-letter {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  float: left;
  font-size: 2.6em;
  line-height: 0.82;
  padding: 0.03em 0.08em 0 0;
  color: var(--accent-ink);
}

.edition-colophon {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 4px double var(--rule);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.edition-colophon a {
  color: var(--ink-faint);
  text-decoration: underline;
  text-decoration-color: var(--rule-soft);
  text-underline-offset: 0.15em;
}

.edition-colophon a:hover {
  color: var(--accent-ink);
}

[data-hidden="true"] {
  display: none !important;
}

@media (max-width: 1000px) {
  .newspaper-columns {
    column-count: 2;
  }
}

@media (max-width: 720px) {
  .story.is-lead .story-body {
    column-count: 1;
  }
}

@media (max-width: 640px) {
  .newspaper-columns {
    column-count: 1;
  }

  .masthead-cat {
    display: none;
  }

  .masthead-brand {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .page-container {
    padding: 0.5rem 0.5rem 4rem;
  }

  .newspaper-sheet {
    padding: 1.25rem 0.75rem;
  }

  .filter-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
  }

  .filter-label {
    font-size: 0.72rem;
  }

  .filter-mobile-trigger {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-sheet-alt);
    border: 1px solid var(--rule-soft);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    border-radius: 4px;
  }

  .filter-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    margin-top: 0.35rem;
    background-color: var(--bg-sheet);
    border: 1px solid var(--rule-soft);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.25rem;
    min-width: 130px;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
  }

  .interest-filter .filter-options {
    left: auto;
    right: 0;
  }

  .filter-group.open .filter-options {
    display: flex;
  }

  .filter-options .filter-btn {
    text-align: left;
    padding: 0.45rem 0.75rem;
    font-size: 0.72rem;
    width: 100%;
    border: none;
    background: transparent;
  }

  .filter-options .filter-btn.active {
    background-color: var(--accent);
    color: var(--ink-invert);
  }
}

@media (max-width: 480px) {
  .masthead-eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0;
  }

  .masthead-eyebrow-center {
    order: 3;
    width: 100%;
    padding-top: 0.25rem;
  }

  .masthead-eyebrow-left,
  .masthead-eyebrow-right {
    flex: 1 0 auto;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }

  * {
    print-color-adjust: exact !important;
  }

  html,
  body {
    background: var(--bg-sheet) !important;
  }

  #theme-toggle,
  .filter-bar,
  .no-stories-message {
    display: none !important;
  }

  .newspaper-sheet {
    box-shadow: none !important;
  }

  .newspaper-columns {
    column-count: 3 !important;
  }

  .story.is-lead .story-body {
    column-count: 2 !important;
  }
}
