:root {
  --primary: #f5c400;
  --primary-hover: #e6b800;
  --bg-dark: #050505;
  --bg-card: #0f0f0f;
  --bg-soft: #141414;
  --text-main: #ffffff;
  --text-body: #e0e0e0;
  --text-muted: #888888;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --section-spacing: 80px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.article-wrap {
  max-width: 720px;
  /* Slimmer for better readability */
  margin: 0 auto;
  padding: 140px 24px 100px;
}

.breadcrumbs {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumbs a:hover {
  color: var(--primary);
}

/* Article Hero */
.article-hero {
  margin-bottom: 64px;
  text-align: left;
}

.article-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #000;
  background: var(--primary);
  border-radius: 4px;
  padding: 4px 10px;
  margin-bottom: 24px;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 24px;
  font-size: 48px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero-lead {
  margin: 0;
  color: #c0c0c0;
  font-size: 20px;
  line-height: 1.6;
  font-weight: 400;
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.meta-chip {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
}

.meta-chip::before {
  content: "•";
  margin-right: 8px;
  color: var(--primary);
}

.meta-chip:first-child::before {
  display: none;
}

/* Sections & Typography */
.section {
  margin-bottom: var(--section-spacing);
}

.section h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 24px;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.section h3 {
  font-size: 22px;
  font-weight: 600;
  margin: 48px 0 16px;
  color: var(--text-main);
}

.section p {
  margin-bottom: 24px;
  color: var(--text-body);
}

.section a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: opacity 0.2s ease;
}

.section a:hover {
  opacity: 0.8;
}

/* Special Components */
.quick-summary {
  background: var(--bg-soft);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 64px;
}

.quick-summary h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--primary);
}

.toc-box {
  background: var(--bg-soft);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 64px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.toc-box h2 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
}

.toc-box ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: toc-counter;
}

.toc-box li {
  margin: 12px 0;
  display: flex;
  align-items: flex-start;
}

.toc-box li::before {
  counter-increment: toc-counter;
  content: counter(toc-counter, decimal-leading-zero);
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  opacity: 0.5;
  margin-right: 16px;
  margin-top: 6px;
  font-family: monospace;
}

.toc-box a {
  color: var(--text-body);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.toc-box a:hover {
  color: var(--primary);
  transform: translateX(4px);
}

/* Anchor offset for fixed header: stop a bit earlier than default */
.section[id] {
  scroll-margin-top: 92px;
}

.quick-summary ul,
.quick-summary ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: summary-counter;
}

.quick-summary li {
  position: relative;
  margin-bottom: 16px;
  padding-left: 36px;
  color: var(--text-body);
}

.quick-summary li::before {
  counter-increment: summary-counter;
  content: counter(summary-counter);
  position: absolute;
  left: 0;
  top: 2px;
  width: 22px;
  height: 22px;
  background: rgba(245, 196, 0, 0.1);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(245, 196, 0, 0.2);
}

/* Figures */
.figure-card {
  margin: 48px 0;
  padding: 0;
  /* Remove padding for edge-to-edge image inside border */
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-card);
  overflow: hidden;
  /* Round corners of the image */
}

.figure-card img {
  width: 100%;
  height: auto;
  display: block;
  filter: contrast(1.05);
  /* Slight pop */
  transition: transform 0.3s ease;
}

.placeholder-note {
  margin-top: 24px;
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: 14px;
}

.placeholder-note a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.figure-caption {
  padding: 20px 24px;
  font-size: 14px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border-color);
}

/* Tables */
.table-wrap {
  margin: 40px 0;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow-x: auto;
  /* Allow horizontal scroll */
  -webkit-overflow-scrolling: touch;
  /* Smooth scroll on iOS */
}

table {
  width: 100%;
  min-width: 600px;
  /* Ensure table doesn't get too squeezed */
  border-collapse: collapse;
  font-size: 15px;
}

th {
  background: rgba(255, 255, 255, 0.04);
  padding: 16px;
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-body);
}

tr:last-child td {
  border-bottom: none;
}

.data-source {
  margin-top: 48px;
  padding: 24px;
  background: var(--bg-soft);
  border: 1px solid var(--border-color);
  border-radius: 20px;
}

.data-source h3 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--text-main);
}

.data-source p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.data-source a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
}

.data-source a:hover {
  filter: brightness(1.1);
}

/* CTA & Other boxes */
.cta-box {
  margin-top: 64px;
  background: linear-gradient(135deg, rgba(245, 196, 0, 0.1), rgba(20, 20, 20, 0.4));
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 48px 32px;
  text-align: center;
}

.cta-box h3 {
  font-size: 26px;
  margin-bottom: 12px;
}

.cta-buttons {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.term-box {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  margin-top: 48px;
}

.conclusion-box {
  background: linear-gradient(135deg, rgba(245, 196, 0, 0.08), rgba(20, 20, 20, 0.4));
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
}

.conclusion-box h2 {
  margin-top: 0;
}

.conclusion-box ul {
  margin-bottom: 0;
}

.author-box {
  margin-top: 80px;
  background: linear-gradient(135deg, var(--bg-soft), rgba(245, 196, 0, 0.03));
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 40px;
  display: flex;
  gap: 32px;
  align-items: center;
}

.author-box h3 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--primary);
  font-weight: 800;
}

.author-box .author-content {
  flex: 1;
}

.author-box p {
  margin: 0;
  color: var(--text-main);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.5;
}

.author-box p strong {
  color: var(--primary);
}

.author-box p+p {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.6;
}

.author-box p a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--primary);
  color: #000;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: transform 0.2s ease, background 0.2s ease;
}

.author-box p a:hover {
  background: var(--primary-hover);
  color: #000;
  transform: translateY(-1px);
}

.author-box .author-avatar {
  width: 80px;
  height: 80px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 24px;
  color: #000;
  flex-shrink: 0;
  box-shadow: 0 8px 16px rgba(245, 196, 0, 0.2);
}

.related-links {
  margin-top: 80px;
  margin-bottom: 80px;
}

.related-links h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.related-links h2::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border-color);
}

.related-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.related-links li a {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 28px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-main);
  background: var(--bg-card);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.related-links li a:hover {
  border-color: var(--primary);
  background: rgba(245, 196, 0, 0.02);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.related-links li a::after {
  content: "READ MORE →";
  margin-top: 20px;
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.1em;
}

/* Tag Filter */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.tag-filter button {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tag-filter button:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.tag-filter button.active {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
}

.insight-card.hidden {
  display: none;
}

/* Hub Grid (Index Page) */
.hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.insight-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.insight-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.insight-card h3 {
  margin: 12px 0 16px;
  font-size: 24px;
  color: var(--text-main);
  line-height: 1.3;
}

.insight-card p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 16px;
}

.insight-link {
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
}

.insight-link::after {
  content: "→";
  margin-left: 8px;
  transition: transform 0.2s ease;
}

.insight-card:hover .insight-link::after {
  transform: translateX(4px);
}

/* Responsive */
@media (max-width: 768px) {
  .article-wrap {
    padding-top: 100px;
  }

  h1 {
    font-size: 32px;
  }

  .hero-lead {
    font-size: 18px;
  }

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

  .quick-summary,
  .section,
  .figure-card {
    margin-bottom: 48px;
  }
}
