/* Kraybazaar shared chrome — voltage mixer bay (not glass dock / orbit nav). */

:root {
  --kb-bay: 6.4rem;
  --cv-bay: var(--kb-bay);
  --cv-void: #070708;
  --cv-chalk: #f3f0e7;
  --cv-dim: #9a968a;
  --cv-cadmium: #ff3b00;
  --cv-acid: #d6ff3c;
  --cv-cobalt: #7a8cff;
  --cv-line: rgba(243, 240, 231, 0.12);
  --cv-display: "Syne", "Avenir Next", sans-serif;
  --cv-sans: "DM Sans", "Segoe UI", sans-serif;
  --cv-mono: "JetBrains Mono", ui-monospace, monospace;
  --cv-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.cv-bay {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--kb-bay);
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.45rem 0.9rem;
  background: #0c0c10;
  border-right: 1px solid var(--cv-line);
  box-shadow: 18px 0 50px rgba(0, 0, 0, 0.22);
  color: var(--cv-chalk);
  overflow-x: hidden;
  overflow-y: auto;
}

.cv-bay-readout {
  display: grid;
  gap: 0.2rem;
  padding: 0.15rem 0.2rem 0.55rem;
  font-family: var(--cv-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cv-acid);
  flex: 0 0 auto;
}
.cv-bay-readout strong {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--cv-chalk);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cv-live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--cv-cadmium);
}
.cv-live::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--cv-cadmium);
  box-shadow: 0 0 10px var(--cv-cadmium);
  animation: kb-pulse 1.6s ease-in-out infinite;
}

.cv-master {
  width: 3.35rem;
  height: 3.35rem;
  margin: 0 auto 0.65rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--cv-cadmium);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 59, 0, 0.45), transparent 50%),
    #140800;
  font-family: var(--cv-display);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--cv-chalk);
  transition: transform 0.4s var(--cv-ease), box-shadow 0.4s var(--cv-ease);
}
.cv-master:hover {
  transform: rotate(-8deg) scale(1.06);
  box-shadow: 0 0 0 4px rgba(255, 59, 0, 0.2), 0 0 24px rgba(255, 59, 0, 0.35);
}
.cv-master.is-on {
  box-shadow: 0 0 0 3px var(--cv-acid), 0 0 20px rgba(214, 255, 60, 0.35);
}

.cv-faders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.28rem;
  align-content: start;
  flex: 1 1 auto;
}
.cv-fader {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.28rem;
  min-height: 6.4rem;
  padding: 0.35rem 0.15rem 0.2rem;
  color: var(--cv-dim);
  isolation: isolate;
}
.cv-fader-track {
  position: relative;
  width: 0.34rem;
  height: 3.6rem;
  border-radius: 999px;
  background: #1c1c22;
  overflow: hidden;
  order: 0;
}
.cv-fader-track i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22%;
  background: linear-gradient(180deg, var(--tone), rgba(255, 59, 0, 0.2));
  transition: height 0.45s var(--cv-ease);
}
.cv-fader-cap {
  position: absolute;
  top: 3.05rem;
  width: 1.15rem;
  height: 0.55rem;
  border-radius: 0.12rem;
  background: #ece7db;
  box-shadow: 0 2px 0 #8a867c, 0 6px 12px rgba(0, 0, 0, 0.4);
  transition: top 0.45s var(--cv-ease), background 0.25s;
  order: 2;
}
.cv-fader-led {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #2a2a32;
  box-shadow: inset 0 0 0 1px #000;
  transition: background 0.25s, box-shadow 0.35s;
  order: 1;
}
.cv-fader-name {
  font-family: var(--cv-mono);
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.15;
  order: 3;
}

.cv-fader:hover,
.cv-fader:focus-visible,
.cv-fader.is-on {
  color: var(--cv-chalk);
  outline: none;
}
.cv-fader:hover .cv-fader-track i,
.cv-fader:focus-visible .cv-fader-track i,
.cv-fader.is-on .cv-fader-track i { height: 92%; }
.cv-fader:hover .cv-fader-cap,
.cv-fader:focus-visible .cv-fader-cap,
.cv-fader.is-on .cv-fader-cap {
  top: 0.55rem;
  background: var(--tone);
}
.cv-fader:hover .cv-fader-led,
.cv-fader:focus-visible .cv-fader-led,
.cv-fader.is-hot .cv-fader-led,
.cv-fader.is-on .cv-fader-led {
  background: var(--tone);
  box-shadow: 0 0 10px var(--tone);
}

.cv-bay-open,
.cv-bay-scrim { display: none; }

@keyframes kb-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ——— Mobile drawer ——— */
@media (max-width: 760px) {
  :root {
    --kb-bay: 0px;
    --kb-channels-fab: 4.6rem;
  }

  .cv-bay-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 80;
    left: 50%;
    bottom: max(0.85rem, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    min-height: 44px;
    min-width: 8.5rem;
    padding: 0.65rem 1.35rem;
    border: 0;
    border-radius: 999px;
    background: #ff3b00;
    color: #140600;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    font-family: var(--cv-mono);
    box-shadow: 0 12px 28px rgba(255, 59, 0, 0.35);
  }
  /* Body open-state class must NOT be `.cv-bay-open` — that class is the FAB button. */
  body.cv-bay-is-open .cv-bay-open {
    visibility: hidden;
    pointer-events: none;
  }

  .cv-bay {
    z-index: 90;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(20rem, 86vw);
    max-width: 22rem;
    height: 100dvh;
    max-height: 100vh;
    padding: 1.1rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
    border-right: 1px solid rgba(243, 240, 231, 0.14);
    background: #101014;
    color: #f3f0e7;
    box-shadow: 18px 0 50px rgba(0, 0, 0, 0.45);
    /* Closed: park off-screen without transform (avoids blank paint bugs). */
    margin-left: -110%;
    transition: margin-left 0.35s var(--cv-ease);
    display: flex !important;
    flex-direction: column;
    gap: 0.55rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    visibility: visible;
    opacity: 1;
  }
  body.cv-bay-is-open .cv-bay {
    margin-left: 0;
  }

  /* Scroll lock without breaking fixed descendants */
  html.cv-bay-is-open,
  html.cv-bay-is-open body {
    overflow: hidden;
  }

  .cv-bay-readout {
    display: grid !important;
    gap: 0.35rem;
    padding: 0.15rem 0.1rem 0.35rem;
    color: #d6ff3c !important;
    font-size: 0.7rem;
  }
  .cv-bay-readout strong {
    color: #f3f0e7 !important;
    font-size: 0.92rem !important;
    font-weight: 700;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  .cv-live {
    color: #ff3b00 !important;
  }

  .cv-master {
    display: grid !important;
    width: 3.8rem;
    height: 3.8rem;
    margin: 0.15rem auto 0.35rem;
    color: #f3f0e7 !important;
  }

  .cv-faders {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: none;
    gap: 0.4rem;
    width: 100%;
    flex: 1 0 auto;
    min-height: 0;
    padding-bottom: 0.5rem;
  }

  .cv-fader {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.7rem;
    width: 100%;
    min-height: 3rem;
    height: auto;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(243, 240, 231, 0.14);
    border-radius: 0.45rem;
    background: #0c0c10;
    color: #f3f0e7 !important;
    isolation: auto;
  }

  .cv-fader-track {
    display: none !important;
  }

  .cv-fader-led {
    display: block !important;
    order: 0;
    flex: 0 0 auto;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #4a4a55;
  }

  .cv-fader-name {
    display: block !important;
    order: 1;
    flex: 1 1 auto;
    font-size: 0.82rem !important;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: left;
    color: #f3f0e7 !important;
    line-height: 1.2;
  }

  .cv-fader-cap {
    display: block !important;
    order: 2;
    position: static !important;
    top: auto !important;
    flex: 0 0 auto;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 0.2rem;
    background: var(--tone, #ff3b00) !important;
    box-shadow: none;
  }

  .cv-fader.is-on,
  .cv-fader:focus-visible {
    border-color: rgba(255, 59, 0, 0.55);
    background: rgba(255, 59, 0, 0.12);
    color: #f3f0e7 !important;
  }
  .cv-fader.is-on .cv-fader-led,
  .cv-fader.is-hot .cv-fader-led,
  .cv-fader:focus-visible .cv-fader-led {
    background: var(--tone, #ff3b00);
    box-shadow: 0 0 10px var(--tone, #ff3b00);
  }
  .cv-fader:hover .cv-fader-cap,
  .cv-fader:focus-visible .cv-fader-cap,
  .cv-fader.is-on .cv-fader-cap {
    top: auto !important;
    background: var(--tone, #ff3b00) !important;
  }

  .cv-bay-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(0, 0, 0, 0.58);
  }
  .cv-bay-scrim[hidden] { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .cv-live::before { animation: none; }
  .cv-bay { transition: none; }
}
