/*
 * Sky Replacement (inc/skr-tool.inc.php). The layout is pt-ui.css's, the
 * phone editor pt-app.css's, the segmented track and the one-line sliders
 * pt-theme.css's; this is the sky tiles, the picture, the brush ring and the
 * samples. Sizes in px: the theme's rem is 20px. Panel rows are styled by
 * id: in the phone editor they are moved out of .skr-editor.
 */
.skr-ic { width: 20px; height: 20px; flex: 0 0 auto; }

/* ── The skies ────────────────────────────────────────────────────────── */
#skr-skies { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 10px 8px; width: 100%; }
.skr-sky {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cb-text, #3d434b);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}
.skr-sky > img, .skr-own-pic {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 10px;
  background: #dfe6ef;
  transition: box-shadow 0.15s ease;
}
.skr-sky > span { display: block; min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.skr-sky:hover > img, .skr-sky:hover .skr-own-pic { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #cfcac3; }
.skr-sky.active { color: var(--cb-ink, #16181d); }
.skr-sky.active > img, .skr-sky.active .skr-own-pic { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cb-ink, #16181d); }
.skr-sky:focus-visible { outline: none; }
.skr-sky:focus-visible > img, .skr-sky:focus-visible .skr-own-pic { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pt-accent, #0f70e6); }
/* Your sky: an upload tile until one is given, then its picture. */
.skr-own-pic {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1.5px dashed #b4bcc8;
  background: var(--cb-bg, #f2f4f8);
  color: var(--cb-muted, #626973);
  font-style: normal;
  box-sizing: border-box;
}
.skr-sky.has-sky .skr-own-pic { border: 0; }
.skr-own-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.skr-flip { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; }
.skr-flip .skr-ic { width: 17px; height: 17px; }
.skr-flip.active { color: #fff; background: var(--cb-ink, #16181d); border-color: var(--cb-ink, #16181d); }
.skr-seg button { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.skr-note { margin-top: 8px; line-height: 1.4; }

/* ── The picture ──────────────────────────────────────────────────────── */
#skr-viewport { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#skr-viewport.pt-app-loaded { padding: 12px; }
#skr-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#skr-canvas.skr-dragging { cursor: grabbing; }
#skr-canvas.skr-brush { cursor: crosshair; }
/* The brush: a ring the size it paints. */
#skr-ring {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  display: none;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
#skr-ring.show { display: block; }
#skr-busy {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 24, 32, 0.35);
  border-radius: inherit;
}
#skr-busy.show { display: flex; }

/* ── Empty: the samples ───────────────────────────────────────────────── */
.skr-samples { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 6px; }
.skr-sample {
  flex-shrink: 0;
  width: 110px;
  height: 73px;
  padding: 0;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.skr-sample:hover, .skr-sample:focus-visible { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 4px 12px rgba(15, 112, 230, 0.25); outline: none; }
.skr-sample img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 767px) {
  .skr-sample { width: 88px; height: 59px; }
  .skr-samples { gap: 8px; }
}

/* ── Phone editor ─────────────────────────────────────────────────────── */
/* The skies: a sideways strip of pictures. */
.pt-app-strip#skr-skies { display: flex; gap: 10px; padding: 4px 4px 2px; }
.pt-app-strip#skr-skies > .skr-sky { flex: 0 0 72px; width: 72px; color: var(--pt-app-muted); font-size: 11px; }
.pt-app-strip#skr-skies > .skr-sky.active { color: var(--pt-app-fg); }
.pt-app-panels #skr-fix-opts { max-width: 420px; margin: 0 auto; padding: 4px 6px; color: var(--pt-app-fg); }
.pt-app-panels #skr-fix-opts .form-check { margin: 8px 0 0; }
.pt-app-panels #skr-flip { display: flex; margin: 2px auto; min-height: 40px; }
