/* "Design your kitchen" (phase 6): the kitchen large on a dark stage, the parts and their materials beside it; on a phone
   the kitchen stays in view at the top while the materials scroll under it. Colours, corners and the font are the
   company's tokens from /identity.css. */
.d-head { padding-block: 34px 18px; display: grid; gap: 8px; }
.d-head h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); letter-spacing: -.01em; }
.d-head p { color: var(--mut); max-width: 62ch; }
.designer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); gap: 20px; align-items: start; padding-bottom: 56px; position: relative; }
.designer > .d-status { grid-column: 1 / -1; padding: 40px 0; color: var(--mut); }

/* the stage */
.d-stage { position: sticky; top: calc(88px + env(safe-area-inset-top, 0px)); aspect-ratio: 1.6; background: var(--cat-dark); border-radius: var(--r); overflow: hidden; isolation: isolate; }
.d-canvas, .d-poster { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; }
.d-poster { object-fit: cover; filter: blur(10px) saturate(.9); transform: scale(1.06); transition: opacity .6s ease; background: transparent; }
.d-canvas { opacity: 0; transition: opacity .45s ease; }
.d-stage.ready .d-canvas { opacity: 1; }
.d-stage.ready .d-poster { opacity: 0; }
.d-stage.busy.ready .d-canvas { opacity: .82; }
.d-stage .d-status { position: absolute; inset-inline: 0; bottom: 64px; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 10px rgb(0 0 0 / .6); z-index: 2; pointer-events: none; }
.d-stage.busy::after { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; z-index: 4;
  background: linear-gradient(90deg, transparent, var(--s), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: d-load 1.2s linear infinite; }
@keyframes d-load { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@media (prefers-reduced-motion: reduce) { .d-stage.busy::after { animation: none; background-size: 100% 100%; opacity: .6; } .d-poster, .d-canvas { transition: none; } }

/* the kitchen picker, on the stage */
.d-scenes-box { position: absolute; top: 12px; inset-inline-start: 12px; z-index: 5; }
.d-pick { display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: 999px; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  background: rgb(10 10 12 / .5); color: #fff; border: 1px solid rgb(255 255 255 / .28); backdrop-filter: blur(10px); }
html[dir="rtl"] .d-pick { padding: 5px 5px 5px 14px; }
.d-pick img { width: 54px; height: 34px; border-radius: 999px; object-fit: cover; }
.d-pick .caret { opacity: .8; font-size: .8rem; }
.d-scenes { position: absolute; top: calc(100% + 8px); inset-inline-start: 0; width: min(660px, calc(100vw - 48px)); max-height: min(70vh, 560px); overflow: auto;
  background: var(--bg); color: var(--ink); border: 1px solid var(--ln); border-radius: var(--r); box-shadow: 0 18px 50px rgb(0 0 0 / .35); padding: 16px; display: grid; gap: 10px; }
.d-scenes h3 { font-size: .9rem; color: var(--mut); }
.d-scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.d-scene-grid button { padding: 0; background: none; border: 0; color: inherit; font: inherit; font-size: .85rem; text-align: start; cursor: pointer; display: grid; gap: 6px; }
.d-scene-grid img { width: 100%; aspect-ratio: 1.6; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .2s; }
.d-scene-grid button.on img, .d-scene-grid button:hover img { outline-color: var(--p); }

/* the views, under the kitchen */
.d-views { position: absolute; bottom: 12px; inset-inline: 12px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; z-index: 3; }
.d-views button { padding: 7px 14px; border-radius: 999px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  background: rgb(10 10 12 / .45); color: #fff; border: 1px solid rgb(255 255 255 / .25); backdrop-filter: blur(8px); }
.d-views button.on { background: var(--p); color: var(--onp); border-color: transparent; }

/* the panel */
.d-panel { position: sticky; top: calc(88px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 104px); display: flex; flex-direction: column; gap: 12px;
  background: var(--sf); border: 1px solid var(--ln); border-radius: var(--r); padding: 14px; }
.d-hint { font-size: .82rem; color: var(--mut); }
.d-slots { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; flex: 1; overscroll-behavior: contain; }
.d-slot { border: 1px solid var(--ln); border-radius: var(--r); background: var(--bg); }
.d-slot.open { border-color: color-mix(in srgb, var(--p) 55%, var(--ln)); }
.d-slot.open .d-slot-top { position: sticky; top: 0; z-index: 2; background: var(--bg); border-radius: var(--r) var(--r) 0 0; }
.d-slot-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; background: none; border: 0; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.d-slot-head[disabled] { cursor: default; }
.d-slot-head:not([disabled])::after { content: "▾"; margin-inline-start: auto; color: var(--mut); transition: transform .2s; }
.d-slot.open .d-slot-head::after { transform: rotate(180deg); }
.d-slot-head img, .d-sw { width: 52px; height: 52px; flex: none; border-radius: calc(var(--r) * .6); object-fit: cover; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08); }
.d-t { display: grid; min-width: 0; line-height: 1.35; }
.d-t small { color: var(--mut); font-size: .76rem; }
.d-t b { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-t span { color: var(--mut); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 8px 10px; scrollbar-width: thin; }
.d-chips button { flex: none; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--ln); background: var(--sf); color: inherit; font: inherit; font-size: .8rem; cursor: pointer; }
.d-chips button.on { background: var(--p); color: var(--onp); border-color: transparent; }
.d-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px 8px; padding: 2px 8px 12px; }
.d-grid button { padding: 0; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; display: grid; gap: 5px; align-content: start; }
.d-grid img { width: 100%; aspect-ratio: 1; border-radius: 10px; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .15s, transform .15s; }
.d-grid button:hover img { transform: scale(1.03); }
.d-grid button.on img { outline-color: var(--p); }
.d-grid span { font-size: .72rem; line-height: 1.3; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.d-light { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--mut); }
.d-light input { flex: 1; accent-color: var(--p); }
.d-note { font-size: .74rem; color: var(--mut); line-height: 1.5; }
.d-actions { display: grid; gap: 8px; }
.d-actions .btn { width: 100%; }
.d-call { background: none; border: 0; padding: 4px; color: var(--p-text); font: inherit; font-size: .9rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.d-copy { width: 100%; font: inherit; font-size: .8rem; padding: 6px 8px; border: 1px solid var(--ln); border-radius: 8px; background: var(--bg); color: var(--ink); direction: ltr; }
.d-toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
  background: var(--cat-dark); color: var(--cat-light); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; transition: opacity .25s, transform .25s; }
.d-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* the request */
.d-dialog { border: 0; border-radius: var(--r); padding: 24px; width: min(440px, calc(100vw - 32px)); background: var(--bg); color: var(--ink); box-shadow: 0 24px 70px rgb(0 0 0 / .4); }
.d-dialog::backdrop { background: rgb(0 0 0 / .55); }
.d-req { display: grid; gap: 4px; }
.d-req h2 { font-size: 1.3rem; }
.d-req > p { color: var(--mut); font-size: .9rem; }
.d-req label { display: grid; gap: 4px; margin-top: 10px; font-size: .85rem; font-weight: 600; }
.d-req input, .d-req textarea { width: 100%; font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--ln); border-radius: calc(var(--r) * .6); background: var(--sf); color: var(--ink); }
.d-req input[type="tel"] { text-align: start; }
html[dir="rtl"] .d-req input[type="tel"] { text-align: right; }
.d-req .d-consent { font-size: .76rem; margin-top: 10px; }
.d-req .btns { margin-top: 14px; }
.d-err { color: #b3261e; font-size: .85rem; min-height: 1.2em; }
.d-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
html[data-mode="dark"] .d-err { color: #ffb4ab; }
.d-ok { font-size: 1rem; color: var(--ink); margin-block: 8px; }

/* phones and narrow windows: the kitchen at the top of the screen, the parts under it, the actions at the bottom */
@media (max-width: 900px) {
  .d-head { padding-block: 22px 12px; }
  .designer { grid-template-columns: 1fr; gap: 0; padding-inline: 0; padding-bottom: 0; }
  .d-stage { top: calc(77px + env(safe-area-inset-top, 0px)); border-radius: 0; z-index: 6; }   /* under the header (76 px and its line) */
  .d-panel { position: static; max-height: none; border-radius: 0; border-inline: 0; border-bottom: 0; padding: 12px max(14px, env(safe-area-inset-left, 0px)) 0; }
  .d-slots { overflow: visible; }
  .d-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .d-slot.open .d-slot-top { top: calc(77px + env(safe-area-inset-top, 0px) + 62.5vw); }   /* under the kitchen, which stays at the top */
  .d-actions { position: sticky; bottom: 0; z-index: 4; grid-template-columns: 1fr 1fr; margin-inline: -14px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--sf) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--ln); }
  .d-actions .btn { min-height: 44px; padding: 8px 10px; font-size: .86rem; }
  .d-actions .btn-p { grid-column: 1 / -1; }
  .d-call { grid-column: 1 / -1; }
  .d-pick { font-size: .82rem; }
  .d-pick img { width: 44px; height: 28px; }
  .d-views { bottom: 8px; gap: 4px; }
  .d-views button { padding: 5px 10px; font-size: .74rem; }
  .d-stage .d-status { bottom: 46px; font-size: .9rem; }
}
