/* v7 forms: the prototype's close form and picker, rule for rule, with its colours bound
   to tokens so the dark close bands flip with their data-tone. Behaviour is js/v7/forms.js.

   Two additions only, both invisible on a desktop: inputs are 16px on a phone so iOS never zooms, and the
   bot trap (.form-hp) sits off screen. */

.close__form { position: relative; padding: 28px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-strong); }
.close .input, .close .pick__button { background: var(--bg); }
.close .pick__pop, .close .pick__group { background: var(--surface); }
.close .pick__mark img { border-radius: 6px; }
.close .pick__mark { background: var(--surface); border-color: var(--line); }
.close .pick__mark .int-mono { width: 100%; height: 100%; font-family: var(--sans); font-size: 18px; line-height: 1; color: var(--fg-3); }
.close .pick__opt .pick__mark .int-mono { font-size: 13px; }

.form-fields { display: grid; gap: 16px; }
/* Questions one answer brings in (Pricing's Startup plan): spaced as the form's own fields */
.form-when { display: grid; gap: 16px; }
.form-when[hidden] { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field[hidden] { display: none; }
.field__label { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--fg-2); }
[data-std] .field__label { font: var(--t-small); }
.field__opt { font-weight: 400; color: var(--fg-4); }
.input { height: 40px; width: 100%; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font: inherit; font-size: 14px; color: var(--fg); transition: border-color 140ms ease, box-shadow 160ms ease; }
.input::placeholder { color: var(--lt-foreground-disabled); }
.input:hover { border-color: var(--line-interactive); }
.input:focus { outline: 0; border-color: var(--fg-3); box-shadow: 0 0 0 4px var(--lt-container-hover); }
.input[aria-invalid='true'] { border-color: var(--red-accent); }
.textarea { height: auto; min-height: 104px; padding-block: 10px; resize: vertical; line-height: 20px; }
.form-error { font-size: 13px; color: var(--lt-red-fg-status); }
.form-error a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.close__submit { margin-top: 4px; width: 100%; }
.close__submit[aria-busy='true'] { opacity: 0.6; pointer-events: none; }
.form-ok { display: grid; justify-items: start; gap: 8px; padding: 8px 0; }
.form-ok:focus { outline: 0; }
.form-ok__tick { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--green-fill); color: var(--green-fg); margin-bottom: 6px; }
.form-ok__tick .ico { width: 18px; height: 18px; }
.form-ok strong { font-size: 17px; font-weight: 600; color: var(--fg); }
.form-ok p { font-size: 14px; line-height: 22px; color: var(--fg-3); margin-bottom: 8px; }
.form-note { font: var(--t-small); color: var(--fg-4); }
.form-note a { color: var(--fg-3); text-decoration: underline; text-underline-offset: 3px; }

/* The trap for bots: off screen and out of the tab order, never display:none, which some bots skip */
.form-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* A choice row: one pressed button stands for the answer (a second press clears it) */
.ptype { display: flex; flex-wrap: wrap; gap: 8px; }
.ptype button { height: 34px; padding-inline: 12px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--bg); font-size: 13px; font-weight: 500; color: var(--fg-2); transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease; }
[data-std] .ptype button { font: var(--t-action); }
.ptype button:hover { border-color: var(--line-interactive); color: var(--fg); }
.ptype button[aria-pressed='true'] { border-color: var(--fg); color: var(--fg); background: var(--lt-container-selected); }
.ptype[aria-invalid='true'] button { border-color: var(--red-accent); }
.labs .ptype { display: grid; gap: 8px; }
.labs .ptype button { width: 100%; height: 40px; padding-inline: 12px; border-radius: 10px; font-size: 14px; text-align: left; }
[data-std] .labs .ptype button { height: auto; min-height: 40px; padding-block: 9px; line-height: 20px; }

/* Picker: a field that opens a searchable list of every on request tool, with its mark */
.pick { position: relative; }
.pick__button { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 14px 0 6px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); text-align: left; transition: border-color 140ms ease, box-shadow 160ms ease; }
.pick__button:hover { border-color: var(--line-interactive); }
.pick__button[aria-expanded='true'] { border-color: var(--fg-3); box-shadow: 0 0 0 4px var(--lt-container-hover); }
.pick__mark { width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; flex: none; overflow: hidden; }
.pick__mark img { width: 18px; height: 18px; object-fit: contain; }
.pick__mark .int-mono { background: transparent; color: var(--fg-3); width: 18px; height: 18px; font-size: 14px; }
.pick__label { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick__label.is-empty { color: var(--lt-foreground-disabled); font-weight: 400; }
.pick__chev { width: 7px; height: 7px; border-right: 1.5px solid var(--fg-3); border-bottom: 1.5px solid var(--fg-3); transform: translateY(-2px) rotate(45deg); transition: transform 200ms var(--ease); }
.pick__button[aria-expanded='true'] .pick__chev { transform: translateY(2px) rotate(225deg); }
.pick.is-picked .pick__button { animation: pick-pulse 700ms var(--ease); }
@keyframes pick-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green-accent) 35%, transparent); } 100% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--green-accent) 0%, transparent); } }
.pick__pop { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-menu); overflow: hidden; animation: menu-in 160ms var(--ease) both; }
.pick.is-up .pick__pop { top: auto; bottom: calc(100% + 6px); transform-origin: bottom left; }
.pick__search { display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 42px; border-bottom: 1px solid var(--line); color: var(--fg-4); }
.pick__search .ico { width: 16px; height: 16px; }
.pick__search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; color: var(--fg); }
.pick__list { list-style: none; margin: 0; padding: 6px; max-height: 280px; overflow-y: auto; scrollbar-width: thin; }
.pick__group { position: sticky; top: -6px; z-index: 1; padding: 10px 8px 4px; background: var(--surface); font-family: var(--mono); font-size: 12px; color: var(--fg-4); }
.pick__opt { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 14px; color: var(--fg-2); cursor: pointer; }
.pick__opt .pick__mark { width: 24px; height: 24px; border-radius: 6px; }
.pick__opt .pick__mark img { width: 14px; height: 14px; }
.pick__opt .pick__mark .int-mono { font-size: 9px; width: 14px; height: 14px; }
.pick__opt.is-active { background: var(--lt-container-hover); color: var(--fg); }
.pick__opt[aria-selected='true'] { color: var(--fg); font-weight: 500; }
.pick__opt[aria-selected='true']::after { content: ''; margin-left: auto; width: 9px; height: 5px; border-left: 1.5px solid var(--fg); border-bottom: 1.5px solid var(--fg); transform: rotate(-45deg) translate(1px, -1px); }
.pick__none { padding: 12px 8px; font-size: 14px; color: var(--fg-3); }


@media (max-width: 760px) {
  .input, .pick__search input { font-size: 16px; }
  /* A finger's target: the choice buttons grow from 34 to 40px on a phone */
  .ptype button { height: auto; min-height: 40px; }
}
@media (max-width: 560px) {
  .close__form { padding: 20px; }
}
/* A short message box: two lines to start, it grows as the reader writes */
.textarea--short { min-height: 64px; }

/* Wider and shorter than the prototype's 460px card: on a desktop the form takes up to 560px of the close,
   so a pair of fields shares each row and the choices sit on one line */
@media (min-width: 1024px) {
  .site :is(#close, #help, #form, #work-with-us, #request, #contact) > :is(.s-close, .close__panel):has(> .close__form) { grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: 64px; }
  /* Beside a form the headline steps down to 40px, so each of its two sentences holds one line */
  .site :is(#close, #help, #form, #work-with-us, #request, #contact) > :is(.s-close, .close__panel):has(> .close__form) .close__title { font: var(--t-close); letter-spacing: var(--tr-headline); }
  .site :is(#close, #help, #form, #work-with-us, #request, #contact) > :is(.s-close, .close__panel):has(> .close__form) .close__title .tone-2 { display: block; text-wrap: balance; }
}
/* A pair of fields stacks once a phone cannot give each half a comfortable width */
@media (max-width: 560px) {
  .field-row { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

/* Stacked below 1024, the copy and the form keep 32px apart on every page (Research's and Publications' closes
   were laid out without a form and had no gap) */
@media (max-width: 1023px) {
  .site :is(#close, #help, #form, #work-with-us, #request, #contact) > :is(.s-close, .close__panel):has(> .close__form) { row-gap: 32px; }
}
