/* ==========================================================================
   Optzeci de milisecunde / Eighty Milliseconds - Visual Mixing Console Design System
   ========================================================================== */

:root {
  --bg-primary: #090d16;
  --bg-surface: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #283548;
  --border-subtle: #334155;
  --border-active: #475569;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  /* Multisensory Track Accents */
  --track-visual: #fbbf24;      /* Amber / Golden Light */
  --track-visual-glow: rgba(251, 191, 36, 0.25);
  --track-auditory: #38bdf8;    /* Cobalt / Cyan Soundwave */
  --track-auditory-glow: rgba(56, 189, 248, 0.25);
  --track-tactile: #fb7185;     /* Coral / Terracotta Somatic */
  --track-tactile-glow: rgba(251, 113, 133, 0.25);
  --track-binding: #a855f7;     /* Purple / 80ms Buffer */
  --track-binding-glow: rgba(168, 85, 247, 0.25);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "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;
}

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding: 0 1rem;
}

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

.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  background: var(--track-auditory);
  color: #000;
  padding: 0.5rem 1rem;
  font-weight: 700;
  border-radius: 4px;
  z-index: 100;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 1rem;
}

/* Container & Header */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 0 4rem 0;
}

header {
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 2rem;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.brand a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: color 0.15s ease;
}
.brand a:hover {
  color: var(--track-auditory);
}

.lang-switch {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.lang-btn {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.lang-btn:hover, .lang-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--track-auditory);
}

/* Hero Section */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #d8b4fe;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-radius: 9999px;
  margin-bottom: 1.25rem;
  font-weight: 600;
}

.hero-badge::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #c084fc;
  border-radius: 50%;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

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

.hero-lead {
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Highlight metrics banner */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
}

.metric-card.visual { border-top: 3px solid var(--track-visual); }
.metric-card.auditory { border-top: 3px solid var(--track-auditory); }
.metric-card.tactile { border-top: 3px solid var(--track-tactile); }
.metric-card.buffer { border-top: 3px solid var(--track-binding); }

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
}
.metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.metric-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Sections & Flow */
section {
  margin-bottom: 3.5rem;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.2em;
  background: var(--track-auditory);
  border-radius: 2px;
}

p {
  color: #cbd5e1;
  font-size: 1.05rem;
  margin-bottom: 1.35rem;
}

p strong {
  color: #ffffff;
}

/* Interactive Mixing Lab Container */
.interactive-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.75rem;
  margin: 2rem 0;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

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

.panel-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
}

.panel-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 600px;
}

/* Interactive Simultaneity Tester */
.stimulus-arena {
  background: #040711;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.flash-box {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.05s ease, border-color 0.05s ease, transform 0.05s ease;
}

.flash-box.active-flash {
  background: var(--track-visual);
  border-color: #ffffff;
  box-shadow: 0 0 40px var(--track-visual-glow), 0 0 80px var(--track-visual);
  transform: scale(1.15);
}

.flash-box.active-audio {
  border-color: var(--track-auditory);
  box-shadow: 0 0 30px var(--track-auditory-glow);
}

.arena-status {
  position: absolute;
  bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

button {
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
button:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-1px);
}
button:active:not(:disabled) {
  transform: translateY(0);
}
button:focus-visible {
  outline: 2px solid var(--track-auditory);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #60a5fa;
}

.btn-sound {
  border-color: var(--track-auditory);
  color: #7dd3fc;
}
.btn-light {
  border-color: var(--track-visual);
  color: #fde047;
}
.btn-sync {
  border-color: var(--track-binding);
  color: #e9d5ff;
}

.test-feedback {
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.25rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feedback-score {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--track-binding);
}

/* Crossover Timeline Slider & Visualization */
.timeline-console {
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.control-readout {
  font-family: var(--font-mono);
  color: var(--track-auditory);
  font-weight: 700;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-card);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--track-auditory);
  box-shadow: 0 0 10px var(--track-auditory-glow);
  cursor: pointer;
  border: 2px solid #ffffff;
  transition: transform 0.1s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.tracks-visualizer {
  background: #050811;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.track-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.track-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.track-meta.visual { color: var(--track-visual); }
.track-meta.auditory { color: var(--track-auditory); }

.track-bar-bg {
  width: 100%;
  height: 28px;
  background: #111827;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  border: 1px solid #1f293d;
}

.track-bar-fill {
  height: 100%;
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding-left: 0.5rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #000;
  transition: width 0.15s ease-out;
  min-width: 45px;
}
.track-bar-fill.visual { background: var(--track-visual); }
.track-bar-fill.auditory { background: var(--track-auditory); }

.track-marker-sync {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 10;
}
.track-marker-sync::after {
  content: "55 ms";
  position: absolute;
  top: -16px;
  left: -15px;
  font-size: 0.65rem;
  color: #ef4444;
  font-family: var(--font-mono);
}

.crossover-verdict {
  margin-top: 0.75rem;
  padding: 0.85rem;
  background: rgba(168, 85, 247, 0.1);
  border-left: 4px solid var(--track-binding);
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  color: #e2e8f0;
}

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

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

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

th {
  background: var(--bg-surface);
  color: #f1f5f9;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.tag-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
}
.tag-badge.light { background: rgba(251, 191, 36, 0.15); color: #fde047; }
.tag-badge.sound { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.tag-badge.touch { background: rgba(251, 113, 133, 0.15); color: #fda4af; }

/* Stetson Recalibration Box */
.recalibration-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tap-target {
  height: 120px;
  background: #1e293b;
  border: 2px dashed #475569;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  user-select: none;
  cursor: pointer;
  transition: all 0.1s ease;
}
.tap-target:hover {
  background: #273549;
  border-color: var(--track-binding);
}
.tap-target:active, .tap-target.flash-hit {
  background: var(--track-binding);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 40px var(--track-binding-glow);
}

/* Method & References */
.method-note {
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
  margin-top: 3.5rem;
}

.reference-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.reference-list li {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
  padding-left: 1.25rem;
  position: relative;
}

.reference-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--track-auditory);
}

footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  max-width: 900px;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}
footer a:hover {
  color: var(--track-auditory);
}

/* Reduced Motion: FM requirements */
@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;
  }
  .flash-box, .tap-target, .track-bar-fill {
    transition: none !important;
  }
}

/* Mobile Viewport */
@media (max-width: 640px) {
  .container {
    padding: 1.5rem 0 3rem 0;
  }
  .interactive-panel {
    padding: 1.2rem;
  }
  .btn-row {
    flex-direction: column;
  }
  button {
    width: 100%;
    justify-content: center;
  }
}
