/* Version 15: heading rhythm, accessible contact dialog and clear success state */
.hero-title,
.contact-title { line-height: .9; }

.display-title,
.section-title { line-height: .94; }

.problem-name,
.process-list h3 { line-height: 1; }

.contact-orbit {
  border: 0;
  cursor: pointer;
  font: inherit;
}

body.contact-modal-open { overflow: hidden; }
.contact-modal[hidden] { display: none; }

.contact-modal {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(.75rem, 3vw, 2rem);
}

.contact-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(16 16 16 / 78%);
  backdrop-filter: blur(8px);
}

.contact-dialog {
  --field-border: rgb(16 16 16 / 32%);
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: calc(100dvh - 1.5rem);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--accent, #f2e85c);
  color: var(--ink, #101010);
  padding: clamp(1.5rem, 4vw, 3.5rem);
  box-shadow: 0 2rem 6rem rgb(0 0 0 / 32%);
}

.contact-dialog h2 {
  max-width: 13ch;
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: clamp(2.35rem, 6vw, 5.25rem);
  font-weight: 400;
  letter-spacing: -.045em;
  line-height: .98;
}

.contact-dialog [data-contact-form-view] > p:not(.eyebrow),
.contact-success > p:not(.eyebrow) {
  max-width: 42rem;
  margin: 0 0 2rem;
}

.contact-dialog__close {
  position: sticky;
  z-index: 2;
  top: 0;
  float: right;
  display: grid;
  width: 3rem;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1;
}

.contact-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
}

.contact-form label:not(.contact-form__consent) {
  display: grid;
  gap: .45rem;
}

.contact-form label > span:first-child {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.contact-form input:not([type="checkbox"]),
.contact-form textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--field-border);
  border-radius: 0;
  outline: 0;
  background: rgb(255 255 255 / 32%);
  color: inherit;
  padding: .9rem .75rem;
  font: inherit;
}

.contact-form textarea { resize: vertical; }

.contact-form input:focus-visible,
.contact-form textarea:focus-visible,
.contact-dialog__close:focus-visible,
.contact-form__submit:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.contact-form__message { margin-top: 1.15rem; }

.contact-form__consent {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  align-items: start;
  gap: .75rem;
  margin: 1.35rem 0;
  font-size: .87rem;
  line-height: 1.45;
}

.contact-form__consent input {
  width: 1.2rem;
  height: 1.2rem;
  margin: .08rem 0 0;
  accent-color: var(--ink);
}

.contact-form__consent a {
  color: inherit;
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

.contact-form__submit {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: .95rem 1.2rem;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.contact-form__submit:disabled { cursor: wait; opacity: .65; }

.contact-form__status {
  min-height: 1.5em;
  margin: 0 0 .75rem;
  font-weight: 700;
}

.contact-form__status.is-error { color: #7a1010; }
.contact-form__required { display: inline; margin-left: .75rem; font-size: .75rem; }

.contact-success[hidden],
[data-contact-form-view][hidden] {
  display: none;
}

.contact-success {
  min-height: min(29rem, 70dvh);
  display: grid;
  align-content: center;
  justify-items: start;
  padding: clamp(1rem, 5vw, 3rem) 0;
}

.contact-success:focus {
  outline: 0;
}

.contact-success h2 {
  max-width: 12ch;
}

.contact-success > p:not(.eyebrow) {
  max-width: 34rem;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.55;
}

.contact-success__close {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: .95rem 1.2rem;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.contact-success__close:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.contact-form__trap {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .hero-title,
  .contact-title { line-height: .94; }

  .display-title,
  .section-title { line-height: .98; }

  .contact-modal { align-items: end; padding: 0; }

  .contact-dialog {
    width: 100%;
    max-height: 94dvh;
    padding: 1.35rem 1.1rem max(1.35rem, env(safe-area-inset-bottom));
  }

  .contact-dialog h2 { font-size: clamp(2.2rem, 12vw, 3.8rem); }
  .contact-form__grid { grid-template-columns: 1fr; gap: .85rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .contact-modal__backdrop { animation: contact-fade .22s ease-out both; }
  .contact-dialog { animation: contact-rise .38s cubic-bezier(.16, 1, .3, 1) both; }
}

@keyframes contact-fade { from { opacity: 0; } }
@keyframes contact-rise { from { opacity: 0; transform: translateY(2rem); } }
