/* Morph Paths demo — full-bleed canvas with a floating, collapsible control
   sidebar on the left. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Canvas fills the viewport; the sidebar floats on top of it. */
.container {
  position: fixed;
  inset: 0;
  background: rgb(250, 250, 250);
}

#myCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */

#sidebar {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 320px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  z-index: 10;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #222;
}

.sidebar-toggle:hover { background: rgba(0, 0, 0, 0.04); }
.toggle-icon { font-size: 16px; }

.sidebar-body {
  padding: 4px 16px 16px;
  overflow-y: auto;
}

#sidebar.collapsed .sidebar-body { display: none; }

.sidebar-title {
  margin: 4px 0 6px;
  font-size: 16px;
}

.sidebar-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #555;
}

.sidebar-hint kbd {
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0 4px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

/* ── Groups & rows ────────────────────────────────────────────────────── */

fieldset.group {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 10px 10px;
  margin: 0 0 12px;
}

fieldset.group legend {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
  padding: 0 4px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0;
}

.control-row > label {
  font-size: 13px;
  color: #333;
  flex: 0 0 auto;
}

.control-row select {
  flex: 1 1 auto;
  min-width: 0;
}

select,
button {
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid #bbb;
  border-radius: 6px;
  background: #fff;
  color: #222;
  cursor: pointer;
}

button {
  width: 100%;
  font-weight: 600;
}

button:hover { background: #f2f2f2; }
button.playing { background: #ffe3e3; border-color: #e88; }

.range-with-value {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
}

.range-with-value input[type="range"] { flex: 1 1 auto; min-width: 0; }
.range-with-value span {
  flex: 0 0 38px;
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #555;
}

/* ── Radio & checkbox groups ──────────────────────────────────────────── */

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 4px 0;
}

.radio-label,
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
}

.checkbox-label { margin: 6px 0; }

/* ── State helpers ────────────────────────────────────────────────────── */

.hidden { display: none !important; }

#playbackControls { margin-top: 4px; }

#playbackControls.disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ── Accessibility: visible focus ─────────────────────────────────────── */

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid #4c6ef5;
  outline-offset: 1px;
}

/* ── Small screens ────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  #sidebar {
    width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
  }
}
