/* Ask Alcor intake: the dialog opened by [data-ask-open], and the Ask Alcor FAQs.
 * Dialog selectors start at #ask-alcor-dialog on purpose. The page-wide standard sheet loads after this one
 * and styles bare h2, h3, p, label, input and button, so class-only selectors here would lose to it.
 * Tokens come from design-system.css; each var() carries its value as a fallback. */

.ask-faq { scroll-margin-top: 100px; }
.ask-preview-note { font-size: .875rem; }

#ask-alcor-dialog {
  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 560px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--paper, #f6f0e4);
  background: var(--surface-raised, #11131b);
  border: 1px solid var(--line, rgba(246, 240, 228, .10));
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
}
#ask-alcor-dialog::backdrop {
  background: rgba(5, 6, 8, .72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
/* A modal dialog does not stop the page behind it from scrolling. Stop it where :has() exists. */
@supports selector(:has(*)) {
  html:has(#ask-alcor-dialog[open]) { overflow: hidden; scrollbar-gutter: stable; }
}
/* display on these panels would beat the hidden attribute the script toggles. */
#ask-alcor-dialog [hidden] { display: none !important; }

#ask-alcor-dialog .ask-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted, #b8bec8);
  font: 400 28px/1 var(--font-body, "Inter", system-ui, sans-serif);
  cursor: pointer;
}
#ask-alcor-dialog .ask-close:hover { color: var(--paper, #f6f0e4); background: rgba(246, 240, 228, .08); }

#ask-alcor-dialog .ask-title {
  max-width: none;
  margin: 0 48px 8px 0;
  color: var(--paper, #f6f0e4);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
}
#ask-alcor-dialog .ask-lede {
  max-width: none;
  margin: 0 0 20px;
  color: var(--muted, #b8bec8);
  font-size: 1rem;
  line-height: 1.55;
}

#ask-alcor-dialog .ask-form { display: grid; gap: 18px; margin: 0; }
#ask-alcor-dialog .ask-field { display: grid; gap: 8px; }
#ask-alcor-dialog .ask-field > label {
  color: var(--paper, #f6f0e4);
  font: 600 .875rem/1.4 var(--font-body, "Inter", system-ui, sans-serif);
  letter-spacing: normal;
  text-transform: none;
}
#ask-alcor-dialog :is(input[type="email"], textarea) {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: var(--field-pad-y, 12px) var(--field-pad-x, 16px);
  border: 1px solid var(--line-control, rgba(246, 240, 228, .22));
  border-radius: var(--radius-input, 10px);
  background: rgba(246, 240, 228, .03);
  color: var(--paper, #f6f0e4);
  font: 400 16px/var(--leading-field, 1.5) var(--font-body, "Inter", system-ui, sans-serif); /* 16px keeps iOS from zooming on focus */
  -webkit-appearance: none;
  appearance: none;
}
/* [name] matches the weight of the :is() rule above, so the textarea's own padding wins (it had lost to "0 14px",
 * leaving the caret on the border). The field padding is the site standard (arcana.css). */
#ask-alcor-dialog textarea[name] { height: auto; min-height: 140px; padding: var(--field-pad-y-area, 14px) var(--field-pad-x, 16px); resize: vertical; }
#ask-alcor-dialog :is(input[type="email"], textarea):focus {
  outline: 0;
  border-color: var(--cyan, #53d9d4);
  box-shadow: 0 0 0 3px rgba(83, 217, 212, .25);
}
#ask-alcor-dialog :is(input[type="email"], textarea)[aria-invalid="true"] { border-color: var(--red, #ff4e6a); }
#ask-alcor-dialog :is(input[type="email"], textarea)[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(255, 78, 106, .25); }
#ask-alcor-dialog :is(input[type="email"], textarea)[readonly] { opacity: .7; }
#ask-alcor-dialog .ask-count {
  justify-self: end;
  color: var(--quiet, #959dac);
  font-size: .8125rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

#ask-alcor-dialog .ask-consent {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 0;
  color: var(--muted, #b8bec8);
  font: 400 .875rem/1.5 var(--font-body, "Inter", system-ui, sans-serif);
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}
#ask-alcor-dialog .ask-consent input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--cyan, #53d9d4); cursor: pointer; }
#ask-alcor-dialog .ask-consent input[aria-invalid="true"] { outline: 2px solid var(--red, #ff4e6a); outline-offset: 2px; }
#ask-alcor-dialog .ask-consent a {
  color: var(--paper, #f6f0e4);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Off screen, not display:none, so a bot still sees a field. aria-hidden on the wrapper keeps it from screen readers. */
#ask-alcor-dialog .ask-hp {
  position: absolute;
  top: auto;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#ask-alcor-dialog :is(.ask-submit, .ask-done) {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  min-height: 48px;
  margin: 0;
  padding: 0 22px;
  border-radius: 999px;
  font: 600 .9375rem/1 var(--font-body, "Inter", system-ui, sans-serif);
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
#ask-alcor-dialog .ask-submit {
  border: 1px solid var(--cyan, #53d9d4);
  background: var(--cyan, #53d9d4);
  color: #06110f;
}
#ask-alcor-dialog .ask-submit:hover:not(:disabled) {
  border-color: var(--action-primary-hover, #7de3df);
  background: var(--action-primary-hover, #7de3df);
}
#ask-alcor-dialog .ask-submit:disabled { opacity: .65; cursor: progress; }
#ask-alcor-dialog .ask-done {
  border: 1px solid var(--line-control, rgba(246, 240, 228, .22));
  background: rgba(246, 240, 228, .05);
  color: var(--paper, #f6f0e4);
}
#ask-alcor-dialog .ask-done:hover { border-color: var(--line-hover, rgba(246, 240, 228, .32)); }

#ask-alcor-dialog .ask-status {
  min-height: 1.5em;
  max-width: none;
  margin: 0;
  color: var(--muted, #b8bec8);
  font-size: .875rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#ask-alcor-dialog .ask-status[data-state="error"] { color: var(--red, #ff4e6a); }

#ask-alcor-dialog .ask-success { display: grid; gap: 14px; }
#ask-alcor-dialog .ask-success h3 {
  margin: 0;
  color: var(--paper, #f6f0e4);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
}
#ask-alcor-dialog .ask-success h3:focus { outline: 0; }
#ask-alcor-dialog .ask-success p {
  max-width: none;
  margin: 0;
  color: var(--muted, #b8bec8);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
#ask-alcor-dialog .ask-success strong { color: var(--paper, #f6f0e4); font-weight: 600; }

@keyframes ask-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ask-fade { from { opacity: 0; } to { opacity: 1; } }
#ask-alcor-dialog[open] { animation: ask-rise .18s ease-out; }
#ask-alcor-dialog[open]::backdrop { animation: ask-fade .18s ease-out; }

/* Phones: a bottom sheet fixed to the bottom edge, scrolling inside if the keyboard leaves little room. */
@media (max-width: 480px) {
  #ask-alcor-dialog {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    margin: 0;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    border-bottom-width: 0;
    border-radius: 16px 16px 0 0;
  }
  #ask-alcor-dialog .ask-close { top: 8px; right: 8px; }
  #ask-alcor-dialog .ask-title { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  #ask-alcor-dialog[open],
  #ask-alcor-dialog[open]::backdrop { animation: none; }
  #ask-alcor-dialog :is(.ask-submit, .ask-done) { transition: none; }
}
