/* ============================================================================
   Life Beyond Earth CSS System (Web & Print PDF)
   Drake Equation Semantic Palette & Narrative Structure
   Status: Active (Scoped to data-course="life-beyond-earth")
   Last Updated: 2026-11-10
   ============================================================================ */

[data-course="life-beyond-earth"] {
  /* ========================================================================
     1. Drake Equation Semantic Palette (Narrative Structure)
     ======================================================================== */
  --drake-rate:        #e74c3c; /* Red: Star formation rate (R*) */
  --drake-rate-bg:     #fadbd8;
  --drake-planets:     #3498db; /* Blue: Planets per star (Np) */
  --drake-planets-bg:  #d6eaf8;
  --drake-habitable:   #27ae60; /* Green: Habitable zone fraction (fh) */
  --drake-habitable-bg: #d5f4e6;
  --drake-life:        #f39c12; /* Orange: Life development (fl) */
  --drake-life-bg:     #fdebd0;
  --drake-intel:       #8e44ad; /* Purple: Intelligent life (fi) */
  --drake-intel-bg:    #ebdef0;
  --drake-tech:        #16a085; /* Teal: Technological capability (fc) */
  --drake-tech-bg:     #d1f2eb;
  --drake-longevity:   #c0392b; /* Dark Red: Civilization longevity (L) */
  --drake-longevity-bg: #f5b7b1;

  /* ========================================================================
     2. Structural & Neutral Palette
     ======================================================================== */
  --color-text-main:   #2c3e50;
  --color-text-muted:  #7f8c8d;
  --color-bg-canvas:   #ffffff;
  --color-surface-sub: #ecf0f1;
  --color-border-sub:  #bdc3c7;
  --color-border-hard: #95a5a6;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  
  --line-height-body:  1.68;
  --line-height-tight: 1.25;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

[data-course="life-beyond-earth"] body {
  font-family: var(--font-sans);
  color: var(--color-text-main);
  background-color: var(--color-bg-canvas);
  line-height: var(--line-height-body);
  font-size: 16px;
}

[data-course="life-beyond-earth"] h1,
[data-course="life-beyond-earth"] h2,
[data-course="life-beyond-earth"] h3,
[data-course="life-beyond-earth"] h4 {
  color: #1a252f;
  line-height: var(--line-height-tight);
  font-weight: 700;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

[data-course="life-beyond-earth"] h1 {
  font-size: 1.9rem;
  border-bottom: 2px solid var(--drake-rate);
  padding-bottom: 0.3em;
}

[data-course="life-beyond-earth"] h2 {
  font-size: 1.5rem;
}

[data-course="life-beyond-earth"] h3 {
  font-size: 1.15rem;
}

[data-course="life-beyond-earth"] p {
  margin-bottom: 1em;
}

[data-course="life-beyond-earth"] .katex-display {
  background-color: var(--color-surface-sub);
  border-left: 4px solid var(--drake-intel);
  padding: 1rem;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
}

/* ============================================================================
   NotebookTask Components (RFC-035) - Drake Equation Themed
   ============================================================================ */

[data-course="life-beyond-earth"] .notebook-task {
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--color-border-sub);
}

[data-course="life-beyond-earth"] .notebook-task-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
}

[data-course="life-beyond-earth"] .notebook-task-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.625rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-course="life-beyond-earth"] .notebook-task[data-type="practice"] .notebook-task-header {
  background-color: var(--drake-rate-bg);
  border-bottom: 2px solid var(--drake-rate);
}

[data-course="life-beyond-earth"] .notebook-task[data-type="practice"] .notebook-task-badge {
  background-color: var(--drake-rate);
  color: white;
}

[data-course="life-beyond-earth"] .notebook-task[data-type="diagram"] .notebook-task-header {
  background-color: var(--drake-planets-bg);
  border-bottom: 2px solid var(--drake-planets);
}

[data-course="life-beyond-earth"] .notebook-task[data-type="diagram"] .notebook-task-badge {
  background-color: var(--drake-planets);
  color: white;
}

[data-course="life-beyond-earth"] .notebook-task[data-type="cer"] .notebook-task-header {
  background-color: var(--drake-habitable-bg);
  border-bottom: 2px solid var(--drake-habitable);
}

[data-course="life-beyond-earth"] .notebook-task[data-type="cer"] .notebook-task-badge {
  background-color: var(--drake-habitable);
  color: white;
}

[data-course="life-beyond-earth"] .notebook-task[data-type="derivation"] .notebook-task-header {
  background-color: var(--drake-intel-bg);
  border-bottom: 2px solid var(--drake-intel);
}

[data-course="life-beyond-earth"] .notebook-task[data-type="derivation"] .notebook-task-badge {
  background-color: var(--drake-intel);
  color: white;
}

[data-course="life-beyond-earth"] .notebook-task[data-type="flowchart"] .notebook-task-header {
  background-color: var(--drake-tech-bg);
  border-bottom: 2px solid var(--drake-tech);
}

[data-course="life-beyond-earth"] .notebook-task[data-type="flowchart"] .notebook-task-badge {
  background-color: var(--drake-tech);
  color: white;
}

/* ============================================================================
   Scientific Table Styling
   ============================================================================ */

[data-course="life-beyond-earth"] .table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--color-border-sub);
  border-radius: var(--radius-md);
  background-color: var(--color-bg-canvas);
}

[data-course="life-beyond-earth"] table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

[data-course="life-beyond-earth"] th {
  background-color: #f8f9fa;
  color: var(--color-text-main);
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--color-border-hard);
  border-right: 1px solid var(--color-border-sub);
}

[data-course="life-beyond-earth"] th:last-child {
  border-right: none;
}

[data-course="life-beyond-earth"] td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border-sub);
  border-right: 1px solid var(--color-border-sub);
}

[data-course="life-beyond-earth"] td:last-child {
  border-right: none;
}

[data-course="life-beyond-earth"] tbody tr:hover {
  background-color: rgba(39, 174, 96, 0.05);
}

/* ============================================================================
   Print Media Optimization (PDF Generation)
   ============================================================================ */

@media print {
  [data-course="life-beyond-earth"] {
    --color-text-main: #000;
    --color-bg-canvas: #fff;
  }

  [data-course="life-beyond-earth"] .notebook-task {
    page-break-inside: avoid;
    border: 1.5px solid #000;
    margin: 0.5rem 0;
  }

  [data-course="life-beyond-earth"] .notebook-task-header {
    background-color: #f0f0f0 !important;
  }

  [data-course="life-beyond-earth"] table {
    page-break-inside: avoid;
  }

  [data-course="life-beyond-earth"] th {
    background-color: #e0e0e0 !important;
    border-bottom: 2px solid #000 !important;
  }

  [data-course="life-beyond-earth"] td {
    border-bottom: 1px solid #999 !important;
  }

  [data-course="life-beyond-earth"] .katex-display {
    page-break-inside: avoid;
  }
}
