/* wall-preview.css — Fullscreen “See This On The Wall” immersive preview (art chamber) */

/* --------------------------------------------------------------------------
   Page lock
--------------------------------------------------------------------------- */
body.wall-preview-is-open {
  overflow: hidden;
  touch-action: none;
}

/* --------------------------------------------------------------------------
   Root overlay
--------------------------------------------------------------------------- */
.wall-preview {
  --wp-accent: rgba(140, 190, 255, 0.82);
  --wp-accent-dim: rgba(100, 150, 220, 0.28);
  --wp-ui-bg: rgba(6, 9, 14, 0.72);
  --wp-ui-border: rgba(200, 220, 255, 0.12);
  --wp-text: rgba(232, 238, 248, 0.94);
  --wp-muted: rgba(160, 180, 205, 0.55);
  --wp-radius: 3px;
  --wp-font-ui: "Inter", system-ui, sans-serif;

  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  font-family: var(--wp-font-ui);
  color: var(--wp-text);
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.wall-preview.is-open {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}

.wall-preview[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Backdrop
--------------------------------------------------------------------------- */
.wall-preview__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 85% 70% at 50% 38%, rgba(18, 28, 48, 0.55), rgba(2, 4, 8, 0.96)),
    #020308;
  opacity: 0;
}

/* --------------------------------------------------------------------------
   Scene (scaled on open)
--------------------------------------------------------------------------- */
.wall-preview__scene {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(56px, 10vh, 96px) clamp(12px, 3vw, 28px) clamp(88px, 14vh, 120px);
  transform-origin: 50% 45%;
  opacity: 0;
  will-change: transform, opacity;
}

.wall-preview__scene-drift {
  position: relative;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  will-change: transform;
}

/* Grid stack: room image + art slot share the same cell (composition plane) */
.wall-preview__bg-stack {
  position: relative;
  display: inline-grid;
  max-width: min(100vw - 24px, 1680px);
  max-height: min(100dvh - 160px, 980px);
  filter: drop-shadow(0 28px 64px rgba(0, 0, 0, 0.55));
}

.wall-preview__bg-stack > * {
  grid-area: 1 / 1;
}

.wall-preview__bg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: min(100dvh - 160px, 980px);
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  will-change: opacity, transform;
}

.wall-preview__bg.is-loaded {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Art placement (percent of room image box — set via inline style from JS)
--------------------------------------------------------------------------- */
.wall-preview__art-slot {
  position: relative;
  justify-self: stretch;
  align-self: stretch;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wall-preview__art-inner {
  position: absolute;
  left: var(--wp-slot-left, 35%);
  top: var(--wp-slot-top, 28%);
  width: var(--wp-slot-width, 30%);
  height: var(--wp-slot-height, 38%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  transform: scale(var(--wp-art-scale, 1));
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

/*
 * Definite box for img % max-width / max-height (fills wall slot, centers child).
 */
.wall-preview__art-fit {
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/*
 * Thick gradient border on the image itself — follows exact rendered width/height for any aspect.
 */
.wall-preview__art {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-sizing: border-box;
  border-style: solid;
  border-width: clamp(3px, 0.45vw, 6px);
  border-color: #2a2a2a;
  border-image: linear-gradient(
    155deg,
    #9a9a9a 0%,
    #4a4a4a 14%,
    #1c1c1c 38%,
    #060606 52%,
    #242424 72%,
    #5c5c5c 100%
  ) 1;
  border-image-slice: 1;
  object-fit: contain;
  object-position: center;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.65),
    0 20px 48px rgba(0, 0, 0, 0.4);
  user-select: none;
  -webkit-user-drag: none;
}

/* --------------------------------------------------------------------------
   Atmosphere (vignette + wall wash — over scene, under chrome)
--------------------------------------------------------------------------- */
.wall-preview__atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.wall-preview__atmosphere-wash {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 55% 48% at 50% 42%,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.02) 35%,
    transparent 62%
  );
  mix-blend-mode: soft-light;
  opacity: 0.85;
}

.wall-preview__atmosphere-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 72% 65% at 50% 48%, transparent 30%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.25) 0%, transparent 22%, transparent 78%, rgba(0, 0, 0, 0.55) 100%);
  opacity: 0.92;
}

.wall-preview__atmosphere-grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* --------------------------------------------------------------------------
   Top chrome
--------------------------------------------------------------------------- */
.wall-preview__chrome {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  top: 0;
  padding: calc(12px + env(safe-area-inset-top, 0px)) clamp(14px, 3vw, 28px) 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.wall-preview__chrome > * {
  pointer-events: auto;
}

.wall-preview__title-block {
  min-width: 0;
}

.wall-preview__eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--wp-muted);
}

.wall-preview__title {
  margin: 0;
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: clamp(0.95rem, 2.1vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.25;
  max-width: min(52vw, 420px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wall-preview__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -6px -8px 0 0;
  border: 1px solid var(--wp-ui-border);
  border-radius: var(--wp-radius);
  background: var(--wp-ui-bg);
  color: var(--wp-text);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.wall-preview__close:hover {
  border-color: var(--wp-accent-dim);
  color: #fff;
}

.wall-preview__close:focus-visible {
  outline: 2px solid var(--wp-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Bottom dock — rooms, scale
--------------------------------------------------------------------------- */
.wall-preview__dock {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px clamp(12px, 3vw, 24px) calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  pointer-events: none;
}

.wall-preview__dock-row {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  padding: 10px 12px;
  border-radius: var(--wp-radius);
  border: 1px solid var(--wp-ui-border);
  background: var(--wp-ui-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.wall-preview__dock-label {
  flex: 0 0 100%;
  margin: 0 0 2px;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--wp-muted);
}

.wall-preview__dock-label--inline {
  flex: 0 0 auto;
  margin: 0 6px 0 0;
  text-align: left;
}

/* Scale row: segment buttons + disclaimer inline */
.wall-preview__scale-with-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  flex: 1 1 100%;
  min-width: 0;
}

.wall-preview__disclaimer {
  flex: 1 1 200px;
  min-width: min(100%, 12rem);
  max-width: 26rem;
  margin: 0;
  padding: 0;
  text-align: left;
  font-size: 0.7rem;
  line-height: 1.38;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.94);
  opacity: 1;
  pointer-events: none;
}

.wall-preview__room-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.wall-preview__tab {
  appearance: none;
  margin: 0;
  padding: 0.55rem 0.85rem;
  min-height: 40px;
  border-radius: 2px;
  border: 1px solid rgba(200, 220, 255, 0.1);
  background: rgba(8, 12, 20, 0.65);
  color: var(--wp-muted);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.28s ease;
}

.wall-preview__tab:hover {
  border-color: rgba(200, 220, 255, 0.22);
  color: var(--wp-text);
  transform: translateY(-1px);
}

.wall-preview__tab.is-active {
  border-color: var(--wp-accent-dim);
  color: var(--wp-text);
  background: rgba(20, 32, 52, 0.75);
  box-shadow: 0 0 20px var(--wp-accent-dim);
}

.wall-preview__tab:focus-visible {
  outline: 2px solid var(--wp-accent);
  outline-offset: 2px;
}

.wall-preview__segment {
  display: inline-flex;
  border-radius: 2px;
  border: 1px solid rgba(200, 220, 255, 0.1);
  overflow: hidden;
}

.wall-preview__segment-btn {
  appearance: none;
  margin: 0;
  padding: 0.5rem 0.7rem;
  min-height: 40px;
  border: none;
  border-right: 1px solid rgba(200, 220, 255, 0.08);
  background: rgba(8, 12, 20, 0.55);
  color: var(--wp-muted);
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.wall-preview__segment-btn:last-child {
  border-right: none;
}

.wall-preview__segment-btn:hover {
  color: var(--wp-text);
}

.wall-preview__segment-btn.is-active {
  background: rgba(24, 38, 62, 0.9);
  color: var(--wp-text);
}

.wall-preview__segment-btn:focus-visible {
  outline: 2px solid var(--wp-accent);
  outline-offset: -2px;
}

/* --------------------------------------------------------------------------
   Row layout on wider docks
--------------------------------------------------------------------------- */
@media (min-width: 720px) {
  .wall-preview__dock {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
  }

  .wall-preview__dock-row {
    flex: 0 1 auto;
  }

  .wall-preview__dock-row--rooms {
    flex: 1 1 320px;
    max-width: 560px;
  }

  .wall-preview__dock-row--rooms .wall-preview__dock-label {
    flex: 0 0 100%;
  }

  .wall-preview__dock-row--scale .wall-preview__dock-label {
    display: none;
  }

  .wall-preview__scale-with-note {
    flex: 0 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    max-width: min(920px, 100%);
  }

  .wall-preview__disclaimer {
    flex: 1 1 220px;
    max-width: min(320px, 36vw);
    margin-left: 4px;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion & coarse pointer
--------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .wall-preview__bg,
  .wall-preview__scene-drift,
  .wall-preview__art-inner {
    transition: none !important;
  }
}

@media (max-width: 480px) {
  .wall-preview__title {
    max-width: 62vw;
  }
}

/* Hero trigger — matches art-chamber button language (site “steel” command tone) */
body.page-art-chamber .art-chamber__btn--wall-preview {
  margin-top: 0.35rem;
}
