/* The graphic looks tool (inc/graphic-tool.inc.php): the samples, the look
   tiles, the colour pairs and the photo. The layout is pt-ui.css's, the
   phone editor pt-app.css's, the sliders and buttons take pt-theme.css's look. */

/* ── Empty state: the samples ─────────────────────────────────────────── */
.graphic-editor .sample-thumbnails-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  /* Without a width it shrinks to half the box (left: 50%). */
  width: 90%;
}
/* By id: in the phone editor the photo box is out of the card. */
#gx-empty.hidden { display: none; }
.graphic-editor .sample-thumbnails { display: flex; justify-content: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.graphic-editor .sample-thumbnail {
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  overflow: hidden;
  width: 110px;
  height: 110px;
  padding: 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.graphic-editor .sample-thumbnail:hover,
.graphic-editor .sample-thumbnail:focus-visible { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 4px 12px rgba(15, 112, 230, 0.25); }
.graphic-editor .sample-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 767px) { .graphic-editor .sample-thumbnail { width: 84px; height: 84px; } }

/* ── The photo ────────────────────────────────────────────────────────── */
#gx-viewport { position: relative; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
#gx-canvas { display: block; max-width: 100%; max-height: 100%; border-radius: 6px; background: #fff; }
#gx-canvas[hidden] { display: none; }
/* Threshold on a transparent background: the checkerboard behind it. */
#gx-canvas.gx-alpha {
  background-color: #fff;
  background-image: linear-gradient(45deg, #e3e3e3 25%, transparent 25%), linear-gradient(-45deg, #e3e3e3 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #e3e3e3 75%), linear-gradient(-45deg, transparent 75%, #e3e3e3 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
#gx-compare.active { color: #fff; background: var(--cb-ink, #16181d); border-color: var(--cb-ink, #16181d); }

/* ── Look tiles: the photo in each look ───────────────────────────────── */
.gx-looks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; }
.gx-look {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cb-text, #3d434b);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
}
.gx-thumb {
  position: relative;
  display: block;
  width: 100%;
  max-width: 96px;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #e9e5df, #f6f4f1);
  box-shadow: inset 0 0 0 1px var(--cb-line, #e4e1dc);
  transition: box-shadow 0.15s;
}
.gx-thumb canvas { display: block; width: 100%; height: 100%; }
.gx-name { max-width: 100%; text-align: center; overflow-wrap: anywhere; hyphens: auto; }
.gx-look:hover .gx-thumb { box-shadow: inset 0 0 0 1px var(--cb-line, #e4e1dc), 0 0 0 2px #cfcac3; }
.gx-look[aria-pressed="true"] { color: var(--cb-ink, #16181d); font-weight: 700; }
/* The chosen one: CB's double ring. */
.gx-look[aria-pressed="true"] .gx-thumb { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cb-ink, #16181d); }
.gx-look:focus-visible { outline: none; }
.gx-look:focus-visible .gx-thumb { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(15, 112, 230, 0.6); }
fieldset:disabled .gx-look { cursor: default; opacity: 0.75; }

.gx-link {
  border: 0;
  background: none;
  padding: 2px 4px;
  font-size: 0.8rem;
  color: var(--pt-accent, #0f70e6);
  cursor: pointer;
}
.gx-link:disabled { color: #9aa1aa; cursor: default; }
#gx-shuffle { display: inline-flex; align-items: center; gap: 6px; }
.gx-opts[hidden] { display: none; }
/* Choices of three or six: words wrap rather than overflow. */
.gx-choice .pt-cseg { flex-wrap: wrap; }
.gx-choice .pt-cseg button { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
#gx-palette.pt-cseg button { flex: 1 1 30%; }

/* ── Duotone: the pairs and your own two colours ──────────────────────── */
.gx-pairs { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.gx-pair {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(22, 24, 29, 0.12);
}
.gx-pair[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cb-ink, #16181d); }
.gx-pair:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(15, 112, 230, 0.6); }
.gx-own { flex-wrap: wrap; }
.gx-swatch { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 600; color: var(--cb-text, #3d434b); cursor: pointer; min-width: 0; }
.gx-swatch input[type="color"] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--cb-line, #e4e1dc); border-radius: 50%; background: none; cursor: pointer; flex-shrink: 0; }
.gx-swatch input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.gx-swatch input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.gx-swatch input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.gx-swap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d6d2cc;
  border-radius: 50%;
  background: #fff;
  color: var(--cb-text, #3d434b);
  cursor: pointer;
  flex-shrink: 0;
}
.gx-swap:hover { border-color: var(--cb-ink, #16181d); }

/* ── Phone editor ─────────────────────────────────────────────────────── */
/* The tiles lifted into the bottom bar: one row that scrolls sideways. */
.pt-app-panels .gx-looks { display: flex; gap: 10px; padding: 6px 4px; }
.pt-app-panels .gx-look { flex: 0 0 auto; width: 68px; color: var(--pt-app-fg); }
.pt-app-panels .gx-look[aria-pressed="true"] { color: var(--pt-app-fg); }
.pt-app-panels .gx-thumb { box-shadow: inset 0 0 0 1px var(--pt-app-line-strong); }
/* Options in the bottom bar: the look's choices, compact. */
.pt-app-panels #gx-opts { padding: 4px 4px 2px; max-height: 40vh; overflow-y: auto; }
.pt-app-panels #gx-opts .form-label { color: var(--pt-app-fg); font-size: 13px; margin-bottom: 4px; }
.pt-app-panels #gx-opts .gx-choice,
.pt-app-panels #gx-opts #gx-pair-row { margin-bottom: 10px !important; }
.pt-app-panels #gx-opts .form-check-label,
.pt-app-panels #gx-opts .gx-swatch { color: var(--pt-app-fg); }
.pt-app-panels .gx-pairs { gap: 10px; }
