/* A continuity suite: painted metal, engraved labels, indicator lamps. */
:root {
  color-scheme: dark;

  --shell: #262b28;
  --panel: #333935;
  --panel-lo: #1f2321;
  --raise: #3d443f;
  --edge: #4a524c;
  --ink: #efe9da;
  --dim: #9aa39c;
  --amber: #f0a93b;
  --oxide: #d2603a;
  --glass: #c8d6ce;

  --label: "Archivo Narrow", "Arial Narrow", system-ui, sans-serif;
  --voice: "Newsreader", Georgia, serif;
  --data: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;

  --gap: clamp(0.9rem, 2.5vw, 1.4rem);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: var(--gap);
  background: var(--shell);
  /* Faint vertical brushing on the painted shell. */
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.012) 0 1px,
    transparent 1px 3px
  );
  color: var(--ink);
  font-family: var(--label);
  font-size: 16px;
  line-height: 1.5;
}

.rack {
  max-width: 46rem;
  margin-inline: auto;
}

/* ---- Head ---- */

.rack__head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding-bottom: 0.7rem;
  margin-bottom: var(--gap);
  border-bottom: 1px solid var(--edge);
}

.wordmark {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}

.wordmark__sub {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---- Panels ---- */

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 3px;
  padding: var(--gap);
  margin-bottom: var(--gap);
  /* Top highlight, bottom shadow: a raised painted face. */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.engraved {
  display: block;
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim);
}

.prose {
  margin: 0 0 1rem;
  color: var(--dim);
  font-size: 0.92rem;
  max-width: 34ch;
}

.readout {
  margin: 0.9rem 0 0;
  font-family: var(--data);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--dim);
  min-height: 1.3em;
}

.alert {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--oxide);
  min-height: 1.3em;
}

/* ---- Instrument cluster: the signature ---- */

.cluster {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--edge);
}

.lamp {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6d746f;
  transition: color 0.25s;
}

.lamp i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--panel-lo);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5);
  transition:
    background 0.25s,
    box-shadow 0.25s;
}

.lamp[data-lit="true"] {
  color: var(--amber);
}

.lamp[data-lit="true"] i {
  background: var(--amber);
  box-shadow: 0 0 9px var(--amber);
}

.lamp--new[data-lit="true"] {
  color: var(--oxide);
}

.lamp--new[data-lit="true"] i {
  background: var(--oxide);
  box-shadow: 0 0 9px var(--oxide);
}

.cluster__id {
  margin: 0 0 0 auto;
  font-family: var(--data);
}

/* ---- Now playing ---- */

.now {
  display: flex;
  gap: 1.1rem;
  align-items: center;
}

.sleeve {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  background: var(--panel-lo);
  border: 1px solid var(--edge);
  border-radius: 2px;
  overflow: hidden;
}

#art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#art:not([src]),
#art[src=""] {
  visibility: hidden;
}

.now__text {
  min-width: 0;
}

.now__artist {
  margin: 0;
  font-size: clamp(1.25rem, 5vw, 1.9rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.now__title {
  margin: 0.15rem 0 0;
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  color: var(--dim);
}

/* The spoken line. A voice, not machine chrome. */
.patter {
  font-family: var(--voice);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--glass);
  margin: 1.1rem 0 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--oxide);
  min-height: 1.5em;
}

.patter:empty {
  display: none;
}

/* ---- Meter ---- */

.meter {
  margin-top: 1.3rem;
}

.meter__times {
  display: flex;
  justify-content: space-between;
  font-family: var(--data);
  font-size: 0.68rem;
  color: var(--dim);
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}

/* Faders: native range inputs dressed as hardware. */
.fader {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
  display: block;
}

.fader::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--panel-lo);
  border-radius: 2px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.fader::-moz-range-track {
  height: 4px;
  background: var(--panel-lo);
  border-radius: 2px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* A tall thin cap, like a desk fader. */
.fader::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 6px;
  height: 18px;
  margin-top: -7px;
  border-radius: 1px;
  background: var(--ink);
  border: 1px solid #14170f;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.fader::-moz-range-thumb {
  width: 6px;
  height: 18px;
  border-radius: 1px;
  background: var(--ink);
  border: 1px solid #14170f;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.fader--seek::-webkit-slider-thumb {
  background: var(--amber);
}

.fader--seek::-moz-range-thumb {
  background: var(--amber);
}

.fader:disabled {
  cursor: default;
  opacity: 0.45;
}

/* ---- Transport ---- */

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--edge);
}

.key {
  font-family: var(--label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, var(--raise), #2c322e);
  border: 1px solid var(--edge);
  border-radius: 3px;
  padding: 0.62rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.4);
}

.key:hover:not(:disabled) {
  background: linear-gradient(180deg, #464e48, var(--raise));
}

.key:active:not(:disabled) {
  background: var(--panel-lo);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.key svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: none;
}

.key svg .stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* The UA [hidden] rule does not reach inline SVG. Say it explicitly. */
.key svg[hidden] {
  display: none;
}

.key--main {
  background: linear-gradient(180deg, #f5bc5c, var(--amber));
  border-color: #a3701f;
  color: #221a08;
  padding-inline: 1.3rem;
}

.key--main:hover:not(:disabled) {
  background: linear-gradient(180deg, #ffc971, #f2ae44);
}

.key--main svg {
  fill: #221a08;
}

.key--main svg .stroke {
  stroke: #221a08;
}

.key--wide {
  width: 100%;
  padding-block: 0.75rem;
}

.key--danger {
  margin-left: auto;
  color: var(--oxide);
  border-color: #6a3325;
}

.key:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.vol {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 8rem;
  flex: 1 1 8rem;
  padding-left: 0.6rem;
}

.vol .engraved {
  margin: 0;
  white-space: nowrap;
}

/* ---- Request ---- */

.request {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: flex-end;
  margin: 0;
}

.request > div {
  flex: 1 1 16rem;
}

.request .key {
  flex: 0 0 auto;
  width: auto;
  padding-inline: 1.4rem;
}

/* ---- Log ---- */

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--data);
  font-size: 0.78rem;
}

.log li {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--edge);
  color: var(--dim);
}

.log li:last-child {
  border-bottom: 0;
}

.log__n {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.log__name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log__mark {
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  /* Lifted from --oxide: that reads as a lamp, but fails AA as small text. */
  color: #e8825c;
}

.log li[data-played="true"] .log__name {
  color: var(--dim);
  text-decoration: line-through;
  text-decoration-color: var(--dim);
}

/* Current beats played: never strike the row that is on air. */
.log li[data-current="true"] .log__name {
  color: var(--ink);
  text-decoration: none;
}

.log li[data-current="true"] {
  background: rgba(240, 169, 59, 0.07);
  box-shadow: inset 2px 0 0 var(--amber);
  padding-left: 0.6rem;
  margin-left: -0.6rem;
}

/* ---- Forms ---- */

form {
  margin: 0;
}

label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  font: inherit;
  font-size: 0.95rem;
  width: 100%;
  padding: 0.62rem 0.7rem;
  color: var(--ink);
  background: var(--panel-lo);
  border: 1px solid var(--edge);
  border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

input::placeholder {
  color: #6d746f;
}

.select {
  font: inherit;
  font-size: 0.9rem;
  width: 100%;
  padding: 0.62rem 0.7rem;
  color: var(--ink);
  background: var(--panel-lo);
  border: 1px solid var(--edge);
  border-radius: 2px;
}

.dial--voice {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--edge);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
}

.dial--voice label {
  flex: 1 1 100%;
}

.dial--voice .select {
  flex: 1 1 12rem;
  width: auto;
}

#login-form,
.calibration {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.dial__hint {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #7f877f;
  margin-top: 0.2rem;
}

summary {
  cursor: pointer;
  margin-bottom: 0;
}

details[open] summary {
  margin-bottom: 1rem;
}

/* ---- Focus and skip ---- */

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--gap);
  top: var(--gap);
  z-index: 10;
  padding: 0.6rem 0.9rem;
  background: var(--amber);
  color: #221a08;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- Motion ---- */

/* Warm-up: lamps and panels come up as the desk powers on. */
@keyframes warm {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.panel {
  animation: warm 0.45s ease-out backwards;
}

.panel:nth-of-type(2) {
  animation-delay: 0.07s;
}

.panel:nth-of-type(3) {
  animation-delay: 0.14s;
}

/* While the DJ is talking, the on-air lamp breathes. */
@keyframes breathe {
  50% {
    opacity: 0.55;
  }
}

.lamp[data-speaking="true"] i {
  animation: breathe 1.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- Narrow ---- */

@media (max-width: 34rem) {
  .now {
    gap: 0.9rem;
  }

  .sleeve {
    width: 76px;
    height: 76px;
  }

  .key--danger {
    margin-left: 0;
    width: 100%;
  }

  .vol {
    order: 5;
    padding-left: 0;
    flex-basis: 100%;
  }
}
