/*
  Northmount Pharmacy: request forms and dialog.

  Colour and type come from the --f-* variables set in site.css.
  Keep this file loaded before site.css (see inc/head.php).

  Made with Aloha ~ Aloha Way Marketing
*/

body.dialog-open { overflow: hidden; }

/* WCAG 1.4.11 (QA-TECH QT-04): field, chip and file-zone borders need 3:1 against the cream dialog and the white
   fields. #A8738F is 3.65:1 on cream and 3.81:1 on white, a deeper shade of the same mauve. Set here on the dialog,
   so site.css keeps its softer line colour for decoration elsewhere. */
.nm-dialog { --f-line: #A8738F; --f-line-strong: #A8738F; --f-line-soft: #F3E1EA; }

/* ---------- Dialog + forms ---------- */
.nm-dialog { width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: var(--f-radius, 16px); background: var(--f-bg, #fff); color: var(--f-ink, #111); font-family: var(--f-font, system-ui, sans-serif); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); overflow: auto; overscroll-behavior: contain; }
.nm-dialog::backdrop { background: var(--f-backdrop, rgba(20, 10, 18, .55)); }
.nm-dialog[open] { animation: nm-in .28s cubic-bezier(.2,.7,.2,1); }
@keyframes nm-in { from { opacity: 0; transform: translateY(14px); } }
.nm-dialog__panel { padding: clamp(22px, 4vw, 36px); }
.nm-dialog__head { padding-right: 48px; margin-bottom: 22px; }
.nm-dialog__kicker { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--f-accent-text, var(--f-accent, #a0177d)); }
.nm-dialog__title { margin: 0 0 8px; font-family: var(--f-display, inherit); font-weight: var(--f-display-weight, 700); font-size: clamp(26px, 4vw, 34px); line-height: 1.1; letter-spacing: var(--f-display-tracking, -0.01em); }
.nm-dialog__intro { margin: 0; color: var(--f-muted, #555); font-size: 16px; line-height: 1.55; }
/* The close button is the panel's first child and floats into the 48px kept clear beside the heading. */
.nm-dialog__close { float: right; position: relative; z-index: 2; margin: -6px -6px 0 0; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--f-field-bg, #f3f3f3); color: var(--f-ink, #111); cursor: pointer; }
.nm-dialog__close:hover { background: var(--f-line-soft, #eee); }

.nm-form { display: grid; gap: 18px; }
/* The display rules above and below would otherwise beat the hidden attribute (form, done and "call or fax" panels). */
.nm-form[hidden], .nm-done[hidden] { display: none; }
.nm-field { display: grid; gap: 6px; min-width: 0; }
.nm-field[hidden] { display: none; }
.nm-field__label { font-size: 14.5px; font-weight: 700; padding: 0; }
.nm-field__opt { font-weight: 400; color: var(--f-muted, #555); }
.nm-field__hint { margin: 0; font-size: 15.5px; color: var(--f-muted, #555); }
.nm-field__error { margin: 0; font-size: 13px; font-weight: 700; color: var(--f-error, #a4262c); }
.nm-field__error:empty { display: none; }
.nm-field input:not([type=radio]):not([type=file]):not([type=checkbox]), .nm-field textarea, .nm-field select {
  width: 100%; min-height: 48px; padding: 12px 14px; border: 1.5px solid var(--f-line, #ccc); border-radius: var(--f-radius-sm, 10px); background: var(--f-field-bg, #fff); font-size: 16px; line-height: 1.4; }
.nm-field textarea { resize: vertical; min-height: 88px; }
.nm-field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23555' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.nm-field input:focus-visible, .nm-field textarea:focus-visible, .nm-field select:focus-visible { outline: 3px solid var(--f-focus, #a0177d); outline-offset: 1px; border-color: var(--f-ink, #111); }
.nm-field.is-invalid input:not([type=radio]), .nm-field.is-invalid textarea, .nm-field.is-invalid select, .nm-field.is-invalid .nm-file { border-color: var(--f-error, #a4262c); }

.nm-choices { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 8px; }
.nm-choices__row { display: flex; flex-wrap: wrap; gap: 8px; }
.nm-choice { position: relative; display: inline-flex; }
.nm-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nm-choice span { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; border: 1.5px solid var(--f-line, #ccc); border-radius: var(--f-radius-chip, 999px); background: var(--f-field-bg, #fff); font-size: 15px; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.nm-choice span:hover { border-color: var(--f-ink, #111); }
.nm-choice input:checked + span { background: var(--f-accent, #a0177d); border-color: var(--f-accent, #a0177d); color: var(--f-accent-ink, #fff); }
.nm-choice input:focus-visible + span { outline: 3px solid var(--f-focus, #a0177d); outline-offset: 2px; }
.nm-field.is-invalid .nm-choice span { border-color: var(--f-error, #a4262c); }

.nm-file { position: relative; display: grid; gap: 4px; padding: 18px; border: 1.5px dashed var(--f-line-strong, var(--f-line, #bbb)); border-radius: var(--f-radius-sm, 10px); background: var(--f-field-bg, #fff); text-align: center; font-size: 15px; }
.nm-file:hover { border-color: var(--f-ink, #111); }
.nm-file:focus-within { outline: 3px solid var(--f-focus, #a0177d); outline-offset: 1px; }
.nm-file__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.nm-file__text strong { color: var(--f-accent-text, var(--f-accent, #a0177d)); text-decoration: underline; text-underline-offset: 3px; }
.nm-file__name { font-size: 13.5px; font-weight: 700; }
.nm-file__name:empty { display: none; }

.nm-form__foot { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; justify-content: space-between; padding-top: 6px; }
.nm-form__privacy { margin: 0; flex: 1 1 220px; font-size: 14.5px; color: var(--f-muted, #555); }
.nm-form__summary { margin: 0; font-size: 14px; font-weight: 700; color: var(--f-error, #a4262c); }
.nm-form__summary:empty { display: none; }
.nm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 24px; border: 2px solid var(--f-accent, #a0177d); border-radius: var(--f-radius-btn, 999px); background: var(--f-accent, #a0177d); color: var(--f-accent-ink, #fff); font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s, transform .15s; }
.nm-btn:hover { background: var(--f-accent-hover, #7f1263); border-color: var(--f-accent-hover, #7f1263); }
.nm-btn:focus-visible { outline: 3px solid var(--f-focus, #a0177d); outline-offset: 3px; }
.nm-btn[disabled] { opacity: .7; cursor: progress; }
.nm-btn--ghost { background: transparent; color: var(--f-ink, #111); border-color: var(--f-line-strong, #999); }
.nm-btn--ghost:hover { background: var(--f-field-bg, #f3f3f3); border-color: var(--f-ink, #111); }

.nm-done { padding: 8px 0 4px; text-align: left; outline: none; }
/* The thank-you and "call or fax" panels take focus (tabindex="-1") so screen readers read them out, but they are
   not controls: no ring drawn tight around the text. Specific enough to beat the site-wide :focus-visible ring in
   site.css, which loads after this file (QA-TECH QT-13). */
.nm-dialog .nm-done:focus, .nm-dialog .nm-done:focus-visible { outline: none; }
.nm-done__mark { color: var(--f-accent-text, var(--f-accent, #a0177d)); margin-bottom: 16px; }
.nm-done__title { margin: 0 0 10px; font-family: var(--f-display, inherit); font-weight: var(--f-display-weight, 700); font-size: clamp(22px, 3.4vw, 28px); line-height: 1.15; }
.nm-done__text { margin: 0 0 12px; color: var(--f-muted, #555); line-height: 1.55; }
.nm-done__mock { margin: 0 0 22px; font-size: 13px; font-weight: 700; color: var(--f-muted, #555); }

@media (max-width: 520px) {
  .nm-dialog { width: 100%; max-height: 100dvh; height: 100dvh; max-width: none; margin: 0; border-radius: 0; }
  .nm-form__foot .nm-btn { width: 100%; }
  /* Full screen on a phone: Escape and the backdrop are out of reach, so the close button stays in view while a
     long form scrolls (QA-TECH QT-21). */
  .nm-dialog__close { position: sticky; top: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
}

/* Consent checkbox */
.nm-consent { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; cursor: pointer; }
.nm-consent input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--f-accent, #a0177d); }
.nm-consent input:focus-visible { outline: 3px solid var(--f-focus, #a0177d); outline-offset: 2px; }
.nm-consent a { font-weight: 700; color: var(--f-accent-text, var(--f-accent, #a0177d)); }

/* Honeypot field (assets/js/forms.js): off-screen, never seen or focused by people; bots fill it in. */
.nm-hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* A form button waiting for the form to load (first open on a page). */
[data-form][aria-busy="true"] { cursor: progress; }
