:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --ink: #1c2522;
  --muted: #66736d;
  --line: #ded8cb;
  --accent: #276055;
  --accent-strong: #183f38;
  --accent-soft: #dcebe4;
  --warm: #a65f2c;
  --shadow: 0 18px 45px rgba(32, 45, 39, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 28px 22px;
  background: #ebe5d8;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 24px;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-heading h2 {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  letter-spacing: 0;
}

.brand p,
.eyebrow,
.article-meta,
.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

.search-box {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 13px;
}

.search-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 96, 85, 0.16);
}

.sidebar h2 {
  margin: 20px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.nav-list,
.period-list,
.date-list,
.item-list {
  display: grid;
  gap: 8px;
}

.nav-button,
.period-button,
.date-button,
.item-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.nav-button,
.period-button,
.date-button {
  min-height: 42px;
  padding: 10px 12px;
}

.nav-button,
.period-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-button.active,
.period-button.active,
.date-button.active,
.item-button.active {
  border-color: rgba(39, 96, 85, 0.26);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.reader {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.topbar h2 {
  font-size: 30px;
  line-height: 1.18;
}

.icon-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.today-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.today-card {
  min-height: 158px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-strong);
  box-shadow: 0 8px 22px rgba(36, 45, 40, 0.07);
  cursor: pointer;
}

.today-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.35;
}

.today-card p,
.item-button p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

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

.tag {
  border-radius: 999px;
  padding: 4px 9px;
  background: #f0eee7;
  color: var(--muted);
  font-size: 12px;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.library-list,
.article-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.library-list {
  position: sticky;
  top: 28px;
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 16px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 18px;
}

.item-button {
  padding: 13px;
  background: #fbfaf5;
}

.item-button strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.35;
}

.item-button .small-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--warm);
  font-size: 12px;
}

.article-card {
  min-height: calc(100vh - 56px);
  padding: 28px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.markdown-body {
  font-size: 16px;
  line-height: 1.82;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  line-height: 1.32;
  letter-spacing: 0;
}

.markdown-body h1 {
  margin: 0 0 20px;
  font-size: 30px;
}

.markdown-body h2 {
  margin: 34px 0 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 23px;
}

.markdown-body h3 {
  margin: 24px 0 10px;
  font-size: 18px;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body table {
  margin: 0 0 16px;
}

.markdown-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  background: #eef4ee;
  color: #30413b;
}

.markdown-body code {
  border-radius: 5px;
  padding: 2px 5px;
  background: #ece7dc;
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: #eee8dc;
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
}

body.nav-open .sidebar {
  transform: translateX(0);
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    width: min(86vw, 330px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .reader {
    padding: 18px;
  }

  .icon-button {
    display: block;
    flex: 0 0 auto;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .view-mode {
    margin-left: 56px;
  }

  .newspaper-page {
    padding: 22px;
  }

  .newspaper-name {
    font-size: 38px;
  }

  .newspaper-headline {
    font-size: 29px;
  }

  .newspaper-columns {
    column-count: 1;
    column-rule: 0;
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  .library-list {
    position: static;
    max-height: none;
  }

  .article-card {
    min-height: auto;
    padding: 20px;
  }
}

@media (max-width: 620px) {
  .reader {
    padding: 14px;
  }

  .today-section {
    grid-template-columns: 1fr;
  }

  .article-card {
    padding: 16px;
  }

  .view-mode {
    width: 100%;
    margin-left: 0;
  }

  .view-mode-button {
    flex: 1 1 0;
  }

  .newspaper-page {
    padding: 16px;
  }

  .newspaper-name {
    font-size: 31px;
  }

  .newspaper-headline {
    font-size: 24px;
  }

  .newspaper-lede {
    font-size: 16px;
    text-align: left;
  }

  .markdown-body {
    font-size: 15px;
  }

  .markdown-body h1 {
    font-size: 24px;
  }

  .markdown-body h2 {
    font-size: 20px;
  }
}


.topbar-title {
  min-width: 0;
  flex: 1 1 auto;
}

.view-mode {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.view-mode-button {
  min-width: 62px;
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.view-mode-button:last-child {
  border-right: 0;
}

.view-mode-button.active {
  background: var(--accent);
  color: #fff;
}

.view-mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.newspaper-body {
  line-height: 1.64;
}

.newspaper-page {
  color: #17140f;
  background: #fffaf0;
  border: 1px solid #d7cbb7;
  padding: 30px;
  box-shadow: inset 0 0 0 1px rgba(60, 44, 27, 0.04);
}

.newspaper-kicker {
  display: flex;
  justify-content: center;
  color: #6f6252;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.newspaper-name {
  margin: 8px 0 4px;
  color: #17140f;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.newspaper-rule {
  border-top: 3px double #2c241b;
  margin: 12px 0 22px;
}

.newspaper-headline {
  margin: 0 0 18px;
  color: #17140f;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 36px;
  line-height: 1.12;
  text-align: center;
}

.newspaper-lede {
  max-width: 820px;
  margin: 0 auto 18px;
  color: #3d3428;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
  line-height: 1.68;
  text-align: center;
}

.newspaper-lede blockquote,
.newspaper-lede p {
  margin-bottom: 10px;
}

.newspaper-lead-story {
  border-top: 1px solid #2c241b;
  border-bottom: 1px solid #d7cbb7;
  margin-bottom: 20px;
  padding: 18px 0 16px;
}

.newspaper-lead-story h2,
.newspaper-section h2 {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
  color: #17140f;
  font-family: Georgia, 'Times New Roman', serif;
}

.newspaper-lead-story h2 {
  font-size: 26px;
}

.newspaper-columns {
  column-count: 2;
  column-gap: 30px;
  column-rule: 1px solid #d7cbb7;
}

.newspaper-section {
  break-inside: avoid;
  margin-bottom: 22px;
}

.newspaper-section h2 {
  font-size: 21px;
}

.newspaper-body p,
.newspaper-body li,
.newspaper-body td,
.newspaper-body th {
  font-family: Georgia, 'Times New Roman', 'Noto Serif SC', serif;
}

.newspaper-body blockquote {
  border-left-color: #8f5f2d;
  background: #f4ead8;
}

.newspaper-body table {
  white-space: normal;
}


/* Final newspaper responsive overrides */
@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .view-mode {
    margin-left: 56px;
  }

  .newspaper-page {
    padding: 22px;
  }

  .newspaper-name {
    font-size: 38px;
  }

  .newspaper-headline {
    font-size: 29px;
  }

  .newspaper-columns {
    column-count: 1;
    column-rule: 0;
  }
}

@media (max-width: 620px) {
  .view-mode {
    width: 100%;
    margin-left: 0;
  }

  .view-mode-button {
    flex: 1 1 0;
  }

  .newspaper-page {
    padding: 16px;
  }

  .newspaper-name {
    font-size: 31px;
  }

  .newspaper-headline {
    font-size: 24px;
  }

  .newspaper-lede {
    font-size: 16px;
    text-align: left;
  }
}
