/* shared/uv-colorway-strip.css — Sprint 22.1
 * Top-of-editor colorway picker. Horizontally scrollable on mobile, flexbox
 * row on tablet+. Designed to coexist with .uv-toolbar (top) and
 * .uv-floatbar (bottom). All sizing in clamp() to feel native on iPhone SE
 * through iPad Pro. */

.uv-colorway-strip {
  /* Pinned under the fixed editor toolbar. We use fixed (not sticky) because
     the toolbar itself is position:fixed and lives outside the natural flow,
     and the editor canvas is a long scrolling document. */
  position: fixed;
  top: var(--uv-toolbar-h, 56px);
  left: 0;
  right: 0;
  z-index: 38; /* below toolbar (40), above page content */
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid rgba(20, 24, 32, 0.08);
  box-shadow: 0 4px 14px rgba(20, 24, 32, 0.06);
  padding: 10px clamp(12px, 4vw, 20px) 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: uvCwSlideDown 320ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes uvCwSlideDown {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

body.has-uv-colorway-strip {
  /* Push the page content down so the canvas doesn't slip under the strip.
     --uv-colorway-strip-h and --uv-toolbar-h are kept fresh by the JS
     syncTop() routine that measures the live DOM. */
  --uv-colorway-strip-h: 96px;
  padding-top: calc(var(--uv-toolbar-h, 56px) + var(--uv-colorway-strip-h, 96px)) !important;
}
@media (min-width: 640px) {
  body.has-uv-colorway-strip { --uv-colorway-strip-h: 88px; }
}
/* If the editor already had top padding for just the toolbar (.has-uv-toolbar),
   the rule above takes over and includes the strip height as well. */

.uv-colorway-strip__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  line-height: 1.2;
}

.uv-colorway-strip__title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: clamp(0.78rem, 3vw, 0.92rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #18222e;
  text-transform: uppercase;
}

.uv-colorway-strip__hint {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(0.68rem, 2.6vw, 0.78rem);
  color: rgba(24, 34, 46, 0.6);
}
@media (max-width: 380px) {
  /* Phone: the hint duplicates the obvious, hide it to gain space. */
  .uv-colorway-strip__hint { display: none; }
}

.uv-colorway-strip__rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 2px 2px 4px;
  margin: 0 -2px;
}
.uv-colorway-strip__rail::-webkit-scrollbar { display: none; }

.uv-cw-swatch {
  flex: 0 0 auto;
  scroll-snap-align: start;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 6px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0.7, 0.2, 1),
              border-color 160ms ease,
              background 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.uv-cw-swatch:hover {
  transform: translateY(-1px);
  background: rgba(20, 24, 32, 0.04);
}
.uv-cw-swatch:focus-visible {
  outline: none;
  border-color: #2a6df4;
  background: rgba(42, 109, 244, 0.08);
}

.uv-cw-swatch__pill {
  display: inline-flex;
  width: clamp(44px, 12vw, 56px);
  height: clamp(44px, 12vw, 56px);
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(20, 24, 32, 0.1),
    0 2px 6px rgba(20, 24, 32, 0.12);
  position: relative;
}

.uv-cw-swatch__band {
  flex: 1 1 33.333%;
  display: block;
  height: 100%;
}

.uv-cw-swatch__label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(0.66rem, 2.6vw, 0.74rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #2a3340;
  white-space: nowrap;
  max-width: 76px;
  text-overflow: ellipsis;
  overflow: hidden;
}

.uv-cw-swatch__check {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  color: #16a34a;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(20, 24, 32, 0.25));
}

.uv-cw-swatch[aria-checked="true"] {
  background: rgba(20, 24, 32, 0.05);
  border-color: rgba(20, 24, 32, 0.18);
}
.uv-cw-swatch[aria-checked="true"] .uv-cw-swatch__check {
  opacity: 1;
  transform: scale(1);
}
.uv-cw-swatch[aria-checked="true"] .uv-cw-swatch__pill {
  box-shadow:
    inset 0 0 0 2px #fff,
    inset 0 0 0 4px rgba(20, 24, 32, 0.2),
    0 4px 10px rgba(20, 24, 32, 0.18);
}

.uv-cw-swatch[aria-checked="true"] .uv-cw-swatch__label {
  color: #18222e;
  font-weight: 700;
}

/* Dark / cinematic templates — the strip needs to read against dark canvases.
   The .uv-mode-draft body class is always present in editor draft mode, so we
   detect dark template canvases via the data-template attribute if set. */
@media (prefers-color-scheme: dark) {
  .uv-colorway-strip {
    background: rgba(18, 22, 30, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
  .uv-colorway-strip__title { color: #f5f3ef; }
  .uv-colorway-strip__hint  { color: rgba(245, 243, 239, 0.6); }
  .uv-cw-swatch__label      { color: #d7dbe0; }
  .uv-cw-swatch:hover       { background: rgba(255, 255, 255, 0.06); }
  .uv-cw-swatch[aria-checked="true"] {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
  }
  .uv-cw-swatch[aria-checked="true"] .uv-cw-swatch__label { color: #fff; }
}

/* Reduce motion. */
@media (prefers-reduced-motion: reduce) {
  .uv-colorway-strip,
  .uv-cw-swatch,
  .uv-cw-swatch__check { animation: none !important; transition: none !important; }
}
