/**
 * Shared styles for experiment control panels.
 * Import via <link rel="stylesheet" href="/experiments/lib/experiment-controls.css" />
 *
 * Provides:
 *   - Range slider styling (filled track + thumb)
 *   - Control layout (rows, labels, values)
 *   - Buttons and mode toggles
 *   - Parameter grids (collapsible details)
 *   - Preset buttons
 */

/* ===== Layout ===== */

.control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.control-label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  color: #404040;
  min-width: 32px;
}
.control-label sub { font-size: 9px; }

.control-value {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #525252;
  min-width: 110px;
  text-align: right;
  white-space: nowrap;
}

/* ===== Range inputs ===== */

input[type="range"] {
  --fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: linear-gradient(to right,
    #e3e4e6 0%,
    #171717 var(--fill),
    #d4d4d4 var(--fill),
    #d4d4d4 100%);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #171717;
  border: none;
  box-shadow: 0 0 0 3px rgba(23,23,23,0.1);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 5px rgba(23,23,23,0.15);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #171717;
  border: none;
  box-shadow: 0 0 0 3px rgba(23,23,23,0.1);
  cursor: pointer;
}
input[type="range"]::-moz-range-progress {
  background: linear-gradient(to right, #e3e4e6, #171717);
  height: 4px;
  border-radius: 2px;
}
input[type="range"]:focus-visible {
  outline: 2px solid #525252;
  outline-offset: 4px;
  border-radius: 2px;
}

/* ===== Buttons ===== */

.button-row { display: flex; gap: 8px; flex-wrap: wrap; }

button {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border: 1px solid #a3a3a3;
  border-radius: 2px;
  background: #fafafa;
  color: #404040;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 36px;
}
button:hover { background: #e5e5e5; border-color: #737373; }
button:active { background: #d4d4d4; }
button:focus-visible { outline: 2px solid #525252; outline-offset: 2px; }

/* ===== Mode toggles ===== */

.mode-group { display: flex; }
.mode-btn {
  border-radius: 0;
  border-right-width: 0;
  padding: 3px 10px;
  font-size: 10px;
  min-height: 36px;
}
.mode-btn:first-child { border-radius: 2px 0 0 2px; }
.mode-btn:last-child { border-radius: 0 2px 2px 0; border-right-width: 1px; }
.mode-btn.active {
  background: #525252;
  color: #fafafa;
  border-color: #525252;
}
.mode-btn.active + .mode-btn { border-left-color: #525252; }

/* ===== Preset buttons ===== */

.preset-btn {
  font-size: 10px;
  padding: 2px 8px;
  min-height: 30px;
  border-color: #b5b5b5;
  background: #f0f0f0;
}

/* ===== Parameter details/grid ===== */

.param-details {
  border-top: 1px solid #d4d4d4;
  padding-top: 10px;
}
.param-details summary {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #525252;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}
.param-details summary::-webkit-details-marker { display: none; }
.param-details summary::before {
  content: "▸";
  font-size: 10px;
  transition: transform 0.15s ease;
}
.param-details[open] summary::before { transform: rotate(90deg); }
.param-details summary:hover { color: #404040; }
.param-details[open] summary { margin-bottom: 10px; }

.param-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
}
@media (max-width: 420px) {
  .param-grid { grid-template-columns: 1fr; }
}
.param-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.param-label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  color: #525252;
  min-width: 22px;
}
.param-label sub { font-size: 9px; }
.param-value {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: #737373;
  min-width: 44px;
  text-align: right;
  white-space: nowrap;
}
