/* =====================================================================
   GeekHuang Lab — 像素头像生成器 page styles
   Uses the site tokens from css/style.css (--bg, --surface, --line,
   --text*, --cyan …). Everything is scoped to .pa-page / .pa-*.
   ===================================================================== */

.pa-page {
  padding-block: clamp(28px, 5vw, 64px) clamp(64px, 8vw, 120px);
}

/* author display rules below would beat the UA [hidden] rule — restore it */
.pa-page [hidden] { display: none !important; }

.pa-back { display: inline-flex; gap: 8px; color: var(--text-3); margin-bottom: 28px; }
.pa-back:hover { color: var(--text); }

/* ---------- head ---------- */
.pa-eyebrow { display: flex; align-items: center; gap: 12px; color: var(--text-3); }
.pa-eyebrow__rule { flex: 0 1 64px; height: 1px; background: var(--line-2); }
.pa-title {
  margin-top: 14px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
}
.pa-intro { margin-top: 14px; max-width: 62ch; color: var(--text-2); }
.pa-privacy {
  margin-top: 14px;
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

/* ---------- layout ---------- */
.pa-grid {
  margin-top: clamp(24px, 4vw, 40px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
@media (min-width: 960px) {
  .pa-grid { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); align-items: start; }
}

.pa-stage, .pa-panel {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: clamp(16px, 2.4vw, 24px);
}

/* corner brackets (same idea as lab/pet) */
.pa-page .corner {
  position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 0 solid var(--line-3);
}
.pa-page .corner--tl { top: 8px; left: 8px; border-top-width: 1px; border-left-width: 1px; }
.pa-page .corner--br { bottom: 8px; right: 8px; border-bottom-width: 1px; border-right-width: 1px; }

.pa-stage__top, .pa-panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--text-3);
}
.pa-stage__title, .pa-panel__title { font: inherit; letter-spacing: inherit; color: var(--text-2); }
.pa-stage__grid { padding: 2px 10px; border: 1px solid var(--line-2); border-radius: 999px; }

/* ---------- preview ---------- */
.pa-preview-wrap {
  position: relative;
  margin: 20px auto 0;
  width: min(320px, 100%);
  aspect-ratio: 1;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  overflow: hidden;
  /* checkerboard shows through a transparent avatar background */
  background-color: var(--surface-2);
  background-image:
    linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%),
    linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}
#preview {
  display: block;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.pa-empty {
  position: absolute; inset: 0;
  display: grid; place-content: center; gap: 8px;
  text-align: center; color: var(--text-3);
  padding: 16px;
}
.pa-empty__big { margin: 0; font-size: 18px; color: var(--text-2); }
.pa-empty__hint { margin: 0; font-size: 14px; line-height: 1.7; }

/* ---------- drop zone / crop view ---------- */
.pa-drop {
  position: relative;
  margin: 20px auto 0;
  max-width: 560px;
  border: 1.5px dashed var(--line-3);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.pa-drop.is-drag {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}
#crop-view {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  touch-action: none;
  cursor: grab;
}
#crop-view.is-panning { cursor: grabbing; }
.pa-drop__hint {
  display: grid; place-content: center; gap: 6px;
  aspect-ratio: 1;
  text-align: center;
  color: var(--text-3);
  padding: 16px;
  pointer-events: none;
}
.pa-drop__hint p { margin: 0; }
.pa-drop__or { font-size: 12px; letter-spacing: 0.14em; }

/* square viewfinder frame over the crop view */
.pa-frame {
  position: absolute; inset: 12px;
  border: 1.5px dashed rgba(255, 255, 255, 0.55);
  pointer-events: none;
}
[data-theme="light"] .pa-frame { border-color: rgba(11, 16, 32, 0.45); }
.pa-frame::before, .pa-frame::after {
  content: ""; position: absolute; background: inherit;
}
.pa-frame::before { left: 50%; top: 0; bottom: 0; width: 1.5px; transform: translateX(-50%); opacity: 0.4; }
.pa-frame::after { top: 50%; left: 0; right: 0; height: 1.5px; transform: translateY(-50%); opacity: 0.4; }

/* ---------- zoom ---------- */
.pa-zoom {
  margin-top: 14px;
  display: flex; align-items: center; gap: 12px;
}
.pa-zoom__label { color: var(--text-3); font-size: 13px; }
.pa-zoom__val { min-width: 44px; text-align: right; color: var(--text-2); font-size: 13px; }
#zoom-slider {
  flex: 1;
  accent-color: var(--cyan);
  height: 28px;
  cursor: pointer;
}

/* ---------- actions ---------- */
.pa-actions {
  margin-top: 18px;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.pa-actions .btn { flex: 1 1 auto; min-height: 46px; }
.pa-note { margin-top: 12px; color: var(--text-3); font-size: 12px; }
.pa-status { margin: 10px 0 0; min-height: 1.4em; color: var(--ok); font-size: 14px; }

/* ---------- panel groups ---------- */
.pa-group { margin-top: 22px; }
.pa-group__title {
  margin: 0 0 10px;
  color: var(--text-3);
  font-size: 13px;
  letter-spacing: 0.08em;
}
.pa-group__hint { margin: 8px 0 0; color: var(--text-3); font-size: 12px; }

/* segmented radio buttons */
.pa-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.pa-seg button {
  min-width: 56px;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.pa-seg button:hover { border-color: var(--line-3); color: var(--text); }
.pa-seg button[aria-checked="true"] {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-soft);
}

/* palette list */
.pa-palettes { display: grid; gap: 8px; }
.pa-palettes button {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.pa-palettes button:hover { border-color: var(--line-3); color: var(--text); }
.pa-palettes button[aria-checked="true"] {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-soft);
}
.pa-dots { display: inline-flex; gap: 3px; flex: 0 0 auto; }
.pa-dots i {
  width: 12px; height: 12px;
  border-radius: 3px;
  border: 1px solid var(--line-2);
}

/* toggle switch */
.pa-switch {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0;
  cursor: pointer;
  color: var(--text);
  font-size: 15px;
}
.pa-switch input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.pa-switch__track {
  flex: 0 0 auto;
  position: relative;
  width: 40px; height: 22px;
  border-radius: 999px;
  background: var(--line-2);
  transition: background var(--t-fast) var(--ease);
}
.pa-switch__thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text);
  transition: transform var(--t-fast) var(--ease);
}
.pa-switch input:checked + .pa-switch__track { background: var(--cyan); }
.pa-switch input:checked + .pa-switch__track .pa-switch__thumb { transform: translateX(18px); background: #fff; }
.pa-switch input:focus-visible + .pa-switch__track { outline: 2px solid var(--cyan); outline-offset: 2px; }
.pa-switch__desc { color: var(--text-3); font-size: 12px; }

/* background swatches */
.pa-bg { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pa-swatch {
  width: 32px; height: 32px;
  padding: 0;
  border: 1px solid var(--line-3);
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pa-swatch.is-active { outline: 2px solid var(--cyan); outline-offset: 2px; }
.pa-swatch--clear {
  background-color: var(--surface-2);
  background-image:
    linear-gradient(45deg, var(--line-3) 25%, transparent 25%, transparent 75%, var(--line-3) 75%),
    linear-gradient(45deg, var(--line-3) 25%, transparent 25%, transparent 75%, var(--line-3) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}
.pa-swatch--custom { position: relative; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); }
.pa-swatch--custom::after { content: "+"; font-size: 18px; color: var(--text-2); line-height: 1; }
.pa-swatch--custom input[type="color"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* download */
.pa-dl { display: flex; gap: 10px; }
.pa-dl .btn { flex: 1; min-height: 46px; }
.pa-dl .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.pa-src { margin-top: 22px; color: var(--text-3); font-size: 12px; }

/* ---------- small screens ---------- */
@media (max-width: 480px) {
  .pa-actions .btn { flex: 1 1 100%; }
  .pa-dl { flex-direction: column; }
  .pa-preview-wrap { width: 100%; }
}
