/* Sine combinator — artifact-specific layout. Tokens come from /styles.css. */

.combinator {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 2.5rem;
  align-items: stretch;
  margin: 0 0 2.5rem;
}

.combinator-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.spectrum-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-self: stretch;
}
.spectrum-panel .ctrl-label {
  margin-right: 0;
}
.spectrum-canvas {
  width: 100%;
  flex: 1;
  min-height: 380px;
  display: block;
}

@media (max-width: 820px) {
  .combinator {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  .spectrum-canvas {
    flex: none;
    min-height: 0;
    height: 260px;
  }
}

.row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 1rem;
  row-gap: 0.5rem;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px dashed var(--rule);
}
.rows .row:first-child {
  border-top: none;
}

.composite-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  column-gap: 1rem;
  align-items: center;
  border-top: 1px solid var(--ink-soft);
  padding: 1.5rem 0 0.5rem;
  margin-top: 0.5rem;
}

.circle-canvas {
  width: 90px;
  height: 90px;
  display: block;
}
.wave-canvas {
  width: 100%;
  height: 90px;
  display: block;
}
.composite-row .wave-canvas {
  height: 110px;
}

.composite-stack {
  /* Inherits .circle-canvas sizing; visual treatment comes from JS canvas drawing. */
}

/* per-row remove (×) */
.row-remove {
  align-self: center;
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 1.05rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.55rem;
  opacity: 0.55;
  transition: opacity 0.2s, color 0.2s;
}
.row-remove:hover:not(:disabled) {
  opacity: 1;
  color: var(--accent-warm);
}
.row-remove:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}
.row-remove:focus-visible {
  outline: 2px solid var(--accent-warm);
  outline-offset: 2px;
  border-radius: 2px;
  opacity: 1;
}

/* + add sine row */
.add-source {
  display: block;
  width: 100%;
  padding: 0.95rem 0;
  margin: 0;
  background: transparent;
  border: none;
  border-top: 1px dashed var(--rule);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.add-source:hover {
  color: var(--accent-warm);
}
.add-source:focus-visible {
  outline: 2px solid var(--accent-warm);
  outline-offset: -4px;
  color: var(--accent-warm);
}

/* Per-row controls span the full width below the canvases. */
.row-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  padding: 0.5rem 0 0.25rem;
}

.row-control {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.row-control .label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
.row-control .value {
  color: var(--ink-soft);
}

/* Range slider — minimal editorial style. */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]:focus-visible {
  outline: 2px solid var(--accent-warm);
  outline-offset: 4px;
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--rule);
  border: none;
}
input[type="range"]::-moz-range-track {
  height: 1px;
  background: var(--rule);
  border: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-warm);
  margin-top: -6px;
  border: none;
  transition: transform 0.15s ease;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-warm);
  border: none;
  transition: transform 0.15s ease;
}
input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus::-webkit-slider-thumb {
  transform: scale(1.25);
}
input[type="range"]:hover::-moz-range-thumb,
input[type="range"]:focus::-moz-range-thumb {
  transform: scale(1.25);
}

/* Bottom controls strip */
.combinator-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.ctrl-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ctrl-label {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.06em;
  margin-right: 0.4rem;
}

.combinator-controls button {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.4rem 0.95rem;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.combinator-controls button:hover {
  color: var(--accent-warm);
  border-color: var(--accent-warm);
}
.combinator-controls button.active {
  color: var(--bg);
  background: var(--accent-warm);
  border-color: var(--accent-warm);
}
.combinator-controls button:focus-visible {
  outline: 2px solid var(--accent-warm);
  outline-offset: 2px;
}

@media (max-width: 580px) {
  .row {
    grid-template-columns: 70px minmax(0, 1fr) auto;
  }
  .composite-row {
    grid-template-columns: 70px minmax(0, 1fr);
  }
  .circle-canvas {
    width: 70px;
    height: 70px;
  }
  .row-controls {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
}
