/* "+ Ask for a new tool" (qazzly.app home only; sites/build_qazzly_app.ask_button / ask_dialog, wired by /ask.js).
   Uses the page tokens (style.css; pro-tools.css dark tokens when a page has them), so it follows the page theme.
   Without JS the button is a plain link to the idea form on /about/#suggest. Free calculator pages never load this. */
.ask-row { margin: calc(var(--s-5) * -1) 0 0; }
.ask-btn {
  display: inline-flex; align-items: center; gap: var(--s-3);
  min-height: 52px; padding: 6px var(--s-5) 6px 6px; border: 1.5px solid var(--ink); border-radius: 999px;
  background: var(--card); color: var(--ink); font: 600 var(--t-lead)/1.2 var(--font); letter-spacing: -0.01em;
  text-decoration: none; cursor: pointer; max-width: 100%;
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.ask-btn:hover { background: color-mix(in oklab, var(--coral) 14%, var(--card)); }
.ask-btn:active { transform: translateY(1px) scale(.985); }
.ask-btn:focus-visible { border-radius: 999px; }
.ask-plus {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--coral); color: #14213D;
  transition: transform 260ms var(--ease);
}
.ask-btn:hover .ask-plus { transform: rotate(90deg); }
.ask-plus svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; fill: none; }

.ask-panel { border-left: 4px solid var(--coral); }
.ask-panel h2 { margin-top: 0; }
.ask-panel p:last-child { margin-bottom: 0; }

/* "+ Ask" at the end of the top nav (sites/nav_ask.py, every non-frozen qazzly.app page) */
.top .bar { position: relative; }
.top nav a.nav-ask { gap: 6px; padding: 0 var(--s-3) 0 6px; font-weight: 600; }
.nav-ask-plus { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--coral); color: #14213D; transition: transform 260ms var(--ease); }
.nav-ask-plus svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 3; stroke-linecap: round; fill: none; }
.top nav a.nav-ask:hover .nav-ask-plus { transform: rotate(90deg); }
.top nav a.nav-ask::before { left: 34px; }
/* the home's long trade row wraps under the logo: Ask goes on the logo row (top right) so it adds no extra row */
@media (min-width: 640px) {
  .top-many nav a.nav-ask { position: absolute; top: 0; right: 0; height: 40px; margin: 0; }
}
@media (max-width: 639px) {
  /* a phone: the word row scrolls sideways, so Ask sits on the logo row, top right, always in view */
  .top nav a.nav-ask { position: absolute; top: var(--s-3); right: 0; height: 40px; margin: 0; padding: 0 0 0 4px; }
  .top nav a.nav-ask::before { left: 32px; right: 0; }
}
@media (prefers-reduced-motion: reduce) { .nav-ask-plus { transition: none; } .top nav a.nav-ask:hover .nav-ask-plus { transform: none; } }

/* the window */
html.ask-open { overflow: hidden; }
.ask-dlg {
  width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--card); color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(20,33,61,.45), 0 2px 6px rgba(20,33,61,.12); overflow: auto;
  overscroll-behavior: contain;
}
.ask-dlg[open] { animation: ask-in 220ms var(--ease); }
.ask-dlg::backdrop { background: rgba(20,33,61,.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes ask-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.ask-in { padding: var(--s-5); }
@media (min-width: 640px) { .ask-in { padding: var(--s-6); } }
/* the title + close stay at the top while the form scrolls (small phones) */
.ask-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3);
  margin: calc(var(--s-5) * -1) calc(var(--s-5) * -1) 0; padding: var(--s-5) var(--s-5) var(--s-2); background: var(--card); }
@media (min-width: 640px) { .ask-head { margin: calc(var(--s-6) * -1) calc(var(--s-6) * -1) 0; padding: var(--s-6) var(--s-6) var(--s-2); } }
.ask-head h2 { margin: 0; font-size: clamp(24px, 1vw + 20px, 30px); line-height: 1.15; }
.ask-x {
  flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -6px -8px 0 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer;
}
.ask-x:hover { background: var(--surface); }
.ask-x svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.ask-sub { margin: 0 0 var(--s-4); color: var(--muted); }
.ask-opts { margin: 0 0 var(--s-4); padding: 0; border: 0; display: grid; gap: var(--s-2); }
.ask-opt {
  display: flex; align-items: center; gap: var(--s-3); min-height: 52px; padding: 10px var(--s-4);
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md); background: var(--field); cursor: pointer;
  font-weight: 500; transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.ask-opt:hover { border-color: var(--ink); }
.ask-opt input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: #14213D; }
.ask-opt:has(input:checked) { border-color: var(--coral); background: color-mix(in oklab, var(--coral) 10%, var(--field)); box-shadow: inset 4px 0 0 var(--coral); }
.ask-opt:has(input:focus-visible) { outline: 3px solid var(--navy); outline-offset: 2px; }
.ask-field { margin: 0 0 var(--s-4); }
.ask-field label { display: block; font-weight: 600; margin-bottom: 6px; }
.ask-field input, .ask-field textarea {
  display: block; width: 100%; min-height: 44px; padding: 8px 12px; font: inherit; color: var(--ink);
  border: 1px solid var(--field-line); border-radius: 10px; background: var(--field);
}
.ask-field textarea { min-height: 88px; resize: vertical; }
.ask-field .fine { margin: 6px 0 0; }
.ask-field input[aria-invalid="true"], .ask-field textarea[aria-invalid="true"] { border: 2px solid var(--coral); }
.ask-err { margin: 6px 0 0; padding-left: 10px; border-left: 3px solid var(--coral); color: var(--navy); font-weight: 600;
  font-size: var(--t-small); line-height: 1.4; }
.ask-check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; }
.ask-check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: #14213D; }
.ask-check label { display: flex; align-items: center; flex: 1; min-height: 44px; font-weight: 600; cursor: pointer; }
.ask-hint { margin: 0 0 var(--s-4) 32px; }
.ask-check.is-off label { color: var(--muted); cursor: default; }
/* the Send button stays in reach on a small phone: pinned to the bottom of the window while the form scrolls */
.ask-actions { position: sticky; bottom: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4);
  margin: 0 calc(var(--s-5) * -1) calc(var(--s-5) * -1); padding: var(--s-3) var(--s-5) var(--s-5);
  background: var(--card); border-top: 1px solid var(--line); }
@media (min-width: 640px) { .ask-actions { margin: 0 calc(var(--s-6) * -1) calc(var(--s-6) * -1); padding: var(--s-4) var(--s-6) var(--s-6); } }
.ask-actions .fine { margin: 0; flex: 1 1 160px; }
@media (max-width: 639px) { .ask-field textarea { min-height: 72px; } .ask-opt { min-height: 48px; } }
.ask-done h2 { margin: 0 0 var(--s-3); }
.ask-done p { margin: 0 0 var(--s-5); }
.ask-done h2:focus { outline: none; }   /* focused by script only, so screen readers read the thanks */
.ask-done .btn::after { display: none; }   /* Close: no forward chevron */
.ask-dlg [hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .ask-dlg[open] { animation: none; }
  .ask-plus, .ask-btn { transition: none; }
  .ask-btn:hover .ask-plus { transform: none; }
}
