/* style.css - Design System Bioenergetic Tachometer */
:root {
  --bg-deep: #070a11;
  --bg-card: #0d1322;
  --bg-card-hover: #121a2f;
  --border-subtle: rgba(245, 158, 11, 0.15);
  --border-active: rgba(245, 158, 11, 0.45);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --amber-gold: #f59e0b;
  --amber-light: #fbbf24;
  --copper-orange: #d97706;
  --proton-cyan: #38bdf8;
  --proton-glow: rgba(56, 189, 248, 0.25);
  --danger-crimson: #ef4444;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  font-size: 1.0625rem;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* FM-001 Accessibility sr-only styling */
.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;
}

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

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

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.brand-link:hover {
  color: var(--amber-gold);
}

.brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.lang-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  padding: 0.25rem;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
}

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

.lang-btn.active {
  background: var(--amber-gold);
  color: #000;
}

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

/* Layout */
.main-content {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

/* Answer-First Hero Section */
.hero-section {
  text-align: center;
  padding: 2.5rem 1rem 3.5rem;
  position: relative;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber-light);
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #ffffff 40%, var(--amber-light) 90%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-lead {
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 820px;
  margin: 0 auto 2.5rem;
  font-weight: 400;
}

/* Key Metrics Grid - The Answer First */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--amber-gold), var(--copper-orange));
}

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

.metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

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

.metric-value .unit {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--amber-light);
  margin-left: 0.2rem;
}

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

/* Section Headers */
.content-section {
  margin-bottom: 4.5rem;
}

.section-header {
  margin-bottom: 2rem;
}

.section-number {
  color: var(--amber-gold);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  display: block;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #fff;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 800px;
}

/* Interactive Rotary Simulator Box */
.sim-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

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

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

.canvas-wrapper {
  background: #05080f;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  aspect-ratio: 1;
  max-height: 400px;
}

#motorCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sim-controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.control-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.control-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--amber-light);
  font-size: 1.05rem;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #1e293b;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--amber-gold);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-btn {
  background: #141c2e;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.preset-btn:hover, .preset-btn.active {
  background: var(--amber-gold);
  color: #000;
  border-color: var(--amber-gold);
}

.live-telemetry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.telemetry-box {
  background: #090d16;
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}

.telemetry-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.telemetry-num {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--proton-cyan);
}

/* Personal ATP Calculator */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2rem;
}

.calc-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

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

.calc-input-wrapper {
  position: relative;
}

.calc-input-wrapper input {
  width: 100%;
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s ease;
}

.calc-input-wrapper input:focus {
  border-color: var(--amber-gold);
}

.calc-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  background: #070a11;
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 14px;
  padding: 1.5rem;
}

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

.res-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.res-num {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--amber-light);
}

.res-hint {
  font-size: 0.825rem;
  color: var(--text-secondary);
}

/* Apnea Survival Countdown Box */
.apnea-box {
  background: linear-gradient(145deg, #18101a 0%, #0d1322 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 20px;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  margin-top: 2rem;
}

@media (max-width: 720px) {
  .apnea-box {
    grid-template-columns: 1fr;
  }
}

.apnea-text h3 {
  color: #fff;
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.apnea-text p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.apnea-gauge {
  text-align: center;
  background: #090d16;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 14px;
  padding: 1.25rem 1.75rem;
  min-width: 160px;
}

.apnea-timer {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--danger-crimson);
}

.apnea-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Prose and Explanations */
.prose-block {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 2rem;
}

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

.prose-block strong {
  color: #fff;
}

.prose-block em {
  color: var(--amber-light);
  font-style: italic;
}

/* Comparison Cards */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2.5rem 0;
}

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

.comp-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--border-subtle);
}

.comp-card.static-storage {
  border-color: rgba(239, 68, 68, 0.3);
}

.comp-card.dynamic-recycle {
  border-color: rgba(56, 189, 248, 0.4);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.05) 0%, var(--bg-card) 100%);
}

.comp-card h4 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  color: #fff;
}

.comp-card p {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Scientific Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  margin: 2rem 0;
}

.sci-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.sci-table th, .sci-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.1);
}

.sci-table th {
  background: #070a11;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.sci-table td strong {
  color: var(--amber-light);
}

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

/* References and Scientific Methodology */
.sources-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.75rem;
  margin-top: 3rem;
}

.sources-card h3 {
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 1rem;
}

.sources-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sources-list li {
  padding-left: 1.25rem;
  position: relative;
}

.sources-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--amber-gold);
  font-size: 1.2rem;
  line-height: 1;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

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

.footer-links a:hover {
  color: var(--amber-gold);
}

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