/* ===============================
   Great Tales – Contact Section
   =============================== */

.contact-section {
  position: relative;
  background: linear-gradient(to bottom right, var(--color-bg-light, #f6f5f3), var(--color-bg-medium, #ebe8e5));
  padding: 40px 0 120px;
  color: var(--color-primary, #1c1208);
  overflow: visible;
}

.contact-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100% - 3rem, var(--container-max, 1100px));
  margin-inline: auto;
  gap: 10px;
  flex-wrap: wrap;
}

/* Left: Image */
.contact-image {
  flex: 1 1 45%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
}

.contact-image img {
  width: 100%;
  max-width: 580px;
  border-radius: var(--radius-lg, 20px);
  object-fit: cover;
  box-shadow: none;
  background: transparent;
  transition: transform 0.5s ease, filter 0.5s ease;
}

.contact-image {
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.contact-image img:hover {
  transform: scale(1.03);
  filter: brightness(1.1);
}

/* Right: Form */
.contact-form-wrapper {
  flex: 1 1 45%;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl, 24px);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: var(--shadow-xl, 0 20px 50px rgba(0, 0, 0, 0.12));
  padding: 28px 42px 48px;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.contact-form-wrapper h2 {
  font-family: "Grift", serif;
  font-size: clamp(2.24rem, 3.13vw, 3.13rem);
  margin-bottom: 0.4rem;
  font-weight: 900;
  color: var(--color-primary, #1c1208);
  text-align: left;
  letter-spacing: -0.02em;
}

.contact-subtext {
  font-family: "Grift", serif;
  font-weight: 500;
  color: #3b2f18;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  line-height: 1.7;
  opacity: 0.85;
}

/* Form Fields */
.contact-form {
  width: 100%;
  box-sizing: border-box;
  padding: 18px 22px;
}
.contact-form .form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.2rem;
}

.contact-form label {
  font-family: "Grift", serif;
  font-weight: 600;
  color: var(--color-text-dark, #2e1d08);
  margin-bottom: 0.3rem;
}

.contact-form input,
.contact-form textarea {
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-sm, 12px);
  padding: 1rem 1.2rem;
  font-size: 1.05rem;
  font-family: "Grift", serif;
  color: var(--color-primary, #1c1208);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(241, 120, 36, 0.25);
  background: #fff;
}

/* Button */
.contact-form button {
  margin-top: 1.6rem;
  background: linear-gradient(145deg, var(--color-accent, #f17824), var(--color-accent-hover, #ff9845));
  color: #fff;
  border: none;
  border-radius: var(--radius-pill, 50px);
  padding: 1rem 2.2rem;
  font-family: "Grift", serif;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md, 0 10px 30px rgba(241, 120, 36, 0.35));
}
.contact-form button:hover {
  filter: brightness(1.05);
  transform: translateY(-3px);
}

/* ===============================
   Responsiveness
   =============================== */
@media (max-width: 1024px) {
  .contact-container {
    flex-direction: column;
    gap: 50px;
  }

  .contact-image,
  .contact-form-wrapper {
    flex: 1 1 100%;
    max-width: 700px;
  }

  .contact-form-wrapper {
    padding: 32px 28px;
  }

  .contact-form-wrapper h2 {
    text-align: center;
  }

  .contact-subtext {
    text-align: center;
  }
}

@media (max-width: 760px) {
  .contact-section {
    padding: 30px 0 50px;
  }

  .contact-form-wrapper h2 {
    font-size: 3.2rem;
    line-height: 1.1;
  }

  /* FIX: Reduced padding significantly on mobile */
  .contact-form-wrapper {
    margin-left: 0;
    margin-right: 0;
    padding: 20px 16px 24px; /* Was: 42px 48px - reduced by ~60% */
  }

  .contact-image img {
    max-width: 100%;
  }

  .contact-form {
    padding: 12px 8px; /* Reduced inner padding too */
  }

  .contact-form input,
  .contact-form textarea {
    font-size: 0.95rem;
    padding: 0.85rem 1rem; /* Slightly smaller input padding */
  }
}

@media (max-width: 480px) {
  .contact-form-wrapper {
    padding: 16px 12px 20px; /* Even tighter on very small screens */
  }

  .contact-form {
    padding: 8px 4px;
  }

  .contact-form button {
    width: 100%;
    text-align: center;
  }

  .contact-form input,
  .contact-form textarea {
    font-size: 0.9rem;
  }
}

/* ===============================
   Flip Animation for Contact Card
   =============================== */
/* Flip container: consistent dynamic height, no collapse */
.contact-flip {
  perspective: 1600px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  min-height: 520px;
  position: relative;
  transition: height 0.3s ease;
}
.contact-face {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xl, 24px);
  box-shadow: var(--shadow-md, 0 10px 36px rgba(60, 60, 60, 0.10)), 0 1.5px 7px rgba(0,0,0,0.05);
  background: linear-gradient(120deg, #f7f6f4 80%, #ece9e6 100%);
  position: absolute;
  top: 0; left: 0;
  backface-visibility: hidden;
  transition: box-shadow 0.35s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.contact-front {
  z-index: 2;
}
.contact-back {
  transform: rotateY(180deg);
  background: linear-gradient(120deg, #edeae7 80%, #f6f5f3 100%);
  color: var(--color-text-dark, #2e1d08);
  z-index: 1;
}
.contact-flip {
  transition: box-shadow 0.3s cubic-bezier(.4,0,.2,1), height 0.3s ease;
}
.contact-flip.flipped .contact-front {
  transform: rotateY(180deg);
  box-shadow: var(--shadow-sm, 0 10px 36px rgba(60, 60, 60, 0.07));
}
.contact-flip.flipped .contact-back {
  transform: rotateY(0deg);
  box-shadow: var(--shadow-md, 0 14px 48px rgba(60, 60, 60, 0.13));
}
.contact-front,
.contact-back {
  transition: transform 0.4s cubic-bezier(.4,0,.2,1), box-shadow 0.35s cubic-bezier(.4,0,.2,1);
}

/* ===============================
   Flip Animation Overflow Fix
   =============================== */

.contact-face,
.contact-back {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
}

/* Measurement helper: temporarily neutralize transforms for accurate height calc */
.contact-flip.__measure .contact-front,
.contact-flip.__measure .contact-back {
  transform: none !important;
  position: static !important;
}

/* Flip Back – Improved Styling */
.contact-back {
  background: linear-gradient(135deg, #fffdfb 0%, #f6f4f1 100%);
  padding: 2.5rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.contact-back h3 {
  font-family: "Grift", serif;
  font-weight: 900;
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  margin-bottom: 1rem;
  color: var(--color-primary, #1c1208);
  letter-spacing: -0.02em;
}

.contact-back p {
  font-family: "Grift", serif;
  font-size: 1.1rem;
  line-height: 1.6;
  color: #3b2f18;
  margin: 0 0 1.8rem;
  max-width: 360px;
}

.contact-back .button {
  background: linear-gradient(145deg, var(--color-accent, #f17824), var(--color-accent-hover, #ff9845));
  border-radius: var(--radius-pill, 50px);
  padding: 0.9rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-md, 0 10px 28px rgba(241, 120, 36, 0.3));
  transition: transform 0.25s ease, filter 0.25s ease;
}
.contact-back .button:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
}