/* ===== Variables ===== */
:root {
  --bg: #F4F4F6;
  --surface: #FFFFFF;
  --surface-2: #FAFAFB;
  --border: #E4E4E8;
  --text: #17171A;
  --text-2: #3F3F46;
  --text-dim: #71717A;
  --brand: #1F5AD6;
  --brand-ink: #FFFFFF;
  --brand-soft: #EAF1FD;
  --cat-politics: #DC2626;
  --cat-tech: #2563EB;
  --cat-finance: #15803D;
  --cat-science: #7C3AED;
  --cat-all: #1F5AD6;
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.05);
  --shadow-h: 0 10px 30px -10px rgba(20, 20, 40, 0.18);
  --page-gutter: clamp(16px, 4vw, 28px);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #121316;
  --surface: #1A1B1F;
  --surface-2: #202126;
  --border: #2A2C32;
  --text: #F2F2F4;
  --text-2: #C7C7CC;
  --text-dim: #9A9AA2;
  --brand: #6FA1FF;
  --brand-ink: #0E1320;
  --brand-soft: rgba(111, 161, 255, 0.15);
  --cat-politics: #F87171;
  --cat-tech: #5B9BFF;
  --cat-finance: #4ADE80;
  --cat-science: #C4B5FD;
  --cat-all: #6FA1FF;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-h: 0 12px 32px -10px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

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

body {
  margin: 0;
}

::selection {
  background: var(--brand);
  color: #fff;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.nb-shell {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-2);
  font-family: "Source Sans 3", -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

.nb-brand-accent {
  color: var(--brand);
}

/* ===== Header ===== */
.nb-site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.nb-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 13px var(--page-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nb-header-inner--article {
  max-width: 760px;
}

.nb-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nb-logo-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-soft);
  flex-shrink: 0;
}

.nb-logo-text {
  font-family: "Source Serif 4", serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.nb-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nb-back-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.nb-back-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.nb-theme-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.nb-theme-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

[data-theme-icon-dark][hidden],
[data-theme-icon-light][hidden] {
  display: none;
}

/* ===== Navbar ===== */
.nb-navbar {
  border-top: 1px solid var(--border);
}

.nb-navbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--page-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nb-navbar-scroll {
  display: flex;
  gap: 22px;
  overflow-x: auto;
}

.nb-navbar-scroll::-webkit-scrollbar {
  height: 0;
  width: 0;
}

.nb-nav-tab {
  font-family: "Source Sans 3", sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  padding: 13px 1px;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  color: var(--text-dim);
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nb-nav-tab:hover {
  color: var(--text);
}

.nb-nav-tab.is-active {
  font-weight: 700;
  border-bottom-color: var(--brand);
  color: var(--text);
}

.nb-view-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  flex-shrink: 0;
}

.nb-view-btn {
  font-family: "Source Sans 3", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nb-view-btn.is-active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow);
}

/* ===== Main & footer ===== */
.nb-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 34px) var(--page-gutter) 72px;
}

.nb-main--article {
  max-width: 760px;
  padding: clamp(26px, 4vw, 44px) var(--page-gutter) 72px;
}

.nb-site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.nb-site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px var(--page-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.nb-site-footer-tagline {
  font-family: "Source Serif 4", serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-2);
}

.nb-site-footer-links {
  display: flex;
  gap: 20px;
  font-size: 13.5px;
}

.nb-site-footer-links a {
  color: var(--text-dim);
  text-decoration: none;
}

.nb-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--brand);
  z-index: 40;
  transition: width 0.08s linear;
}

/* ===== Typography & badges ===== */
.nb-serif {
  font-family: "Source Serif 4", serif;
}

.nb-page-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.nb-page-title {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.nb-page-subtitle {
  font-size: 14px;
  color: var(--text-dim);
}

.nb-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.nb-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 4px 9px;
  border-radius: 5px;
}

.nb-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.nb-meta--sm {
  font-size: 13px;
}

.nb-meta-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.nb-meta-strong {
  font-weight: 600;
  color: var(--text-2);
}

.nb-time {
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ===== Source logos ===== */
.nb-source-logo {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

/* ===== Feed cards ===== */
.nb-lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 3.5vw, 30px);
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(20px, 3vw, 36px);
  animation: fadeUp 0.45s ease both;
}

.nb-lead-body {
  display: flex;
  flex-direction: column;
}

.nb-lead-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.nb-title-link {
  text-decoration: none;
}

.nb-title-link h1,
.nb-title-link h2 {
  transition: color 0.15s ease;
}

.nb-title-link:hover h1,
.nb-title-link:hover h2 {
  color: var(--brand);
}

.nb-lead-title {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}

.nb-card-title {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}

.nb-lead-meta {
  margin-top: 14px;
}

.nb-btn-primary {
  margin-top: 20px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nb-btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.nb-lead-sidebar {
  border-left: 1px solid var(--border);
  padding-left: clamp(20px, 3vw, 32px);
}

.nb-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.nb-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 18px;
}

.nb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  height: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.nb-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-h);
  border-color: var(--brand);
}

.nb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nb-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 15px;
}

/* ===== Story body ===== */
.nb-story-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.nb-story-list--compact {
  gap: 10px;
}

.nb-story-item {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.nb-story-item--compact {
  gap: 10px;
}

.nb-story-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 8px;
}

.nb-story-dot--compact {
  width: 5px;
  height: 5px;
}

.nb-story-text {
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--text-2);
}

.nb-story-text--compact {
  font-size: 14.5px;
}

.nb-story-empty {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

.nb-story-paragraphs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nb-story-paragraphs--compact {
  gap: 10px;
}

.nb-story-paragraph {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--text-2);
}

.nb-story-paragraph--compact {
  font-size: 14px;
  line-height: 1.6;
}

/* ===== Article detail ===== */
.nb-article {
  animation: fadeUp 0.45s ease both;
}

.nb-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 18px;
}

.nb-article-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.nb-read-time {
  font-size: 13px;
  color: var(--text-dim);
}

.nb-article-title {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: clamp(28px, 5.2vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}

.nb-article-byline {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-dim);
}

.nb-tldr {
  margin-top: 26px;
  background: var(--brand-soft);
  border-radius: 12px;
  padding: clamp(18px, 3.5vw, 26px);
  border-left: 4px solid var(--brand);
}

.nb-tldr-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 15px;
}

.nb-tldr-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.nb-tldr-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.nb-tldr-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 8px;
}

.nb-tldr-text {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  font-weight: 500;
}

.nb-tldr-empty {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-dim);
}

.nb-divider-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 34px 0 20px;
}

.nb-divider-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.nb-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.nb-prose {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nb-prose p {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: clamp(17px, 2.5vw, 18px);
  line-height: 1.72;
  color: var(--text-2);
  text-wrap: pretty;
}

.nb-prose-empty {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 17px;
  line-height: 1.72;
  color: var(--text-dim);
}

.nb-read-original {
  margin-top: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nb-read-original:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-h);
}

.nb-read-original-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.nb-read-original-domain {
  font-size: 12.5px;
  opacity: 0.8;
}

.nb-read-original-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nb-share {
  margin-top: 32px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.nb-share-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.nb-share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.nb-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  font-family: "Source Sans 3", sans-serif;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.nb-share-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.nb-share-reddit:hover {
  border-color: #FF4500;
  color: #FF4500;
}

.nb-share-x:hover {
  border-color: var(--text);
  color: var(--text);
}

.nb-related-section {
  margin-top: 46px;
}

.nb-related-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
}

.nb-related-title {
  font-family: "Source Serif 4", serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.nb-related-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nb-related-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nb-related-card:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow-h);
}

.nb-related-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.nb-related-story-title {
  font-family: "Source Serif 4", serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

.nb-related-chevron {
  flex-shrink: 0;
}

.nb-article-footer {
  margin-top: 46px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.nb-back-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}
