/* ==========================================================================
   Contact popover — Pencil › Final Design › Contact (txBEm)
   A 560px white panel inset 24px from the right edge, over the page dimmed
   to 60% black with a background blur. Markup comes from js/contact.js.
   ========================================================================== */

.contact {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  padding: 0;
  border: 0;
  background: none;
  overflow: hidden;
}
.contact::backdrop { background: transparent; }

/* dim + blur the page (design: #000 at 60%, background blur). The colour and blur
   themselves animate — fading an already-blurred layer flickers. */
.contact::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  transition: background-color 500ms ease, backdrop-filter 500ms ease, -webkit-backdrop-filter 500ms ease;
}
.contact.is-open::before {
  background: rgb(0 0 0 / 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition-duration: 700ms;
}

.contact__panel {
  position: absolute;
  top: var(--space-24);
  right: var(--space-24);
  bottom: var(--space-24);
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100% - 48px));
  padding: 56px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-white);
  color: var(--color-black);
  /* mask wipe, as on the projects and capabilities photos: the panel stays put and
     is revealed from its right edge leftwards; closing wipes back to the right */
  clip-path: inset(0 0 0 100%);
  transition: clip-path 500ms var(--ease-button);
}
.contact.is-open .contact__panel {
  clip-path: inset(0);
  transition: clip-path 750ms var(--ease-button) 80ms;
}

/* content rises in one item at a time once the wipe is mostly open (--i set in
   js/contact.js); on close it just fades with the panel, no stagger */
.contact__reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 250ms ease, transform 0s 250ms;
}
.contact.is-open .contact__reveal {
  opacity: 1;
  transform: none;
  transition: opacity 700ms ease, transform 1000ms var(--ease-out);
  transition-delay: calc(380ms + var(--i, 0) * 60ms);
}

.contact__close {
  position: absolute;
  top: var(--space-24);
  right: var(--space-24);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
}
.contact__close svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: transform var(--duration-base) var(--ease-out);
}
.contact__close:hover svg { transform: rotate(90deg); }

.contact__title {
  font-size: var(--fs-s1);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-tight);
}
.contact__intro {
  max-width: 324px;
  margin-top: 40px;
}

.contact__form {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-32);
  margin-top: 63px;
}
.contact__field input,
.contact__field textarea {
  display: block;
  width: 100%;
  padding: 0 0 12px;
  border: 0;
  border-bottom: var(--border-hairline);
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--text-body-1);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body-1);
  transition: border-color var(--duration-base) ease;
}
.contact__field textarea { height: 183px; resize: none; }
.contact__field ::placeholder { color: var(--color-black); opacity: 1; }
.contact__field :focus { outline: none; border-bottom-color: var(--color-black); }
.contact__field :focus::placeholder { color: var(--color-black-60); }
.was-submitted .contact__field :invalid { border-bottom-color: #c62828; }

/* the button drops to the bottom of the panel (72px under the message at 850px tall),
   keeping at least 72px (40 + the 32px gap) when the viewport is short */
.contact__field--message { margin-bottom: 40px; }
.contact__submit { flex: none; margin-top: auto; }
.contact__submit:disabled { opacity: 0.5; cursor: progress; }

.contact__status:empty { display: none; }
.contact__status { margin-top: calc(var(--space-16) * -1); color: var(--color-black-60); }

@media (prefers-reduced-motion: reduce) {
  .contact::before,
  .contact__panel,
  .contact__reveal { transition: none !important; }
  .contact__reveal { transform: none; }
}
