/* ═══════════════════════════════════════════════════════════
   BernAudio Subs — Diseñador de arreglos de subwoofers
   Reutiliza la base de styles.css (nav, btn, section, cmp…)
   ═══════════════════════════════════════════════════════════ */

/* ── Hero del módulo ── */
.subs-skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 300;
  transform: translateY(-150%);
  background: var(--bg-2);
  color: var(--text);
  border: 2px solid var(--teal);
  border-radius: 6px;
  padding: 12px 16px;
}
.subs-skip-link:focus { transform: none; }
.type-card:focus-visible, .stage-tab:focus-visible,
.ctrl input:focus-visible, #simulationPanel:focus-visible,
.table-scroll:focus-visible, .stage-actions .btn:focus-visible,
.wb-preset .btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}
.stage-actions [hidden], .stage-loading[hidden] { display: none; }
.sub-hero {
  padding: calc(var(--nav-h, 72px) + 56px) 0 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.sub-hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 130%;
  background:
    radial-gradient(46% 60% at 30% 40%, rgba(255,162,62,.14), transparent 70%),
    radial-gradient(40% 55% at 72% 30%, rgba(255,138,51,.08), transparent 70%);
  pointer-events: none;
}
.sub-hero > .container { position: relative; }
.sub-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.05;
  margin: 18px auto 16px;
  max-width: 16ch;
}
.sub-hero .lead {
  max-width: 62ch;
  margin: 0 auto;
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.65;
}
.sub-hero .lead strong { color: var(--text); }
.sub-hero .os-row { justify-content: center; margin-top: 22px; }

/* ── Layout del banco de trabajo ── */
.workbench-section { padding-top: 34px; }
.wb-grid {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 22px;
  align-items: start;
}

/* ── Panel de configuración ── */
.wb-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  position: sticky;
  top: calc(var(--nav-h, 72px) + 16px);
  max-height: calc(100vh - var(--nav-h, 72px) - 32px);
  overflow-y: auto;
}
.wb-title {
  font-family: var(--font-display);
  font-size: .82rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 18px 0 10px;
}
.wb-title:first-child { margin-top: 0; }

.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.type-card {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 54px;
}
.type-card strong {
  font-size: .82rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: .01em;
}
.type-card span { font-size: .72rem; color: var(--text-3); }
.type-card:hover { border-color: var(--border-strong); }
.type-card.is-active {
  background: var(--teal-soft);
  border-color: rgba(255,162,62,.55);
  box-shadow: 0 0 0 1px rgba(255,162,62,.25), 0 6px 18px -10px var(--teal-glow);
}
.type-card.is-active strong { color: var(--teal); }
.type-card.is-active span { color: var(--text-2); }

.ctrl { margin: 14px 0 2px; }
.ctrl[hidden] { display: none; }
.ctrl label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: .82rem;
  color: var(--text-2);
  margin-bottom: 7px;
}
.ctrl output {
  font-variant-numeric: tabular-nums;
  color: var(--teal);
  font-weight: 600;
  font-size: .8rem;
  white-space: nowrap;
}
.ctrl input[type="range"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 26px;
  background: transparent;
  cursor: pointer;
}
.ctrl input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255,162,62,.55), rgba(255,162,62,.12));
}
.ctrl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid #06231e;
  box-shadow: 0 0 0 1px rgba(255,162,62,.5), 0 2px 8px rgba(0,0,0,.5);
}
.ctrl input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255,162,62,.55), rgba(255,162,62,.12));
}
.ctrl input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid #06231e;
  box-shadow: 0 0 0 1px rgba(255,162,62,.5);
}
.ctrl-check { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.ctrl-check label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .84rem;
  color: var(--text-2);
  cursor: pointer;
  justify-content: flex-start;
}
.ctrl-help {
  margin: -2px 0 3px;
  color: var(--text-2);
  font-size: .75rem;
  line-height: 1.5;
}
.ctrl-check label:has(input:disabled) { opacity: .65; }
.ctrl-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 34px; height: 19px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  flex: 0 0 auto;
}
.ctrl-check input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform .18s, background .18s;
}
.ctrl-check input[type="checkbox"]:checked {
  background: var(--teal-soft);
  border-color: rgba(255,162,62,.55);
}
.ctrl-check input[type="checkbox"]:checked::after {
  transform: translateX(15px);
  background: var(--teal);
}

.wb-hint {
  margin-top: 16px;
  font-size: .78rem;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-variant-numeric: tabular-nums;
}
.wb-preset { margin-top: 10px; display: flex; gap: 8px; }
.wb-preset .btn { min-height: 44px; white-space: normal; }

/* ── Escenario (canvas) ── */
.wb-stage-col { min-width: 0; }
.wb-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stage-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.stage-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--text-3);
  font: 600 .82rem/1 var(--font-body);
  padding: 9px 14px 11px;
  border-radius: 9px 9px 0 0;
  cursor: pointer;
  min-height: 44px;
  transition: color .15s, background .15s;
}
.stage-tab:hover { color: var(--text-2); }
.stage-tab.is-active {
  color: var(--teal);
  background: var(--surface);
  border-color: var(--border);
  position: relative;
}
.stage-tab.is-active::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--teal);
}
.stage-canvas-wrap {
  position: relative;
  aspect-ratio: 16 / 10.5;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,162,62,.05), transparent 60%),
    #05080d;
}
.stage-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.stage-loading {
  position: absolute;
  top: 12px; right: 12px;
  font-size: .74rem;
  color: var(--teal);
  background: rgba(6,35,30,.85);
  border: 1px solid rgba(255,162,62,.4);
  border-radius: 999px;
  padding: 4px 12px;
  pointer-events: none;
}
.stage-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  font-size: .76rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.stage-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.stage-note {
  margin-top: 12px;
  font-size: .8rem;
  line-height: 1.55;
  color: var(--text-3);
  max-width: 70ch;
}
.simulation-summary {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .8rem;
  line-height: 1.55;
}

/* ── Tabla de delays ── */
.delay-table td { font-variant-numeric: tabular-nums; }
.delay-table .pol-inv { color: var(--amber); font-weight: 700; }
.delay-table .pol-nor { color: var(--teal); font-weight: 600; }

/* ── Nav: página activa ── */
.nav-links a.is-current { color: var(--teal); }

/* ── Responsive ── */
@media (max-width: 980px) {
  .wb-grid { grid-template-columns: 1fr; }
  .wb-panel {
    position: static;
    max-height: none;
  }
  .stage-canvas-wrap { aspect-ratio: 4 / 3.4; }
}
@media (max-width: 560px) {
  .sub-hero { padding-top: calc(var(--nav-h, 72px) + 34px); }
  .type-grid { grid-template-columns: 1fr 1fr; }
  .stage-actions .btn { flex: 1 1 100%; justify-content: center; }
  .wb-panel { padding: 16px; }
  .stage-tabs { padding-inline: 6px; gap: 0; }
  .stage-tab { flex: 1 1 0; padding-inline: 6px; font-size: .74rem; }
  .ctrl label { flex-wrap: wrap; }
  .ctrl input[type="range"] { height: 44px; }
  .ctrl-check label { min-height: 44px; flex-wrap: nowrap; }
  .wb-grid { min-width: 0; }
  .type-grid { min-width: 0; }
  .type-card { min-width: 0; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  .type-card, .stage-tab, .ctrl-check input[type="checkbox"],
  .ctrl-check input[type="checkbox"]::after { transition: none; }
}
