/* Design tokens (08-public-site.md §8.2.1) */
:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --ink: #09090B;
  --muted: #52525B;
  --line: #E4E4E7;
  --accent: #B91C1C;
  --accent-hover: #991B1B;
  --accent-weak: #FEF2F2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --container: 1200px;
  --gap: 24px;
  --radius: 12px;
  --touch-target: 44px;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #0B0B0D;
    --surface: #18181B;
    --ink: #FAFAFA;
    --muted: #A1A1AA;
    --line: #27272A;
    --accent: #F87171;
    --accent-hover: #FCA5A5;
    --accent-weak: rgba(248, 113, 113, 0.08);
    --shadow: none;
  }
}

html.dark {
  --bg: #0B0B0D;
  --surface: #18181B;
  --ink: #FAFAFA;
  --muted: #A1A1AA;
  --line: #27272A;
  --accent: #F87171;
  --accent-hover: #FCA5A5;
  --accent-weak: rgba(248, 113, 113, 0.08);
  --shadow: none;
}

html.light {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --ink: #09090B;
  --muted: #52525B;
  --line: #E4E4E7;
  --accent: #B91C1C;
  --accent-hover: #991B1B;
  --accent-weak: #FEF2F2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--accent-hover);
}

@media (prefers-reduced-motion: no-preference) {
  a,
  button,
  .icon-btn {
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
  }
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 1024px) {
  .container {
    padding: 0 24px;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  min-height: var(--touch-target);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  z-index: 60;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Header (§8.2.4) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  padding: 0 4px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.wordmark .dot {
  color: var(--accent);
}

.header-spacer {
  flex: 1;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch-target);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  width: 320px;
  max-width: 38vw;
}

.search:focus-within {
  border-color: var(--accent);
}

.search input {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  width: 100%;
  outline: none;
}

.search svg {
  flex: none;
  color: var(--muted);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg);
}

.search-icon-btn {
  display: none;
}

/* Theme toggle icons */
.i-sun {
  display: none;
}

.i-moon {
  display: block;
}

html.dark .i-sun {
  display: block;
}

html.dark .i-moon {
  display: none;
}

html.light .i-sun {
  display: none;
}

html.light .i-moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) .i-sun {
    display: block;
  }

  :root:not(.light) .i-moon {
    display: none;
  }
}

/* Topic nav (§8.2.4) */
.topic-nav {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topic-nav ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.topic-nav ul::-webkit-scrollbar {
  display: none;
}

.topic-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  white-space: nowrap;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.topic-nav a:hover {
  color: var(--ink);
}

.topic-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* Main content area */
main {
  padding: 8px 0 48px;
}

.page-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.2;
  margin: 16px 0 0;
}

.search-prompt {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 16px;
}

/* Source page */
.source-header {
  display: flex;
  gap: 16px;
  margin: 16px 0 24px;
  padding-bottom: 16px;
}

.source-header__logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--line);
}

.source-header__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.2;
  margin: 0;
}

.source-header__site {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  margin-top: 4px;
  font-size: 14px;
  color: var(--accent);
}

.source-header__site:hover {
  color: var(--accent-hover);
}

.source-list {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
}

.source-list__item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.source-list__item:first-child {
  border-top: 1px solid var(--line);
}

.source-list__headline {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(16px, 1.6vw, 17px);
  line-height: 1.3;
  color: var(--ink);
}

.source-list__headline:hover {
  color: var(--accent-hover);
}

.source-list__meta {
  margin-top: 6px;
  font-size: clamp(13px, 1.4vw, 14px);
  color: var(--muted);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 32px 0 16px;
}

.pagination__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  padding: 0 12px;
  font-weight: 500;
  color: var(--accent);
}

.pagination__link:hover {
  color: var(--accent-hover);
}

.pagination__status {
  font-size: 14px;
  color: var(--muted);
}

/* Ad slots (08 §8.10) */
.ad-slot {
  border: 1px dashed var(--line);
  border-radius: 8px;
  min-height: 90px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
}

.ad-slot--in-feed,
.ad-slot--horizontal {
  grid-column: 1 / -1;
  min-height: 100px;
}

.ad-slot--vertical {
  grid-column: span 1;
}

.ad-slot__inner {
  padding: 12px 16px;
  width: 100%;
}

.ad-slot__link {
  color: var(--muted);
  font-weight: 500;
}

.ad-slot__link:hover {
  color: var(--accent-hover);
}

.ad-slot__house {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
}

.ad-slot__network {
  display: block;
  letter-spacing: 0.02em;
}

/* Box grid (08 §8.2.3, §8.3) */
.box-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
  align-items: start;
}

@media (min-width: 640px) {
  .box-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap);
  }
}

@media (min-width: 1024px) {
  .box-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.news-box {
  min-width: 0;
}

.news-box.span-1 {
  grid-column: span 1;
}

.news-box.span-2,
.news-box.span-3 {
  grid-column: span 1;
}

@media (min-width: 640px) {
  .news-box.span-2,
  .news-box.span-3 {
    grid-column: span 2;
  }
}

@media (min-width: 1024px) {
  .news-box.span-2 {
    grid-column: span 2;
  }

  .news-box.span-3 {
    grid-column: span 3;
  }
}

.news-box.boxed {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 6px;
  box-shadow: var(--shadow);
}

.news-box.tinted {
  background: var(--accent-weak);
}

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

.news-box__title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(18px, 2vw, 20px);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

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

.news-box__title a:hover {
  color: var(--accent-hover);
}

.news-box__all {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
}

.news-box__all:hover {
  color: var(--accent-hover);
}

.news-box__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-box__item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.news-box__item:last-child {
  border-bottom: 0;
}

.news-box__headline {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(16px, 1.6vw, 17px);
  line-height: 1.3;
  color: var(--ink);
  display: inline;
}

.news-box__headline:hover {
  color: var(--accent-hover);
}

.news-box__headline--lead {
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.2;
}

.news-box__meta {
  margin-top: 6px;
  font-size: clamp(13px, 1.4vw, 14px);
  color: var(--muted);
}

.news-box__source {
  font-weight: 600;
  color: var(--muted);
}

.news-box__summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.news-box__empty {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

/* Lead image layout (08 §8.3.2 / §8.5) */
.news-box__lead {
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line);
}

.news-box__thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 12px;
}

.news-box__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-box__lead--text .news-box__headline--lead {
  font-size: clamp(22px, 2.4vw, 28px);
}

@media (min-width: 1024px) {
  .news-box.span-3.layout-lead_image .news-box__lead:not(.news-box__lead--text) {
    display: grid;
    grid-template-columns: 0.6fr 1fr;
    gap: 20px;
    /* align-items: center; */
  }

  .news-box.span-3.layout-lead_image .news-box__lead:not(.news-box__lead--text) .news-box__thumb {
    margin-bottom: 0;
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 24px 0;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-target);
  padding: 0 4px;
}

.site-footer a:hover {
  color: var(--accent-hover);
}

.footer-note {
  margin-left: auto;
}

/* Cookie consent */
.consent-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
}

.consent-banner--hidden {
  display: none;
}

.consent-banner__panel {
  max-width: var(--container);
  margin: 0 auto;
}

.consent-banner__title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
}

.consent-banner__body {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.consent-banner__body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.consent-settings-page__lead {
  margin: 0 0 20px;
  color: var(--muted);
  max-width: 60ch;
}

.legal-page__placeholder {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  max-width: 72ch;
}

.legal-page__intro {
  margin: 20px 0 0;
  color: var(--muted);
  max-width: 72ch;
  line-height: 1.6;
}

.legal-page__sections {
  margin-top: 28px;
  display: grid;
  gap: 24px;
  max-width: 72ch;
}

.legal-page__heading {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.legal-page__body {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-line;
}

.legal-page__footer-link {
  margin: 32px 0 0;
  max-width: 72ch;
  color: var(--muted);
}

.legal-page__footer-link a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.consent-categories {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.consent-category {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.consent-category__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.consent-category__label {
  font-weight: 600;
}

.consent-category__badge {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.consent-category__desc {
  margin: 6px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.consent-toggle {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.consent-details {
  margin: 0;
}

.consent-details__panel {
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn--secondary:hover {
  border-color: var(--muted);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn--ghost:hover {
  background: var(--accent-weak);
}

.consent-details > summary {
  list-style: none;
}

.consent-details > summary::-webkit-details-marker {
  display: none;
}

/* Mobile */
@media (max-width: 639px) {
  .search {
    display: none;
  }

  .search.is-expanded {
    display: flex;
    position: absolute;
    left: 16px;
    right: 16px;
    top: 60px;
    width: auto;
    max-width: none;
    z-index: 31;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .search-icon-btn {
    display: inline-flex;
  }

  .wordmark {
    font-size: 22px;
  }

  .header-row {
    position: relative;
  }
}
