/* configurator */
.cfg-head { padding-block: var(--s-7) var(--s-5); }
.cfg-head h1 { margin-bottom: var(--s-2); }
.cfg-head p { margin: 0; color: var(--ink-2); }
.configurator { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-6); align-items: start; padding-bottom: var(--s-7); }
@media (min-width: 900px) { .configurator { grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: var(--s-7); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.1rem, 3vw, 2rem); box-shadow: var(--shadow-sm);
  display: grid; gap: var(--s-5); }
.panel fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: var(--s-3); min-width: 0; }
.panel legend { padding: 0; font-weight: 700; font-size: var(--fs-sm); margin-bottom: var(--s-1); display: flex; align-items: center; gap: .6rem; }
.panel legend .n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: var(--fs-xs); }
.panel label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: .35rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--s-3); }
.optional { color: var(--mute); font-weight: 400; }
.search { position: relative; }
.search input { padding-left: 2.6rem; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236b655b' stroke-width='1.8'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E") no-repeat .85rem center; }
.results { position: absolute; z-index: 5; left: 0; right: 0; margin: .35rem 0 0; padding: .35rem; list-style: none; background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto; }
.results button { display: block; width: 100%; text-align: left; padding: .6rem .75rem; border: 0; background: none; border-radius: var(--r-sm); font: inherit; cursor: pointer; color: var(--ink); }
.results button:hover, .results button:focus-visible { background: var(--bg-deep); outline-offset: -2px; }
.chosen { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chosen:empty { display: none; }
.chosen li { display: inline-flex; align-items: center; gap: .15rem; padding: .25rem .25rem .25rem .85rem; background: var(--bg-deep); border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600; }
.chosen button { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--ink-2); font-size: 1.1rem; line-height: 1; }
.chosen button:hover { background: var(--ink); color: var(--bg); }
.chosen button:disabled { opacity: .3; cursor: default; background: none; color: var(--ink-2); }
/* 2+ films: a numbered, sortable list (order = order on the poster) */
.chosen.is-sortable { flex-direction: column; flex-wrap: nowrap; }
.chosen.is-sortable li { display: flex; border-radius: var(--r-md); padding-left: .5rem; cursor: grab; }
.chosen.is-sortable li > span:not(.chosen__pos) { flex: 1; min-width: 0; }
.chosen__pos { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-right: .35rem; border-radius: 50%;
  background: var(--bg); color: var(--ink-2); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.chosen li.is-dragging { opacity: .45; }
.chosen li.is-over { box-shadow: inset 0 2px 0 var(--ink); }
.hint { margin: 0; color: var(--mute); font-size: var(--fs-xs); }
/* quick picks while no film is chosen */
.quick { display: grid; gap: var(--s-2); }
.quick[hidden] { display: none; }
.quick__label { margin: 0; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.quick__chips { list-style: none; margin: 0 0 var(--s-1); padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: baseline; gap: .35rem; padding: .35rem .8rem; border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface-2); font: 600 var(--fs-xs) var(--font-sans); color: var(--ink); text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--ink); background: var(--bg-deep); }
.chip__n { font-weight: 400; color: var(--mute); }
.hint:empty { display: none; }
.stage { position: sticky; top: calc(var(--header-h) + var(--s-4)); display: grid; place-items: center; padding: clamp(1.25rem, 4vw, 3.5rem);
  background: radial-gradient(120% 90% at 50% 0%, #efe9dc 0%, var(--wall) 60%, #d6cfbf 100%); border-radius: var(--r-lg);
  min-height: min(70vh, 640px); }
#preview { max-width: min(100%, 520px); max-height: 74vh; width: auto; height: auto; box-shadow: var(--shadow-poster); transition: opacity .2s var(--ease); background: var(--bg); }
#preview.loading { opacity: .55; }
#preview.is-example { opacity: .75; }
.stage__badge { margin: 0 0 var(--s-3); padding: .35rem .9rem; border-radius: var(--r-pill);
  background: var(--ink); color: var(--bg); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; z-index: 1; }
.stage__badge[hidden] { display: none; }
.stage__msg { margin: 0; text-align: center; color: var(--ink-2); max-width: 28ch; font-family: var(--font-serif); font-size: var(--fs-lg); }
.stage__msg[hidden], #preview[hidden] { display: none; }
.stage__note { position: absolute; bottom: var(--s-3); left: 0; right: 0; text-align: center; font-size: var(--fs-xs); color: var(--mute); margin: 0; }
@media (max-width: 899px) {
  .stage { position: sticky; top: var(--header-h); z-index: 4; order: -1; min-height: 0; padding: var(--s-3); height: 36vh; border-radius: var(--r); }
  #preview { max-height: calc(36vh - var(--s-5)); }
  .stage__note { display: none; }
  .stage__badge { position: absolute; bottom: .5rem; left: 50%; transform: translateX(-50%); margin: 0; }
}

/* frame, price, add to cart */
.frames { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: var(--s-2); }
.panel .frame-opt { position: relative; display: grid; justify-items: center; gap: .2rem; padding: .7rem .4rem; margin: 0; border: 1px solid var(--line-strong);
  border-radius: var(--r); cursor: pointer; text-align: center; background: var(--surface-2); font-weight: 600; }
.frame-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.frame-opt:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.frame-opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.frame-opt__swatch { width: 34px; height: 44px; border-radius: 2px; background: var(--bg-deep); border: 4px solid var(--line-strong); }
.frame-opt--black .frame-opt__swatch { border-color: #1c1b1a; }
.frame-opt--white .frame-opt__swatch { border-color: #fbfaf7; outline: 1px solid var(--line-strong); }
.frame-opt--none .frame-opt__swatch { border: 1px dashed var(--line-strong); }
.frame-opt__name { font-size: var(--fs-xs); }
.frame-opt__price { font-size: var(--fs-xs); color: var(--mute); font-weight: 400; min-height: 1.2em; }
.buy { display: grid; gap: var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.buy__price { display: grid; gap: .1rem; }
.buy__label { font-size: var(--fs-xs); color: var(--mute); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.buy__price strong { font-family: var(--font-serif); font-size: var(--fs-xl); line-height: 1.1; }
.buy__vat { font-size: var(--fs-xs); color: var(--mute); }
.buy__row { display: flex; gap: var(--s-3); align-items: end; flex-wrap: wrap; }
.buy__qty { width: 5.5rem; }
.buy__qty input { width: 100%; }
.buy__row .btn { flex: 1 1 12rem; }
.buy__status { margin: 0; padding: .7rem .9rem; border-radius: var(--r); font-size: var(--fs-sm); font-weight: 600; }
.buy__status[hidden] { display: none; }
.buy__status.is-ok { background: var(--ok-soft); color: #1d4a2a; }
.buy__status.is-err { background: #f7dfdb; color: #7a1d14; }
.buy__status a { color: inherit; text-decoration: underline; white-space: nowrap; }
.stage__tools { position: absolute; top: var(--s-3); left: 0; right: 0; display: flex; justify-content: center; gap: var(--s-2); flex-wrap: wrap; z-index: 1; }
.seg { padding: .4rem .9rem; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: rgb(255 255 255 / .7); font: 600 var(--fs-xs) var(--font-sans); color: var(--ink); cursor: pointer; }
.seg.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stage__sep { width: 1px; align-self: stretch; margin: .2rem var(--s-1); background: var(--line-strong); }
.stage { padding-top: 3.5rem; }
/* flat preview with a CSS frame so the choice is visible without the room scene */
#preview[data-frame="black"]:not(.is-room) { border: clamp(6px, 1.2vw, 12px) solid #1c1b1a; }
#preview[data-frame="white"]:not(.is-room) { border: clamp(6px, 1.2vw, 12px) solid #fbfaf7; }
#preview.is-room { max-width: 100%; max-height: 80vh; cursor: zoom-in; }  /* portrait room photos */
#preview.is-room.is-close { cursor: zoom-out; }
.seg[hidden], .stage__sep[hidden] { display: none; }
@media (max-width: 899px) {
  .stage { padding-top: 2.6rem; }
  /* one row of preview buttons; scrolls sideways instead of wrapping onto the image on very narrow phones */
  .stage__tools { top: .4rem; padding-inline: var(--s-2); justify-content: safe center; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: none; }
  .stage__tools::-webkit-scrollbar { display: none; }
  .seg { flex: none; }
  /* fit the image (flat or room) into the fixed-height stage below the buttons */
  #preview, #preview.is-room { max-width: 100%; max-height: calc(36vh - 2.6rem - var(--s-3)); }
}
@media (max-width: 480px) {
  .stage__tools { gap: var(--s-1); }
  .seg { padding: .35rem .5rem; font-size: .75rem; }
  .stage__sep { margin-inline: 2px; }
}

.row { grid-template-columns: 1.25fr 1fr 1fr; }
.row select { padding-inline: .7rem 1.6rem; }
@media (max-width: 480px) {
  .row { grid-template-columns: 1fr 1fr; }
  .row > :first-child { grid-column: 1 / -1; }
  .frames { grid-template-columns: repeat(2, 1fr); }
}
