/* ==========================================================================
   Thought Injection Introspection — Article Stylesheet
   Typography: Plus Jakarta Sans
   Layout: Wide (1040px), strictly centered with balanced margins
   Navigation: Leftmost slide-out TOC Drawer
   ========================================================================== */

:root {
  /* Color Palette - Light Theme */
  --bg-primary: #fcfcfd;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-sidebar: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: #eff6ff;
  --accent-border: #bfdbfe;
  --code-bg: #f8fafc;
  --quote-bg: #f8fafc;
  --quote-border: #3b82f6;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.09), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.08);

  /* Typography: Plus Jakarta Sans */
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, Menlo, monospace;

  /* Layout dimensions - Locked to Wide (1040px) */
  --content-max-width: 1040px;
  --header-height: 56px;
  --drawer-width: 320px;
}

body.theme-dark {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-subtle: #1f2937;
  --bg-sidebar: #111827;
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --border-subtle: #1f2937;
  --border-strong: #374151;
  --accent-primary: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-subtle: rgba(37, 99, 235, 0.15);
  --accent-border: #1e40af;
  --code-bg: #111827;
  --quote-bg: #111827;
  --quote-border: #60a5fa;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.74;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: -0.012em;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(to right, #2563eb, #8b5cf6);
  width: 0%;
  z-index: 2000;
  transition: width 0.08s ease-out;
}

/* ==========================================================================
   Top Navigation
   ========================================================================== */

.top-nav {
  position: sticky;
  top: 0;
  z-index: 500;
  height: var(--header-height);
  background-color: rgba(252, 252, 253, 0.94);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.theme-dark .top-nav {
  background-color: rgba(11, 15, 25, 0.94);
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.nav-brand-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.version-switch {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-surface);
}

.version-link {
  min-width: 2.2rem;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}

.version-link:hover,
.version-link:focus-visible {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.version-link.is-active {
  color: var(--bg-primary);
  background: var(--text-primary);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.8rem;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.toc-trigger-btn {
  background: var(--accent-subtle);
  color: var(--accent-primary);
  border-color: var(--accent-border);
}

.toc-trigger-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
}

body.theme-light .theme-icon-light { display: inline; }
body.theme-light .theme-icon-dark { display: none; }
body.theme-dark .theme-icon-light { display: none; }
body.theme-dark .theme-icon-dark { display: inline; }

/* ==========================================================================
   Sliding Left Table of Contents Drawer
   ========================================================================== */

.toc-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--drawer-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.toc-drawer.open {
  transform: translateX(0);
}

.toc-drawer-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.toc-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.toc-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.toc-close-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.toc-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.15rem 2rem 1.15rem;
}

.toc-scroll-area::-webkit-scrollbar {
  width: 4px;
}
.toc-scroll-area::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 4px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc-item {
  font-size: 0.8rem;
  line-height: 1.4;
}

.toc-item.toc-level-1 {
  font-weight: 600;
  margin-top: 0.45rem;
}

.toc-item.toc-level-2 {
  padding-left: 0.75rem;
  font-weight: 400;
}

.toc-item.toc-level-3 {
  padding-left: 1.45rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.toc-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
  display: block;
}

.toc-link:hover {
  color: var(--accent-primary);
}

.toc-link.active {
  color: var(--accent-primary);
  font-weight: 700;
}

/* Semi-transparent Backdrop */
.toc-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.toc-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   Main Article Layout — Wide & Strictly Centered
   ========================================================================== */

.article-layout {
  width: 100%;
  margin: 0 auto;
  padding: 2.75rem 1.5rem 4rem 1.5rem;
  display: flex;
  justify-content: center;
}

.article-main {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.article-content {
  width: 100%;
  max-width: 100%;
}

/* ==========================================================================
   Article Header
   ========================================================================== */

.article-header {
  margin-bottom: 2.75rem;
  text-align: left;
  width: 100%;
}

.header-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
}

.article-version {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.article-tag {
  background: var(--accent-subtle);
  color: var(--accent-primary);
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.72rem;
}

.article-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
}

.article-lead {
  font-size: 1.16rem;
  line-height: 1.55;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.ai-disclosure-banner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  margin-bottom: 1.75rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.ai-disclosure-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.ai-disclosure-icon {
  flex-shrink: 0;
  margin-top: 0.18rem;
  color: var(--text-muted);
}

.ai-disclosure-text {
  flex: 1;
}

.ai-disclosure-banner strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Early Publishing Disclosure Details (nested within banner) */
.early-publishing-details {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.early-publishing-details:hover {
  border-color: var(--border-strong);
}

.early-publishing-details[open] {
  border-color: var(--accent-border);
}

.early-publishing-summary {
  padding: 0.5rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  transition: background-color 0.15s ease, color 0.15s ease;
  list-style: none;
}

.early-publishing-summary::-webkit-details-marker {
  display: none;
}

.early-publishing-summary:hover {
  color: var(--text-primary);
  background: var(--accent-subtle);
}

.early-publishing-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.early-publishing-title svg {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.early-publishing-details .details-chevron {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.early-publishing-details[open] .details-chevron {
  transform: rotate(180deg);
}

.early-publishing-body {
  padding: 0.75rem 0.95rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.early-publishing-body p {
  margin: 0;
}

.early-publishing-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, var(--border-strong), var(--border-subtle), transparent);
}

/* ==========================================================================
   Headings & Sections
   ========================================================================== */

.section-heading {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

h2.section-heading {
  font-size: 1.72rem;
  line-height: 1.28;
  margin-top: 3.25rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
}

h3.section-heading {
  font-size: 1.3rem;
  line-height: 1.35;
  margin-top: 2.4rem;
  margin-bottom: 0.85rem;
}

h4.section-heading {
  font-size: 1.06rem;
  line-height: 1.4;
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
}

.heading-anchor {
  position: absolute;
  left: -1.35rem;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  font-weight: 400;
}

.section-heading:hover .heading-anchor {
  opacity: 1;
}

/* ==========================================================================
   Typography & Inline Elements
   ========================================================================== */

.article-para {
  margin-bottom: 1.3rem;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-primary);
}

a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

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

a.internal-link {
  color: var(--text-primary);
  font-weight: 600;
  background: var(--bg-subtle);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border-bottom: 1px dashed var(--border-strong);
  text-decoration: none;
}

a.internal-link:hover {
  background: var(--accent-subtle);
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

strong {
  font-weight: 700;
  color: var(--text-primary);
}

em {
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background-color: var(--code-bg);
  color: var(--text-primary);
  padding: 0.15em 0.35em;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

/* Blockquotes */
.article-quote {
  margin: 1.75rem 0;
  padding: 1.15rem 1.4rem;
  background-color: var(--quote-bg);
  border-left: 4px solid var(--quote-border);
  border-radius: 0 8px 8px 0;
  box-shadow: var(--shadow-sm);
}

.article-quote p {
  font-size: 1.08rem;
  line-height: 1.62;
  color: var(--text-primary);
  font-style: italic;
  margin-bottom: 0;
}

/* Lists */
.article-list, .article-sublist {
  margin: 1.15rem 0 1.35rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.article-sublist {
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
}

.article-list li {
  font-size: 1.03rem;
  line-height: 1.68;
}

/* Math Display */
.math-display {
  margin: 1.85rem 0;
  padding: 1.15rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow-x: auto;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Foldable Quick Links Drawer
   ========================================================================== */

.foldable-quick-links {
  margin: 2.2rem 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.foldable-quick-links:hover {
  border-color: var(--border-strong);
}

.foldable-quick-links[open] {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
}

.quick-links-summary {
  padding: 0.85rem 1.15rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-subtle);
  transition: background-color 0.15s ease;
  list-style: none;
}

.quick-links-summary::-webkit-details-marker {
  display: none;
}

.quick-links-summary:hover {
  background: var(--accent-subtle);
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.summary-icon {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.quick-links-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-surface);
  color: var(--accent-primary);
  border: 1px solid var(--accent-border);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.summary-arrow {
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.foldable-quick-links[open] .summary-arrow {
  transform: rotate(180deg);
}

.quick-links-body {
  padding: 1.1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.quick-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  margin: 0;
  padding: 0;
}

.quick-link-anchor {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.15rem;
  transition: color 0.15s ease;
}

.quick-link-anchor:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.quick-link-line {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

/* ==========================================================================
   Centered Figures & Captions
   ========================================================================== */

.article-figure {
  margin: 2.5rem auto;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.figure-image-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.figure-image-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.figure-img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  opacity: 0;
  backdrop-filter: blur(4px);
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.figure-image-wrapper:hover .zoom-hint {
  opacity: 1;
}

.figure-image-wrapper:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 4px;
}

.figure-caption {
  margin-top: 0.85rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-secondary);
  text-align: center;
  max-width: 92%;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   Interactive Callout Cards (Contextual Links to Atlases)
   ========================================================================== */

.interactive-callout {
  margin: 2.5rem 0;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04), rgba(59, 130, 246, 0.08));
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.interactive-callout:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.callout-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.callout-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-primary);
}

.callout-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.callout-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.callout-button {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  background: var(--accent-primary);
  color: #ffffff !important;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none !important;
  transition: background 0.15s ease;
}

.callout-button:hover {
  background: var(--accent-hover);
}

/* Interactive Grid in Appendix */
.interactive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0 2.5rem 0;
}

.atlas-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  text-decoration: none !important;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.atlas-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.atlas-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.atlas-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--accent-subtle);
  color: var(--accent-primary);
}

.atlas-arrow {
  font-size: 1.1rem;
  color: var(--accent-primary);
  transition: transform 0.15s ease;
}

.atlas-card:hover .atlas-arrow {
  transform: translateX(3px);
}

.atlas-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.atlas-card-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 1.85rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface);
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.55;
}

.article-table th {
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-weight: 700;
  padding: 0.75rem 0.95rem;
  border-bottom: 2px solid var(--border-strong);
}

.article-table td {
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
}

.article-table tbody tr:last-child td {
  border-bottom: none;
}

.article-table tbody tr:hover {
  background-color: var(--bg-subtle);
}

/* ==========================================================================
   Code Blocks
   ========================================================================== */

.code-block-wrapper {
  width: 100%;
  margin: 1.85rem 0;
  background-color: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.9rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-body);
}

.code-lang-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.copy-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-code-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.code-block-wrapper pre {
  margin: 0;
  padding: 1.15rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  max-height: 480px;
}

.code-block-wrapper code {
  border: none;
  padding: 0;
  background: transparent;
  color: inherit;
}

/* ==========================================================================
   Lightbox Modal
   ========================================================================== */

.lightbox-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lightbox-modal.active {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 6px;
  background-color: #ffffff;
  box-shadow: var(--shadow-xl);
}

.lightbox-caption-text {
  margin-top: 0.85rem;
  color: #f8fafc;
  font-family: var(--font-body);
  font-size: 0.88rem;
  max-width: 820px;
  text-align: center;
  line-height: 1.45;
}

.lightbox-close {
  position: absolute;
  top: -2.25rem;
  right: 0;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.4rem;
  line-height: 1;
}

/* ==========================================================================
   Back to Top
   ========================================================================== */

.back-to-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 90;
}

.back-to-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
}

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

/* ==========================================================================
   Footer
   ========================================================================== */

.article-footer {
  margin-top: 3.5rem;
  padding-bottom: 3rem;
  width: 100%;
}

.footer-divider {
  height: 1px;
  background: var(--border-subtle);
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 900px) {
  .nav-brand-title {
    display: none;
  }

  .nav-container {
    padding: 0 1rem;
  }

  .article-title {
    font-size: 2rem;
  }

  h2.section-heading {
    font-size: 1.5rem;
  }

  .interactive-callout {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  html {
    font-size: 15px;
  }

  .article-title {
    font-size: 1.75rem;
  }

  .article-lead {
    font-size: 1.05rem;
  }

  .article-layout {
    padding: 1.5rem 1rem 3rem 1rem;
  }

  .back-to-top-btn {
    bottom: 1.25rem;
    right: 1.25rem;
  }
}
