/* ====== CONTACT OVERLAY ====== */

/* --- Overlay container --- */

#contact-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1100;
  pointer-events: none;
  overflow: hidden;
}

#contact-overlay.is-open {
  pointer-events: auto;
}

/* --- Yellow expanding background --- */

.contact-overlay__bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-yellow);
  clip-path: inset(50% 50% 50% 50% round 50px);
}

/* Success-pulse animation — fires when a contact submission is accepted.
   The bg flashes from yellow → Diffusion brand green → back to yellow,
   feeling like a quick confirmation without being disruptive. Uses the
   brand green #86A624 so the pulse feels on-palette with the rest of
   the site rather than reading as a generic success state.

   Timing breakdown (total 800ms):
     0–200ms : ramp up to green
     200–350ms : hold at green (150ms)
     350–800ms : ease back to yellow */
@keyframes contact-success-pulse {
  0%   { background-color: var(--color-yellow); }
  25%  { background-color: #86A624; }
  44%  { background-color: #86A624; }
  100% { background-color: var(--color-yellow); }
}

.contact-overlay__bg.is-success-pulse {
  animation: contact-success-pulse 800ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Close button --- */

.contact-overlay__close {
  position: absolute;
  top: clamp(1.5rem, 3vw, 2.5rem);
  right: clamp(1.5rem, 3vw, 2.5rem);
  z-index: 2;
  background: none;
  border: none;
  color: var(--color-black);
  cursor: pointer;
  padding: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease 0.5s;
}

#contact-overlay.is-open .contact-overlay__close {
  opacity: 1;
}

#contact-overlay.is-closing .contact-overlay__close {
  opacity: 0;
  transition-delay: 0s;
}

.contact-overlay__close svg {
  display: block;
  width: clamp(1.5rem, 2.5vw, 2rem);
  height: clamp(1.5rem, 2.5vw, 2rem);
}

/* --- Content container (fades in after expand) --- */

.contact-overlay__content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.35s ease;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

#contact-overlay.is-open .contact-overlay__content {
  opacity: 1;
  transition-delay: 0.45s;
}

#contact-overlay.is-closing .contact-overlay__content {
  opacity: 0;
  transition-delay: 0s;
}

/* --- Two-column inner layout --- */

.contact-overlay__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(3rem, 6vw, 8rem);
  max-width: var(--site-max-width);
  width: 100%;
  padding: clamp(4rem, 6vw, 6rem) var(--site-gutter);
  align-items: stretch;
}

/* --- Left column: heading top, body text bottom --- */

.contact-overlay__left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 0.5em;
}

.contact-overlay__heading {
  font-family: var(--font-display);
  font-size: clamp(3rem, 5vw, 5.5rem);
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
  color: var(--color-black);
  margin: 0;
}

.contact-overlay__body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-black);
  opacity: 0.7;
  max-width: 36ch;
  margin-top: auto;
}

/* --- Right column: form + focus dot --- */

.contact-overlay__right {
  position: relative;
  /* Enough room for the dot to sit clear of the text (dot is ~1.8rem wide at ~4rem font) */
  padding-left: clamp(2.8rem, 4.5vw, 4rem);
}

/* Dot: sized relative to the field font-size, vertically centered on label */
.contact-overlay__dot {
  position: absolute;
  left: 0.15em;
  top: 0;
  width: 0.38em;
  height: 0.38em;
  border-radius: 50%;
  background: var(--color-white);
  pointer-events: none;
  font-size: clamp(2.6rem, 4vw, 4.4rem);
  opacity: 0;
  transition: top 0.35s cubic-bezier(0.4, 1.4, 0.6, 1),
              opacity 0.2s ease;
}

#contact-overlay.is-open .contact-overlay__dot {
  opacity: 1;
  transition-delay: 0.6s, 0.6s;
}

/* --- Form --- */

.contact-form {
  width: 100%;
}

.contact-form__field {
  position: relative;
  font-size: clamp(2.6rem, 4vw, 4.4rem);
  padding: 0.15em 0;
}

.contact-form__label {
  display: block;
  font-family: var(--font-display);
  font-size: 1em;
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  color: var(--color-black);
  cursor: text;
  transform-origin: left top;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease;
}

/* Active: label scales down via transform (no reflow) */
.contact-form__field.is-active .contact-form__label {
  transform: scale(0.28);
  opacity: 0.5;
}

/* Input: absolutely positioned over the label area */
.contact-form__input {
  display: block;
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 3.2rem);
  font-weight: var(--font-weight-bold);
  line-height: 1.3;
  color: var(--color-black);
  padding: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  left: 0;
  top: 0.35em;
  transition: opacity 0.25s ease;
}

.contact-form__field.is-active .contact-form__input {
  opacity: 1;
  pointer-events: auto;
}

/* Message field: pull textarea up so it sits just below the shrunken label */
.contact-form__field[data-field="message"].is-active .contact-form__label {
  margin-bottom: -0.85em;
}

/* Message textarea: in normal flow, top-aligned, auto-grows */
.contact-form__textarea {
  position: static;
  resize: none;
  overflow-y: hidden;
  min-height: 1.4em;
  font-size: clamp(1.05rem, 1.75vw, 1.7rem);
  line-height: 1.45;
  margin-top: 0.15em;
}

/* Rules between fields */
.contact-form__rule {
  border: none;
  border-top: 2px solid var(--color-black);
  margin: 0;
}

/* --- Send button --- */

.contact-form__actions {
  padding-top: 1.5em;
}

.contact-form__submit {
  display: inline-flex;
  align-items: center;
  gap: 2em;
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.5vw, 1.3rem);
  font-weight: var(--font-weight-bold);
  padding: 0.7em 1.8em;
  background-color: var(--color-white);
  color: var(--color-black);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transform-origin: left center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-form__submit:hover {
  transform: scale(1.06);
}

.contact-form__submit:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.contact-form__arrow {
  display: flex;
  align-items: center;
}

.contact-form__arrow svg {
  width: 1.6em;
  height: 1.6em;
  stroke: currentColor;
  fill: none;
}

/* --- Newsletter opt-in fine print (below submit) --- */

.contact-form__opt-in {
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
  margin-top: 1.25em;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-black);
  opacity: 0.7;
  cursor: pointer;
  max-width: 32rem;
}

.contact-form__opt-in:hover {
  opacity: 0.9;
}

.contact-form__opt-in input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0.15em 0 0 0;
  accent-color: var(--color-black);
  flex-shrink: 0;
  cursor: pointer;
}

/* Honeypot — hidden from real users, invisible to AT but visible to bots */

.contact-form__honeypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- Status messages --- */

.contact-form__status {
  padding-top: 1em;
}

.contact-form__success,
.contact-form__error {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  font-weight: 500;
  line-height: 1.5;
}

.contact-form__success {
  color: var(--color-black);
}

.contact-form__error {
  color: var(--contact-error-text);
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  .contact-overlay__bg {
    transition-duration: 0.01s !important;
  }
  .contact-overlay__content {
    transition-duration: 0.01s !important;
    transition-delay: 0s !important;
  }
  .contact-overlay__close {
    transition-duration: 0.01s !important;
    transition-delay: 0s !important;
  }
  .contact-overlay__dot {
    transition-duration: 0.01s !important;
  }
  .contact-form__label,
  .contact-form__input {
    transition-duration: 0.01s !important;
  }
}

/* --- Mobile --- */

@media (max-width: 768px) {

  .contact-overlay__inner {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding: clamp(3.5rem, 8vw, 5rem) var(--site-gutter) var(--space-xl);
    align-items: start;
  }

  /* Align heading + body text with the form (same left indent as dot padding) */
  .contact-overlay__left {
    padding-left: clamp(2rem, 5vw, 2.8rem);
    padding-top: 0;
    gap: 0.8em;
  }

  .contact-overlay__heading {
    font-size: clamp(2.2rem, 8vw, 3.5rem);
    margin-bottom: 0;
  }

  .contact-overlay__body {
    margin-top: 0;
  }

  .contact-overlay__right {
    padding-left: clamp(2rem, 5vw, 2.8rem);
  }

  .contact-form__field {
    font-size: clamp(1.8rem, 6vw, 2.4rem);
  }

  .contact-form__input {
    font-size: clamp(1.4rem, 5vw, 2rem);
  }

  .contact-form__textarea {
    font-size: clamp(0.9rem, 3vw, 1.15rem);
    line-height: 1.45;
  }

  .contact-overlay__dot {
    font-size: clamp(1.8rem, 6vw, 2.4rem);
    left: 0.1em;
  }

  .contact-overlay__close {
    top: 1rem;
    right: 1rem;
  }
}
