/* ==========================================
   1. VARIABLES & THEMING
   ========================================== */
:root {
  --bg-color: #0d0d0d;
  --card-bg: #121212;
  --input-bg: #18181b;
  --text-color: #e6e6e6;
  --text-dim: #cccccc;
  --muted-color: #999999;
  --border-color: #262626;
  --border-subtle: rgba(255, 255, 255, 0.15);
  
  --accent-deterministic: #4a90e2;
  --accent-conditional: #10b981;
  --accent-link: #007bff;
  --accent-focus: #3b82f6;

  --max-width-main: 840px;
  --max-width-showcase: 1200px;
}

/* ==========================================
   2. RESET & BASE LAYOUT
   ========================================== */
*, 
*::before, 
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: "Times New Roman", Times, "Baskerville", "Georgia", serif;
  font-size: 1.1rem;
  line-height: 1.6;
  padding: 2.5rem 1.25rem 4rem;
  display: flex;
  justify-content: center;
}

main {
  width: 100%;
  max-width: var(--max-width-main);
}

/* ==========================================
   3. TYPOGRAPHY & HEADERS
   ========================================== */
header {
  margin-bottom: 3.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2rem;
}

h1 {
  font-weight: 400;
  font-size: 2.1rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.subtitle {
  color: var(--muted-color);
  font-style: italic;
  font-size: 1.05rem;
}

p {
  font-family: "Georgia", "Times New Roman", Times, serif;
  color: var(--text-dim);
  margin-bottom: 1.75rem;
  margin-left: 0;
}

strong {
  color: #ffffff;
  font-weight: 600;
}

hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 3rem 0;
}

/* Document Section Headings */
.doc-section {
  margin: 3rem 0;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--accent-deterministic);
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.subsection-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

/* Document hierarchy indents & adjacencies */
.doc-section .subsection-title,
.doc-section p,
.doc-section .concept-card {
  margin-left: 0;
}

.subsection-title + p {
  margin-top: 0.5rem;
}

/* ==========================================
   4. CONCEPT CARDS & GRID LAYOUT
   ========================================== */
.concept-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 3rem 0;
}

.concept-card {
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  padding: 1.75rem;
  border-radius: 4px;
}

.concept-card h3 {
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
}

.concept-card.deterministic h3 {
  color: var(--accent-deterministic);
}

.concept-card.conditional h3 {
  color: var(--accent-conditional);
}

.concept-card p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted-color);
  margin-bottom: 1.25rem;
}

.card-link {
  display: inline-block;
  font-size: 0.95rem;
  color: var(--text-color);
  text-decoration: none;
  border-bottom: 1px solid var(--muted-color);
  margin-top: 0.5rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.card-link:hover {
  color: #ffffff;
  border-color: #ffffff;
}

/* ==========================================
   5. SHOWCASE, CHARTS & AUDIT TABLE
   ========================================== */
.showcase-container {
  width: 100%;
  max-width: var(--max-width-showcase);
  margin: 0 auto;
  padding: 0 16px;
}

.showcase-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.showcase-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.showcase-label {
  color: #9ca3af;
  font-size: 0.85rem;
}

.showcase-select {
  background: var(--input-bg);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  outline: none;
}

.showcase-select:focus {
  border-color: var(--accent-focus);
}

.showcase-chart-box {
  position: relative;
  width: 100%;
  height: 380px;
  margin-bottom: 24px;
}

.showcase-table-section {
  width: 100%;
  margin-top: 16px;
  margin-bottom: 2.5rem; /* Generous bottom spacing before text */
}

.showcase-table-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
}

.svg-container {
  width: 100%;
  margin-top: 1rem;
}

/* ==========================================
   6. UTILITIES & NAVIGATION
   ========================================== */
.back-home {
  position: absolute;
  top: 16px;
  right: 16px;
  text-decoration: none;
  color: var(--accent-link);
  font-family: sans-serif;
  font-size: 14px;
  z-index: 1000;
}

.back-home:hover {
  text-decoration: underline;
}

/* Element spacing helpers */
img + p, 
.svg-container + p,
canvas + p {
  margin-top: 1.5rem;
}

.concept-card + p {
  margin-top: 2rem;
}

/* Footer Styling */
footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

footer p,
.footer-note {
  font-size: 1rem;
  color: #888888;
  line-height: 1.5;
}

/* ==========================================
   7. MEDIA QUERIES
   ========================================== */

/* Tablet / Mobile Layout Adjustments */
@media (max-width: 680px) {
  .concept-grid {
    grid-template-columns: 1fr;
  }
}

/* Desktop & Large Screens */
@media (min-width: 768px) {
  body {
    font-size: 1.35rem;
    line-height: 1.7;
    padding-top: 4rem;
    padding-left: 1.75rem;
    padding-right: 1.75rem;
  }

  h1 {
    font-size: 2.8rem;
  }

  .subtitle {
    font-size: 1.25rem;
  }

  .concept-card h3 {
    font-size: 1.45rem;
  }

  .concept-card p {
    font-size: 1.15rem;
  }

  .card-link {
    font-size: 1.1rem;
  }
}