/* =====================================================
   SHARED ANIMATIONS — Sprzątanie Warszawa
   Loaded by all pages. Selectors are defensive; rules
   only kick in if matching elements exist on the page.
   ===================================================== */

/* Respect motion preferences */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-stagger, .hero-anim > * { opacity: 1 !important; transform: none !important; }
  .bubbles { display: none !important; }
  .summary-price, .mb-price { transition: none !important; }
}

/* ---------- Hero entrance (index only) ---------- */
.hero-anim > * {
  opacity: 0;
  transform: translateY(14px);
  animation: heroIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.hero-anim > *:nth-child(1) { animation-delay: 0.05s; }
.hero-anim > *:nth-child(2) { animation-delay: 0.18s; }
.hero-anim > *:nth-child(3) { animation-delay: 0.30s; }
.hero-anim > *:nth-child(4) { animation-delay: 0.42s; }
.hero-anim > *:nth-child(5) { animation-delay: 0.52s; }
@keyframes heroIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Page entrance (subpages) ---------- */
.page-anim > * {
  opacity: 0;
  transform: translateY(12px);
  animation: heroIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.page-anim > *:nth-child(1) { animation-delay: 0.05s; }
.page-anim > *:nth-child(2) { animation-delay: 0.14s; }
.page-anim > *:nth-child(3) { animation-delay: 0.24s; }
.page-anim > *:nth-child(4) { animation-delay: 0.34s; }
.page-anim > *:nth-child(5) { animation-delay: 0.44s; }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-stagger.in > * { opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger.in > *:nth-child(2) { transition-delay: 0.15s; }
.reveal-stagger.in > *:nth-child(3) { transition-delay: 0.25s; }
.reveal-stagger.in > *:nth-child(4) { transition-delay: 0.35s; }
.reveal-stagger.in > *:nth-child(5) { transition-delay: 0.45s; }
.reveal-stagger.in > *:nth-child(6) { transition-delay: 0.55s; }
.reveal-stagger.in > *:nth-child(7) { transition-delay: 0.65s; }
.reveal-stagger.in > *:nth-child(8) { transition-delay: 0.72s; }

/* ---------- Hero bubbles (index only) ---------- */
.bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.hero { position: relative; }
.hero > * { position: relative; z-index: 1; }
.hero > .bubbles { z-index: 0; }
.bubble {
  position: absolute;
  bottom: -60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), rgba(216, 243, 220, 0.35) 60%, transparent 75%);
  box-shadow: inset -2px -3px 6px rgba(45,106,79,0.08);
  opacity: 0;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0%   { transform: translateY(0) translateX(0) scale(0.95); opacity: 0; }
  10%  { opacity: 0.55; }
  50%  { transform: translateY(-260px) translateX(20px) scale(1.05); opacity: 0.5; }
  90%  { opacity: 0.15; }
  100% { transform: translateY(-520px) translateX(-12px) scale(0.85); opacity: 0; }
}

/* ---------- Price bump (index only) ---------- */
.summary-price {
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s;
  display: inline-block;
}
.summary-price.bump { transform: scale(1.08); }
.mb-price { transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); display: inline-block; }
.mb-price.bump { transform: scale(1.08); }

/* ---------- Micro-interactions: hover lifts ---------- */
.why-card .icon,
.trust-item .ic,
.contact-card .ic,
.service-card .ic { transition: all 0.3s; }

.why-card:hover .icon,
.service-card:hover .ic {
  transform: scale(1.06) rotate(-3deg);
}
.why-card:hover .icon { background: var(--green-100); }

.trust-item:hover .ic,
.contact-card:hover .ic {
  transform: translateY(-2px);
}

/* Test/contact/service/step cards — subtle lift on hover */
.test-card,
.contact-card,
.service-card,
.trust-card,
.step-item,
.perk,
.job-card { transition: transform 0.25s, box-shadow 0.25s; }
.test-card:hover,
.contact-card:hover,
.service-card:hover,
.trust-card:hover,
.step-item:hover,
.perk:hover,
.job-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(20, 35, 30, 0.08), 0 4px 12px rgba(20, 35, 30, 0.04);
}

/* Icon pulse on hover for additional card types */
.trust-card .ic,
.perk .ic { transition: all 0.3s; }
.trust-card:hover .ic,
.perk:hover .ic { transform: scale(1.06) rotate(-3deg); }

/* Step pill — soft pulse when becoming active */
.step-pill.active { animation: pillPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes pillPop {
  0% { transform: scale(0.96); }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* Submit button — shimmer on hover */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.22), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}
.btn-primary:hover::after { left: 130%; }

/* Logo wiggle on hover */
.logo:hover .logo-mark { animation: wiggle 0.6s ease; }
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-6deg); }
  50% { transform: rotate(0); }
  75% { transform: rotate(6deg); }
}

/* FAQ answer smoother fade */
.faq-a > div {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s 0.05s, transform 0.3s 0.05s;
}
.faq-item.open .faq-a > div { opacity: 1; transform: translateY(0); }

/* Nav links — underline grow on hover */
.nav-links a {
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1.5px;
  background: var(--green-700);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }

/* Footer links — gentle slide on hover */
footer a { transition: color 0.2s, transform 0.2s; display: inline-block; }
footer a:hover { transform: translateY(-1px); }

/* Step pill subtle hover */
.step-pill { transition: transform 0.2s, background 0.3s, border-color 0.3s, color 0.3s; }

/* ---------- Stage entrance (index) — form + sidebar pop in like hero ---------- */
.stage-anim .steps-bar,
.stage-anim .form-card,
.stage-anim .summary-card,
.stage-anim .sidebar-trust {
  opacity: 0;
  transform: translateY(18px);
  animation: heroIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.stage-anim .steps-bar    { animation-delay: 0.55s; }
.stage-anim .summary-card { animation-delay: 0.62s; }
.stage-anim .form-card    { animation-delay: 0.70s; }
.stage-anim .sidebar-trust{ animation-delay: 0.82s; }

@media (prefers-reduced-motion: reduce) {
  .stage-anim .steps-bar,
  .stage-anim .form-card,
  .stage-anim .summary-card,
  .stage-anim .sidebar-trust { opacity: 1 !important; transform: none !important; animation: none !important; }
}

/* ---------- SCRATCH CARD MODAL ---------- */
.scratch-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.scratch-modal.open { display: flex; }
.scratch-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 48, 36, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: scFade 0.3s ease both;
}
@keyframes scFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.scratch-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--paper, #fff);
  border-radius: 24px;
  padding: 28px 24px 22px;
  box-shadow: 0 30px 80px rgba(19, 48, 36, 0.35), 0 8px 22px rgba(19, 48, 36, 0.18);
  text-align: center;
  overflow: hidden;
  animation: scPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes scPop {
  0%   { opacity: 0; transform: translateY(20px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.scratch-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(199, 154, 42, 0.22), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.scratch-card::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -50px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(82, 183, 136, 0.18), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.scratch-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  border: none;
  background: var(--cream, #faf7f0);
  color: var(--ink-soft, #4d5853);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  z-index: 2;
}
.scratch-close:hover {
  background: var(--ink, #1a2520);
  color: #fff;
  transform: rotate(90deg);
}

.scratch-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold, #c79a2a);
  background: var(--gold-soft, #f4e9c8);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 14px;
  position: relative;
}

.scratch-title {
  font-family: var(--serif, 'Instrument Serif', Georgia, serif);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.05;
  color: var(--green-900, #133024);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  position: relative;
}
.scratch-title em {
  font-style: italic;
  color: var(--green-700, #2d6a4f);
}

.scratch-sub {
  font-size: 13.5px;
  color: var(--ink-soft, #4d5853);
  margin-bottom: 18px;
  position: relative;
}

.scratch-area {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--green-50, #ecf6ef) 0%, var(--gold-soft, #f4e9c8) 100%);
  margin-bottom: 18px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  border: 1.5px solid var(--line, #ebe4d3);
}

.scratch-prize {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
}
.scratch-prize-tag {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green-700, #2d6a4f);
  margin-bottom: 4px;
}
.scratch-prize-code {
  font-family: var(--serif, 'Instrument Serif', Georgia, serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--green-900, #133024);
  line-height: 1;
  margin-bottom: 6px;
}
.scratch-prize-amount {
  font-size: 13px;
  color: var(--ink, #1a2520);
}
.scratch-prize-amount em {
  font-style: normal;
  font-weight: 700;
  color: var(--warm, #b9402e);
  font-size: 17px;
}

.scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.scratch-canvas:active { cursor: grabbing; }
.scratch-area.revealed .scratch-canvas {
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.scratch-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  color: #fff;
  background: rgba(19, 48, 36, 0.72);
  padding: 5px 12px;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  animation: scHintBounce 1.8s ease-in-out infinite;
  white-space: nowrap;
}
.scratch-hint svg { width: 13px; height: 13px; }
@keyframes scHintBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-4px); }
}
.scratch-area.scratching .scratch-hint,
.scratch-area.revealed .scratch-hint { opacity: 0; transition: opacity 0.2s; }

.scratch-apply {
  width: 100%;
  background: var(--green-700, #2d6a4f);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 14px 20px;
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.scratch-apply:disabled {
  background: var(--line, #ebe4d3);
  color: var(--ink-mute, #8a9590);
  cursor: not-allowed;
}
.scratch-apply:not(:disabled):hover {
  background: var(--green-800, #1d4534);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(45,106,79,0.25);
}
.scratch-apply::after {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: skewX(-20deg);
  transition: left 0.7s ease;
  pointer-events: none;
}
.scratch-apply:not(:disabled):hover::after { left: 130%; }

.scratch-footnote {
  font-size: 11.5px;
  color: var(--ink-mute, #8a9590);
  margin-top: 12px;
  position: relative;
}

/* Confetti burst */
.scratch-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.scratch-confetti i {
  position: absolute;
  width: 8px; height: 12px;
  top: 50%; left: 50%;
  opacity: 0;
  animation: scConfetti 1.1s cubic-bezier(0.18, 0.7, 0.45, 1) forwards;
}
@keyframes scConfetti {
  0%   { opacity: 1; transform: translate(-50%, -50%) rotate(0); }
  100% { opacity: 0; transform: translate(var(--cx), var(--cy)) rotate(var(--cr)); }
}

/* ---------- REMINDER PILL (bottom-right blink) ---------- */
.scratch-remind {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 14px;
  background: var(--green-900, #133024);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(19, 48, 36, 0.35), 0 4px 10px rgba(19, 48, 36, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: scRemindIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both,
             scRemindBlink 2.4s ease-in-out 0.5s infinite;
}
.scratch-remind.show { display: inline-flex; }
.scratch-remind:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(19, 48, 36, 0.45);
}
.scratch-remind-dot {
  width: 9px; height: 9px;
  background: var(--gold, #c79a2a);
  border-radius: 50%;
  flex-shrink: 0;
  animation: scRemindDot 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(199, 154, 42, 0.7);
}
.scratch-remind-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
}
.scratch-remind-text small {
  font-size: 10.5px;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.02em;
}
.scratch-remind-text strong {
  font-weight: 600;
  color: var(--gold, #c79a2a);
}
.scratch-remind .scratch-remind-close {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  flex-shrink: 0;
  transition: all 0.18s;
}
.scratch-remind .scratch-remind-close:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
@keyframes scRemindIn {
  0%   { opacity: 0; transform: translateY(20px) scale(0.85); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes scRemindBlink {
  0%, 100% { box-shadow: 0 14px 36px rgba(19, 48, 36, 0.35), 0 0 0 0 rgba(199, 154, 42, 0); }
  50%      { box-shadow: 0 14px 36px rgba(19, 48, 36, 0.35), 0 0 0 10px rgba(199, 154, 42, 0); }
  25%      { box-shadow: 0 14px 36px rgba(19, 48, 36, 0.35), 0 0 0 0 rgba(199, 154, 42, 0.4); }
}
@keyframes scRemindDot {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(199, 154, 42, 0.7); }
  50%      { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(199, 154, 42, 0); }
}

@media (max-width: 960px) {
  .scratch-remind {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .scratch-remind { animation: none; }
  .scratch-card, .scratch-backdrop, .scratch-confetti i { animation: none !important; }
}
