/*
 * Copyright (c) 2026 PsyGioX. Licensed under the MIT License.
 * Source: https://github.com/PsyGioX/PsyGioX-website — Site: https://psygiox-dev.vercel.app/
 *
 * Copyright (c) 2026 PsyGioX. Лицензия MIT.
 * Исходники: https://github.com/PsyGioX/PsyGioX-website — Сайт: https://psygiox-dev.vercel.app/
 */
/* ==========================================================================
   Калькулятор стоимости (services/calculator.html).
   Всё на токенах из site.css; общие панели, поля и тост берутся из site.css / tools.css.
   ========================================================================== */

.calc {
  width: min(var(--wrap), 100% - var(--gutter) * 2);
  margin-inline: auto;
  padding: 36px 0 8px;
}
.calc > * + * { margin-top: 24px; }

/* Простая блочная колонка: форма, «Итоговая стоимость», «Почему стоит заказать
   сайт» — один под другим, без grid-колонок и без position:sticky. Так блоки
   никогда не наезжают друг на друга при скролле, на любом экране. */
.calc-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.calc-aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Форма ---------- */
.calc-form { counter-reset: step; }
.calc-group {
  min-width: 0;
  margin: 0 0 30px;
  padding: 0;
  border: 0;
}
.calc-group:last-of-type { margin-bottom: 0; }
.calc-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0;
  font-family: var(--f-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--star);
}
.calc-legend::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  padding: 2px 10px;
  font-family: var(--f-hand);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--on-pastel);
  background: var(--p-pink);
  border-radius: 999px;
}
.calc-hint { margin-top: 10px; font-size: 12px; color: var(--faint); }
.calc-label { display: block; margin: 0 0 6px; font-size: 12px; color: var(--dim); letter-spacing: 0.02em; }

/* карточки выбора: радио и чекбоксы выглядят одинаково, отличается только «метка» */
.calc-opts { display: grid; gap: 12px; }
.calc-opts--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.calc-opts--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card .opt { position: relative; display: block; margin: 0; font-size: inherit; color: inherit; cursor: pointer; }
.opt input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.opt__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 14px 18px;
  background: var(--field);
  border: 2px solid var(--line-dim);
  border-radius: var(--r-md);
  transition: transform 0.3s var(--spring), border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.opt:hover .opt__body { border-color: var(--line-mid); transform: translateY(-2px); }
.opt input:checked + .opt__body {
  background: linear-gradient(135deg, rgba(205, 180, 246, 0.45), rgba(248, 180, 208, 0.45));
  border-color: rgba(var(--ion-rgb), 0.7);
  box-shadow: 0 4px 0 rgba(var(--ion-rgb), 0.22);
}
.opt input:focus-visible + .opt__body { outline: 3px solid rgba(var(--ion-rgb), 0.7); outline-offset: 3px; }
.opt__title { font-family: var(--f-display); font-size: 15px; font-weight: 800; color: var(--star); }
.opt__desc { font-size: 12px; line-height: 1.5; color: var(--dim); }
.opt__price { margin-top: auto; padding-top: 4px; font-size: 13px; font-weight: 600; color: var(--cyan); font-variant-numeric: tabular-nums; }
.opt--check .opt__body { padding-right: 46px; }
.opt__mark {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--line-mid);
  border-radius: 8px;
  background: var(--field);
  transition: background-color 0.2s, border-color 0.2s, transform 0.3s var(--spring);
}
.opt__mark::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid var(--on-pastel);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.18s var(--ease);
}
.opt input:checked + .opt__body .opt__mark { background: var(--p-pink); border-color: rgba(255,255,255,0.9); transform: scale(1.1) rotate(-6deg); }
.opt input:checked + .opt__body .opt__mark::after { transform: rotate(45deg) scale(1); }

.calc-row { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.calc-row .tool-select { width: 100%; }
.calc-seg { display: inline-grid; grid-auto-flow: column; }
.calc-seg .opt__body { align-items: center; justify-content: center; min-width: 64px; padding: 0 14px; min-height: 46px; font-family: var(--f-display); font-weight: 600; color: var(--star); }
.calc-seg { gap: 8px; }
.calc-seg .opt__body { border-radius: 999px; }
.calc-contacts { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.calc-contacts .calc-wide { grid-column: 1 / -1; }
.calc-form textarea.tool-textarea { min-height: 112px; }

.calc-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.calc-actions .btn { min-height: 46px; }

/* ---------- Итог ---------- */
.calc-sum { padding: 22px; }
.calc-sum__top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; }
.calc-sum__label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--dim); letter-spacing: 0.04em; }
.calc-sum__price {
  font-family: var(--f-display);
  font-size: clamp(32px, 4.4vw, 44px);
  font-weight: 900;
  line-height: 1.05;
  color: var(--star);
  background: linear-gradient(transparent 62%, var(--marker) 62% 92%, transparent 92%);
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.calc-sum__deadline {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--star);
  font-weight: 800;
  color: var(--on-pastel);
  background: var(--p-butter);
  border-radius: 999px;
  white-space: nowrap;
}
.calc-details { margin-top: 18px; border-top: 3px dashed var(--line-dim); }
.calc-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
  list-style: none;
}
.calc-details summary::-webkit-details-marker { display: none; }
.calc-details summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border: solid var(--cyan);
  border-width: 0 3px 3px 0;
  border-radius: 1px;
  transform: rotate(45deg);
  transition: transform 0.3s var(--spring);
}
.calc-details[open] summary::after { transform: rotate(-135deg); }
.calc-lines { margin: 0; padding: 0; list-style: none; }
.calc-lines li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--line-dim);
}
.calc-lines li:last-child { border-bottom: 0; }
.calc-lines span { color: var(--dim); }
.calc-lines b { color: var(--star); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-lines .cl-right { display: inline-flex; align-items: center; gap: 8px; }
.cl-remove {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--faint);
  background: transparent;
  border: 1px solid var(--line-dim);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.cl-remove:hover, .cl-remove:focus-visible { color: var(--hot); border-color: var(--hot); }
.calc-note { margin-top: 14px; padding: 10px 12px; font-size: 12px; line-height: 1.55; color: var(--dim); border: 1px dashed var(--line-mid); }
.calc-sum__actions { display: grid; gap: 10px; margin-top: 16px; }
.calc-sum__actions .btn { width: 100%; min-height: 46px; }

/* ---------- Преимущества ---------- */
.calc-why { padding: clamp(18px, 3vw, 26px); }
.calc-why h2 { margin-bottom: 14px; font-size: clamp(17px, 2.2vw, 20px); }
.calc-why ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.calc-why li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--star);
  border-bottom: 1px dashed var(--line-dim);
}
.calc-why li:last-child { border-bottom: 0; }
.calc-why .bi {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 12px;
  color: var(--cyan);
  border: 1px solid var(--line-ion);
  background: rgba(var(--cyan-rgb), 0.08);
  border-radius: 50%;
}

/* ---------- Адаптив ---------- */
@media (max-width: 959px) {
  .calc-sum {
    padding: 14px 16px;
    background: var(--panel-hi);
  }
  .calc-sum__top { align-items: center; flex-wrap: nowrap; }
  .calc-sum__label { margin-bottom: 2px; }
  .calc-sum__price { font-size: 26px; }
  .calc-details { margin-top: 10px; }
}
@media (max-width: 640px) {
  .calc { padding-top: 24px; }
  .calc-opts--3, .calc-opts--2 { grid-template-columns: 1fr; }
  .calc-row { grid-template-columns: 1fr; }
  .calc-contacts { grid-template-columns: 1fr; }
  .calc-actions .btn { flex: 1 1 100%; }
  .calc-sum__deadline { font-size: 11px; padding: 3px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .opt__body, .opt__mark, .opt__mark::after { transition: none; }
}
