/* ============================================================
   CONTACT POP-UP

   A native <dialog>, opened by the five triggers:
     CONTACT (header menu)            CONTACT (footer menu)
     REQUEST A CONSULTATION (hero)    REQUEST A CONSULTATION (closing CTA)
     ASK ABOUT THE CHRONON STANDARD

   It lives outside #stage-wrap, so the 1920px canvas's scale
   transform does not shrink it — the panel renders at its true
   544px width, centred in the viewport.

   Redesigned per the "Contact Modal" handoff spec (13 Sep 2026): a
   four-field form (544 x ~847) that replaces the old 300 x 285
   placeholder. The panel's height is NOT fixed — the spec says so
   explicitly ("height hugs content") — so every field's height
   below falls out of real content (labels, 64px inputs, a 160px
   textarea, an optional helper line) rather than being forced to
   match the spec's own arithmetic check.
   ============================================================ */
:root {
  --background-primary:   #0b0d0f;
  --background-surface:   #ffffff;
  --background-secondary: #292c30;
  --overlay-heavy:        rgba(0, 0, 0, 0.80);
  --border-subtle:        #d4d5d6;
  --border-bright:        #f5f5f5;
  --border-light:         #e7e7e8;
  --focus-ring:           #6591c6;
  --error-default:        #dc2626;
  --disabled-bg:          #edeef0;
  --disabled-text:        #868a90;
  --text-primary-light:   #ffffff;
  --text-secondary-light: #e7e7e8;
  --text-tertiary-light:  #d4d5d6;
  --text-primary-dark:    #0b0d0f;
  --neutral-500:          #5e6268;
  --misc-black:           #000000;
  --easing-standard:      cubic-bezier(0, 0, 0.58, 1);
}

/* ---------- Panel shell (shared by both dialogs) ---------- */
.contact-dialog,
.thanks-dialog {
  position: relative;             /* anchors the close button */
  width: 544px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px); /* leaves room to breathe on short viewports */
  padding: 32px;
  margin: auto;                   /* centres it in the viewport */
  /* dialog:modal's UA stylesheet sets its own overflow: auto (and, on some
     engines, an !important position) on the <dialog> itself; left alone it
     fights the .dialog-scroll wrapper below and double-scrolls, clipping
     the close button along with it. This cancels that. */
  overflow: visible;

  border-radius: 12px;
  border: 1px solid var(--border-bright);
  background: var(--background-primary);
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.10); /* Elevation/xl */

  /* Open/close motion. The dialog is display:none until [open], so these
     can't run until showModal() has painted it once — see contact.js. */
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 250ms var(--easing-standard),
              transform 250ms var(--easing-standard);
}
.contact-dialog[open],
.thanks-dialog[open] { display: flex; flex-direction: column; }

.contact-dialog.is-open,
.thanks-dialog.is-open {
  opacity: 1;
  transform: translateY(0);
}
/* Exit: fade only, faster, no rise — a different motion from the entrance. */
.contact-dialog.is-closing,
.thanks-dialog.is-closing {
  opacity: 0;
  transform: none;
  transition: opacity 150ms ease-in;
}
/* Request -> Sent cross-fade: flat 200ms fade on both panels, no rise. */
.contact-dialog.is-swap,
.thanks-dialog.is-swap {
  transform: none;
  transition: opacity 200ms var(--easing-standard);
}

.contact-dialog::backdrop,
.thanks-dialog::backdrop {
  background: var(--overlay-heavy);
  opacity: 0;
  transition: opacity 200ms ease-out;
}
.contact-dialog.is-open::backdrop,
.thanks-dialog.is-open::backdrop { opacity: 1; }
.contact-dialog.is-closing::backdrop,
.thanks-dialog.is-closing::backdrop { transition: opacity 150ms ease-in; opacity: 0; }
.contact-dialog.is-swap::backdrop,
.thanks-dialog.is-swap::backdrop { transition: opacity 200ms var(--easing-standard); }

@media (prefers-reduced-motion: reduce) {
  .contact-dialog,
  .thanks-dialog {
    transform: none !important;
    transition-property: opacity;
  }
}

/* Scrolls internally past the max-height above so the close button (a
   sibling, not a child of this) stays pinned to the panel's corner
   instead of scrolling away with the content. */
.dialog-scroll {
  overflow-y: auto;
  min-height: 0; /* lets this flex child actually shrink and scroll instead
                    of forcing the (overflow:visible) dialog itself to grow
                    past its own max-height */
}

/* ---------- Close button ----------
   32x32 hit area around a 14px stroked x, 2px, round caps. */
.dialog-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog-close-glyph { position: relative; width: 14px; height: 14px; }
.dialog-close-glyph::before,
.dialog-close-glyph::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--text-tertiary-light);
  transition: background-color 150ms ease;
}
.dialog-close-glyph::before { transform: rotate(45deg); }
.dialog-close-glyph::after  { transform: rotate(-45deg); }
.dialog-close:hover .dialog-close-glyph::before,
.dialog-close:hover .dialog-close-glyph::after,
.dialog-close:focus-visible .dialog-close-glyph::before,
.dialog-close:focus-visible .dialog-close-glyph::after {
  background: var(--text-primary-light);
}

/* ---------- Overline + heading (shared) ---------- */
.dialog-overline {
  margin: 0;
  font-family: Manrope;
  font-size: 14px;
  font-weight: 800;
  line-height: normal;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-tertiary-light);
}
.dialog-heading {
  margin: 0;
  font-family: Manrope;
  font-size: 36px;
  font-weight: 700;
  line-height: 44px;
  color: var(--text-primary-light);
}

/* ---------- Form stack ---------- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 24px; /* spacing/lg between every item */
  margin: 0;
}

/* ---------- Field ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 12px; /* spacing/sm: label -> control, and control -> helper */
  width: 100%;
}
.field-label {
  font-family: Manrope;
  font-size: 15px;
  font-weight: 600;
  line-height: normal;
  color: var(--text-primary-light);
}

.field-input,
.field-textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--background-surface);
  color: var(--text-primary-dark);
  font-family: Manrope;
  font-size: 18px;
  font-weight: 400;
  line-height: 22px;
  transition: border-color 150ms ease, border-width 150ms ease;
}
.field-input { height: 64px; padding: 0 24px; }
/* 120px, not the spec's 160px — shortened post-handoff (13 Sep 2026) along
   with dropping the Company field so Submit is reachable without scrolling
   on common laptop viewport heights. See BUILD-NOTES.md. */
.field-textarea { height: 120px; padding: 20px 24px; resize: none; }

.field-input::placeholder,
.field-textarea::placeholder { color: var(--neutral-500); opacity: 1; }

/* Focus and error both double the border weight, not just its colour —
   the state never depends on colour alone. box-sizing:border-box (set
   globally in base.css) means the 1px -> 2px jump doesn't shift the
   control's outer size, only its content inset by 1px. */
.field-input:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--focus-ring);
  border-width: 2px;
}
.field.has-error .field-input,
.field.has-error .field-textarea {
  border-color: var(--error-default);
  border-width: 2px;
}
.field-input:disabled,
.field-textarea:disabled {
  background: var(--disabled-bg);
  border-color: var(--border-light);
  color: var(--disabled-text);
}

/* Error text reuses this same slot instead of adding a line, so the field
   doesn't jump height when it turns invalid — true for EMAIL, which always
   reserves this line; for the other fields the slot is empty (collapsed
   via :empty) until an error fills it, so those DO grow slightly on error.
   The spec's own height table doesn't reserve helper space for them, and
   doesn't resolve this either way — flagging it rather than guessing
   silently, per the brief's own instructions. */
.field-helper {
  margin: 0;
  font-family: Manrope;
  font-size: 15px;
  font-weight: 600;
  line-height: normal;
  color: var(--text-tertiary-light);
}
.field-helper:empty { display: none; }
.field.has-error .field-helper { color: var(--error-default); }

/* ---------- Submit button ----------
   Deliberately the same 64px height as an Input, so the form and its
   submit share one rhythm. */
.contact-submit {
  width: 100%;
  height: 64px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 12px;
  border: 1px solid var(--border-bright);
  background: var(--background-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); /* Elevation/sm */

  cursor: pointer;
  transition: background-color 150ms ease;
}
.contact-submit:hover  { background: var(--background-secondary); }
.contact-submit:active { background: var(--misc-black); }
.contact-submit:disabled {
  background: var(--disabled-bg);
  border-color: transparent;
  box-shadow: none;
  cursor: not-allowed;
}
.contact-submit-label {
  font-family: Manrope;
  font-size: 24px;
  font-weight: 800;
  line-height: 24px;
  color: var(--text-primary-light);
}
.contact-submit:disabled .contact-submit-label { color: var(--disabled-text); }

/* ============================================================
   THANK-YOU POP-UP
   Replaces the contact box when Submit is pressed (cross-fade, see
   contact.js) — never appended below it, so there's nothing left to
   submit twice.
   ============================================================ */
.thanks-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.thanks-text {
  margin: 0;
  font-family: Manrope;
  font-size: 22px;
  font-weight: 300;
  line-height: 30px;
  color: var(--text-secondary-light);
}
.thanks-rule {
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
}

/* ---------- Triggers ----------
   The five openers are real <button>s (the correct control for opening a
   dialog) and SEE OUR SERVICES is a real <a>. Both are reset to inherit so
   they render exactly as the <div>s they replaced. */
button.cta-button,
a.cta-button {
  font: inherit;
  color: inherit;
  text-align: inherit;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.nav-line button.nav-link {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  white-space: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  vertical-align: baseline;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
