/* 
  O nară la două ore / The Two-Hour Nostril
  Design System: Aerodynamic Fluid Dynamics & Thermal Chromatography Palette
*/

:root {
  --bg-primary: #070d18;
  --bg-surface: #0f192c;
  --bg-surface-elevated: #16233b;
  --bg-surface-hover: #1e3050;
  --border-subtle: rgba(148, 163, 184, 0.15);
  --border-strong: rgba(148, 163, 184, 0.3);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Aerodynamic stream colors (Cold, fast, patent flow) */
  --stream-cyan: #38bdf8;
  --stream-cyan-glow: rgba(56, 189, 248, 0.25);
  --stream-teal: #06b6d4;
  --stream-cyan-bg: rgba(6, 182, 212, 0.1);
  
  /* Vascular thermal colors (Warm, slow, mucosal engorgement) */
  --vascular-rose: #f43f5e;
  --vascular-rose-glow: rgba(244, 63, 94, 0.25);
  --vascular-coral: #fb7185;
  --vascular-rose-bg: rgba(244, 63, 94, 0.1);
  
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Source Code Pro", Menlo, monospace;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow-cyan: 0 0 30px -5px rgba(56, 189, 248, 0.3);
  --shadow-glow-rose: 0 0 30px -5px rgba(244, 63, 94, 0.3);
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Accessibility: FM-001 strict definition */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Layout Containers */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(7, 13, 24, 0.85);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 1.25rem;
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon {
  width: 22px;
  height: 22px;
  color: var(--stream-cyan);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-surface);
  padding: 0.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.lang-btn {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--stream-cyan);
  color: var(--bg-primary);
  font-weight: 700;
}

main {
  flex: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
  width: 100%;
}

/* Article Typography */
.article-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stream-cyan);
  background: var(--stream-cyan-bg);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
}

h1.article-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 60%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

p.article-lead {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  line-height: 1.6;
  color: #e2e8f0;
  font-weight: 450;
  margin-bottom: 2rem;
}

/* Immediate Body Self-Test Card (Answer First) */
.self-test-card {
  background: linear-gradient(145deg, var(--bg-surface-elevated), var(--bg-surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin: 2rem 0 3rem;
  box-shadow: var(--shadow-subtle);
  position: relative;
  overflow: hidden;
}

.self-test-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--stream-cyan) 0%, var(--vascular-rose) 100%);
}

.test-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.test-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

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

.test-instructions {
  color: var(--text-secondary);
  font-size: 0.98rem;
  margin-bottom: 1.25rem;
}

.test-instructions ol {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
}

.test-instructions li {
  margin-bottom: 0.4rem;
}

.test-selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

.test-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.test-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

.test-btn.selected-left {
  border-color: var(--stream-cyan);
  background: var(--stream-cyan-bg);
  box-shadow: var(--shadow-glow-cyan);
}

.test-btn.selected-right {
  border-color: var(--vascular-rose);
  background: var(--vascular-rose-bg);
  box-shadow: var(--shadow-glow-rose);
}

.test-btn-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.test-btn-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.test-result-box {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.test-result-box strong {
  color: var(--text-primary);
}

/* Key Metrics Ribbon */
.metrics-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2.5rem 0;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.metric-value.cyan { color: var(--stream-cyan); }
.metric-value.rose { color: var(--vascular-rose); }
.metric-value.amber { color: var(--accent-amber); }
.metric-value.emerald { color: var(--accent-emerald); }

.metric-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Editorial Content Sections */
.section-title {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 3.5rem 0 1.25rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-number {
  font-size: 0.9rem;
  font-family: var(--font-mono);
  color: var(--stream-cyan);
  background: var(--stream-cyan-bg);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.prose {
  font-size: 1.05rem;
  color: #cbd5e1;
  margin-bottom: 1.5rem;
}

.prose p {
  margin-bottom: 1.25rem;
}

.prose strong {
  color: var(--text-primary);
}

.prose em {
  color: #e2e8f0;
  font-style: italic;
}

/* Interactive Airway & Vascular Simulator Container */
.interactive-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2.5rem 0;
  box-shadow: var(--shadow-subtle);
}

.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sim-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.sim-controls-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.ctrl-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ctrl-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--stream-cyan);
}

.ctrl-btn.active {
  background: var(--stream-cyan);
  color: var(--bg-primary);
  border-color: var(--stream-cyan);
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  background: #040810;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  aspect-ratio: 16 / 9;
  min-height: 280px;
}

canvas#airwayCanvas, canvas#olfactoryCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sim-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

.dash-pane {
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  padding: 1rem;
  border-left: 3px solid var(--border-strong);
}

.dash-pane.left-pane { border-left-color: var(--stream-cyan); }
.dash-pane.right-pane { border-left-color: var(--vascular-rose); }
.dash-pane.total-pane { border-left-color: var(--accent-emerald); }

.dash-pane-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.dash-stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.dash-stat-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.slider-group {
  margin-top: 1.25rem;
  background: var(--bg-surface-elevated);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--stream-cyan);
  height: 6px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  outline: none;
}

/* Olfactory Chromatography Widget */
.molecule-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.mol-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.mol-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

.mol-card.active {
  border-color: var(--stream-cyan);
  background: var(--stream-cyan-bg);
}

.mol-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
}

.mol-sorp {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--stream-cyan);
}

.mol-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Personal Calculator Widget */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.calc-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.calc-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  transition: border-color 0.2s ease;
}

.calc-input-wrapper:focus-within {
  border-color: var(--stream-cyan);
}

.calc-input-wrapper input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  width: 100%;
  outline: none;
}

.calc-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.calc-outputs {
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.calc-out-item {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.6rem;
}

.calc-out-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.calc-out-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.calc-out-val {
  font-size: 1.2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--stream-cyan);
}

/* Comparative Table */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

table.scientific-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  background: var(--bg-surface);
}

table.scientific-table th, table.scientific-table td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
}

table.scientific-table th {
  background: var(--bg-surface-elevated);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

table.scientific-table tr:hover td {
  background: var(--bg-surface-hover);
}

/* Footnotes & Methodology */
.methodology-box {
  margin-top: 4rem;
  padding: 1.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.methodology-box h3 {
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.methodology-box p {
  margin-bottom: 0.75rem;
}

.methodology-box p:last-child {
  margin-bottom: 0;
}

.methodology-box a {
  color: var(--stream-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Site Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background: #040810;
  padding: 2.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* Reduced Motion Mode */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  main {
    padding: 1.5rem 1rem 3.5rem;
  }
  
  .test-selectors {
    grid-template-columns: 1fr;
  }
  
  .sim-dashboard {
    grid-template-columns: 1fr;
  }
  
  .calc-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-container {
    flex-direction: column;
    align-items: flex-start;
  }
}
