/* v2 "gallery" shell. Loads AFTER style.css + landing.css, so the chat widget's own internals
   (messages, chips, cards, price card) keep their styling; this file owns the gallery frame:
   the neutral/adjustable wall backdrop, the sidebar, the chat surface, and the lightbox.
   The wall color is a CSS var (--wall) that v2.js swaps as the user picks presets or room colors. */

:root {
  --wall: #f5f2ec;                 /* warm off-white default (not stark white) */
  --panel-surface: #ffffff;
  --gallery-ink: #1c1b19;
  --gallery-muted: #7c766c;
  --gallery-line: rgba(0, 0, 0, 0.09);
}

body {
  /* the page frames the chat a few shades darker than the selected wall (--wall-dark set by v2.js) */
  background: var(--wall-dark, #e4e0d8);
  color: var(--gallery-ink);
  min-height: 100vh;
  transition: background 0.45s ease;
  font-family: "Inter", -apple-system, system-ui, sans-serif;
}

/* The shared site header (.gallery-bar / .gallery-logo / .gallery-nav) is styled in landing.css so
   every page matches; the gallery homepage only adds dark-wall overrides for it (see below). */

/* ---- headline / hero ---- */
.gallery-hero { max-width: 1180px; margin: 0 auto; padding: 48px 28px 4px; }
.gallery-hero .eyebrow { color: var(--gallery-muted); }
.gallery-headline {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: clamp(1.85rem, 3.4vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--gallery-ink);
  margin: 12px 0 0;
  max-width: 17ch;
}
.gallery-subhead {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--gallery-muted);
  max-width: 54ch;
  margin: 16px 0 0;
}

/* ---- body layout: sidebar + main ---- */
.gallery-body {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 28px 90px;
  display: grid;
  grid-template-columns: 224px 1fr;
  gap: 36px;
  align-items: start;
}

/* ---- sidebar (the wall controls) ---- */
.gallery-sidebar {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding-top: 1.5rem; /* aligns "The wall" with the chat panel's "Discovery" eyebrow (panel's own padding) */
}
.sidebar-section { display: flex; flex-direction: column; gap: 11px; }
.sidebar-label {
  font-family: "Space Mono", monospace;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gallery-muted);
}
.sidebar-hint { font-size: 0.8rem; line-height: 1.5; color: var(--gallery-muted); margin: 0; }
.wall-presets, .wall-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.wall-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--gallery-line);
  padding: 0;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
  transition: transform 0.12s ease;
}
.wall-swatch:hover { transform: scale(1.09); }
.wall-swatch.is-active { box-shadow: 0 0 0 2px var(--wall), 0 0 0 4px var(--gallery-ink); }
#wall-lightness { width: 100%; accent-color: var(--gallery-ink); }

/* Room colors stay hidden until a room photo has been analyzed (v2.js adds .show) - the section is
   empty otherwise. The lighten/darken tuner is always available: it nudges whatever wall color is
   currently picked (a preset or a room color) lighter or darker. */
#room-colors-section { display: none; }
#room-colors-section.show { display: flex; }
#wall-tune-section { display: flex; }
/* Keep the slider visible on a dark wall (the default accent is the dark ink). */
.on-dark #wall-lightness { accent-color: rgba(255, 255, 255, 0.85); }

/* ---- the chat window IS the selected wall color; the page around it is the darker frame ---- */
.gallery-main { min-width: 0; }
.gallery-chat.panel {
  margin-top: 0;              /* drop the landing .chat-panel top margin so it aligns with the sidebar */
  background: var(--wall);
  color: var(--ink);          /* keep chat content dark-on-light regardless of the wall's darkness */
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 18px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  transition: background 0.45s ease;
}

/* Only the artwork sits directly on the wall: the whole image shows (no crop), floating on the
   selected color; its title/price ride a light "placard" so they stay legible on any wall.
   Everything else in the chat (bubbles, chips, input) keeps its own light surface + dark text. */
.gallery-chat .chat-art-card { background: transparent; border: none; box-shadow: none; cursor: zoom-in; }
.gallery-chat .chat-art-card .art-thumb {
  object-fit: contain;        /* fit the whole image, keep its aspect ratio - no more cutoff */
  background: transparent;
}
.gallery-chat .art-info {
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border-radius: 9px;
  margin-top: 7px;
}
/* feedback icons sit on the bare wall - give them a light treatment on a dark wall */
.on-dark .gallery-chat .chat-art-feedback button { border-color: rgba(255, 255, 255, 0.45); color: #f2efe9; }

/* Dark wall: text that sits directly ON the wall (panel header, hint, "note" messages) flips light
   for contrast. The message bubbles are deliberately left alone - they carry their own light surface
   with dark text (assistant = paper card, user = ink card, summary chips = paper-2), so they stay
   readable on any wall. Answer chips get a brighter outline too so they don't dissolve into a dark wall. */
.on-dark .gallery-chat .chat-panel-header .eyebrow,
.on-dark .gallery-chat .chat-hint,
.on-dark .gallery-chat .saved-pill { color: rgba(255, 255, 255, 0.68); }
.on-dark .gallery-chat .saved-pill strong { color: #fff; }
.on-dark .gallery-chat .chat-message.note {
  color: rgba(255, 255, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.3);
}
.on-dark .gallery-chat .chat-chip {
  border-color: rgba(255, 255, 255, 0.5);
  color: #f2efe9;
}
.on-dark .gallery-chat .chat-chip:hover {
  background: #f2efe9;
  color: var(--ink);
}

/* ---- dark wall: flip only the surrounding chrome (bar + sidebar + hero, which sit on the
   darker page) to light text. The chat panel keeps its own dark-on-light styling. ---- */
.on-dark .gallery-logo { color: #fff; }
.on-dark .gallery-headline { color: #f3f0ea; }
.on-dark .gallery-tag,
.on-dark .gallery-nav-link,
.on-dark .gallery-hero .eyebrow,
.on-dark .gallery-subhead,
.on-dark .sidebar-label,
.on-dark .sidebar-hint { color: rgba(255, 255, 255, 0.66); }

/* ---- "view on the wall" lightbox: the piece shown large on the selected wall color ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--wall);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 5vh 4vw;
}
.lightbox[hidden] { display: none; }

/* Left rail: the live wall-color controls (moved in from the sidebar by v2.js). Its own faint,
   blurred surface so it reads as a control panel and stays legible on any wall color. */
.lb-controls {
  flex: 0 0 214px;
  align-self: center;
  max-height: 86vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 18px 22px;
  border: 1px solid var(--gallery-line);
  border-radius: 16px;
  background: rgba(127, 127, 127, 0.1);
  backdrop-filter: blur(6px);
}
.lb-controls-head {
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gallery-muted);
}
.lb-controls #wall-controls { display: flex; flex-direction: column; gap: 18px; }
/* The verbose sidebar hint is redundant next to the art - the rail heading says enough. */
.lb-controls .sidebar-hint { display: none; }
.on-dark .lb-controls-head { color: rgba(255, 255, 255, 0.62); }
.lb-close {
  position: absolute;
  top: 22px;
  right: 26px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--gallery-line);
  background: rgba(127, 127, 127, 0.12);
  color: var(--gallery-ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.lb-figure { margin: 0; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
/* Wraps the piece (image + crop canvas). Shrink-wraps to whichever is shown; carries the drop shadow
   (moved off .lb-img so it survives the crop swap) and clips the crop-selection dim to the art area. */
.lb-img-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
  overflow: hidden;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.34);
}
.lb-img,
.lb-crop-canvas {
  max-height: 72vh;
  max-width: 100%;
  display: block;
  /* Discourage saving the expanded artwork (see the JS blocker in chat-widget.js). */
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.lb-img { object-fit: contain; }
/* Transparent capture layer for drag-to-crop; sits above the image so pointer events draw the box. */
.lb-draw-layer { position: absolute; inset: 0; cursor: crosshair; touch-action: none; z-index: 2; }
/* The selection box; the huge box-shadow dims everything outside it (clipped to the art by the wrap). */
.lb-sel {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 1;
}
.lb-crop-hint { font-family: "Space Mono", monospace; font-size: 0.72rem; letter-spacing: 0.04em; color: var(--gallery-muted); margin-top: 10px; }
.lb-cap { text-align: center; }
.lb-title { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 1.15rem; color: var(--gallery-ink); }
.lb-meta { font-family: "Space Mono", monospace; font-size: 0.74rem; letter-spacing: 0.05em; color: var(--gallery-muted); margin-top: 7px; }
.lb-price-note { font-size: 0.72rem; font-style: italic; color: var(--gallery-muted); margin-top: 5px; }
.lb-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.lb-buy {
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--wall);
  background: var(--gallery-ink);
  padding: 10px 22px;
  border-radius: 999px;
}
/* "More like this": secondary (outlined) pill next to the solid "View listing" button. */
.lb-similar {
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--gallery-ink);
  background: transparent;
  border: 1px solid var(--gallery-ink);
  padding: 10px 22px;
  border-radius: 999px;
}
.lb-similar:hover { background: var(--gallery-ink); color: var(--wall); }

/* ---- responsive: stack sidebar above the chat ---- */
@media (max-width: 820px) {
  .gallery-body { grid-template-columns: 1fr; gap: 22px; padding: 20px 18px 70px; }
  .gallery-sidebar { position: static; flex-direction: row; flex-wrap: wrap; gap: 20px 28px; }
  /* Lightbox: stack the art over the controls so neither is cramped on a phone. */
  .lightbox { flex-direction: column; gap: 18px; padding: 4vh 5vw; overflow-y: auto; justify-content: flex-start; }
  .lb-figure { order: 1; }
  .lb-controls { order: 2; flex: 0 0 auto; width: 100%; max-width: 440px; align-self: center; }
  .lb-controls #wall-controls { flex-direction: row; flex-wrap: wrap; gap: 14px 22px; }
  .lb-img,
  .lb-crop-canvas { max-height: 56vh; }
}
