:root {
  --bg-deep: #070a13;
  --bg-surface: #0e1424;
  --bg-card: #141c30;
  --bg-card-hover: #1a2540;
  --border-subtle: #22304d;
  --border-strong: #33476e;

  /* The Micro-Depth Gradient Palette */
  --acid-amber: #f59e0b;
  --acid-glow: rgba(245, 158, 11, 0.18);
  --acid-crimson: #ef4444;
  --acid-text: #fbbf24;

  --neutral-cyan: #06b6d4;
  --neutral-emerald: #10b981;
  --neutral-glow: rgba(16, 185, 129, 0.2);
  --neutral-text: #34d399;

  --cell-blue: #3b82f6;
  --cell-indigo: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --font-serif: "Newsreader", "Georgia", "Cambria", serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(245, 158, 11, 0.12);
}

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

html {
  font-size: 16px;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.08) 0%, rgba(7, 10, 19, 1) 60%),
              radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.06) 0%, rgba(7, 10, 19, 1) 50%);
  background-attachment: fixed;
  overflow-x: hidden;
  position: relative;
}

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

:focus-visible {
  outline: 2px solid var(--acid-amber);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Container */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Nav */
.site-header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(7, 10, 19, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4rem;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  transition: opacity 0.2s;
}

.brand-link:hover {
  opacity: 0.85;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  color: var(--acid-amber);
}

.lang-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.2s;
}

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

.lang-btn.active {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border-strong);
  font-weight: 600;
}

/* Hero Section */
.hero {
  padding: 4.5rem 0 3rem;
  position: relative;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--acid-amber);
}

.hero-meta-dot {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 5vw, 3.4rem);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: #fff;
  margin-bottom: 1.5rem;
}

.hero-title em {
  font-style: normal;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-lead {
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 48rem;
  margin-bottom: 2rem;
}

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

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1.25rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient, linear-gradient(90deg, var(--acid-amber), var(--neutral-emerald)));
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.metric-unit {
  font-size: 0.95rem;
  color: var(--acid-amber);
  font-weight: 500;
}

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

/* Content Sections */
.section {
  padding: 3rem 0;
  border-top: 1px solid var(--border-subtle);
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: #fff;
}

.section-lead {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 46rem;
  margin-bottom: 2rem;
}

/* Interactive Component: Depth Probe */
.interactive-probe-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  margin: 2.5rem 0;
}

.probe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

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

/* Visual Depth Gauge */
.depth-visual {
  height: 380px;
  background: linear-gradient(to bottom, 
    #ef4444 0%, 
    #f59e0b 25%, 
    #d97706 45%, 
    #0d9488 75%, 
    #10b981 90%, 
    #3b82f6 100%
  );
  border-radius: 12px;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-strong);
  overflow: hidden;
}

.depth-visual-marker {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff, 0 0 20px var(--acid-amber);
  top: 0%;
  transition: top 0.05s linear;
  pointer-events: none;
}

.depth-layer-label {
  position: absolute;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.55);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.depth-layer-label.top { top: 10px; }
.depth-layer-label.middle { top: 48%; }
.depth-layer-label.bottom { bottom: 10px; }

/* Probe Controls & Readout */
.probe-readout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.probe-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-surface);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  border: 1px solid var(--border-strong);
}

.probe-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--acid-amber);
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
  cursor: pointer;
  transition: transform 0.1s;
}

.probe-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--acid-amber);
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
  cursor: pointer;
}

.readout-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.25rem;
}

.readout-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.readout-row:last-child {
  border-bottom: none;
}

.readout-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.readout-val {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.readout-val.highlight {
  color: var(--acid-amber);
}

.readout-status-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.status-corrosive {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-neutralizing {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.status-protected {
  background: rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Restitution Section */
.restitution-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.timeline-step {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1.5rem;
  border-radius: 12px;
  position: relative;
}

.step-time {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--neutral-emerald);
  margin-bottom: 0.5rem;
}

.step-title {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.5rem;
}

.step-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Calculator Section */
.calculator-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2rem;
  margin: 2.5rem 0;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2rem;
}

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

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

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

.calc-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.calc-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.calc-results {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 1rem;
}

.calc-res-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.calc-res-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calc-res-val {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--acid-amber);
}

.calc-res-val.green {
  color: var(--neutral-emerald);
}

/* Body Observation Box */
.observation-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 182, 212, 0.04) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 14px;
  padding: 1.75rem;
  margin: 2rem 0;
}

.observation-title {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--neutral-emerald);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.observation-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Scientific Method & Sources */
.method-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.75rem;
  margin-top: 2rem;
}

.method-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.sources-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sources-list li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  padding-left: 1rem;
  border-left: 2px solid var(--border-strong);
}

.sources-list a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.sources-list a:hover {
  color: var(--acid-amber);
}

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

.footer-inner {
  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-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

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