/* Inline SVG icons from the sprite in index.html */
.icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
  vertical-align: -0.125em;
}

.icon-lg {
  width: 1.33em;
  height: 1.33em;
  vertical-align: -0.25em;
}

/* Theme toggle shows the icon for the current theme */
[data-bs-theme="dark"] .theme-icon-light,
[data-bs-theme="light"] .theme-icon-dark {
  display: none;
}

/* Fixed-width digits so values don't jitter while animating */
.slider-value,
.recording-timer {
  font-variant-numeric: tabular-nums;
}

/* Shown under the record button (centered by startTimer()) so it doesn't shift the toolbar */
.recording-timer {
  position: absolute;
  top: 100%;
  margin-top: 2px;
  transform: translateX(50%);
  font-size: 0.65rem;
  padding: 0.2em 0.4em;
  animation: recording-pulse 1.5s ease-in-out infinite;
}

@keyframes recording-pulse {
  50% {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .recording-timer {
    animation: none;
  }
}

/* Compact settings panels (main and fullscreen): smaller text and slimmer range inputs */
#settingsContent,
#fullscreenSliders {
  font-size: 0.875rem;
}

:is(#settingsContent, #fullscreenSliders) .form-range {
  height: 1rem;
}

:is(#settingsContent, #fullscreenSliders) .form-range::-webkit-slider-runnable-track {
  height: 0.25rem;
}

:is(#settingsContent, #fullscreenSliders) .form-range::-webkit-slider-thumb {
  width: 0.75rem;
  height: 0.75rem;
  margin-top: -0.25rem; /* Center the thumb on the track */
}

:is(#settingsContent, #fullscreenSliders) .form-range::-moz-range-track {
  height: 0.25rem;
}

:is(#settingsContent, #fullscreenSliders) .form-range::-moz-range-thumb {
  width: 0.75rem;
  height: 0.75rem;
}

/* Equal-width toolbar buttons, so icons of different widths (and the record/stop swap) don't change their size */
:is(#settingsContent, #fullscreenSliders, #fullscreenToolbar) :is(.btn-group-sm > .btn, .btn-sm) {
  min-width: 2.25rem;
}

/* Custom gradient color pickers sized to match the small select next to them */
.custom-colors .form-control-color {
  width: 2rem;
  height: calc(1.5em + 0.5rem + 2px);
  padding: 0.2rem;
}

/* Slider values are editable but look like plain text until hovered or focused */
input.slider-value {
  width: 5.5em;
  padding: 0 0.25rem;
  margin-right: -0.25rem;
  text-align: right;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--bs-border-radius-sm);
}

input.slider-value:hover {
  border-color: var(--bs-border-color);
}

input.slider-value:focus {
  outline: 0;
  border-color: var(--bs-primary);
  background: var(--bs-body-bg);
}

#canvasDiv {
  padding: 0;
  position: relative;
}

/* Drag sideways on the canvas to adjust the multiplier; vertical touch drags still scroll the page */
#canvas {
  cursor: ew-resize;
  touch-action: pan-y;
}

/* Fullscreen controls, faded out by setControlsVisible() when the pointer is still */
#fullscreenSliders,
#fullscreenToolbar {
  z-index: 1050;
  transition: opacity 0.5s ease-in-out;
  max-width: calc(100% - 2rem);
}

#fullscreenSliders {
  width: 300px;
  max-height: calc(100% - 2rem);
  overflow-y: auto;
}

#fullscreenToolbar {
  width: max-content;
}

/* Fallback when the Fullscreen API isn't available (iPhone Safari): fill the viewport instead */
#canvasDiv.pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1045;
}

html.pseudo-fullscreen-active,
html.pseudo-fullscreen-active body {
  overflow: hidden;
}

/* Help toggle in the navbar hides form-text help and the shortcuts list */
.hide-help .help-text {
  display: none !important;
}

/* Favorites dialog thumbnails */
.favorite-load img {
  aspect-ratio: 1;
  object-fit: cover;
  width: 100%;
  height: auto;
}
