/* =====================================
   PaletteForge — tools/paletteforge/css/style.css
   Builds on base.css / layout.css / tool.css
===================================== */

/* ---- Hero image ----
   layout.css hides .hero-image (display:none) globally; re-enable it scoped to
   this tool (higher specificity) so the hero shows on both PC and SP. */
.gz-tool-paletteforge .hero-image {
  display: block;
  width: clamp(280px, 46vw, 560px);
  margin: 0 auto 1.3rem;
  border-radius: 18px;
}
@media (max-width: 600px) {
  .gz-tool-paletteforge .hero-image {
    display: block;
    width: 86vw;
    max-width: 420px;
  }
}

/* ---- Hero swatch strip ---- */
.pf-hero-art {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 0 auto 1.2rem;
  max-width: 320px;
}
.pf-hero-art span {
  flex: 1 1 0;
  height: 44px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* ---- Compare (canvas variant of the shared slider) ---- */
.gz-compare-card,
.gz-settings-card {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.gz-compare-card { text-align: center; }

.gz-compare-inner {
  position: relative;
  margin: 0.5rem auto 1rem;
  display: block;
  overflow: hidden;
  border-radius: 14px;
  background:
    repeating-conic-gradient(#eee 0% 25%, #fafafa 0% 50%) 50% / 24px 24px;
}

.gz-compare-img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  user-select: none;
  -webkit-user-drag: none;
}
.gz-compare-img--base { position: relative; z-index: 1; }

.gz-compare-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}
.gz-compare-img--top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.gz-compare-side-label {
  position: absolute;
  bottom: 8px;
  font-size: 0.75rem;
  line-height: 1.3;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  pointer-events: none;
  z-index: 4;
}
.gz-label-left { left: 10px; }
.gz-label-right { right: 10px; }

.gz-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  touch-action: none;
  width: 0;
}
.gz-compare-handle-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-50%);
  width: 2px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgb(31 41 55 / 12%);
}
.gz-compare-handle-knob {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  pointer-events: auto;
  cursor: ew-resize;
}
.gz-compare-knob-dot {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d7d7d7;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease;
}
.gz-compare-handle-knob:hover .gz-compare-knob-dot { transform: scale(1.08); }

/* ---- Busy indicator ---- */
.pf-busy[hidden] { display: none; }
.pf-busy {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.66);
  color: #1f2937;
  font-size: 0.9rem;
  z-index: 5;
}
.pf-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(31, 111, 255, 0.25);
  border-top-color: #1f6fff;
  border-radius: 50%;
  animation: pf-spin 0.8s linear infinite;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }

/* ---- Settings card ---- */
.gz-settings-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Color count */
.pf-count-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.pf-count-btn {
  min-width: 48px;
  padding: 0.45rem 0.7rem;
  border: 1px solid #d7dbe0;
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pf-count-btn:hover { border-color: #1f6fff; }
.pf-count-btn.is-active {
  background: #1f6fff;
  border-color: #1f6fff;
  color: #fff;
}
.pf-count-custom {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #4b5563;
}
.pf-count-custom input {
  width: 72px;
  padding: 0.4rem 0.5rem;
  border: 1px solid #d7dbe0;
  border-radius: 8px;
}

/* Dithering */
.pf-dither-control {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.pf-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid #d7dbe0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
.pf-radio input { accent-color: #1f6fff; }
.pf-radio:has(input:checked) {
  border-color: #1f6fff;
  background: rgba(31, 111, 255, 0.06);
}

/* Blocks */
.pf-block { border-top: 1px solid #eef0f3; padding-top: 0.9rem; }
.pf-block-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}
.pf-block-hint {
  font-size: 0.8rem;
  color: #6b7280;
  margin: 0 0 0.6rem;
}

/* Palette chips */
.pf-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
}
.pf-chip {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.pf-chip:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); }
.pf-chip__swatch {
  height: 52px;
  background: var(--pf-chip-color, #ccc);
}
.pf-chip__hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  padding: 0.3rem 0;
  text-align: center;
  color: #374151;
}

/* Usage list */
.pf-usage-list { display: flex; flex-direction: column; gap: 0.4rem; }
.pf-usage-row {
  display: grid;
  grid-template-columns: 18px 76px 1fr 54px 70px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}
.pf-usage-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.pf-usage-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #374151;
}
.pf-usage-bar {
  height: 8px;
  background: #eef0f3;
  border-radius: 999px;
  overflow: hidden;
}
.pf-usage-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #1f6fff, #22d3ee);
  border-radius: 999px;
}
.pf-usage-pct { text-align: right; font-variant-numeric: tabular-nums; color: #111827; }
.pf-usage-count { text-align: right; color: #6b7280; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .pf-usage-row { grid-template-columns: 16px 1fr 48px; }
  .pf-usage-bar, .pf-usage-count { display: none; }
}

/* Export */
.pf-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.pf-export-grid .gz-secondary-btn { width: 100%; }

/* Toast */
.pf-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: #111827;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}
.pf-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
