/* ============================================================
   CLOUD PAINTS — Colour Visualiser page
   ============================================================ */

body[data-page="visualiser"] { background: var(--bg); }

/* ---------- Hero ---------- */
.vs-hero {
  padding: clamp(120px, 17vh, 180px) 0 clamp(28px, 4vw, 50px);
}
.vs-hero-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(28px, 4vw, 60px);
  align-items: end;
}
.vs-hero .eyebrow {
  color: var(--blue-2);
  border-color: rgba(37,71,184,0.25);
  background: rgba(37,71,184,0.06);
}
.vs-hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  font-weight: 400;
  margin: 16px 0 18px;
}
.vs-hero h1 em { color: var(--blue-2); font-style: italic; }
.vs-hero .lede {
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 560px;
}
.vs-hero-note {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2);
  display: flex; flex-direction: column; gap: 4px;
}
.vs-hero-note strong { color: var(--text); }

/* ---------- Stage layout ---------- */
.vs-stage-wrap {
  padding: clamp(20px, 3vw, 40px) 0 clamp(60px, 9vw, 110px);
}
.vs-stage {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(20px, 2.4vw, 36px);
  align-items: start;
}

/* ---------- Preview side ---------- */
.vs-preview { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.vs-preview-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0d0b12;
  box-shadow: var(--shadow-2);
  aspect-ratio: 3 / 2;
  isolation: isolate;
}
.vs-preview-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.4s ease;
}
.vs-preview-frame img.is-loading { opacity: 0.6; }
/* True wall-only recolour. Each room has a hand-tuned grayscale mask
   PNG that says which pixels are wall. We composite the colour through
   the mask in a <canvas> — real alpha pixels, no mask-image quirks —
   and let CSS mix-blend-mode multiply the result over the room photo
   so the wall keeps its natural shadows and highlights. */
/* The canvas draws the FULL composite (room photo + tinted wall), so
   no CSS blend mode is needed. It sits opaque over the <img>, which
   only stays in the DOM so the layout has natural intrinsic size. */
.vs-paint-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  pointer-events: none;
  object-fit: cover;
}

/* Room strip — horizontal scrollable thumbnails */
.vs-room-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding: 4px 4px 12px;
  margin: 0 -4px;
  -webkit-overflow-scrolling: touch;
}
.vs-room-strip::-webkit-scrollbar { height: 6px; }
.vs-room-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.vs-room-chip {
  appearance: none; background: transparent; border: 0; padding: 0;
  flex: 0 0 auto;
  width: 130px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  position: relative;
  display: flex; flex-direction: column;
  gap: 6px;
  text-align: left;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.vs-room-chip img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: border-color var(--t-fast);
}
.vs-room-chip span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 4px;
}
.vs-room-chip:hover img { border-color: var(--border); }
.vs-room-chip.is-active img { border-color: var(--ink); }
.vs-room-chip.is-active span { color: var(--text); }

/* ---------- Palette side ---------- */
.vs-palette {
  display: flex; flex-direction: column;
  gap: 16px;
}
.vs-active-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  display: flex; align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-1);
}
.vs-active-chip {
  width: 72px; height: 72px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.08),
    0 6px 14px -6px rgba(10,14,39,0.28);
}
.vs-active-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vs-active-name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text);
}
.vs-active-code {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}
.vs-active-cta {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--red-2);
  text-decoration: none;
  align-self: flex-start;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: color var(--t-fast);
}
.vs-active-cta:hover { color: var(--ink); }

/* ============================================================
   HSV Picker — unlimited colour
   ============================================================ */
.vs-picker {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Saturation/Value 2D canvas */
.vs-sv-wrap {
  --hue-color: hsl(220, 100%, 50%);
  position: relative;
}
.vs-sv-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 10px;
  background-color: var(--hue-color);
  background-image:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, transparent);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.10);
  overflow: hidden;
}
.vs-sv-cursor {
  position: absolute;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.45);
  pointer-events: none;
  background: #1f4088;
}

/* Hue slider — rainbow */
.vs-hue-wrap { position: relative; }
.vs-hue-slider {
  position: relative;
  width: 100%;
  height: 16px;
  border-radius: 100px;
  background: linear-gradient(to right,
    #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%,
    #00f 67%, #f0f 83%, #f00 100%);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.vs-hue-cursor {
  position: absolute;
  top: 50%;
  width: 14px; height: 22px;
  margin: -11px 0 0 -7px;
  border-radius: 4px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.4);
  pointer-events: none;
  background: #1f4088;
}

/* Hex input row */
.vs-hex-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 2px;
}
.vs-hex-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.vs-hex-row input {
  flex: 1;
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
}
.vs-hex-row input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10,14,39,0.08);
}
.vs-hex-copy {
  appearance: none;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity var(--t-fast);
}
.vs-hex-copy:hover { opacity: 0.85; }

/* Popular shades rail */
.vs-quick {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vs-quick-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.vs-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.vs-quick-chip {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  text-align: left;
}
.vs-quick-chip-swatch {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: var(--c);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.10),
    0 2px 6px -2px rgba(10,14,39,0.18);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.vs-quick-chip:hover .vs-quick-chip-swatch {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.10),
    0 8px 14px -6px rgba(10,14,39,0.28);
}
.vs-quick-chip.is-active .vs-quick-chip-swatch {
  box-shadow:
    inset 0 0 0 2px var(--ink),
    0 6px 12px -4px rgba(10,14,39,0.32);
}
.vs-quick-chip-name {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-3);
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.vs-factory-note {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-3);
  font-style: italic;
  margin: 4px 0 0;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
}

/* Footer note */
.vs-footer-note {
  margin-top: clamp(24px, 3vw, 36px);
  padding: 14px 18px;
  border-top: 1px solid var(--border-2);
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.55;
  text-align: center;
  font-style: italic;
}

/* ---------- CTA ---------- */
.vs-cta-wrap {
  padding: 0 0 clamp(80px, 12vw, 140px);
}
.vs-cta {
  padding: clamp(50px, 7vw, 80px);
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2, #1c1131) 100%);
  border-radius: var(--radius-xl, 28px);
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.vs-cta::before {
  content: ""; position: absolute;
  top: -120px; right: -120px;
  width: 340px; height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,163,23,0.45), transparent 65%);
  filter: blur(40px);
}
.vs-cta::after {
  content: ""; position: absolute; inset: 0;
  background-image: var(--grain);
  opacity: 0.08; mix-blend-mode: overlay;
  pointer-events: none;
}
.vs-cta .eyebrow {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--gold-2, #ffc93d);
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 700;
  border-radius: 100px;
}
.vs-cta h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-weight: 400;
  margin: 16px auto 14px;
  max-width: 600px;
}
.vs-cta h2 em { font-style: italic; color: var(--gold-2, #ffc93d); }
.vs-cta p {
  color: rgba(255,255,255,0.78);
  font-size: 1rem;
  max-width: 540px;
  margin: 0 auto 28px;
  line-height: 1.65;
}
.vs-cta-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.vs-cta .btn-pour {
  background: var(--gold);
  color: var(--ink);
  padding: 16px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none;
  transition: transform var(--t-fast);
}
.vs-cta .btn-pour:hover { transform: translateY(-2px); }
.vs-cta .btn-ghost-d {
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent;
  padding: 16px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.vs-cta .btn-ghost-d:hover {
  background: rgba(255,255,255,0.08);
  border-color: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .vs-hero-inner { grid-template-columns: 1fr; gap: 28px; }
  .vs-stage { grid-template-columns: 1fr; gap: 18px; }
  .vs-active-card { gap: 14px; }
  .vs-active-chip { width: 56px; height: 56px; }
}
@media (max-width: 700px) {
  .vs-quick-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .vs-quick-grid { grid-template-columns: repeat(3, 1fr); }
  .vs-room-chip { width: 110px; }
  .vs-cta-btns .btn-pour, .vs-cta-btns .btn-ghost-d { width: 100%; justify-content: center; }
  .vs-hex-row input { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .vs-preview-frame img,
  .vs-paint-overlay { transition: none !important; }
}
