/* Palette customizer — sits beside the style switcher pill, bottom-right. */

.palette-customizer {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 1001;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.palette-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  background: rgba(20, 20, 20, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  transition: transform .2s ease;
}
.palette-toggle:hover { transform: translateY(-2px); }
.palette-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}
.palette-swatch + .palette-swatch { margin-left: -6px; }
.palette-toggle-label {
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

/* ── Panel ── */
.palette-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 320px;
  background: #161614;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 18px;
  color: #f4f4ee;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease;
}
.palette-customizer.is-open .palette-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.palette-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.palette-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244, 244, 238, 0.65);
}
.palette-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: rgba(244, 244, 238, 0.5);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
}
.palette-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.palette-row-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244, 244, 238, 0.4);
  margin-bottom: 10px;
}

/* Presets */
.palette-presets { margin-bottom: 18px; }
.palette-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.palette-preset {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  text-align: left;
  font-family: inherit;
}
.palette-preset:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
.pp-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.pp-swatch + .pp-swatch { margin-left: -4px; }
.pp-name {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #f4f4ee;
}

/* Custom controls */
.palette-controls { margin-bottom: 16px; }
.palette-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}
.palette-control:last-child { border-bottom: none; }
.pc-label {
  font-size: 13px;
  font-weight: 500;
  color: #f4f4ee;
}
.pc-input {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.pc-input input[type="color"] {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.pc-input input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; border-radius: 6px; }
.pc-input input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.pc-hex {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: rgba(244, 244, 238, 0.55);
  font-weight: 500;
  letter-spacing: 0.04em;
  min-width: 64px;
  text-align: right;
}

/* Footer buttons */
.palette-footer {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.palette-reset, .palette-copy {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: #f4f4ee;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, border-color .2s;
}
.palette-copy {
  background: rgba(214, 242, 74, 0.95);
  border-color: rgba(214, 242, 74, 0.95);
  color: #0b0b0b;
  font-weight: 700;
}
.palette-reset:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.3); }
.palette-copy:hover { background: #fff; border-color: #fff; }

.palette-hint {
  font-size: 11px;
  color: rgba(244, 244, 238, 0.45);
  line-height: 1.5;
}
.palette-hint code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .palette-customizer {
    bottom: 80px; /* sit above the style-switcher pill */
    right: 12px;
  }
  .palette-toggle-label { display: none; }
  .palette-toggle { padding: 8px 10px; }
  .palette-panel {
    width: calc(100vw - 24px);
    max-width: 360px;
    right: 0;
  }
}
