/* ============================================================
   Contact Section
   ============================================================ */

.contact {
  background-color: var(--color-bg);
  background-image: url("../../assets/img/01_Background/Design Size Relation@3x/06_Contact.png");
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  min-height: 900px;
}

.contact__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 9rem 7.5rem 0;
  display: flex;
  flex-direction: row;
  gap: clamp(2rem, 25.6vw - 12.4rem, 10rem);
  align-items: flex-start;
}

/* ── Left column ────────────────────────────────────────── */

.contact__left {
  flex: 0 1 560px;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.contact__label {
  font-family: var(--font-base);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin: 0 0 1rem;
}

.contact__heading {
  font-family: var(--font-base);
  font-size: var(--font-size-section-heading);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--color-text-light);
  margin: 0 0 2rem;
}

.contact__desc {
  font-family: var(--font-base);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  max-width: 34rem;
  text-align: justify;
}

@keyframes contact-decoration-sweep {
  0%   { clip-path: inset(0 100% 0 0); }
  10%  { clip-path: inset(0 0%   0 0); }
  70%  { clip-path: inset(0 0%   0 0); }
  80%  { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 100% 0 0); }
}

.contact__decoration {
  display: block;
  width: 280px;
  height: 44px;
  object-fit: contain;
  margin-top: 3rem;
  pointer-events: none;
  align-self: flex-end;
  animation: contact-decoration-sweep 5s ease-out infinite;
  animation-delay: 3000ms;
}

/* ── Right column ───────────────────────────────────────── */

.contact__right {
  flex: 0 1 480px;
  position: relative;
  padding-top: 9rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.contact__badge {
  position: absolute;
  top: clamp(-2rem, 12.3vw - 8.9rem, 0rem);
  right: clamp(-2rem, 12.3vw - 9.9rem, 0rem);
  width: 168px;
  height: 166px;
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
}

.contact__decoration-mobile {
  display: none;
}

/* ── Form ───────────────────────────────────────────────── */

.contact__form {
  display: flex;
  flex-direction: column;
}

.form__group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}


.form__group label {
  font-family: var(--font-base);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text-light);
  margin-bottom: 0.5rem;
  padding-left: 1rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.form__group:not(.form__group--checkbox):hover label,
.form__group:not(.form__group--checkbox):focus-within label {
  color: rgba(248, 122, 85, 1);
}

.form__group input:not(.form__checkbox),
.form__group textarea,
.form__field .form__error--overlay,
.form__field-sizer {
  font-family: var(--font-base);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  padding: 0 0 1rem 1rem;
}

.form__group input:not(.form__checkbox),
.form__group textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-yellow);
  border-radius: 0;
  color: var(--color-text-light);
  -webkit-text-fill-color: var(--color-text-light);
  outline: none;
  resize: none;
}

/* The contact section's background is a textured image, not a flat color, so
   a solid inset box-shadow (the usual autofill-background-override trick)
   would itself show up as a visible rectangle. Using a transparent inset
   shadow together with a near-infinite background-color transition instead
   suppresses Chrome/WebKit's native autofill paint entirely, leaving the
   input's own transparent background (and the image behind it) untouched. */
.form__group input:-webkit-autofill,
.form__group input:-webkit-autofill:hover,
.form__group input:-webkit-autofill:focus,
.form__group textarea:-webkit-autofill,
.form__group textarea:-webkit-autofill:hover,
.form__group textarea:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px transparent inset;
  box-shadow: 0 0 0 1000px transparent inset;
  -webkit-text-fill-color: var(--color-text-light);
  caret-color: var(--color-text-light);
  transition: background-color 600000s ease-in-out 0s;
}

.form__group input:not(.form__checkbox)::placeholder,
.form__group textarea::placeholder {
  font-family: var(--font-base);
  font-weight: 400;
  font-size: 1.125rem;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--color-text-muted);
  -webkit-text-fill-color: var(--color-text-muted);
}

/* While a field is in error state, its typed value/placeholder is hidden
   (not cleared) so .form__error--overlay can show the message in its place;
   the real value stays in the DOM and reappears once the error clears. */
.form__group input.input--error:not(.form__checkbox),
.form__group textarea.input--error {
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
}

.form__group input.input--error::placeholder,
.form__group textarea.input--error::placeholder {
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* input/textarea, their error overlay, and (for the textarea) an invisible
   sizing mirror all share one grid cell: the row's height is driven by
   whichever is taller, so wrapped content or a wrapped error message grows
   the field (and pushes its underline down) instead of being clipped or
   overlapping the next field. */
.form__field {
  display: grid;
}

.form__field input:not(.form__checkbox),
.form__field textarea,
.form__field .form__error--overlay,
.form__field-sizer {
  grid-area: 1 / 1;
  min-width: 0;
}

.form__error--overlay {
  color: var(--color-error);
  pointer-events: none;
}

/* Mirrors the textarea's own current text (typed value, or placeholder when
   empty) so the field's height always tracks its real single-/multi-line
   content, in every state — not just while an error is showing. Invisible;
   exists purely to size the shared grid row. */
.form__field-sizer {
  color: transparent;
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.form__group:hover input:not(.form__checkbox),
.form__group:hover textarea,
.form__group input:not(.form__checkbox):focus,
.form__group textarea:focus {
  border-bottom-color: var(--color-blue);
}

.form__group:has(+ .form__group:hover) input:not(.form__checkbox),
.form__group:has(+ .form__group:hover) textarea,
.form__group:has(+ .form__group:focus-within) input:not(.form__checkbox),
.form__group:has(+ .form__group:focus-within) textarea {
  border-bottom-color: var(--color-blue);
}

.form__group:first-child {
  position: relative;
}

.form__group:first-child::before {
  content: '';
  position: absolute;
  top: -1rem;
  left: 0;
  right: 0;
  height: 1px;
  background: transparent;
}

.form__group:first-child:hover::before,
.form__group:first-child:focus-within::before {
  background: var(--color-blue);
}

/* Reserved space prevents layout shift */
.form__error {
  display: block;
  min-height: 1.25rem;
  font-size: var(--font-size-sm);
  color: var(--color-error);
  /* margin-top: 0.25rem; */
}

.form__group--checkbox {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0;
  overflow: visible;
}

.form__group--checkbox .form__error {
  flex-basis: 100%;
  font-size: 14px;
  line-height: 1.2;
  color: rgba(248, 122, 85, 1);
}

.form__checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.form__group--checkbox label {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text-light);
  padding-left: 0;
  margin: 0;
  cursor: default;
  overflow: visible;
 margin-top: 1rem;
}

.form__group--checkbox label a {
  color: rgba(51, 85, 255, 1);
  text-decoration: underline;
  cursor: pointer;
}

.form__group--checkbox label a:hover,
.form__group--checkbox label a:focus-visible {
  color: var(--color-yellow);
}

.form__checkbox-visual {
  position: relative;
  z-index: 0;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  margin-top: 3px;
  border: 2px solid rgba(51, 85, 255, 1);
  border-radius: 2px;
  background: var(--color-bg-dark);
}

.form__checkbox:checked ~ label .form__checkbox-visual::after {
  content: "";
  position: absolute;
  top: -8px;
  right: -3px;
  bottom: -2px;
  left: -3px;
  background-image: url("../../assets/img/00_Hand-drawn lines/00_Header/Color option 1/Check.png");
  background-size: 85%;
  background-repeat: no-repeat;
  background-position: calc(50% + 1px) calc(50% + 2px);
  z-index: 1;
}

.form__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  align-self: flex-end;
  margin-top: 16px;
}

.form__submit {
  min-width: 140px;
  height: 38px;
  padding: 0 24px;
  border: none;
  box-shadow:
    inset 0 0 0 1px var(--color-off-white),
    3px 3.5px 0 0 var(--color-off-white);
  font-family: var(--font-base);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text-light);
  transition: transform 90ms ease-in;
}

.form__submit::after {
  z-index: -1;
}

.form__submit:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  /* Lets the wrapper receive the click/keyboard-activation attempt instead
     of it being silently swallowed by the native disabled button. */
  pointer-events: none;
}

.form__submit-wrap {
  display: inline-flex;
  outline: none;
}

.form__submit-wrap:has(.form__submit:disabled) {
  cursor: not-allowed;
}

.form__submit:not(:disabled):hover {
  box-shadow: none;
}

.form__submit:not(:disabled):hover::after {
  box-shadow: inset 0 0 0 1.5px var(--color-off-white);
}

.form__feedback {
  min-height: 1.75rem;
  font-size: var(--font-size-sm);
  color: var(--color-success);
  margin-top: 1.5rem;
  text-align: right;
}

.form__feedback--success {
  font-size: 18px;
  font-weight: 600;
  color: #4ade80;
  transition: opacity 0.4s ease;
}

.form__feedback--success.form__feedback--hidden {
  opacity: 0;
}

.form__feedback--error {
  font-weight: 600;
  color: var(--color-error);
}

/* ── Responsive (≤ 900px) ─────────────────────────────────── */

@media (max-width: 900px) {
  .contact {
    min-height: auto;
  }

  .contact__inner {
    position: relative;
    flex-direction: column;
    padding: 4rem 1rem 0;
    gap: 2rem;
  }

  .contact__left {
    flex: none;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .contact__right {
    position: static;
    flex: none;
    width: 100%;
    padding-top: 0;
  }

  .contact__badge {
    position: absolute;
    top: 87px;
    right: 1rem;
    width: 120px;
    height: 120px;
  }

  .contact__label {
    font-size: var(--font-size-18px);
    margin-top: 143px;
  }

  .contact__heading {
    font-size: 3rem;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .contact__desc {
    max-width: none;
    overflow-wrap: break-word;
  }

  .contact__decoration {
    display: none;
  }

  .contact__decoration-mobile {
    display: block;
    width: 152.97px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
    pointer-events: none;
    animation: contact-decoration-sweep 5s ease-out infinite;
    animation-delay: 3000ms;
  }

  .form__actions {
    align-self: stretch;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .form__submit {
    margin-left: auto;
  }

  .form__privacy-break {
    display: none;
  }

  .form__group--checkbox label {
    font-size: 14px;
    gap: 8px;
  }

  .form__feedback {
    margin-bottom: 1.5rem;
  }
}

/* ── Narrow phones only (≤ 370px) ──────────────────────────── */

@media (max-width: 370px) {
  .form__group textarea::placeholder {
    font-size: 1rem;
    line-height: 1.35;
  }

  .form__group--checkbox label {
    font-size: 15px;
    gap: 6px;
  }
}

/* Re-enable text selection for meaningful copy (label/heading/description),
   overriding the global user-select: none from base.css. Form fields, the
   submit button and footer nav stay non-selectable/interactive. */
.contact__label,
.contact__heading,
.contact__desc {
  user-select: text;
  -webkit-user-select: text;
}
