/* =========================
   CONTACT SECTION
========================= */

.contact {
  position: relative;
  width: 100%;
  max-height: 700px;
  background: url('../../assets/contactbg.webp') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(4rem, 10vh, 8rem) 1rem;
  gap: 2rem;
  overflow: hidden;
}

.contact h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  background: var(--page-bg);
  border-radius: 10px;
  color: var(--white);
  text-align: center;
}

/* =========================
   CARD SYSTEM
========================= */

.contact-card {
  width: 100%;
  max-width: 800px;
  height: 400px;
  perspective: 2000px;
  position: relative;
}

.contact-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.social-label {
  font-weight: 500;
  margin-top: 0.75rem;
}

.socials {
  display: flex;
  gap: 1rem;
  margin: 0.25rem 0;
}

.socials a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.socials a:hover {
  transform: translateY(-3px);
  background: var(--accent-red);
}

.socials svg {
  width: 20px;
  height: 20px;
  fill: var(--dark-text);
}

.socials a:hover svg {
  fill: var(--white);
}

/* =========================
   FRONT / BACK
========================= */

.contact-front,
.contact-back {
  position: absolute;
  inset: 0;
  padding: clamp(.25rem, 1rem, 1.5rem);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  text-align: center;
  background: var(--gray-bg);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
  backface-visibility: hidden;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

.contact-front {
  z-index: 2;
  transform-origin: left center;
  transition:
    transform 0.9s cubic-bezier(.55, .02, .2, 1),
    opacity 0.4s ease 0.5s;
}

.contact-front h2 {
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}
.contact-front p {
  font-size: 1rem;
  line-height: 1.35;
  margin: 0;
}

.contact-front strong {
  display: inline-block;
  margin-top: 0.25rem;
}
.contact-front p {
  font-size: clamp(0.9rem, 1vw, 1rem);
}

.contact-back {
  z-index: 1;
  transform: rotateY(180deg);
  pointer-events: none;
}

/* =========================
   FLIP
========================= */

.contact-card.flipped .contact-front {
  transform: rotateY(-180deg);
  opacity: 0;
  pointer-events: none;
}

.contact-card.flipped .contact-back {
  transform: rotateY(0deg);
  pointer-events: auto;
  z-index: 3;
}

/* =========================
   FORM
========================= */

.contact-form {
  width: 100%;
  height: 100%;
  position: relative;
}

.form-fields {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.input-group {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: 1px solid #ccc;
  background: var(--white);
  font-size: 1rem;
  outline: none;
  box-sizing: border-box;
}

.input-group textarea {
  min-height: 80px;
  resize: vertical;
}

.input-group .error-text {
  margin-top: 6px;
}

/* =========================
   WAVE LABEL
========================= */

.input-group label {
  position: absolute;
  left: 1rem;
  top: 1rem;
  pointer-events: none;
  display: flex;
  gap: 1px;
}

.input-group label span {
  display: inline-block;
  transition: transform 0.3s ease, color 0.3s ease;
  color: #777;
}

.input-group input:focus + label span,
.input-group input:valid + label span,
.input-group textarea:focus + label span,
.input-group textarea:valid + label span {
  transform: translateY(-22px);
  color: var(--accent-red);
}

.input-group label span:nth-child(n) {
  transition-delay: calc(0.02s * var(--i));
}

/* =========================
   INPUT STATES
========================= */

.input-error {
  border-color: var(--accent-red);
}

.error-text {
  font-size: 0.8rem;
  color: var(--accent-red);
}

/* =========================
   BUTTON
========================= */

.submit-btn {
  position: relative;
  overflow: hidden;
  margin-top: 0.5rem;
  padding: 0.9rem 1.5rem;
  border: none;
  border-radius: 999px;
  background: var(--accent-red);
  color: var(--white);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(127, 29, 29, 0.4);
}

/* =========================
   BUTTON LOADING STATE
========================= */

.btn-text {
  display: inline-block;
  transition: opacity 0.2s ease;
}

.btn-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  margin-left: -9px;
  border: 2px solid transparent;
  border-top: 2px solid var(--white);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.8);
  animation: spin 0.8s linear infinite;
}

.submit-btn.loading .btn-text {
  opacity: 0;
}

.submit-btn.loading .btn-spinner {
  opacity: 1;
  transform: scale(1);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

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

/* =========================
   SUCCESS STATE
========================= */

.form-success-state {
  position: absolute;
  inset: 0;
  background: var(--gray-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  text-align: center;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: all 0.4s ease;
}

.form-success-state.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.contact-form.success .form-fields {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

/* =========================
   HONEYPOT
========================= */

.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

/* =========================
   REVIEWS
========================= */

.reviews-section {
  background: var(--page-bg);
  width: 100%;
  max-width: 1400px;
  margin: 4rem auto 0;
  padding: 0 1rem;
  box-sizing: border-box;
}

.reviews-section h2 {
  color: var(--white);
  text-align: center;
  margin-bottom: 2rem;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {

  .contact {
    min-height: 600px;
    padding: 1rem;
  }

  .contact-card {
    height: 400px;
  }

  .contact-front,
  .contact-back {
    position: absolute;
    inset: 0;
    height: auto;
    padding: var(--space-md);
    transition: opacity 0.4s ease;
  }

  .contact-front {
    z-index: 2;
    opacity: 1;
    pointer-events: auto;
    gap: 0.5rem;
  }

  .contact-front h2 {
    font-size: 1.2rem;
    line-height: 1;
  }

  .contact-front p {
    font-size: 0.9rem;
    line-height: 1;
    margin: 0.3rem 0;
  }

  .socials {
    margin: 0.5rem 0;
    gap: 0.75rem;
  }

  .socials a {
    width: 34px;
    height: 34px;
  }

  .contact-back {
    z-index: 1;
    opacity: 0;
    pointer-events: none;
  }

  .contact-card.flipped .contact-front {
    opacity: 0;
    pointer-events: none;
  }

  .contact-card.flipped .contact-back {
    opacity: 1;
    pointer-events: auto;
  }

  .review-card {
    flex: 0 0 85%;
  }
}
