/* ============================================
   Contact modal
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 4, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: linear-gradient(160deg, #1a1612 0%, #141110 100%);
  border: 1px solid rgba(232, 168, 48, 0.2);
  border-radius: var(--radius-xl);
  padding: 24px 24px 22px;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 60px rgba(200, 134, 10, 0.08);
  transform: scale(0.92) translateY(24px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.is-open .modal__dialog {
  transform: scale(1) translateY(0);
}

.modal__dialog::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-amber), var(--color-gold), var(--color-amber));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  transition: var(--transition);
  z-index: 2;
}

.modal__close svg {
  width: 18px;
  height: 18px;
}

.modal__close:hover {
  background: rgba(200, 134, 10, 0.15);
  border-color: rgba(232, 168, 48, 0.35);
  color: var(--color-gold);
  transform: rotate(90deg);
}

.modal__head {
  margin-bottom: 16px;
  padding-right: 32px;
}

.modal__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-heading);
  margin: 0 0 4px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-transform: none;
  overflow: visible;
}

.modal__desc {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.modal__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.modal__field-phone {
  grid-column: 1 / -1;
}

.modal__form .form-group {
  gap: 5px;
}

.modal__form .form-group label {
  font-size: 12px;
}

.modal__form .form-group input,
.modal__form .form-group textarea {
  padding: 10px 12px;
  font-size: 14px;
}

.modal__form .form-group textarea {
  min-height: 72px;
  resize: vertical;
}

.modal__form .form-group--full {
  grid-column: unset;
}

.modal__captcha {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal__captcha-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.modal__captcha-label svg {
  flex-shrink: 0;
  color: var(--color-gold);
  opacity: 0.85;
}

.modal__captcha-box {
  position: relative;
  padding: 18px 14px 14px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(200, 134, 10, 0.14) 0%, transparent 65%),
    radial-gradient(circle at 12% 88%, rgba(232, 168, 48, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 88% 78%, rgba(154, 104, 8, 0.1) 0%, transparent 40%),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(232, 168, 48, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.modal__captcha-box.is-verified {
  border-color: rgba(232, 168, 48, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 28px rgba(200, 134, 10, 0.22);
}

.modal__captcha-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 3px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, transparent, rgba(255, 248, 235, 0.45), transparent);
  pointer-events: none;
  z-index: 2;
}

.captcha-beer__keg,
.captcha-beer__hops {
  position: absolute;
  pointer-events: none;
  opacity: 0.12;
  color: var(--color-gold);
  z-index: 0;
}

.captcha-beer__keg {
  width: 72px;
  height: 72px;
  right: -8px;
  bottom: 8px;
  transform: rotate(-8deg);
}

.captcha-beer__hops {
  width: 56px;
  height: 56px;
  left: -4px;
  top: 6px;
  transform: rotate(12deg);
}

.captcha-beer__ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.captcha-beer__bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: captchaBubble 5s ease-in-out infinite;
}

.captcha-beer__bubble:nth-child(1) { width: 6px; height: 6px; left: 14%; bottom: 18%; animation-delay: 0s; }
.captcha-beer__bubble:nth-child(2) { width: 4px; height: 4px; left: 28%; bottom: 12%; animation-delay: 1.2s; }
.captcha-beer__bubble:nth-child(3) { width: 5px; height: 5px; right: 22%; bottom: 20%; animation-delay: 0.6s; }
.captcha-beer__bubble:nth-child(4) { width: 3px; height: 3px; right: 12%; bottom: 10%; animation-delay: 2s; }
.captcha-beer__bubble:nth-child(5) { width: 4px; height: 4px; left: 48%; bottom: 8%; animation-delay: 1.8s; }

.captcha-beer__liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background: linear-gradient(180deg, rgba(200, 134, 10, 0.05) 0%, rgba(154, 104, 8, 0.35) 55%, rgba(120, 78, 6, 0.5) 100%);
  transform: translateY(55%);
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
}

.captcha-beer__liquid::before {
  content: '';
  position: absolute;
  left: -10%;
  right: -10%;
  top: -7px;
  height: 14px;
  background: radial-gradient(ellipse 50% 100% at 50% 100%, rgba(232, 168, 48, 0.55) 0%, transparent 70%);
  animation: captchaWave 3.5s ease-in-out infinite;
}

.modal__captcha-box.is-verified .captcha-beer__liquid {
  transform: translateY(18%);
}

.captcha-beer__foam {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  opacity: 0;
  background: linear-gradient(180deg, rgba(255, 248, 235, 0.75) 0%, rgba(255, 248, 235, 0.15) 100%);
  transform: translateY(100%);
  transition: opacity 0.4s ease, transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.captcha-beer__foam::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.9) 28%, transparent 30%);
  background-size: 10px 10px;
  background-position: 0 0;
  opacity: 0.35;
}

.modal__captcha-box.is-verified .captcha-beer__foam {
  opacity: 1;
  transform: translateY(0);
}

.captcha-beer__hint {
  position: relative;
  z-index: 2;
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  transition: color 0.3s ease;
}

.modal__captcha-box.is-verified .captcha-beer__hint {
  color: var(--color-gold);
}

@keyframes captchaBubble {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-14px); opacity: 0.85; }
}

@keyframes captchaWave {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}

.modal__captcha-widget {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  min-height: 78px;
  padding: 4px 0;
}

.modal__captcha-widget > div {
  transform-origin: center;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

@media (max-width: 380px) {
  .modal__captcha-widget > div {
    transform: scale(0.92);
  }
}

.modal__consent a {
  color: var(--color-gold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.modal__consent a:hover {
  color: var(--color-amber-light);
}

.modal__success {
  padding: 12px 8px 8px;
  text-align: center;
}

.modal__success-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text);
}

.modal__success-beer {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
}

.modal__success-mug {
  position: absolute;
  inset: 8px 12px 4px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(180deg, rgba(200, 134, 10, 0.5) 0%, rgba(120, 78, 6, 0.85) 100%);
  border: 2px solid rgba(232, 168, 48, 0.5);
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.25);
}

.modal__success-mug::before {
  content: '';
  position: absolute;
  right: -14px;
  top: 28%;
  width: 14px;
  height: 22px;
  border: 2px solid rgba(232, 168, 48, 0.45);
  border-left: none;
  border-radius: 0 8px 8px 0;
}

.modal__success-foam {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  height: 18px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #fff8eb 0%, rgba(255, 248, 235, 0.4) 100%);
  transform: scaleY(0);
  transform-origin: bottom;
  opacity: 0;
}

.modal__success-check {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--color-gold);
  opacity: 0;
  transform: scale(0.5);
}

.modal__success.is-celebrating .modal__success-foam {
  animation: successFoam 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}

.modal__success.is-celebrating .modal__success-check {
  animation: successCheck 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.55s forwards;
}

.modal__success.is-celebrating .modal__success-mug {
  animation: successMugPop 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes successFoam {
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes successCheck {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes successMugPop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .modal__success.is-celebrating .modal__success-foam,
  .modal__success.is-celebrating .modal__success-check,
  .modal__success.is-celebrating .modal__success-mug {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .modal__success-foam {
    transform: scaleY(1);
    opacity: 1;
  }

  .modal__success-check {
    opacity: 1;
    transform: scale(1);
  }
}

.form-server-error {
  font-size: 13px;
  color: #f87171;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.modal__consent {
  margin-top: -2px;
}

.modal__consent .checkbox {
  font-size: 12px;
  gap: 8px;
  line-height: 1.35;
}

.modal__consent .checkbox input {
  margin-top: 2px;
}

.modal__submit {
  padding: 13px 24px;
  font-size: 15px;
}

.req {
  color: var(--color-amber-light);
}

.form-error {
  font-size: 12px;
  color: #f87171;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .modal {
    padding: 12px;
    align-items: flex-end;
  }

  .modal__dialog {
    padding: 22px 18px 18px;
    max-height: 94vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal__fields {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modal__field-phone {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal__dialog {
    transform: none;
    transition: none;
  }

  .captcha-beer__bubble,
  .captcha-beer__liquid::before {
    animation: none;
  }

  .captcha-beer__liquid,
  .captcha-beer__foam {
    transition: none;
  }
}
