/* Two modes, switched by the poster on the wall: a dark poster hangs in a dark,
   neon-lit room; a light poster hangs in daylight. Same two neons in both. */
:root {
  --bg: #0d0d1a;
  --bg-2: #14142a;
  --ink: #eaf7ff;
  --ink-2: #98a4c6;
  --line: rgba(130, 160, 255, 0.24);
  --field: #12122a;
  --neon: #00f0ff;
  --hot: #ff2bd6;
  --on-neon: #04141a;
  --on-hot: #1a0016;
  --glow: 0 0 18px rgba(0, 240, 255, 0.45);
  --glow-hot: 0 0 22px rgba(255, 43, 214, 0.55);
  --wall:
    radial-gradient(60% 46% at 24% 30%, rgba(255, 43, 214, 0.34), rgba(255, 43, 214, 0) 70%),
    radial-gradient(58% 48% at 78% 68%, rgba(0, 240, 255, 0.30), rgba(0, 240, 255, 0) 70%),
    linear-gradient(180deg, #0b0b18 0%, #0d0d1f 60%, #07070f 100%);
  --frame-shadow: 0 34px 60px -22px rgba(0, 0, 0, 0.9), 0 0 60px -10px rgba(0, 240, 255, 0.25);
  --focus: #00f0ff;
  --error: #ff7a8a;
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --text: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
:root[data-mode="light"] {
  --bg: #fbfbfd;
  --bg-2: #f0f1f6;
  --ink: #0d0d1a;
  --ink-2: #555a72;
  --line: rgba(13, 13, 26, 0.17);
  --field: #ffffff;
  --neon: #008a99;
  --hot: #d6009e;
  --on-neon: #ffffff;
  --on-hot: #ffffff;
  --glow: none;
  --glow-hot: 0 8px 22px -8px rgba(214, 0, 158, 0.6);
  --wall:
    radial-gradient(120% 90% at 18% 8%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, #e2e4ea 0%, #e2e4ea 62%, #d2d5dd 100%);
  --frame-shadow: 0 30px 50px -22px rgba(20, 28, 40, 0.55), 0 8px 14px -6px rgba(20, 28, 40, 0.35);
  --focus: #d6009e;
  --error: #b3261e;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--text);
  transition: background-color 0.35s, color 0.35s;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.testbar {
  margin: 0;
  padding: 8px 16px;
  background: #07070f;
  color: #00f0ff;
  font-size: 14px;
  text-align: center;
}

/* ── studio: wall on the left, panel on the right ─────────────────────────── */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr);
  align-items: start;
}

.wall {
  transition: background 0.35s;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 4vh 4vw 12vh;
  background: var(--wall);
  overflow: hidden;
}
.hang { position: relative; height: min(72vh, 100%); aspect-ratio: 3 / 4; max-width: 100%; }
.hang[data-size="21x30"] { aspect-ratio: 210 / 297; height: min(56vh, 100%); }

.frame {
  position: relative;
  height: 100%;
  padding: 3.2%;
  background: #17181a;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, var(--frame-shadow);
  transition: background-color 0.25s, padding 0.25s;
}
.frame[data-frame="white"] { background: #f4f3ef; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), var(--frame-shadow); }
.frame[data-frame="oak"] { background: linear-gradient(92deg, #b98d57, #c79c66 40%, #b4854f 75%, #c29660); }
.frame[data-frame="none"] { padding: 0; background: none; box-shadow: 0 18px 30px -16px rgba(20, 28, 40, 0.5), 0 2px 5px rgba(20, 28, 40, 0.25); }

.sheet {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #e9eaea;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 3px 8px rgba(0, 0, 0, 0.45) inset;
  touch-action: none;
  cursor: grab;
}
.frame[data-frame="none"] .sheet { box-shadow: none; }
.sheet.dragging { cursor: grabbing; }
.sheet.placing { cursor: crosshair; }
.sheet img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
/* glass: one soft reflection across the corner */
.frame:not([data-frame="none"]) .sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 22%, rgba(255, 255, 255, 0) 40%);
  pointer-events: none;
}
.busy {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--hot), var(--neon), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: slide 1.1s linear infinite;
  z-index: 2;
}
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.shadow {
  position: absolute;
  left: 6%; right: 6%; bottom: -5%;
  height: 5%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0));
  filter: blur(6px);
}
.hint {
  position: absolute;
  bottom: 6vh;
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}

/* ── panel ────────────────────────────────────────────────────────────────── */

.panel {
  padding: 28px clamp(20px, 3.4vw, 52px) 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand { margin-bottom: clamp(28px, 7vh, 72px); }
.mark {
  font: 700 17px/1 var(--display);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.mark span { font-weight: 400; color: var(--hot); }

h1 {
  margin: 0 0 16px;
  font: 700 clamp(34px, 3.6vw, 54px) / 1.02 var(--display);
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.lede { margin: 0 0 28px; max-width: 46ch; font-size: 18px; color: var(--ink-2); }
.lede strong { color: var(--ink); white-space: nowrap; }

h2 {
  margin: 32px 0 12px;
  font: 600 15px/1.2 var(--text);
  color: var(--ink);
}

.find { position: relative; }
.find label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 15px; }
.find-row { display: flex; gap: 8px; flex-wrap: wrap; }
.find input {
  flex: 1 1 220px;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--neon);
  border-radius: 4px;
  background: var(--field);
  box-shadow: var(--glow);
  font-size: 18px;
}
.find input::placeholder { color: var(--ink-2); opacity: 0.8; }
.ghost {
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: transparent;
  white-space: nowrap;
}
.ghost:hover { border-color: var(--neon); color: var(--neon); }
.results {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--field);
  border: 1.5px solid var(--neon);
  border-radius: 4px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
}
.results li { padding: 9px 12px; border-radius: 3px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.results li small { color: var(--ink-2); text-align: right; }
.results li[aria-selected="true"], .results li:hover { background: var(--bg-2); color: var(--neon); }
.find-note { min-height: 21px; margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }

.facts { margin: 20px 0 0; padding: 14px 0 0; list-style: none; border-top: 1px solid var(--line); }
.facts li { padding: 2px 0; }
.facts li:first-child { font-weight: 600; color: var(--neon); }

.variants { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.variant { padding: 0; border: 0; background: none; text-align: left; }
.variant img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--bg-2); outline: 1px solid var(--line); }
.variant span { display: block; margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.variant[aria-pressed="true"] img { outline: 2.5px solid var(--neon); outline-offset: 2px; box-shadow: var(--glow); }
.variant[aria-pressed="true"] span { color: var(--ink); font-weight: 600; }

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px 8px; }
.theme { padding: 0; border: 0; background: none; font-size: 13px; color: var(--ink-2); text-align: center; }
.theme i {
  display: block;
  height: 44px;
  margin-bottom: 5px;
  border-radius: 3px;
  outline: 1px solid var(--line);
  /* a tiny poster: background, a water band, one accent line */
  background:
    linear-gradient(var(--a), var(--a)) 18% 38% / 64% 3px no-repeat,
    linear-gradient(var(--i), var(--i)) 50% 78% / 34% 3px no-repeat,
    linear-gradient(160deg, transparent 58%, var(--w) 58%, var(--w) 72%, transparent 72%),
    var(--b);
}
.theme[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.theme[aria-checked="true"] i { outline: 2.5px solid var(--neon); outline-offset: 2px; box-shadow: var(--glow); }

.range { display: grid; grid-template-columns: 40px 1fr 40px auto; align-items: center; gap: 10px; }
.range input { width: 100%; accent-color: var(--neon); }
.range output { min-width: 5.5ch; font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: right; }
.step { height: 40px; border: 1.5px solid var(--line); border-radius: 4px; background: none; font-size: 20px; line-height: 1; }
.step:hover { border-color: var(--neon); color: var(--neon); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 13px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: none;
  font-size: 15px;
  color: var(--ink-2);
}
.chip[aria-pressed="true"] { background: var(--neon); border-color: var(--neon); color: var(--on-neon); font-weight: 600; }

.seg { display: inline-flex; margin-top: 12px; border: 1.5px solid var(--line); border-radius: 4px; overflow: hidden; flex-wrap: wrap; }
.seg button { padding: 8px 12px; border: 0; background: none; font-size: 14px; color: var(--ink-2); }
.seg button[aria-checked="true"] { background: var(--neon); color: var(--on-neon); font-weight: 600; }

.fields { display: grid; gap: 10px; }
.fields label { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-2); }
.fields input, .marker input, dialog input {
  height: 44px;
  min-width: 0;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--field);
  color: var(--ink);
}
.fields input:focus, .marker input:focus, dialog input:focus { border-color: var(--neon); }

.marker { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.marker .ghost { height: 44px; }
.marker .ghost[aria-pressed="true"] { background: var(--hot); border-color: var(--hot); color: var(--on-hot); }
.marker input { flex: 1 1 200px; }
.link { padding: 0; border: 0; background: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-align: left; }

.products { display: grid; gap: 8px; }
.product {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: none;
  text-align: left;
}
.product b { font-weight: 600; }
.product[aria-checked="true"] { border-color: var(--neon); box-shadow: 0 0 0 1px var(--neon) inset, var(--glow); }
.frames { display: flex; gap: 14px; margin-top: 14px; }
.swatch { display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; font-size: 15px; color: var(--ink-2); }
.swatch i { width: 26px; height: 26px; border-radius: 50%; outline: 1px solid var(--line); }
.swatch[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.swatch[aria-checked="true"] i { outline: 2.5px solid var(--neon); outline-offset: 2px; }

.buy {
  position: sticky;
  bottom: 0;
  margin: 36px calc(-1 * clamp(20px, 3.4vw, 52px)) 0;
  padding: 14px clamp(20px, 3.4vw, 52px) 16px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  transition: background-color 0.35s;
}
.buy-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.price span { display: block; font: 700 28px/1 var(--display); letter-spacing: -0.02em; color: var(--neon); }
.price small { color: var(--ink-2); font-size: 13px; }
.cta {
  height: 54px;
  padding: 0 28px;
  border: 0;
  border-radius: 4px;
  background: var(--hot);
  color: var(--on-hot);
  box-shadow: var(--glow-hot);
  font: 700 17px/1 var(--text);
}
.cta:hover { filter: brightness(1.12); }
.cta:disabled { opacity: 0.6; cursor: progress; }
.buy .link { font-size: 14px; color: var(--ink-2); }
.error { margin: 8px 0 0; color: var(--error); font-size: 14px; }
.error:empty { display: none; }

.gift-banner {
  margin: 0 0 24px;
  padding: 14px 16px;
  background: var(--bg-2);
  color: var(--ink);
  border: 1.5px solid var(--hot);
  border-radius: 4px;
}

/* ── below the studio ─────────────────────────────────────────────────────── */

.more { background: #07070f; color: #e8ecf2; padding: clamp(48px, 8vw, 112px) clamp(20px, 5vw, 80px) 40px; }
.more h2 { margin: 0 0 12px; font: 700 clamp(26px, 2.6vw, 38px) / 1.08 var(--display); letter-spacing: -0.025em; color: #fff; }
.more p { max-width: 60ch; margin: 0 0 24px; color: #a4afcc; }
.more > div + div { margin-top: clamp(48px, 7vw, 96px); }
.strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.strip button { padding: 0; border: 0; background: none; color: #b9c3d2; text-align: left; font-size: 14px; }
.strip img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; margin-bottom: 8px; transition: transform 0.2s; }
.strip button:hover img { transform: translateY(-4px); }
.steps ol { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.steps li { counter-increment: s; color: #b9c3d2; border-top: 1px solid rgba(255, 255, 255, 0.22); padding-top: 14px; }
.steps li::before { content: counter(s); display: block; font: 700 30px/1 var(--display); color: #00f0ff; text-shadow: 0 0 16px rgba(0, 240, 255, 0.6); margin-bottom: 10px; }
.steps b { display: block; color: #fff; font-weight: 600; }
footer { margin-top: clamp(48px, 7vw, 96px); padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.16); font-size: 13px; }
footer p { margin: 0; color: #8e9bb0; max-width: none; }
footer a { color: inherit; }

/* ── dialog ───────────────────────────────────────────────────────────────── */

dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 28px;
  border: 0;
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  outline: 1.5px solid var(--line);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}
dialog::backdrop { background: rgba(5, 5, 12, 0.7); }
dialog h3 { margin: 0 0 10px; font: 700 26px/1.1 var(--display); letter-spacing: -0.02em; }
dialog p { margin: 0 0 14px; color: var(--ink-2); }
dialog form { display: grid; gap: 10px; }
dialog .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
dialog .actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
dialog code { display: block; margin: 0 0 14px; padding: 12px; background: var(--bg-2); color: var(--neon); border-radius: 4px; font: 600 17px/1.3 var(--text); word-break: break-all; }

/* ── small screens ────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .wall { position: relative; height: auto; padding: 28px 16px 52px; }
  .hang { height: auto; width: min(78vw, 380px); }
  .hang[data-size="21x30"] { height: auto; width: min(64vw, 310px); }
  .frame { height: auto; }
  .sheet { aspect-ratio: 3 / 4; height: auto; }
  .hang[data-size="21x30"] .sheet { aspect-ratio: 210 / 297; }
  .hint { bottom: 16px; }
  .panel { min-height: 0; padding-top: 24px; }
  .brand { margin-bottom: 24px; }
  .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps ol { grid-template-columns: 1fr 1fr; }
  .fields label { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 480px) {
  .variants { gap: 8px; }
  .buy-main { gap: 10px; }
  .cta { padding: 0 18px; }
  dialog .row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
