/* =====================================================================
   Heart Start Hawaii -- forms.css
   Native contact form (home page #page-contact). Builds on the
   .form-input / .uk-form-label styles in UIkit. Loaded only on pages
   with a form, via hsh_form_assets() in media/php/forms.php.
===================================================================== */

/* Brand tokens for the forms (Heart Start Hawaii red #da314b). */
.hsh-form-wrap {
    --text-dark: #222;
    --text-gray: #666;
    --light-gray: #f5f8fb;
    --gray: #d9dee3;
    --secondary-dark-green: #2f7d5d;
    --radius-sm: 4px;
    --gradient-primary: #da314b;
    --gradient-primary-hover: #b8243a;
}
.hsh-form .form-input { border: 1px solid var(--gray); border-radius: var(--radius-sm); }
.hsh-form .form-input:focus { border-color: #da314b; }

/* Honeypot: off-screen, NOT display:none (some bots skip hidden inputs). */
.hsh-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.hsh-form .uk-form-label { display: block; font-size: .95rem; color: #424242; }
.hsh-req { color: #c0392b; }
.hsh-required-note { margin: 1rem 0 0; font-size: .85rem; color: var(--text-gray); }

/* Checkbox group */
.hsh-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.hsh-fieldset legend { padding: 0; }
.hsh-check { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0; cursor: pointer; color: var(--text-dark); }
.hsh-check .uk-checkbox { margin-top: 3px; flex: none; }

/* Field errors */
.hsh-field-error { display: block; margin-top: 6px; font-size: .875rem; color: #a8324a; }
.hsh-form [aria-invalid="true"].form-input { border-color: #a8324a !important; background: #fdf7f8; }
.hsh-fieldset[aria-describedby] .uk-checkbox { border-color: #a8324a; }

/* Submit button: both labels ship in the markup and swap on .is-busy. */
.hsh-submit-row { margin-top: 1.25rem; text-align: center; }
.hsh-submit { min-width: 240px; border-radius: var(--radius-sm); background: var(--gradient-primary); }
.hsh-submit:hover, .hsh-submit:focus { background: var(--gradient-primary-hover); }
.hsh-submit .hsh-submit-busy { display: none; }
.hsh-submit.is-busy .hsh-submit-idle { display: none; }
.hsh-submit.is-busy .hsh-submit-busy { display: inline-flex; align-items: center; gap: 10px; }
.hsh-submit[disabled] { opacity: .85; cursor: progress; }

.hsh-spinner {
    display: inline-block; width: 16px; height: 16px; flex: none;
    border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
    border-radius: 50%; animation: hsh-spin .7s linear infinite;
}
.hsh-form-status .hsh-spinner { border-color: rgba(218, 49, 75, .25); border-top-color: #da314b; }
@keyframes hsh-spin { to { transform: rotate(360deg); } }

/* Locked while in flight: reads as busy, not broken. */
.hsh-form.is-sending .form-input,
.hsh-form.is-sending .hsh-check { opacity: .55; cursor: progress; }

/* Status region: hidden when empty, shown while sending and on error. */
.hsh-form-status { display: none; }
.hsh-form-status.is-visible {
    display: block; margin-top: 1.25rem; padding: 14px 16px; border-radius: var(--radius-sm);
}
.hsh-form-status.is-sending { background: var(--light-gray); border-left: 4px solid #da314b; color: var(--text-dark); }
.hsh-form-status.is-error   { background: #fdf1f3; border-left: 4px solid #a8324a; color: #6d1f30; }
.hsh-status-line { display: flex; align-items: center; gap: 12px; }

/* Indeterminate bar: SMTP time is unknowable, so show motion, never a %. */
.hsh-progress {
    display: block; height: 3px; margin-top: 12px; border-radius: 2px;
    background: rgba(218, 49, 75, .14); overflow: hidden;
}
.hsh-progress::after {
    content: ""; display: block; width: 40%; height: 100%; border-radius: 2px;
    background: #da314b; animation: hsh-indeterminate 1.15s ease-in-out infinite;
}
@keyframes hsh-indeterminate {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* Completion panel (same markup on the AJAX and ?sent=1 paths). */
.hsh-complete { text-align: center; padding: 34px 20px; outline: none; }
.hsh-complete-icon {
    display: block; width: 62px; height: 62px; margin: 0 auto 20px;
    border-radius: 50%; background: var(--secondary-dark-green); position: relative;
    animation: hsh-pop .35s cubic-bezier(.2, .8, .3, 1.2);
}
.hsh-complete-icon::after {
    content: ""; position: absolute; left: 23px; top: 14px; width: 13px; height: 26px;
    border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg);
    animation: hsh-check .3s ease-out .16s backwards;
}
.hsh-complete-title { margin: 0 0 8px; color: var(--text-dark); font-weight: 700; }
.hsh-complete-text { margin: 0 0 8px; color: var(--text-gray); }
.hsh-send-another { margin-top: 14px; border-radius: var(--radius-sm); }
@keyframes hsh-pop   { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes hsh-check { from { opacity: 0; transform: rotate(45deg) scale(.5); } to { opacity: 1; transform: rotate(45deg) scale(1); } }

@media (prefers-reduced-motion: reduce) {
    .hsh-spinner { animation-duration: 2.4s; }
    .hsh-progress::after { animation-duration: 3s; }
    .hsh-complete-icon, .hsh-complete-icon::after { animation: none; }
}

@media (max-width: 639px) {
    .hsh-submit { width: 100%; min-width: 0; }
}

/* Field help text and the file picker. */
.hsh-help { display: block; margin: -2px 0 6px; font-size: .85rem; color: #666; }
.hsh-file-input.form-input { padding: .6rem !important; cursor: pointer; background: #fafafa; }

/* Long checkbox/radio groups flow into columns on wider screens. */
@media (min-width: 640px) {
    .hsh-fieldset { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: 20px; }
    .hsh-fieldset .hsh-check { margin: 4px 0; }
}
.hsh-check .uk-checkbox, .hsh-check .uk-radio { margin-top: 2px; }

/* -------------------------------------------------------------------
   Heart Start Hawaii runs UIkit 2, which has none of the UIkit 3 classes
   the engine emits (uk-grid-small + uk-grid attribute, uk-width-1-2@s,
   uk-input/uk-select/uk-textarea), so the layout is done here.
------------------------------------------------------------------- */
.hsh-form .uk-grid-small { display: flex; flex-wrap: wrap; margin: 0 0 0 -12px; padding: 0; }
.hsh-form .hsh-field { box-sizing: border-box; width: 100%; padding-left: 12px; margin-top: 12px; }
@media (min-width: 480px) { .hsh-form .hsh-field[class*="uk-width-1-2"] { width: 50%; } }
.hsh-form .uk-form-label { margin-bottom: 4px; font-weight: 600; }
.hsh-form .form-input {
    box-sizing: border-box; width: 100%; max-width: 100%; height: auto; min-height: 40px;
    padding: 8px 10px; font: inherit; font-size: 15px; color: #444; background: #fff;
}
.hsh-form textarea.form-input { min-height: 90px; }
.hsh-form .uk-button.hsh-submit { color: #fff; border: 0; padding: 0 24px; line-height: 44px; min-height: 44px; }
.hsh-submit { min-width: 0; width: 100%; }
.hsh-form .hsh-field[class*="uk-width-1-4"] { width: 50%; }
@media (min-width: 480px) { .hsh-form .hsh-field[class*="uk-width-1-4"] { width: 25%; } }
.hsh-help .hsh-agree-list { margin: 6px 0 8px 1.2em; padding: 0; list-style: disc; }
.hsh-help .hsh-agree-list li { margin: 2px 0; }
