/* Оформление 3D-галереи памятников. */

:root {
  --granite: #14161a;
  --granite-2: #1b1f24;
  --sea: #0f2f36;
  --paper: #faf8f4;
  --paper-2: #f2eee7;
  --ink: #302c25;
  --muted: #756a59;
  --bronze: #a78043;
  --gold: #c8a15a;
  --gold-ink: #1d1406;
  --line: rgba(48, 44, 37, .16);
  --line-light: rgba(255, 255, 255, .16);
  --sans: "Golos Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --serif: "Old Standard TT", "Times New Roman", serif;
  --ease: cubic-bezier(.22, .72, .22, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0c0f12; color: #f0efea; font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; }
ul { margin: 0; padding: 0; list-style: none; }

.scene { position: relative; width: 100vw; height: 100vh; overflow: clip; }
.scene__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 50% at 50% 24%, rgba(200, 161, 90, .16), transparent 66%),
    radial-gradient(46% 40% at 50% 60%, rgba(120, 190, 205, .12), transparent 70%),
    linear-gradient(180deg, #10141a 0%, #0d1a20 44%, #0a1418 72%, #0b0e11 100%);
}
.scene__bg::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(70% 60% at 50% 46%, transparent 0%, rgba(4, 8, 11, .66) 100%);
}
.watermark {
  position: absolute; left: 50%; top: 40%;
  width: min(30vw, 520px); transform: translate(-50%, -50%);
  opacity: .05; filter: grayscale(1) contrast(1.05); mix-blend-mode: luminosity; pointer-events: none;
}

.topbar {
  position: absolute; inset: 0 0 auto 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(10, 13, 17, .82), transparent);
}
.brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.brand img { width: 46px; }
.brand b { display: block; font-family: var(--display); font-size: 14px; letter-spacing: -.03em; }
.brand span { display: block; font-size: 11px; color: #9fb0b5; margin-top: 3px; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 8px 11px; border-radius: 999px; font-size: 13px; color: #b9c4c7; }
.topnav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.topbar__right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #cfd8da; }

/* ---------- сцена галереи ---------- */

.stage { position: absolute; inset: 0; z-index: 10; }
.expo {
  position: absolute; left: 50%; bottom: var(--rail-y, 320px); z-index: 20;
  transform: translateX(-50%);
  display: flex; align-items: flex-end; justify-content: center;
  height: var(--expo-h, 420px);
  pointer-events: none;
  transition: height .35s var(--ease);
}
.expo__glow {
  position: absolute; left: 50%; bottom: -6%;
  width: calc(var(--expo-h, 420px) * 1.5); height: calc(var(--expo-h, 420px) * 1.05);
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(200, 161, 90, .22) 0%, rgba(120, 190, 205, .08) 45%, transparent 72%);
  border-radius: 50%;
}
.expo__img {
  position: relative; z-index: 2;
  height: 100%; width: auto;
  filter: drop-shadow(0 34px 40px rgba(0, 0, 0, .68)) brightness(1.35) contrast(1.08) drop-shadow(0 0 2px rgba(255, 255, 255, .55));
  transform-origin: 50% 100%;
  animation: turntable 9s ease-in-out infinite;
  transition: opacity .3s ease;
}
.expo__img.is-switching { opacity: 0; }
@keyframes turntable {
  0%, 100% { transform: rotateY(-7deg); }
  50% { transform: rotateY(7deg); }
}
.expo__shadow {
  position: absolute; left: 50%; bottom: -14px; z-index: 1;
  width: calc(var(--expo-h, 420px) * .78); height: 34px;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, .62) 0%, transparent 72%);
  border-radius: 50%;
}
.expo__label {
  position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border: 1px solid rgba(200, 161, 90, .45); border-radius: 999px;
  background: rgba(12, 16, 20, .72); backdrop-filter: blur(8px);
  font-size: 12px; color: #e8e4db; white-space: nowrap;
}
.expo__label i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.expo__label b { color: #fff; font-weight: 600; }

/* лента мини-моделей вдоль верха панели */
.rail { position: absolute; left: 0; right: 0; bottom: var(--rail-y, 320px); height: var(--mini-h, 120px); }
.rail__line {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%, rgba(200, 161, 90, .35) 8%, rgba(200, 161, 90, .5) 42%,
    transparent 48%, transparent 52%, rgba(200, 161, 90, .5) 58%, rgba(200, 161, 90, .35) 92%, transparent 100%);
}
.rail__line::after {
  content: ""; position: absolute; left: 50%; bottom: -3px; width: 120px; height: 7px;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(200, 161, 90, .28), transparent 72%);
  border-radius: 50%;
}
.rail__models { position: absolute; inset: 0; }
.rail__nav {
  position: absolute; bottom: var(--rail-y, 320px); z-index: 20;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(12, 16, 20, .72); color: #f0efea;
  display: flex; align-items: center; justify-content: center;
  transform: translateY(50%);
  backdrop-filter: blur(8px);
}
.rail__nav:hover { border-color: var(--gold); color: #fff; }
.rail__nav--prev { left: 22px; }
.rail__nav--next { right: 22px; }
.rail__nav svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mini {
  position: absolute; bottom: 0; left: 0;
  display: flex; align-items: flex-end; justify-content: center;
  height: var(--mini-h, 120px);
  transform-origin: 50% 100%;
  transition: transform .38s var(--ease), opacity .32s ease, filter .32s ease;
  will-change: transform, opacity;
}
.mini img {
  height: 100%; width: auto;
  filter: drop-shadow(0 16px 20px rgba(0, 0, 0, .55)) brightness(1.22) contrast(1.05);
  pointer-events: none; user-select: none; -webkit-user-drag: none;
}
.mini__tag {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 3px 8px; border-radius: 999px;
  background: rgba(12, 16, 20, .72); border: 1px solid rgba(255, 255, 255, .14);
  font-size: 10.5px; color: #d8d2c6; white-space: nowrap;
  opacity: 0; transition: opacity .25s ease;
}
.mini.is-near .mini__tag { opacity: 1; }
.mini.is-busy { opacity: .35; }
.mini.is-hidden { opacity: 0; pointer-events: none; }

/* ---------- панель помощника ---------- */

.assistant {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  height: clamp(260px, 36vh, 380px);
  display: flex; flex-direction: column;
  padding: 12px max(18px, calc((100vw - 1240px) / 2)) calc(10px + env(safe-area-inset-bottom));
  background: var(--paper);
  color: var(--ink);
  border-top: 1px solid rgba(167, 128, 67, .6);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -28px 80px rgba(0, 0, 0, .5);
  transition: height .38s var(--ease);
}
.assistant.is-expanded { height: min(76vh, 620px); }
.assistant__head { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.assistant__avatar {
  width: 40px; height: 40px; border-radius: 13px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--granite); border: 1px solid rgba(200, 161, 90, .5);
}
.assistant__avatar img { width: 28px; }
.assistant__head b { display: block; font-size: 14px; }
.assistant__head span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.assistant__price { margin-left: auto; text-align: right; }
.assistant__price b { display: block; font-family: var(--display); font-size: 18px; letter-spacing: -.03em; }
.assistant__price button { font-size: 11px; color: var(--muted); border-bottom: 1px dashed rgba(117, 106, 89, .5); }
.assistant__icons { display: flex; gap: 6px; }
.assistant__icons button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.assistant__icons button:hover { color: var(--ink); border-color: var(--bronze); }
.assistant__icons svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.assistant__body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 18px; padding-top: 12px; }
.assistant__search { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.search { display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.search svg { width: 17px; height: 17px; stroke: var(--muted); fill: none; stroke-width: 1.8; }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13.5px; color: var(--ink); }
.search input::placeholder { color: #a99f8f; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.filter { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); background: #fff; }
.filter.is-active { border-color: var(--bronze); color: var(--ink); background: #fff7ea; }
.form-list { flex: 1; min-height: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-2); padding: 8px; scrollbar-width: thin; }
.form-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px; border-radius: 10px; }
.form-row:hover { background: #fff; }
.form-row.is-active { background: #fff; box-shadow: inset 0 0 0 1px var(--bronze); }
.form-row img { width: 38px; height: 44px; object-fit: contain; }
.form-row b { display: block; font-size: 12.5px; }
.form-row span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.form-row em { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 600; white-space: nowrap; }

.assistant__chat { display: flex; flex-direction: column; min-height: 0; }
.assistant__log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding-right: 4px; scrollbar-width: thin; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 12.5px; line-height: 1.5; }
.msg--ai { align-self: flex-start; background: #ece7dd; border-bottom-left-radius: 5px; }
.msg--me { align-self: flex-end; background: var(--granite); color: #f4f1ea; border-bottom-right-radius: 5px; }
.assistant__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 0; }
.assistant__chips button { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 11.5px; color: var(--muted); background: #fff; }
.assistant__chips button:hover { border-color: var(--bronze); color: var(--ink); }
.assistant__form { display: flex; gap: 8px; }
.assistant__form input { flex: 1; height: 44px; border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 0 13px; font: inherit; font-size: 13px; color: var(--ink); outline: 0; }
.assistant__form input:focus { border-color: var(--bronze); }
.assistant__form button { width: 44px; height: 44px; border-radius: 13px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); background: #fff; }
.assistant__form button[type="submit"] { background: var(--granite); border-color: var(--granite); color: #fff; }
.assistant__form button svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.assistant__foot { display: flex; justify-content: space-between; gap: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.assistant__foot a { color: #715329; font-weight: 600; }
.assistant__foot a:hover { color: var(--ink); }

/* ---------- модалки ---------- */

.modal { position: absolute; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(4, 8, 11, .74); backdrop-filter: blur(9px); }
.modal.is-open { display: flex; }
.modal__card { width: min(1120px, 96vw); max-height: 92vh; display: flex; flex-direction: column; border: 1px solid var(--line-light); border-radius: 20px; background: var(--paper); color: var(--ink); overflow: hidden; box-shadow: 0 40px 120px rgba(0, 0, 0, .55); }
.modal__head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal__head b { font-size: 15px; }
.modal__head span { font-size: 12px; color: var(--muted); }
.modal__close { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.modal__body { padding: 16px 18px; overflow: auto; }
.modal__body img { width: 100%; border-radius: 14px; border: 1px solid var(--line); }
.modal__foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.modal__foot p { flex: 1 1 340px; margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.modal__foot button { padding: 12px 18px; border-radius: 999px; background: var(--granite); color: #fff; font-size: 13.5px; font-weight: 600; }

/* ---------- адаптив ---------- */

@media (max-width: 1280px) {
  .assistant__body { gap: 14px; }
}
@media (max-width: 1024px) {
  .assistant { height: clamp(300px, 42vh, 430px); }
  .assistant__body { gap: 12px; }
  .form-row span { font-size: 10.5px; }
}
@media (max-width: 820px) {
  .topnav { display: none; }
  .assistant { height: clamp(320px, 50vh, 470px); }
  .assistant__body { grid-template-columns: 1fr; }
  .assistant__search { order: 2; }
  .assistant__chat { order: 1; }
}
@media (max-width: 700px) {
  .topbar { padding: 10px 14px; }
  .topbar__right { display: none; }
  .brand img { width: 38px; }
  .brand b { font-size: 13px; }
  .assistant { height: 52vh; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .assistant.is-expanded { height: 84vh; }
  .assistant__head { flex-wrap: nowrap; gap: 8px; }
  .assistant__head span { display: none; }
  .assistant__head b { font-size: 13px; white-space: nowrap; }
  .assistant__avatar { width: 34px; height: 34px; border-radius: 11px; }
  .assistant__avatar img { width: 24px; }
  .assistant__price b { font-size: 15px; }
  .assistant__price button { font-size: 10px; }
  .assistant__icons button { width: 30px; height: 30px; }
  .assistant__body { grid-template-columns: 1fr; gap: 8px; }
  .assistant__search { order: 1; }
  .assistant__chat { order: 2; }
  .form-list { display: none; }
  .assistant__log { max-height: 17vh; }
  .assistant__chips { padding: 6px 0; }
  .assistant__chips button { font-size: 11px; padding: 6px 9px; }
  .assistant__form input { height: 40px; }
  .assistant__form button { width: 40px; height: 40px; border-radius: 11px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filter { flex: 0 0 auto; padding: 7px 10px; }
  .rail__nav { width: 38px; height: 38px; }
  .rail__nav--prev { left: 10px; }
  .rail__nav--next { right: 10px; }
  .expo__label { font-size: 11px; padding: 5px 9px; }
  .mini__tag { display: none; }
}

/* ---------- темы: тёмная/светлая для посетителей и 3+ темы кабинета ---------- */

.mode-toggle {
  width: 34px; height: 34px; border-radius: 999px;
  background: rgba(255, 255, 255, .1); color: #f0efea; font-size: 15px;
  display: grid; place-items: center;
}
.mode-toggle:hover { background: rgba(255, 255, 255, .2); }

.themes { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.themes > span { font-size: 11px; color: var(--muted); }
.themes button {
  padding: 5px 10px; border-radius: 999px; font-size: 11.5px;
  border: 1px solid var(--line); color: var(--ink); background: transparent;
}
.themes button.is-active { background: var(--gold); color: var(--gold-ink); border-color: transparent; }

:root[data-theme="atelier"] { --bronze: #8a7a5c; --gold: #c2ab7a; }
:root[data-theme="sea"] { --bronze: #2f7f8f; --gold: #59b3c4; }
:root[data-theme="warm"] { --bronze: #b06a3b; --gold: #d59a5f; }

:root[data-mode="light"] body { background: #eef0f2; color: #1d1f22; }
:root[data-mode="light"] .scene__bg {
  background:
    radial-gradient(60% 50% at 50% 24%, rgba(200, 161, 90, .18), transparent 66%),
    radial-gradient(46% 40% at 50% 60%, rgba(120, 190, 205, .16), transparent 70%),
    linear-gradient(180deg, #f6f7f8 0%, #e9edf0 44%, #dfe5e9 72%, #eef0f2 100%);
}
:root[data-mode="light"] .scene__bg::after {
  background: radial-gradient(70% 60% at 50% 46%, transparent 0%, rgba(255, 255, 255, .4) 100%);
}
:root[data-mode="light"] .topbar { background: linear-gradient(180deg, rgba(255, 255, 255, .92), transparent); }
:root[data-mode="light"] .brand b { color: #1d1f22; }
:root[data-mode="light"] .brand span { color: #5b666d; }
:root[data-mode="light"] .topnav a { color: #3a4148; }
:root[data-mode="light"] .topnav a:hover { color: #111; background: rgba(0, 0, 0, .06); }
:root[data-mode="light"] .topbar__right { color: #3a4148; }
:root[data-mode="light"] .mode-toggle { background: rgba(0, 0, 0, .08); color: #1d1f22; }
:root[data-mode="light"] .watermark { opacity: .06; mix-blend-mode: multiply; }

/* тема «Референс»: белый, графит и оранжевый акцент присланного сайта */
:root[data-theme="reference"] {
  --bronze: #ff8921;
  --gold: #ff8921;
  --gold-ink: #1b1b1b;
  --sans: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --display: "Montserrat", system-ui, sans-serif;
}
:root[data-theme="reference"][data-mode="light"] .scene__bg {
  background:
    radial-gradient(60% 50% at 50% 20%, rgba(255, 137, 33, .10), transparent 66%),
    linear-gradient(180deg, #ffffff 0%, #f6f7f8 55%, #eceef0 100%);
}
:root[data-theme="reference"] .filter.is-active,
:root[data-theme="reference"] .themes button.is-active { background: #ff8921; color: #1b1b1b; }

/* ---------- 3D-галерея: живая экспозиция и силуэты моделей ---------- */

.expo__3d {
  position: relative; z-index: 2;
  height: 100%; width: min(82vw, 780px);
  pointer-events: auto;
  cursor: grab;
}
.expo__3d:active { cursor: grabbing; }
.expo__3d canvas { display: block; touch-action: none; }
.expo__bgswitch {
  position: absolute; right: 0; bottom: 6px; z-index: 300;
  display: flex; gap: 4px;
  pointer-events: auto;
}
.expo__bgswitch button {
  padding: 5px 10px; border-radius: 999px; font-size: 11px;
  border: 1px solid var(--line-light); color: #dfe5e6; background: rgba(12, 15, 18, .45);
}
.expo__bgswitch button.is-active { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
:root[data-mode="light"] .expo__bgswitch button { color: #3a4148; background: rgba(255, 255, 255, .7); border-color: var(--line); }
:root[data-mode="light"] .expo__bgswitch button.is-active { background: var(--gold); color: var(--gold-ink); }

.mini__shape { height: var(--mini-h, 140px); width: auto; max-width: 100%; }
.mini__shape path {
  fill: rgba(255, 255, 255, .14);
  stroke: rgba(255, 255, 255, .58);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}
.mini.is-near .mini__shape path { fill: rgba(200, 161, 90, .24); stroke: rgba(200, 161, 90, .95); }
.form-row .mini__shape { height: 42px; width: 42px; flex: 0 0 auto; }
.form-row .mini__shape path { fill: rgba(48, 44, 37, .16); stroke: rgba(48, 44, 37, .55); }

.assistant__tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0 2px; }
.assistant__tools button {
  padding: 6px 10px; border-radius: 999px; font-size: 11.5px;
  border: 1px solid var(--line); color: var(--ink); background: transparent;
}
.assistant__tools button:hover { background: rgba(0, 0, 0, .05); }

.demo-note {font-size:12px;line-height:1.2}
.assistant__foot #downloadProject {
  color:var(--gold-ink,#22180d);background:var(--gold,#e4bb76);border:0;
  border-radius:8px;padding:7px 12px;cursor:pointer;font:inherit;font-size:12px;font-weight:600;line-height:1.3;
}
#downloadProject:focus-visible,.assistant__foot a:focus-visible {outline:2px solid #efaa4d;outline-offset:3px}
@media(max-width:700px){.demo-note{font-size:9px;max-width:84px;text-align:right}}
