﻿/* Конфигуратор брелока — светлая тема сайта */

.product-head {
  margin-bottom: 22px;
}

.product-head h1 {
  margin: 0 0 8px;
  font-family: 'Play', var(--ui);
  font-size: clamp(26px, 3.6vw, 36px);
  line-height: 1.14;
}

.configurator {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: stretch;
  margin-top: 6px;
  margin-bottom: 56px;
}

/* ---------- сцена ---------- */

.viewer {
  position: relative;
  height: 520px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #fdfaf4, #f2ebe0 55%, #efe6d8);
  overflow: hidden;
}

.viewer canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.viewer:fullscreen {
  border-radius: 0;
  height: 100vh;
}

.viewer-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: #7c766d;
  backdrop-filter: blur(6px);
}

.viewer-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  border-color: #d6c9b6;
}

.icon-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff7ec;
}

.viewer-hint {
  position: absolute;
  left: 14px;
  bottom: 12px;
  font-size: 11.5px;
  color: #8b8478;
}

.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(247, 244, 238, 0.86);
  font-size: 13.5px;
  color: #6f685e;
  backdrop-filter: blur(2px);
}

.loader.hidden {
  display: none;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid #d8cdbb;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fbeceb;
  border: 1px solid #f0cfcb;
  color: #8e2a22;
  font-size: 13px;
}

/* ---------- панель ---------- */

.config-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.row label {
  font-size: 13px;
  color: var(--muted);
}

.count {
  font-size: 12px;
  color: #a49c90;
}

#word {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#word:focus {
  outline: none;
  border-color: #d6c9b6;
  box-shadow: 0 0 0 4px rgba(164, 42, 35, 0.07);
}

.hint-sm {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #9a9184;
}

.hint-sm.center {
  text-align: center;
}

.hint-sm.warn {
  color: var(--accent);
}

.price-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

.price-row strong {
  font-size: 24px;
  color: var(--ink);
  font-family: 'Play', var(--ui);
}

.cta {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--ink);
  color: #fff7ec;
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease, background 0.15s ease;
}

.cta:hover:not(:disabled) {
  filter: brightness(1.1);
}

.cta:active:not(:disabled) {
  transform: translateY(1px);
}

.cta:disabled {
  opacity: 0.4;
  cursor: default;
}

.cta.ghost {
  background: transparent;
  border-color: #d8cdbb;
  color: var(--ink);
}

.cta.ghost:hover:not(:disabled) {
  background: #fffdf8;
  filter: none;
}

/* ---------- диалог ---------- */

.dialog {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: min(460px, calc(100vw - 32px));
  width: 100%;
}

.dialog::backdrop {
  background: rgba(31, 25, 18, 0.45);
  backdrop-filter: blur(3px);
}

.dialog-card {
  position: relative;
  padding: 24px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 30px 70px rgba(40, 28, 14, 0.22);
  color: var(--ink);
}

.dialog-card h2 {
  margin: 0 0 14px;
  font-family: 'Play', var(--ui);
  font-size: 20px;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.dialog-close:hover {
  background: #f4ede2;
}

.summary {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: #fbf7ef;
  border: 1px solid var(--line);
  font-size: 13.5px;
}

.summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.summary span {
  color: var(--muted);
}

.form-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.form-field span {
  font-size: 12.5px;
  color: var(--muted);
}

.form-field input,
.form-field textarea {
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fffdfa;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #d6c9b6;
  box-shadow: 0 0 0 4px rgba(164, 42, 35, 0.07);
}

.form-error {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--accent);
}

.done-text {
  margin: 0 0 10px;
  font-size: 14.5px;
}

.done-actions {
  margin-top: 16px;
}

/* ---------- тост ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff7ec;
  font-size: 13.5px;
  box-shadow: 0 16px 36px rgba(40, 28, 14, 0.28);
  z-index: 60;
}

.toast[hidden] {
  display: none;
}

/* ---------- мобильная версия ---------- */

@media (max-width: 900px) {
  .configurator {
    grid-template-columns: minmax(0, 1fr);
  }

  .viewer {
    height: 400px;
  }
}

@media (max-width: 640px) {
  .viewer {
    height: 320px;
    border-radius: 16px;
  }

  .config-panel {
    padding: 16px;
  }

  .viewer-hint {
    display: none;
  }
}

/* ---------- готовые брелоки ---------- */

.products {
  margin-bottom: 64px;
}

.products-head {
  margin-bottom: 16px;
  text-align: center;
}

.products-head h2 {
  margin: 0 0 6px;
  font-family: 'Play', var(--ui);
  font-size: clamp(21px, 2.6vw, 26px);
}

.products-sub {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.product-tabs {
  max-width: 420px;
  margin: 0 auto 18px;
}

.product-grid {
  margin-bottom: 20px;
}

.product-card .card-button {
  margin-top: 12px;
  cursor: pointer;
}

.products-more {
  display: flex;
  justify-content: center;
}

.products-more[hidden],
.products-more button[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .product-tabs {
    max-width: none;
  }
}
.card-action {
  display: flex;
  margin-top: 12px;
}

.card-action .card-button {
  width: 100%;
  text-align: center;
}

/* счётчик в карточке: кнопки явно отделены от числа */
.card-qty {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 0;
  width: 100%;
  margin-top: 0;
  border: 1px solid #d8cdbb;
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.card-qty button {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 0;
  background: #f4ecdf;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.card-qty button:hover {
  background: #ece1d0;
}

.card-qty span {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 40px;
  border-left: 1px solid #e2d8c6;
  border-right: 1px solid #e2d8c6;
  font-size: 14.5px;
  font-weight: 650;
}