/* ============================================================
   EEMT Documentation — Modern Design System
   Inspired by Stripe/Vercel docs aesthetic
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --md-primary-fg-color: #0a6847;
  --md-primary-fg-color--light: #16a34a;
  --md-primary-fg-color--dark: #064e32;
  --md-accent-fg-color: #10b981;
  --eemt-gradient: linear-gradient(135deg, #064e32 0%, #0a6847 40%, #10b981 100%);
  --eemt-surface: #f8fafb;
  --eemt-border: #e2e8f0;
  --eemt-text-secondary: #64748b;
  --eemt-radius: 0.75rem;
  --eemt-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --eemt-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --eemt-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
}

[data-md-color-scheme="slate"] {
  --eemt-surface: #1e293b;
  --eemt-border: #334155;
  --eemt-text-secondary: #94a3b8;
  --eemt-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --eemt-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --eemt-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* --- Typography --- */
.md-typeset {
  font-size: 0.82rem;
  line-height: 1.7;
}

.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
}

.md-typeset h2 {
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-top: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--eemt-border);
}

.md-typeset h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* --- Hero Section --- */
.hero-section {
  background: var(--eemt-gradient);
  border-radius: var(--eemt-radius);
  padding: 3rem 2.5rem;
  margin: -0.6rem -0.6rem 2.5rem -0.6rem;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-section p {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.15rem;
  line-height: 1.7;
  max-width: 640px;
}

.hero-section .md-button {
  margin-right: 0.75rem;
  margin-top: 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  transition: all 0.15s ease;
}

.hero-section .md-button--primary {
  background-color: white;
  color: var(--md-primary-fg-color);
  border-color: white;
}

.hero-section .md-button--primary:hover {
  background-color: rgba(255, 255, 255, 0.92);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hero-section .md-button:not(.md-button--primary) {
  color: white;
  border-color: rgba(255, 255, 255, 0.5);
}

.hero-section .md-button:not(.md-button--primary):hover {
  border-color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

[data-md-color-scheme="slate"] .hero-section {
  background: linear-gradient(135deg, #064e32 0%, #0a6847 50%, #065f46 100%);
}

/* --- Cards (Grid) --- */
.md-typeset .grid.cards > ul > li {
  border: 1px solid var(--eemt-border);
  border-radius: var(--eemt-radius);
  box-shadow: var(--eemt-shadow-sm);
  transition: all 0.2s ease;
}

.md-typeset .grid.cards > ul > li:hover {
  transform: translateY(-3px);
  box-shadow: var(--eemt-shadow-md);
  border-color: var(--md-primary-fg-color--light);
}

/* --- Equations (MathJax) --- */
.arithmatex {
  overflow-x: auto;
  padding: 0.75rem 0;
}

.MathJax {
  font-size: 1.05em !important;
}

.eemt-equation,
.equation-block {
  background-color: var(--eemt-surface);
  border-left: 3px solid var(--md-primary-fg-color);
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
  border-radius: 0 var(--eemt-radius) var(--eemt-radius) 0;
  box-shadow: var(--eemt-shadow-sm);
}

.equation-block {
  overflow-x: auto;
}

.eemt-equation .MathJax,
.equation-block .MathJax {
  font-size: 1.15em !important;
}

.equation-label {
  float: right;
  color: var(--eemt-text-secondary);
  font-size: 0.85em;
  font-style: italic;
}

/* --- Tables --- */
.md-typeset table:not([class]) {
  border: 1px solid var(--eemt-border);
  border-radius: var(--eemt-radius);
  overflow: hidden;
  box-shadow: var(--eemt-shadow-sm);
  font-size: 0.85rem;
  border-collapse: separate;
  border-spacing: 0;
}

.md-typeset table:not([class]) thead {
  background: var(--eemt-surface);
}

.md-typeset table:not([class]) th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--eemt-text-secondary);
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--eemt-border);
}

.md-typeset table:not([class]) td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--eemt-border);
}

.md-typeset table:not([class]) tbody tr:last-child td {
  border-bottom: none;
}

.md-typeset table:not([class]) tbody tr:hover {
  background-color: var(--eemt-surface);
}

.parameter-table th {
  background: var(--md-primary-fg-color) !important;
  color: white !important;
  text-transform: none !important;
  font-size: 0.82rem !important;
  letter-spacing: normal !important;
}

.parameter-table td:first-child {
  font-family: var(--md-code-font);
  font-weight: 600;
  color: var(--md-primary-fg-color);
}

/* --- Code Blocks --- */
.md-typeset pre {
  border-radius: var(--eemt-radius);
  border: 1px solid var(--eemt-border);
  box-shadow: var(--eemt-shadow-sm);
}

.highlight .filename {
  background-color: var(--md-primary-fg-color);
  color: white;
  padding: 0.5rem 1rem;
  margin-bottom: 0;
  border-radius: var(--eemt-radius) var(--eemt-radius) 0 0;
  font-family: var(--md-code-font);
  font-size: 0.78rem;
  font-weight: 500;
}

/* --- Admonitions --- */
.md-typeset .admonition,
.md-typeset details {
  border-radius: var(--eemt-radius);
  box-shadow: var(--eemt-shadow-sm);
  border: 1px solid var(--eemt-border);
  border-left-width: 3px;
}

/* --- Mermaid Diagrams --- */
.mermaid {
  background-color: var(--eemt-surface);
  border-radius: var(--eemt-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid var(--eemt-border);
}

/* --- Climate Zone Cards --- */
.climate-zone {
  border-left: 4px solid;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  border-radius: 0 var(--eemt-radius) var(--eemt-radius) 0;
  background: var(--eemt-surface);
  box-shadow: var(--eemt-shadow-sm);
}

.climate-zone.arid {
  border-color: #ef4444;
}

.climate-zone.semiarid {
  border-color: #f59e0b;
}

.climate-zone.humid {
  border-color: #10b981;
}

/* --- EEMT Range Badges --- */
.eemt-range {
  display: inline-block;
  background: linear-gradient(135deg, #0369a1, #0a6847, #d97706, #dc2626);
  color: white;
  padding: 0.35rem 0.75rem;
  border-radius: 0.4rem;
  font-family: var(--md-code-font);
  font-weight: 600;
  font-size: 0.85em;
}

.eemt-range sup {
  font-size: 0.7em;
  vertical-align: super;
  line-height: 0;
}

/* --- Capability Badges --- */
.capability-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.85rem;
  border-radius: 2rem;
  font-size: 0.82rem;
  font-weight: 500;
  margin: 0.2rem;
  border: 1px solid var(--eemt-border);
  background: var(--eemt-surface);
}

.capability-badge.docker { border-color: #0096d6; color: #0284c7; }
.capability-badge.api { border-color: #10b981; color: #059669; }
.capability-badge.web { border-color: #f59e0b; color: #d97706; }
.capability-badge.timeseries { border-color: #8b5cf6; color: #7c3aed; }

/* --- Unit Styling --- */
.unit, .unit-value {
  font-family: var(--md-code-font);
  font-size: 0.92em;
  white-space: nowrap;
}

.unit sup, .unit-value sup {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
}

.unit-inline {
  font-family: var(--md-code-font);
  background-color: var(--eemt-surface);
  padding: 0.1em 0.35em;
  border-radius: 0.25em;
  font-size: 0.88em;
  border: 1px solid var(--eemt-border);
}

/* --- Workflow Status --- */
.workflow-status {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.workflow-status.completed { background-color: #dcfce7; color: #15803d; }
.workflow-status.in-progress { background-color: #fef3c7; color: #b45309; }
.workflow-status.pending { background-color: #f1f5f9; color: #64748b; }

[data-md-color-scheme="slate"] .workflow-status.completed { background-color: rgba(16, 185, 129, 0.15); }
[data-md-color-scheme="slate"] .workflow-status.in-progress { background-color: rgba(245, 158, 11, 0.15); }
[data-md-color-scheme="slate"] .workflow-status.pending { background-color: rgba(100, 116, 139, 0.15); }

/* --- Data Source Cards --- */
.data-source-card {
  border: 1px solid var(--eemt-border);
  border-radius: var(--eemt-radius);
  padding: 1.25rem;
  margin: 1rem 0;
  transition: all 0.2s ease;
  background: var(--eemt-surface);
}

.data-source-card:hover {
  box-shadow: var(--eemt-shadow-md);
  border-color: var(--md-primary-fg-color--light);
}

.data-source-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--md-primary-fg-color);
}

.data-source-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.spec-label {
  font-weight: 600;
  color: var(--eemt-text-secondary);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

/* --- Quick Start Steps --- */
.quick-start-steps {
  counter-reset: step-counter;
}

.quick-start-steps > li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 3.25rem;
  margin-bottom: 1.75rem;
}

.quick-start-steps > li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 2rem;
  height: 2rem;
  background-color: var(--md-primary-fg-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* --- Navigation polish --- */
.md-tabs {
  border-bottom: 1px solid var(--eemt-border);
}

.md-header {
  box-shadow: var(--eemt-shadow-sm);
}

/* --- Responsive --- */
@media screen and (max-width: 76.1875em) {
  .md-nav--primary .md-nav__title {
    background-color: var(--md-primary-fg-color);
  }
}

/* --- Print --- */
@media print {
  .md-header, .md-tabs, .md-sidebar, .md-footer { display: none; }
  .md-content { margin: 0; }
  .eemt-equation, .equation-block { border: 1px solid #ccc; page-break-inside: avoid; }
}

/* --- Custom Admonition: EEMT --- */
.md-typeset .admonition.eemt {
  border-color: var(--md-primary-fg-color);
}

.md-typeset .admonition.eemt > .admonition-title {
  background-color: rgba(10, 104, 71, 0.08);
  border-color: var(--md-primary-fg-color);
}

/* --- Loading spinner --- */
.loading-spinner {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--md-primary-fg-color--light);
  border-radius: 50%;
  border-top-color: var(--md-primary-fg-color);
  animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Variable highlight --- */
.var {
  font-style: italic;
  color: var(--md-primary-fg-color);
}

/* --- Performance metric --- */
.performance-metric {
  display: inline-flex;
  align-items: center;
  background: var(--eemt-surface);
  border: 1px solid var(--eemt-border);
  border-radius: 2rem;
  padding: 0.3rem 0.85rem;
  margin: 0.2rem;
  font-size: 0.82rem;
}

.performance-metric .icon {
  margin-right: 0.3rem;
}

/* --- Home Page Features & Stats --- */
.eemt-home-features {
  padding: 2.5rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--eemt-border);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto;
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  background: var(--md-default-bg-color);
  border: 1px solid var(--eemt-border);
  border-radius: var(--eemt-radius);
  transition: all 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--eemt-shadow-lg);
  border-color: var(--md-primary-fg-color);
}

.feature-icon {
  color: var(--md-primary-fg-color);
  margin-bottom: 0.25rem;
}

.feature-card strong {
  font-size: 1rem;
  color: var(--md-default-fg-color);
}

.feature-card span {
  font-size: 0.85rem;
  color: var(--eemt-text-secondary);
  line-height: 1.5;
}

.eemt-stats-section {
  background: var(--eemt-gradient);
  padding: 3.5rem 0;
  margin-top: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 2.75rem;
  font-weight: 700;
  color: white;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.stat-label {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

[data-md-color-scheme="slate"] .eemt-stats-section {
  background: linear-gradient(135deg, #064e32 0%, #0a6847 50%, #065f46 100%);
}
