/* ==========================================================================
   Enquiry (after spinta.co.uk)
   "Work with us" opens a full-screen "Start your project" form. It grows out
   of the button as a circle from where it was pressed, the form rises in as
   the circle fills the screen, and the X shrinks it back into the button
   (enquiry.js). The page holds still underneath; the form scrolls itself.
   ========================================================================== */

.enquiry {
  position: fixed;
  inset: 0;
  z-index: var(--z-enquiry);
  overflow-y: auto;
  overscroll-behavior: contain; /* its scroll never runs on into the page */
  background: var(--bone);
  visibility: hidden;
  clip-path: circle(0 at 100% 0);
  /* The page's scrollbar stays (hiding it shifts the layout), so the form's
     own bar is hidden rather than drawn beside it. */
  scrollbar-width: none;
}

.enquiry::-webkit-scrollbar {
  display: none;
}

/* Without the script (or if it failed), the #enquiry link opens it plainly
   and the X, a link to #top, closes it. */
.no-js .enquiry:target,
.intro-failed .enquiry:target {
  visibility: visible;
  clip-path: none;
}

/* ------------------------------------------------------------------ bar */

/* Mirrors the site header: the logo lands on the page's logo, and the X
   sits where the menu button is. */
.enquiry__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 var(--gutter);
}

.enquiry__logo {
  width: clamp(120px, 8vw, 146px);
  height: auto;
}

.enquiry__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  margin-right: -14px; /* centred on the menu button behind it */
  border-radius: 50%;
  color: var(--white);
  background: var(--ink);
  transition:
    background-color 300ms ease,
    scale 240ms var(--ease-out);
}

.enquiry__close svg {
  width: 16px;
  height: 16px;
}

.enquiry__close:active {
  scale: 0.92;
}

/* ------------------------------------------------------------------ form */

.enquiry__form {
  display: grid;
  padding: clamp(20px, calc(100vh * 0.045), 48px) var(--gutter) clamp(48px, calc(100vh * 0.09), 96px);
}

/* Sent: the thank-you takes its place (display: grid would keep it showing). */
.enquiry__form[hidden] {
  display: none;
}

.enquiry__title {
  font-size: clamp(2.25rem, 2.9vw, 3.5rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.enquiry__label {
  display: block;
  padding: 0;
  letter-spacing: 0.12em;
  color: var(--text-mute);
}

.enquiry__needs {
  min-width: 0;
  margin: clamp(32px, calc(100vh * 0.05), 52px) 0 0;
  padding: 0;
  border: 0;
}

.enquiry__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

/* A checkbox under each pill: the whole pill takes the click and the focus. */
.enquiry__chip {
  position: relative;
  display: inline-flex;
}

.enquiry__chip input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.enquiry__chip span {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border: 1px solid rgb(17 17 17 / 0.2);
  border-radius: 999px;
  font-size: 0.9375rem;
  white-space: nowrap;
  transition:
    background-color 250ms ease,
    border-color 250ms ease,
    color 250ms ease;
}

.enquiry__chip input:checked + span {
  color: var(--white);
  background: var(--ink);
  border-color: var(--ink);
}

.enquiry__chip input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.enquiry__field {
  display: grid;
  gap: 8px;
  margin-top: clamp(26px, calc(100vh * 0.04), 38px);
}

.enquiry__input {
  width: 100%;
  height: 48px;
  padding: 0;
  font: inherit;
  font-size: 1.0625rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgb(17 17 17 / 0.2);
  border-radius: 0;
  transition:
    border-color 250ms ease,
    box-shadow 250ms ease;
}

.enquiry__input::placeholder {
  color: var(--text-faint);
}

/* The underline darkens and thickens instead of a ring. */
.enquiry__input:focus {
  outline: none;
  border-bottom-color: var(--ink);
  box-shadow: 0 1px 0 var(--ink);
}

.enquiry__input:user-invalid {
  border-bottom-color: #b42318;
  box-shadow: 0 1px 0 #b42318;
}

.enquiry__input--area {
  height: auto;
  min-height: 7em;
  padding-top: 10px;
  line-height: 1.5;
  resize: vertical;
}

.enquiry__send {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  margin-top: clamp(30px, calc(100vh * 0.05), 48px);
  font-size: 1rem;
  font-weight: 500;
  color: var(--white);
  background: var(--ink);
  border-radius: 999px;
  transition:
    background-color 300ms ease,
    scale 240ms var(--ease-out);
}

.enquiry__send svg {
  width: 16px;
  height: 16px;
  transition: translate 420ms var(--ease-out);
}

.enquiry__send:active {
  scale: 0.985;
}

/* Sending: the arrow keeps setting off until the answer comes back. */
.enquiry__send[aria-busy="true"] {
  cursor: progress;
}

.enquiry__send[aria-busy="true"] svg {
  animation: enquiry-nudge 900ms var(--ease-out) infinite;
}

@keyframes enquiry-nudge {
  0% {
    opacity: 1;
    translate: 0 0;
  }
  55% {
    opacity: 0;
    translate: 8px 0;
  }
  56% {
    opacity: 0;
    translate: -8px 0;
  }
  100% {
    opacity: 1;
    translate: 0 0;
  }
}

/* Why it didn't send, under the button (empty, and gone, until then). */
.enquiry__status {
  margin-top: 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #b42318;
  text-wrap: pretty;
}

.enquiry__status:empty {
  display: none;
}

.enquiry__status a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.enquiry__note {
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--text-faint);
  text-align: center;
}

.enquiry__note a {
  color: var(--text-mute);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.enquiry__input[aria-invalid="true"] {
  border-bottom-color: #b42318;
  box-shadow: 0 1px 0 #b42318;
}

/* ------------------------------------------------------------------ sent */

/* In the form's place once it's sent: a tick that draws itself, thanks by
   name, what happens next and the way back to the page. */
.enquiry__done {
  display: grid;
  justify-items: start;
  gap: 20px;
  padding: clamp(20px, calc(100vh * 0.045), 48px) var(--gutter) clamp(48px, calc(100vh * 0.09), 96px);
}

.enquiry__done[hidden] {
  display: none;
}

.enquiry__done:focus {
  outline: none;
}

.enquiry__done-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.12em;
}

.enquiry__tick {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--white);
  background: var(--ink);
}

.enquiry__tick svg {
  width: 14px;
  height: 14px;
}

.enquiry__tick path {
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
}

.enquiry__done.is-shown .enquiry__tick path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 600ms var(--ease-out) 250ms;
}

.enquiry__done-text {
  max-width: 34ch;
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.75rem);
  line-height: 1.35;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

.enquiry__done-text--small {
  max-width: 48ch;
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--text-mute);
}

.enquiry__done-text a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.enquiry__send--back {
  width: auto;
  margin-top: 12px;
  padding: 0 32px;
}

.enquiry__done.is-shown > * {
  animation: enquiry-rise 800ms var(--ease-out) both;
}

.enquiry__done.is-shown > :nth-child(2) {
  animation-delay: 80ms;
}

.enquiry__done.is-shown > :nth-child(3) {
  animation-delay: 160ms;
}

.enquiry__done.is-shown > :nth-child(4) {
  animation-delay: 240ms;
}

.enquiry__done.is-shown > :nth-child(5) {
  animation-delay: 320ms;
}

@keyframes enquiry-rise {
  from {
    opacity: 0;
    translate: 0 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .enquiry__send[aria-busy="true"] svg,
  .enquiry__done.is-shown > * {
    animation: none;
  }

  .enquiry__tick path {
    stroke-dashoffset: 0;
  }
}

@media (hover: hover) and (pointer: fine) {
  .enquiry__close:hover,
  .enquiry__send:hover {
    background: #262626;
  }

  .enquiry__chip:hover span {
    border-color: var(--ink);
  }

  .enquiry__send:hover svg {
    translate: 3px 0;
  }
}

@media (max-width: 719px) {
  .enquiry__close {
    width: 46px;
    height: 46px;
    margin-right: -11px;
  }

  .enquiry__chip span {
    height: 40px;
    padding: 0 14px;
    font-size: 0.875rem;
  }
}
