/* Site chrome: command dock, palette, tooltips. Plain CSS so RS3 and Voice can load it. */

#command-dock {
  position: fixed;
  left: 50%;
  bottom: env(safe-area-inset-bottom, 0px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  transform: translate(-50%, calc(100% + 5rem));
  transition: transform 280ms ease-out;
}

#command-dock.is-open {
  pointer-events: auto;
  transform: translate(-50%, -0.5rem);
}

.command-dock-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem;
  border-radius: 9999px;
  background: rgb(255 255 255 / 0.8);
  border: 1px solid #e5e7eb;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.1);
  backdrop-filter: blur(12px);
}

html.dark .command-dock-bar,
html[data-theme="dark"] .command-dock-bar {
  background: rgb(14 14 16 / 0.9);
  border-color: #1f2937;
}

@media (min-width: 768px) {
  .command-dock-bar {
    gap: 0.5rem;
    padding: 0.5rem;
  }
}

.command-dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

@media (min-width: 768px) {
  .command-dock-btn {
    padding: 0.75rem;
  }
}

.command-dock-btn:hover {
  background: #f3f4f6;
}

html.dark .command-dock-btn,
html[data-theme="dark"] .command-dock-btn {
  color: #9ca3af;
}

html.dark .command-dock-btn:hover,
html[data-theme="dark"] .command-dock-btn:hover {
  background: #1f2937;
}

.command-dock-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.command-dock-btn.is-pressed {
  background: #e5e7eb;
}

html.dark .command-dock-btn.is-pressed,
html[data-theme="dark"] .command-dock-btn.is-pressed {
  background: #374151;
}

.command-dock-divider {
  width: 1px;
  height: 1.5rem;
  margin: 0 0.25rem;
  background: #e5e7eb;
}

html.dark .command-dock-divider,
html[data-theme="dark"] .command-dock-divider {
  background: #1f2937;
}

#color-picker-popover {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.125rem;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.75rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

html.dark #color-picker-popover,
html[data-theme="dark"] #color-picker-popover {
  background: #111827;
  border-color: #1f2937;
}

#color-picker-popover.is-hidden,
#command-dock .is-hidden,
#custom-tooltip.is-hidden {
  display: none;
}

.color-swatch {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 0 0 2px transparent;
  transition: transform 150ms ease;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #9ca3af;
}

html.dark .color-swatch.active,
html[data-theme="dark"] .color-swatch.active {
  box-shadow: 0 0 0 2px #111827, 0 0 0 4px #6b7280;
}

#dock-hotzone {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 79;
  width: 16rem;
  height: calc(1.75rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
}

@media (hover: hover) and (pointer: fine) {
  #dock-hotzone {
    display: block;
  }
}

#dock-handle {
  display: none;
  position: fixed;
  left: 50%;
  bottom: env(safe-area-inset-bottom, 0px);
  z-index: 81;
  width: 2.75rem;
  height: 2.75rem;
  transform: translateX(-50%);
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

@media (hover: none), (pointer: coarse) {
  #dock-handle {
    display: flex;
  }
}

#dock-handle[aria-expanded="true"] {
  visibility: hidden;
  pointer-events: none;
}

.dock-handle-bar {
  margin-bottom: 0.375rem;
  height: 0.25rem;
  width: 2.25rem;
  border-radius: 9999px;
  background: rgb(17 24 39 / 0.45);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

html.dark .dock-handle-bar,
html[data-theme="dark"] .dock-handle-bar {
  background: rgb(255 255 255 / 0.6);
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 1rem 0;
  background: rgb(0 0 0 / 0.4);
  backdrop-filter: blur(4px);
}

html.dark .command-palette,
html[data-theme="dark"] .command-palette {
  background: rgb(0 0 0 / 0.55);
}

.command-palette[hidden] {
  display: none !important;
}

.command-palette-panel {
  width: 100%;
  max-width: 28rem;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

html.dark .command-palette-panel,
html[data-theme="dark"] .command-palette-panel {
  border-color: #1f2937;
  background: #141418;
}

.command-palette-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  background: transparent;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #111827;
  outline: none;
}

html.dark .command-palette-input,
html[data-theme="dark"] .command-palette-input {
  border-bottom-color: #1f2937;
  color: #f3f4f6;
}

.command-palette-list {
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.command-palette-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
}

html.dark .command-palette-item,
html[data-theme="dark"] .command-palette-item {
  color: #d1d5db;
}

.command-palette-item[aria-selected="true"] {
  background-color: color-mix(in srgb, var(--accent-color, #10b981) 16%, transparent);
  color: inherit;
}

.command-palette-hint {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}

html.dark .command-palette-hint,
html[data-theme="dark"] .command-palette-hint {
  color: #6b7280;
}

.command-palette-empty {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.custom-tooltip {
  position: fixed;
  z-index: 4100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
  width: max-content;
  top: 0;
  left: 0;
}

.custom-tooltip.visible {
  opacity: 1;
}

.tooltip-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  background: #fff;
  color: #111827;
  font-size: 0.75rem;
  font-weight: 500;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  border: 1px solid #e5e7eb;
}

html.dark .tooltip-content,
html[data-theme="dark"] .tooltip-content {
  background: #1f2937;
  color: #f3f4f6;
  border-color: #374151;
}

.tooltip-kbd {
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: #f3f4f6;
  color: #6b7280;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  line-height: 1;
  border: 1px solid #e5e7eb;
}

html.dark .tooltip-kbd,
html[data-theme="dark"] .tooltip-kbd {
  background: #374151;
  color: #d1d5db;
  border-color: #4b5563;
}

#theme-announcer.sr-only,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  #command-dock {
    transition: none;
  }

  .command-palette {
    backdrop-filter: none;
  }
}

@media print {
  #command-dock,
  #dock-hotzone,
  #dock-handle,
  #command-palette,
  #custom-tooltip {
    display: none !important;
  }
}
