/* hdpf-modal.css — modal dialogs: the real site overlay modals (consult + phone)
 * plus the bounded gallery demos.
 *
 * Real modals: `.hdpf-modal` is a fixed overlay toggled by the `.is-open` class
 * (public/assets/js/modal.js). Closed modals stay out of the tab order via
 * visibility:hidden — no `hidden` attribute needed. The dialog chrome
 * (`.hdpf-modal__dialog/__head/__title`) is shared with the gallery demos.
 *
 * Gallery demos: `.hdpf-modal-demo` is a bounded "screen" that can expand to a
 * full-viewport preview. Stepping there is wired in gallery-mockups.js.
 */

/* ================================================================== *
 * Real site overlay modal
 * ================================================================== */

html.hdpf-modal-open {
  overflow: hidden;
}

.hdpf-modal {
  position: fixed;
  inset: 0;
  z-index: var(--hdpf-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--hdpf-space-5);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--hdpf-duration-normal) var(--hdpf-ease-standard),
    visibility 0s linear var(--hdpf-duration-normal);
}

.hdpf-modal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--hdpf-duration-normal) var(--hdpf-ease-standard);
}

.hdpf-modal .hdpf-modal__dialog {
  width: min(30rem, 100%);
  /* Shrink-wraps its content, growing only as tall as the fields need, and
   * caps at the viewport so a long form uses the available height before the
   * body scrolls (no fixed rem ceiling forcing early scroll). dvh tracks mobile
   * browser chrome; the vh line is the fallback. */
  max-height: 90vh;
  max-height: 90dvh;
  transform: translateY(0.75rem) scale(0.985);
  transition: transform var(--hdpf-duration-normal) var(--hdpf-ease-emphasized);
}

.hdpf-modal.is-open .hdpf-modal__dialog {
  transform: none;
}

.hdpf-modal--wide .hdpf-modal__dialog {
  width: min(41rem, 100%);
}

.hdpf-modal--compact .hdpf-modal__dialog {
  width: min(26rem, 100%);
}

/* Head close button nudges to the corner */
.hdpf-modal .hdpf-modal__head {
  align-items: center;
}

.hdpf-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--hdpf-space-5) var(--hdpf-space-6);
}

/* Intro line above the chooser cards in the chooser modal. */
.hdpf-modal__lede {
  margin: 0 0 var(--hdpf-space-4);
  font-size: var(--hdpf-fs-caption);
  color: var(--hdpf-ink-muted);
  line-height: var(--hdpf-lh-normal);
}

/* ---- Turnstile fits the modal on phones ---- *
 * The managed widget is a fixed ~300px box and the modal body clips overflow-x,
 * so on a narrow phone the default padding would shear its edges. Trim the modal
 * padding at phone widths so 300px fits natively (~360px up), then scale the box
 * down as a last-resort guard on anything narrower so it can never blow out.
 * (Base centering lives on `.cf-turnstile` in hdpf-form.css.) */
@container layout-root (max-width: 26rem) {
  .hdpf-modal { padding: var(--hdpf-space-3); }
  .hdpf-modal .hdpf-modal__body { padding-inline: var(--hdpf-space-4); }
}

/* The dialog is its own inline-size container; below ~328px of dialog width the
 * 300px box no longer fits the padded body, so shrink it to fit. */
@container (max-width: 20.5rem) {
  .hdpf-modal .cf-turnstile {
    transform: scale(0.82);
    transform-origin: center top;
  }
}

/* ================================================================== *
 * Phone modal card
 * ================================================================== */

.hdpf-phone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--hdpf-space-4);
  padding: var(--hdpf-space-7) var(--hdpf-space-6) var(--hdpf-space-6);
}

.hdpf-phone-card__number {
  display: inline-flex;
  align-items: center;
  gap: var(--hdpf-space-3);
  font-family: var(--hdpf-font-display);
  font-size: var(--hdpf-fs-display-3);
  font-weight: var(--hdpf-fw-extrabold);
  letter-spacing: var(--hdpf-tracking-tight);
  color: var(--hdpf-ink-strong);
  text-decoration: none;
}

.hdpf-phone-card__number .hdpf-icon {
  color: var(--hdpf-accent);
}

.hdpf-phone-card__number:hover {
  color: var(--hdpf-accent);
}

.hdpf-phone-card__actions {
  display: flex;
  gap: var(--hdpf-space-2);
}

.hdpf-phone-card__note {
  margin: 0;
  max-width: 22rem;
  font-size: var(--hdpf-fs-caption);
  color: var(--hdpf-ink-muted);
  line-height: var(--hdpf-lh-relaxed);
}

.hdpf-phone-card__meta {
  display: inline-flex;
  align-items: center;
  gap: var(--hdpf-space-2);
  margin: 0;
  font-size: var(--hdpf-fs-caption);
  color: var(--hdpf-ink-muted);
}

.hdpf-phone-card__meta .hdpf-icon {
  color: var(--hdpf-ink-faint);
  flex-shrink: 0;
}

.hdpf-phone-card__foot {
  width: 100%;
  margin-top: var(--hdpf-space-1);
  padding-top: var(--hdpf-space-4);
  border-top: 1px solid var(--hdpf-divider);
}

/* Inline text CTA (link variant of hdpf_consult_cta) */
.hdpf-inline-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--hdpf-space-2);
  font-weight: var(--hdpf-fw-semibold);
  color: var(--hdpf-accent);
  text-decoration: none;
}

.hdpf-inline-cta:hover {
  text-decoration: underline;
}

.hdpf-mockup {
  display: flex;
  flex-direction: column;
  gap: var(--hdpf-space-3);
}

.hdpf-mockup__label {
  font-family: var(--hdpf-font-mono);
  font-size: var(--hdpf-fs-micro);
  letter-spacing: var(--hdpf-tracking-wide);
  text-transform: uppercase;
  color: var(--hdpf-ink-faint);
}

/* Bounded screen the modal floats on */
.hdpf-modal-demo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 27rem;
  padding: var(--hdpf-space-5);
  border: 1px solid var(--hdpf-border);
  border-radius: var(--hdpf-radius-lg);
  overflow: hidden;
  background:
    linear-gradient(var(--hdpf-border) 1px, transparent 1px) 0 0 / 1.25rem 1.25rem,
    linear-gradient(90deg, var(--hdpf-border) 1px, transparent 1px) 0 0 / 1.25rem 1.25rem,
    var(--hdpf-page-soft);
}

/* Expanded → real full-viewport modal */
.hdpf-modal-demo.is-expanded {
  position: fixed;
  inset: 0;
  z-index: var(--hdpf-z-modal);
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: var(--hdpf-space-5);
}

.hdpf-modal__scrim {
  position: absolute;
  inset: 0;
  background: var(--hdpf-scrim);
  z-index: 1;
}

.hdpf-modal__dialog {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(29rem, 100%);
  max-height: 100%;
  background: var(--hdpf-surface);
  border: 1px solid var(--hdpf-border);
  border-radius: var(--hdpf-radius-xl);
  box-shadow: var(--hdpf-shadow-modal);
  overflow: hidden;
  container-type: inline-size;
}

.hdpf-modal-demo.is-expanded .hdpf-modal__dialog {
  width: min(32rem, 100%);
  max-height: min(90vh, 44rem);
}

.hdpf-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--hdpf-space-3);
  padding: var(--hdpf-space-4) var(--hdpf-space-5);
  border-bottom: 1px solid var(--hdpf-divider);
}

.hdpf-modal__title {
  margin: 0;
  font-family: var(--hdpf-font-display);
  font-size: var(--hdpf-fs-headline);
  font-weight: var(--hdpf-fw-extrabold);
  color: var(--hdpf-ink-strong);
  text-transform: capitalize;
}

.hdpf-modal__head-actions {
  display: flex;
  gap: var(--hdpf-space-1);
  flex-shrink: 0;
  margin: calc(var(--hdpf-space-1) * -1) calc(var(--hdpf-space-2) * -1) 0 0;
  color: var(--hdpf-ink-faint);
}

/* The multi-step form component (`.hdpf-stepform*`) is defined in
 * hdpf-stepform.css. The old mock rules that lived here (modal steps strip,
 * form-row, 2-col choice grid, done/footer panels) were removed when the real
 * arrow-bar component replaced the gallery mock. */
