/* ============================================================
   GLOBAL RESET, BASE, & FLEXIBLE LAYOUT
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #1a1a1a;
  color: #1e1e2a;
  line-height: 1.6;
  scroll-behavior: smooth;
  max-width: 100%;
  margin: 0;
  padding: 2rem 10px;  /* Tiny, flexible 10px fixed margin to the edge of the screen */
}

/* BACKGROUND VIDEO LAYER (FIXED, FULL SCREEN) */
#video-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

#intro-video {
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  background-color: #000;
}

/* STRUCTURAL CONTENT CONTAINERS (FULL WIDTH) */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 2rem 0 4rem;
}

main {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 2rem 0;
}

/* CENTRAL HUB SPECIFIC HEADINGS & LISTS */
main h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: #f8fafc;
  text-align: center;
}

.chapter-list {
  list-style: none;
  padding: 0;
  width: 100%;
}

.chapter-item {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid #475569;
  padding: 1.5rem;
  margin-bottom: 1rem;
  border-radius: 1rem;
  transition: transform 0.2s;
  width: 100%;
}

.chapter-item:hover {
  transform: scale(1.01);
}

.chapter-item a {
  text-decoration: none;
  color: #f0b86e;
  font-weight: 600;
  font-size: 1.2rem;
}

.chapter-desc {
  color: #cbd5e1;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* NAVIGATION HEADER */
.top-header {
  position: relative;
  background: rgba(255, 255, 255, 0.73);
  backdrop-filter: blur(4px);
  border-radius: 3rem;
  padding: 1rem 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(235, 233, 228, 0.8);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: #4a3f2e;
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #b2773c;
}

.theme-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #e2d9cd;
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font-size: 1.2rem;
  display: grid;
  place-items: center;
  transition: transform 0.2s;
}

.theme-toggle-btn:hover {
  transform: scale(1.05);
}

/* MONOGRAPH FRAMEWORK LAYOUT */
.chapter-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(2px);
  border-radius: 2rem;
  padding: 3rem;
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(235, 233, 228, 0.8);
  margin-bottom: 2rem;
  width: 100%;
}

.chapter-meta {
  font-size: 0.85rem;
  font-weight: 700;
  color: #a8713a;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

h1.chapter-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1e1e2a;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.hero-tagline {
  font-size: 1.2rem;
  font-weight: 500;
  color: #7b6b54;
  border-left: 3px solid #c9ad7a;
  padding-left: 1rem;
  margin-bottom: 2.5rem;
}

/* EXEGESIS PROSE TYPOGRAPHY */
.prose-section {
  font-size: 1.05rem;
  color: #2e2d2c;
  margin-bottom: 2rem;
}

.prose-section p {
  margin-bottom: 1.5rem;
  text-align: justify;
}

h2.section-heading {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  color: #1e1e2a;
  border-bottom: 1px solid #e4dbcf;
  padding-bottom: 0.4rem;
}

/* LISTS INSIDE PROSE SECTION */
.prose-section ul, 
.prose-section ol {
  margin: 1rem 0 1rem 2rem;
}

.prose-section li {
  margin-bottom: 0.5rem;
}

/* MATHEMATICAL BREAKOUT BLOCKS */
.math-container {
  background: rgba(250, 247, 242, 0.85);
  border: 1px solid #e7dfd2;
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  width: 100%;
}

.math-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #7b6b54;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.canonical-box {
  border-left: 4px solid #c6a15b;
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

/* METRIC CONVERSION GRID COMPONENT */
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
  width: 100%;
}

.metric-card {
  background: rgba(254, 252, 247, 0.95);
  border: 1px solid #eee7df;
  border-radius: 1rem;
  padding: 1.5rem;
}

.metric-card h3 {
  font-size: 1.1rem;
  color: #a8713a;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.metric-card p {
  font-size: 0.95rem;
  color: #2e2d2c;
  text-align: left !important;
  margin-bottom: 0;
}

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

/* EPISTEMIC ALERT/NOTE BOX */
.epistemic-note {
  background: rgba(255, 246, 234, 0.95);
  padding: 1.2rem 1.5rem;
  border-radius: 1rem;
  margin: 2rem 0;
  font-size: 0.95rem;
  border-left: 4px solid #c6a15b;
  width: 100%;
}

/* TABLE STYLES */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1rem;
  overflow: hidden;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e7dfd2;
}

th {
  background: rgba(168, 113, 58, 0.15);
  color: #a8713a;
  font-weight: 600;
}

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

/* CONTACT & FOOTER */
.contact-mini {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.85rem;
  color: #e0e0e0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  padding: 0.8rem 1.5rem;
  border-radius: 2rem;
  width: fit-content;
  margin: 2rem auto 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.contact-mini a {
  color: #e0e0e0;
  text-decoration: none;
  font-weight: 500;
}

.contact-mini a:hover {
  color: #f0b86e;
  text-decoration: underline;
}

footer {
  text-align: center;
  color: #ffffff;
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* ============================================================
   DARK MODE OVERRIDES
   ============================================================ */
[data-theme="dark"] body {
  background: transparent;
}

[data-theme="dark"] .chapter-item {
  background: rgba(15, 23, 42, 0.8);
  border-color: #334155;
}

[data-theme="dark"] .chapter-item a {
  color: #f0b86e;
}

[data-theme="dark"] .chapter-desc {
  color: #94a3b8;
}

[data-theme="dark"] main h1 {
  color: #e0f0ff;
}

[data-theme="dark"] .top-header,
[data-theme="dark"] .chapter-card {
  background: rgba(30, 41, 59, 0.85) !important;
  border-color: #475569 !important;
  color: #e5e7eb;
}

[data-theme="dark"] h1.chapter-title,
[data-theme="dark"] h2.section-heading {
  color: #f8fafc;
}

[data-theme="dark"] h2.section-heading {
  border-bottom-color: #334155;
}

[data-theme="dark"] .hero-tagline {
  color: #cbd5e1;
  border-left-color: #f0b86e;
}

[data-theme="dark"] .prose-section {
  color: #d1d5db;
}

[data-theme="dark"] .math-container {
  background: rgba(15, 23, 42, 0.6);
  border-color: #334155;
}

[data-theme="dark"] .math-label {
  color: #94a3b8;
}

[data-theme="dark"] .canonical-box {
  background: rgba(30, 41, 59, 0.95);
  border-left-color: #f0b86e;
}

[data-theme="dark"] .epistemic-note {
  background: rgba(30, 42, 58, 0.95);
  color: #e2e8f0;
  border-left-color: #f0b86e;
}

[data-theme="dark"] .top-header .nav-links a {
  color: #cbd5e1;
}

[data-theme="dark"] .top-header .nav-links a:hover {
  color: #f0b86e;
}

[data-theme="dark"] .theme-toggle-btn {
  background: rgba(21, 27, 43, 0.9);
  border-color: #475569;
  color: #cbd5e1;
}

[data-theme="dark"] .contact-mini {
  background: rgba(0, 0, 0, 0.8);
  border-color: #475569;
}

[data-theme="dark"] .metric-card {
  background: rgba(15, 23, 42, 0.5);
  border-color: #334155;
}

[data-theme="dark"] .metric-card h3 {
  color: #f0b86e;
}

[data-theme="dark"] .metric-card p {
  color: #cbd5e1;
}

[data-theme="dark"] table {
  background: rgba(30, 41, 59, 0.95);
}

[data-theme="dark"] th, 
[data-theme="dark"] td {
  border-bottom-color: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] th {
  background: rgba(240, 184, 110, 0.15);
  color: #f0b86e;
}