:root {
  color-scheme: light;
  --ink: #27231f;
  --muted: #6b6258;
  --line: rgba(64, 54, 43, 0.18);
  --surface: rgba(255, 252, 246, 0.92);
  --surface-strong: #fffaf0;
  --leaf: #4f6f42;
  --maple: #b9472f;
  --gold: #f6b24b;
  --blue: #496b7a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(120deg, #fffaf0 0%, #f4eee4 38%, #edf4f3 70%, #f7efe8 100%),
    repeating-linear-gradient(90deg, rgba(79, 111, 66, 0.08), rgba(79, 111, 66, 0.08) 1px, transparent 1px, transparent 8px);
}

body.theme-winter {
  --ink: #102a43;
  --muted: #526d82;
  --line: rgba(70, 133, 172, 0.24);
  --surface: rgba(248, 253, 255, 0.94);
  --surface-strong: #ffffff;
  --leaf: #68b8de;
  --maple: #357da8;
  --gold: #b8e7f7;
  --blue: #225b84;
  background:
    radial-gradient(circle at 15% 12%, rgba(255,255,255,.96) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 24%, rgba(255,255,255,.85) 0 3px, transparent 4px),
    linear-gradient(135deg, #eef9ff 0%, #d8ecf7 43%, #f9fdff 72%, #c8e3f2 100%);
  background-size: 86px 86px, 128px 128px, auto;
}

body.theme-winter .news-card,
body.theme-winter .source-row,
body.theme-winter .legal-panel,
body.theme-winter .empty-state {
  background: linear-gradient(145deg, rgba(255,255,255,.95), rgba(189,228,246,.42));
  box-shadow: inset 0 1px 0 #fff, 0 16px 38px rgba(34,91,132,.13);
}

body.theme-winter .top-nav a,
body.theme-winter .category-nav a,
body.theme-winter .source-link {
  background: linear-gradient(135deg, #fff, rgba(210,237,249,.86));
}

body.theme-winter .site-header::after {
  content: "❄";
  color: rgba(53,125,168,.45);
  font-size: 28px;
  transform: rotate(12deg);
}

a {
  color: #315f66;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.site-header,
.site-footer,
.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 270px;
  max-width: calc(100vw - 136px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(64, 54, 43, 0.14));
}

.top-nav,
.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.top-nav a,
.category-nav a,
.source-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(255, 252, 246, 0.96), rgba(243, 236, 225, 0.78));
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 8px 22px rgba(64, 54, 43, 0.08);
}

.top-nav a:hover,
.category-nav a:hover,
.source-link:hover {
  border-color: rgba(185, 71, 47, 0.34);
}

.ticker {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 20px;
  padding: 30px 0 24px;
  border-top: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 40px;
}

.news-card,
.source-row,
.legal-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, var(--surface), rgba(246, 178, 75, 0.14)),
    linear-gradient(90deg, rgba(79, 111, 66, 0.12), rgba(73, 107, 122, 0.10), rgba(185, 71, 47, 0.10));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 14px 34px rgba(64, 54, 43, 0.10);
}

.news-card {
  overflow: hidden;
}

.news-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, var(--leaf), var(--blue), var(--gold));
}

.news-body {
  padding: 16px;
}

.news-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.news-card h2 {
  margin: 12px 0 10px;
  font-size: 20px;
  line-height: 1.18;
  letter-spacing: 0;
}

.news-card h2 a {
  color: var(--ink);
}

.news-card p {
  margin: 0 0 14px;
  color: #39342f;
  line-height: 1.48;
}

.legal-panel {
  margin: 26px 0 40px;
  padding: 28px;
}

.legal-panel h1 {
  margin-bottom: 18px;
}

.legal-panel p {
  max-width: 820px;
  line-height: 1.6;
}

.xml-preview {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  max-height: 62vh;
  margin: 22px 0 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  color: #2f2a26;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.48;
  white-space: pre;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.source-row {
  padding: 16px;
}

.source-row h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.source-error {
  color: #9f3b2e;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 22px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.footer-line {
  max-width: 100%;
}

@media (max-width: 900px) {
  .ticker {
    grid-template-columns: 1fr;
  }

  .news-grid,
  .source-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-logo {
    width: min(246px, 100%);
    max-width: 100%;
  }
}
