/* Shared request modal (views/partials/req-modal.ejs), Nov 2 2026.
   Look: the "try Miia / Pi for free" lead modal (views/hero-input.ejs .hi-modal), moved onto the locked
   brand tokens: white card, 24px corners, small uppercase field labels, gold pill submit, ink text.
   Desktop: centred card. Phones (under 600px): a bottom sheet. The body scrolls inside; the title and
   close button stay put. Native <dialog> (top layer, so no z-index fights with the nav or Ask AI). */

.req {
  --rq-gold: #FFC61E; --rq-gold3: #FFE8A5; --rq-violet: #341D99; --rq-ink: #110A33; --rq-lav: #DDD6FF;
  --rq-mist: #F6F4FF; --rq-cream: #FFF4D2; --rq-slate: #5B6478;
  --rq-disp: "Cabinet Grotesk", Cabinetgrotesk, Arial, sans-serif; --rq-body: Manrope, Arial, sans-serif;
  --rq-out: cubic-bezier(.23, 1, .32, 1); --rq-sheet: cubic-bezier(.32, .72, 0, 1);
  --rq-pad: 28px;
  position: fixed; inset: 0; margin: auto;
  width: min(calc(100% - 32px), 520px); max-width: none; height: fit-content; max-height: min(calc(100dvh - 48px), 780px);
  padding: 0; border: 0; border-radius: 24px; overflow: hidden;
  background: #fff; color: var(--rq-ink);
  box-shadow: 0 32px 64px -24px rgba(17, 10, 51, .35), 0 2px 8px rgba(17, 10, 51, .08);
  font: 500 16px/1.5 var(--rq-body); -webkit-font-smoothing: antialiased; text-align: start;
}
.req:not([open]) { display: none; }
.req *, .req *::before, .req *::after { box-sizing: border-box; }
.req::backdrop { background: rgba(17, 10, 51, .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
html.req-lock { overflow: hidden; }

.req__panel { display: flex; flex-direction: column; max-height: inherit; }

/* head: title, one line, close. Outside the scroll area so it never scrolls away. */
.req__head { position: relative; z-index: 1; flex: none; padding: var(--rq-pad) calc(var(--rq-pad) + 44px) 16px var(--rq-pad); transition: box-shadow .15s; }
/* once the body scrolls, a hairline separates the fixed head from the moving fields */
.req.is-scrolled .req__head { box-shadow: 0 1px 0 var(--rq-lav), 0 8px 16px -12px rgba(17, 10, 51, .18); }
.req .req__title { margin: 0; font: 700 24px/1.15 var(--rq-disp); letter-spacing: -.02em; color: var(--rq-ink); text-wrap: balance; outline: none; }
.req .req__lead { margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--rq-slate); text-wrap: pretty; }
.req__x {
  position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--rq-slate); cursor: pointer;
  transition: background-color .15s, color .15s, transform .16s var(--rq-out);
}
.req__x:hover { background: var(--rq-mist); color: var(--rq-ink); }
.req__x:active { transform: scale(.96); }

/* body scrolls when the form is long (more fields, short laptop, phone keyboard) */
.req__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px var(--rq-pad) var(--rq-pad); scrollbar-width: thin; }
.req__form { margin: 0; }

.req .req__label { display: block; margin: 0 0 6px; padding: 0; font: 700 12px/1.3 var(--rq-body); letter-spacing: .09em; text-transform: uppercase; color: var(--rq-slate); }
.req__opt { font-weight: 600; letter-spacing: .04em; text-transform: none; }

.req__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 480px) { .req__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .req__field { grid-column: 1 / -1; } .req__field--half { grid-column: auto; } }

.req__input {
  display: block; width: 100%; min-height: 48px; margin: 0; padding: 0 14px;
  border: 1.5px solid rgba(91, 100, 120, .72); border-radius: 12px; background: var(--rq-mist); /* slate 72%: 3.2:1 on white (WCAG 1.4.11) */
  font: 500 16px/1.3 var(--rq-body); color: var(--rq-ink);
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.req__input--area { min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
select.req__input { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23110A33' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.req__input::placeholder { color: var(--rq-slate); opacity: 1; }
.req__input:hover { border-color: var(--rq-slate); }
.req__input:focus, .req__input:focus-visible { outline: none; border-color: var(--rq-ink); background: #fff; box-shadow: 0 0 0 3px rgba(52, 29, 153, .22); }
.req__input[aria-invalid="true"] { border-color: var(--rq-violet); background: #fff; box-shadow: 0 0 0 3px rgba(52, 29, 153, .12); }
.req .req__hint { margin: 6px 0 0; font-size: 13px; line-height: 1.4; color: var(--rq-slate); }

/* errors: violet text with a mark, never colour alone */
.req .req__err { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0 0; font-size: 13px; font-weight: 700; line-height: 1.4; color: var(--rq-violet); }
.req .req__err::before { content: "!"; flex: none; display: grid; place-items: center; width: 16px; height: 16px; margin-top: 1px; border-radius: 999px; background: var(--rq-violet); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; }
.req .req__err[hidden] { display: none; }

/* document / asset picker: tick cards */
.req__choices { margin: 0 0 20px; padding: 0; border: 0; min-width: 0; display: grid; gap: 8px; }
.req__choices > legend { float: left; width: 100%; }
.req__choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border: 1.5px solid var(--rq-lav); border-radius: 16px; background: #fff; cursor: pointer; transition: border-color .15s, background-color .15s; }
.req__choice:hover { border-color: rgba(52, 29, 153, .4); }
.req__choice:has(input:checked) { border-color: var(--rq-ink); background: var(--rq-mist); }
.req__choice:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(52, 29, 153, .25); }
.req__choice input, .req__optin input {
  appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 1px 0 0;
  border: 1.5px solid var(--rq-ink); border-radius: 6px; background: #fff center / 14px no-repeat; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.req__choice input:checked, .req__optin input:checked {
  background-color: var(--rq-gold);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23110A33' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.req__choice input:focus-visible, .req__optin input:focus-visible { outline: 2px solid var(--rq-violet); outline-offset: 2px; }
.req__choice-txt { display: grid; gap: 2px; min-width: 0; }
.req__choice-txt b { font-size: 15px; font-weight: 700; line-height: 1.35; }
.req__choice-txt span { font-size: 13px; line-height: 1.45; color: var(--rq-slate); text-wrap: pretty; }
.req__choices[aria-invalid="true"] .req__choice { border-color: var(--rq-violet); }

.req .req__privacy { margin: 20px 0 0; font-size: 13px; line-height: 1.5; color: var(--rq-slate); text-wrap: pretty; }
.req__privacy a { color: var(--rq-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.req__optin { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; font-size: 13px; line-height: 1.45; color: var(--rq-slate); cursor: pointer; }
.req__optin input { width: 18px; height: 18px; border-radius: 5px; background-size: 12px; }

.req .req__status { margin: 0; font-size: 13px; font-weight: 700; color: var(--rq-violet); }
.req .req__status:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.req .req__status:not(:empty) { margin-top: 16px; }

.req__submit, .req__done {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; margin: 24px 0 0;
  padding: 12px 24px; border: 0; border-radius: 999px; background: var(--rq-gold); color: var(--rq-ink);
  font: 700 16px/1 var(--rq-disp); letter-spacing: 0; cursor: pointer;
  transition: background-color .15s, transform .16s var(--rq-out);
}
.req__submit:hover { background: var(--rq-gold3); }
.req__submit:active, .req__done:active { transform: scale(.97); }
.req__submit[aria-busy="true"] { pointer-events: none; background: var(--rq-gold3); }
.req__x:focus-visible, .req__submit:focus-visible, .req__done:focus-visible, .req__privacy a:focus-visible { outline: 2px solid var(--rq-violet); outline-offset: 3px; }

/* thank-you state */
.req__thanks { display: grid; justify-items: center; gap: 12px; padding: 8px 0 0; text-align: center; }
.req__thanks[hidden] { display: none; }
.req__tick { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 999px; background: var(--rq-gold); color: var(--rq-ink); }
.req .req__thanks-h { margin: 8px 0 0; font: 700 24px/1.2 var(--rq-disp); letter-spacing: -.02em; text-wrap: balance; outline: none; }
.req .req__thanks-p { margin: 0; max-width: 36ch; font-size: 15px; line-height: 1.5; color: var(--rq-slate); text-wrap: pretty; overflow-wrap: anywhere; }
.req .req__thanks-p b { color: var(--rq-ink); }
.req__done { width: auto; min-width: 160px; margin-top: 12px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--rq-ink); }
.req__done:hover { background: var(--rq-ink); color: #fff; }
/* once the request is sent, the head line about filling the form is no longer true */
.req.is-sent .req__lead { display: none; }

/* phones: a bottom sheet, thumb reach for the button, safe area respected */
@media (max-width: 599px) {
  .req { --rq-pad: 20px; inset: auto 0 0 0; margin: 0; width: 100%; max-height: calc(100dvh - 24px); border-radius: 24px 24px 0 0; }
  .req__head { padding-top: 28px; }
  .req__head::before { content: ""; position: absolute; top: 10px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 999px; background: var(--rq-lav); }
  .req__x { top: 12px; right: 8px; }
  .req .req__title { font-size: 22px; }
  .req__body { padding-bottom: calc(var(--rq-pad) + env(safe-area-inset-bottom, 0px)); }
}

/* motion: opens fast from the page it belongs to, closes faster. Occasional use, so it can animate. */
@media (prefers-reduced-motion: no-preference) {
  .req[open] { animation: rq-in .22s var(--rq-out); }
  .req[open]::backdrop { animation: rq-fade .22s var(--rq-out); }
  .req.is-closing { animation: rq-out .16s ease-out forwards; }
  .req.is-closing::backdrop { animation: rq-fade .16s ease-out reverse forwards; }
  .req.is-sent .req__tick { animation: rq-pop .32s var(--rq-out); }
  .req.is-sent .req__tick path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: rq-draw .3s .12s var(--rq-out) forwards; }
  .req__thanks:not([hidden]) > :not(.req__tick) { animation: rq-rise .26s .08s var(--rq-out) both; }
  @media (max-width: 599px) {
    .req[open] { animation: rq-sheet-in .3s var(--rq-sheet); }
    .req.is-closing { animation: rq-sheet-out .2s ease-out forwards; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .req[open], .req[open]::backdrop { animation: rq-fade .12s linear; }
  .req.is-closing, .req.is-closing::backdrop { animation: rq-fade .1s linear reverse forwards; }
  .req__x, .req__submit, .req__done, .req__input { transition: none; }
}
@keyframes rq-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes rq-out { to { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes rq-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes rq-sheet-out { to { transform: translateY(100%); } }
@keyframes rq-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rq-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes rq-draw { to { stroke-dashoffset: 0; } }
@keyframes rq-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (forced-colors: active) {
  .req { border: 2px solid CanvasText; }
  .req__input:focus, .req__input:focus-visible { outline: 2px solid Highlight; outline-offset: 1px; }
  .req__choice input:checked, .req__optin input:checked { background-color: Highlight; }
}

/* Nov 2: gate mode (data-req-gate). Case studies: the page stays in the HTML, the form sits over it and cannot be dismissed (no X, Esc or backdrop
   close until it is sent). Nov 6 2026: no page uses gate mode any more (case studies now gate only the PDF download, in normal mode);
   the clear backdrop below assumed the page painted its own dim, so add one back if gate mode is used again. */
.req[data-req-gate] .req__x { display: none; }
.req[data-req-gate] .req__head { padding-right: var(--rq-pad); }
.req[data-req-gate]::backdrop { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.req__back { display: block; width: fit-content; margin: 16px auto 0; padding: 8px 12px; font: 600 14px/1.3 var(--rq-body, Manrope, Arial, sans-serif); color: var(--rq-slate, #5B6478); text-decoration: underline; text-decoration-color: #DDD6FF; text-decoration-thickness: 2px; text-underline-offset: 3px; border-radius: 8px; }
.req__back:hover { color: var(--rq-ink, #110A33); text-decoration-color: var(--rq-ink, #110A33); }
.req__back:focus-visible { outline: 2px solid var(--rq-violet, #341D99); outline-offset: 2px; }
