/*
 * Grobio – custom.css
 * Suwak Przed/Po, animacje kroków kreatora, pasek sumy na telefonie, modal.
 * (Reszta stylów: assets/css/main.css – skompilowany Tailwind.)
 */

/* ========== Suwak Przed / Po ========== */
.ba-slider {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.ba-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.ba-before {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0);
  will-change: clip-path;
}

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos, 50%);
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 16px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.ba-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: #fff;
  color: #1b4332;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease;
}

.ba-slider:hover .ba-knob,
.ba-slider.is-dragging .ba-knob {
  transform: translate(-50%, -50%) scale(1.08);
}

/* Natywny input range na całej powierzchni – obsługa myszy, dotyku i klawiatury */
.ba-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.ba-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 52px;
  height: 100%;
}
.ba-range::-moz-range-thumb {
  width: 52px;
  height: 100%;
  border: 0;
}

.ba-range:focus-visible ~ .ba-handle .ba-knob,
.ba-slider:focus-within .ba-knob {
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.7), 0 8px 24px rgba(0, 0, 0, 0.22);
}

.ba-label {
  position: absolute;
  top: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.72);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}

/* Delikatna animacja-podpowiedź przy pierwszym wyświetleniu */
.ba-slider.is-hinting .ba-before,
.ba-slider.is-hinting .ba-handle {
  transition: clip-path 0.9s cubic-bezier(0.65, 0, 0.35, 1), left 0.9s cubic-bezier(0.65, 0, 0.35, 1);
}

/* ========== Kreator – kroki ========== */
.wizard-step {
  display: none;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.wizard-step.is-active {
  display: block;
  animation: grobio-step-in 0.35s ease both;
}

.wizard-step.is-back {
  animation-name: grobio-step-in-back;
}

@keyframes grobio-step-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes grobio-step-in-back {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Mikroanimacja sumy przy zmianie */
[data-total].is-bump {
  animation: grobio-bump 0.35s ease;
}

@keyframes grobio-bump {
  40% {
    transform: scale(1.08);
    color: #b45309;
  }
}

[data-total] {
  display: inline-block;
  transform-origin: right center;
}

/* Spinner w przycisku */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 999px;
  animation: grobio-spin 0.7s linear infinite;
}

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

/* ========== Pasek sumy (mobile) ========== */
.mobile-total {
  transform: translateY(110%);
  transition: transform 0.3s ease;
}

.mobile-total.is-visible {
  transform: none;
}

/* ========== Modal wykonawcy ========== */
.contractor-modal {
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}

.contractor-modal[open] {
  animation: grobio-modal-in 0.25s ease both;
}

@keyframes grobio-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

html:has(.contractor-modal[open]) {
  overflow: hidden;
}

/* ========== FAQ ========== */
.faq[open] summary {
  color: #1b4332;
}

/* ========== Dostępność: ograniczony ruch ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
