/* SmartCMS Forms — public form styles. Namespaced so a theme's own styles always win elsewhere. */

.fmf {
    --fmf-primary: #0e6a66;
    --fmf-on-primary: #ffffff;
    --fmf-accent: #e8a317;
    --fmf-surface: #ffffff;
    --fmf-ink: #15191f;
    --fmf-muted: #5b6470;
    --fmf-border: #d6dae0;
    --fmf-border-strong: #7c8594;
    --fmf-radius: 6px;
    --fmf-error: #b3261e;
    --fmf-success: #1e7b3c;
    box-sizing: border-box;
    width: 100%;
    color: var(--fmf-ink);
}

.fmf *,
.fmf *::before,
.fmf *::after {
    box-sizing: border-box;
}

.fmf [hidden],
.fmf-form[hidden] {
    display: none !important;
}

.fmf-title {
    margin: 0 0 8px;
    color: var(--fmf-ink);
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 600;
    line-height: 1.22;
    letter-spacing: -.012em;
}

.fmf-description {
    max-width: 62ch;
    margin: 0 0 24px;
    color: var(--fmf-muted);
    font-size: .95rem;
    line-height: 1.6;
}

.fmf-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 0;
}

.fmf-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px 16px;
}

.fmf-field {
    grid-column: span 2;
    min-width: 0;
}

.fmf-field--half {
    grid-column: span 1;
}

.fmf-field.is-invalid .fmf-input,
.fmf-field.is-invalid .fmf-textarea {
    border-color: var(--fmf-error);
}

.fmf-label,
.fmf-group legend {
    display: block;
    margin: 0 0 7px;
    color: var(--fmf-ink);
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.35;
}

.fmf-group {
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
}

.fmf-required {
    color: var(--fmf-error);
}

.fmf-input {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--fmf-border);
    border-radius: var(--fmf-radius);
    background: var(--fmf-surface);
    color: var(--fmf-ink);
    font: inherit;
    font-size: .94rem;
    line-height: 1.45;
}

select.fmf-input {
    padding-right: 34px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='%235b6470' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
}

.fmf-input::placeholder {
    color: var(--fmf-muted);
    opacity: .72;
}

.fmf-input:focus {
    border-color: var(--fmf-primary);
    outline: 2px solid color-mix(in srgb, var(--fmf-primary) 22%, transparent);
    outline-offset: 0;
}

.fmf-textarea {
    min-height: 118px;
    padding: 10px 12px;
    resize: vertical;
}

.fmf-help {
    margin: 6px 0 0;
    color: var(--fmf-muted);
    font-size: .78rem;
    line-height: 1.45;
}

.fmf-error {
    margin: 6px 0 0;
    color: var(--fmf-error);
    font-size: .78rem;
    font-weight: 500;
    line-height: 1.4;
}

.fmf-name {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.fmf-choice {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    min-height: 26px;
    padding: 3px 0;
    color: var(--fmf-ink);
    font-size: .94rem;
    line-height: 1.45;
    cursor: pointer;
}

.fmf-choice input {
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    flex: none;
    accent-color: var(--fmf-primary);
}

.fmf-group .fmf-choice + .fmf-choice {
    margin-top: 1px;
}

.fmf-consent {
    color: var(--fmf-muted);
    font-size: .8rem;
    line-height: 1.5;
}

.fmf-consent label {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    cursor: pointer;
}

.fmf-consent input {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    flex: none;
    accent-color: var(--fmf-primary);
}

.fmf-consent.is-invalid .fmf-error {
    margin-left: 25px;
}

.fmf-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 0 22px;
    border: 1px solid var(--fmf-primary);
    border-radius: var(--fmf-radius);
    background: var(--fmf-primary);
    color: var(--fmf-on-primary);
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color .12s, border-color .12s, opacity .12s;
}

.fmf-submit:hover {
    filter: brightness(.93);
}

.fmf-submit:disabled {
    opacity: .55;
    cursor: default;
}

.fmf-footnote {
    margin: -2px 0 0;
    color: var(--fmf-muted);
    font-size: .72rem;
    line-height: 1.45;
    text-align: center;
}

/* Star rating, scale, slider, toggle, file */
.fmf-stars {
    display: flex;
    gap: 3px;
    align-items: center;
}

.fmf-stars label {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.fmf-stars input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.fmf-stars span[aria-hidden] {
    color: var(--fmf-border-strong);
    font-size: 1.75rem;
    line-height: 1;
    transition: color .1s;
}

.fmf-stars input:checked ~ span[aria-hidden],
.fmf-stars label:hover span[aria-hidden] {
    color: var(--fmf-accent);
}

.fmf-stars label:has(~ label input:checked) span[aria-hidden] {
    color: var(--fmf-accent);
}

.fmf-stars input:focus-visible + span {
    outline: 2px solid var(--fmf-primary);
    outline-offset: 2px;
    border-radius: 3px;
}

.fmf-scale {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fmf-scale label {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.fmf-scale input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.fmf-scale span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 36px;
    padding: 0 7px;
    border: 1px solid var(--fmf-border);
    border-radius: var(--fmf-radius);
    background: var(--fmf-surface);
    color: var(--fmf-ink);
    font-size: .82rem;
    font-weight: 600;
}

.fmf-scale input:checked + span {
    border-color: var(--fmf-primary);
    background: var(--fmf-primary);
    color: var(--fmf-on-primary);
}

.fmf-scale input:focus-visible + span {
    outline: 2px solid var(--fmf-primary);
    outline-offset: 2px;
}

.fmf-range {
    width: 100%;
    accent-color: var(--fmf-primary);
}

.fmf-output {
    display: inline-block;
    margin-top: 4px;
    color: var(--fmf-muted);
    font-size: .8rem;
}

.fmf-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.fmf-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.fmf-toggle__track {
    position: relative;
    width: 40px;
    height: 23px;
    flex: none;
    border: 1px solid var(--fmf-border);
    border-radius: 999px;
    background: var(--fmf-surface);
    transition: background-color .15s, border-color .15s;
}

.fmf-toggle__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--fmf-ink);
    opacity: .55;
    transition: transform .15s, opacity .15s;
}

.fmf-toggle input:checked + .fmf-toggle__track {
    border-color: var(--fmf-primary);
    background: var(--fmf-primary);
}

.fmf-toggle input:checked + .fmf-toggle__track::after {
    transform: translateX(17px);
    background: var(--fmf-on-primary);
    opacity: 1;
}

.fmf-toggle__text {
    color: var(--fmf-muted);
    font-size: .86rem;
}

.fmf-file {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 46px;
    padding: 7px 10px;
    border: 1px dashed var(--fmf-border-strong);
    border-radius: var(--fmf-radius);
    background: color-mix(in srgb, var(--fmf-surface) 94%, var(--fmf-ink) 6%);
    color: var(--fmf-muted);
    font-size: .82rem;
    cursor: pointer;
}

.fmf-file input {
    max-width: 100%;
    font: inherit;
    font-size: .8rem;
    color: var(--fmf-muted);
}

.fmf-section {
    grid-column: span 2;
    padding-top: 10px;
    border-top: 1px solid var(--fmf-border);
}

.fmf-section h3 {
    margin: 0;
    color: var(--fmf-ink);
    font-size: 1.02rem;
    font-weight: 600;
}

.fmf-section p {
    margin: 4px 0 0;
    color: var(--fmf-muted);
    font-size: .82rem;
    line-height: 1.5;
}

.fmf-pagebreak {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--fmf-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.fmf-pagebreak::before,
.fmf-pagebreak::after {
    content: "";
    flex: 1;
    border-top: 1.5px dashed var(--fmf-border-strong);
}

.fmf-html {
    grid-column: span 2;
    color: var(--fmf-ink);
    font-size: .92rem;
    line-height: 1.6;
}

.fmf-summary {
    grid-column: span 2;
    padding: 14px 16px;
    border: 1px solid var(--fmf-border);
    border-radius: var(--fmf-radius);
    background: color-mix(in srgb, var(--fmf-surface) 94%, var(--fmf-ink) 6%);
}

.fmf-summary__label {
    color: var(--fmf-ink);
    font-size: .82rem;
    font-weight: 700;
}

.fmf-summary p {
    margin: 3px 0 0;
    color: var(--fmf-muted);
    font-size: .8rem;
}

/* Notices and states */
.fmf-notice {
    padding: 11px 13px;
    margin: 0 0 16px;
    border: 1px solid var(--fmf-border);
    border-radius: var(--fmf-radius);
    font-size: .85rem;
    line-height: 1.5;
}

.fmf-notice--error {
    border-color: color-mix(in srgb, var(--fmf-error) 45%, transparent);
    background: color-mix(in srgb, var(--fmf-error) 8%, var(--fmf-surface));
    color: var(--fmf-error);
}

.fmf-notice--success {
    border-color: color-mix(in srgb, var(--fmf-success) 40%, transparent);
    background: color-mix(in srgb, var(--fmf-success) 8%, var(--fmf-surface));
    color: var(--fmf-success);
}

.fmf-success {
    display: none;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border: 1px solid color-mix(in srgb, var(--fmf-success) 38%, transparent);
    border-radius: var(--fmf-radius);
    background: color-mix(in srgb, var(--fmf-success) 8%, var(--fmf-surface));
    color: var(--fmf-ink);
    font-size: .92rem;
    line-height: 1.55;
}

.fmf-success.is-visible,
.fmf-success[hidden] {
    display: flex;
}

.fmf-success[hidden] {
    display: none;
}

.fmf-success__icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--fmf-success);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.fmf-success strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

.fmf-success p {
    margin: 0;
    color: var(--fmf-muted);
    font-size: .82rem;
}

.fmf-again {
    display: inline-flex;
    margin: 9px 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--fmf-primary);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.fmf-hp {
    position: absolute !important;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.fmf-missing {
    padding: 18px 20px;
    border: 1px dashed var(--fmf-border-strong, #7c8594);
    border-radius: var(--fmf-radius, 6px);
    background: var(--fmf-surface, #fff);
    color: var(--fmf-muted, #5b6470);
    font-size: .9rem;
}

.fmf-preview-note {
    padding: 9px 12px;
    margin: 0 0 18px;
    border: 1px solid #f0d49a;
    border-radius: var(--fmf-radius);
    background: #fdf6e7;
    color: #7a5200;
    font-size: .78rem;
    line-height: 1.45;
}

.fmf--preview {
    width: min(100%, 760px);
    padding: 32px 34px 30px;
    margin: 0 auto;
    border: 1px solid var(--fmf-border);
    border-radius: 10px;
    background: var(--fmf-surface);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

.fmf--preview .fmf-title {
    font-size: 1.6rem;
}

/* Style variants */
.fmf-style-modern-dark:not(.fmf--preview) {
    padding: 28px;
    border-radius: 10px;
    background: #16222f;
}

.fmf-style-warm-sand:not(.fmf--preview) {
    padding: 28px;
    border-radius: 10px;
    background: #fbf7ef;
}

.fmf-style-modern-dark {
    --fmf-primary: #14b8a6;
    --fmf-on-primary: #052b28;
    --fmf-accent: #f0b43c;
    --fmf-surface: #16222f;
    --fmf-ink: #edf2f7;
    --fmf-muted: #a5b4c4;
    --fmf-border: #33475c;
    --fmf-border-strong: #5b7088;
    --fmf-error: #ff938a;
    --fmf-success: #5fcf86;
}

.fmf-style-modern-dark .fmf-input,
.fmf-style-modern-dark .fmf-file,
.fmf-style-modern-dark select.fmf-input {
    background-color: #16222f;
    color: #edf2f7;
}

.fmf-style-modern-dark select.fmf-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='%23a5b4c4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
}

.fmf-style-modern-dark .fmf-input::placeholder {
    color: #7f92a6;
}

.fmf-style-modern-dark .fmf-preview-note {
    border-color: #6b5a2a;
    background: #2a2715;
    color: #f0d49a;
}

.fmf-style-warm-sand {
    --fmf-primary: #b4622a;
    --fmf-on-primary: #fffaf2;
    --fmf-accent: #d99b32;
    --fmf-surface: #fbf7ef;
    --fmf-ink: #2a241c;
    --fmf-muted: #6a5c4b;
    --fmf-border: #ddcdb8;
    --fmf-border-strong: #b8a48a;
    --fmf-radius: 4px;
}

.fmf-style-warm-sand .fmf-input,
.fmf-style-warm-sand .fmf-file {
    background-color: #fdfaf4;
}

.fmf-style-warm-sand select.fmf-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='%236a5c4b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
}

.fmf-style-outline {
    --fmf-primary: #1d232c;
    --fmf-on-primary: #ffffff;
    --fmf-surface: transparent;
    --fmf-border: #9aa3b1;
    --fmf-radius: 3px;
}

.fmf-style-outline .fmf-submit {
    border-color: #1d232c;
    background: transparent;
    color: #1d232c;
}

.fmf-style-outline .fmf-submit:hover {
    background: #1d232c;
    color: #fff;
}

/* Embedded row layouts */
@media (max-width: 620px) {
    .fmf-fields {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .fmf-field,
    .fmf-field--half {
        grid-column: span 1;
    }

    .fmf-name {
        grid-template-columns: 1fr;
    }

    .fmf--preview {
        padding: 22px 18px;
    }

    .fmf-title {
        font-size: 1.3rem;
    }
}

/* Theme isolation: a theme's article selectors must not recolour form controls. */
.fmf .fmf-title,
.fmf .fmf-label,
.fmf .fmf-group legend,
.fmf .fmf-section h3,
.fmf .fmf-summary__label {
    color: var(--fmf-ink);
}

.fmf .fmf-title {
    margin: 0 0 8px;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 600;
    line-height: 1.22;
    letter-spacing: -.012em;
}

.fmf .fmf-description,
.fmf .fmf-help,
.fmf .fmf-footnote,
.fmf .fmf-choice,
.fmf .fmf-consent,
.fmf .fmf-toggle__text {
    color: var(--fmf-muted);
}

.fmf .fmf-input,
.fmf .fmf-textarea {
    border-color: var(--fmf-border);
    background: var(--fmf-surface);
    color: var(--fmf-ink);
}

.fmf .fmf-input::placeholder,
.fmf .fmf-textarea::placeholder {
    color: var(--fmf-muted);
    opacity: .8;
}

.fmf .fmf-submit {
    border-color: var(--fmf-primary);
    background: var(--fmf-primary);
    color: var(--fmf-on-primary);
}

.fmf .fmf-submit:hover {
    border-color: var(--fmf-primary);
    background: var(--fmf-primary);
    color: var(--fmf-on-primary);
    filter: brightness(.92);
}

.fmf--preview .fmf-submit:disabled {
    opacity: 1;
    cursor: default;
}

.fmf .fmf-required,
.fmf .fmf-error {
    color: var(--fmf-error);
}

/* Native select arrows: themes often set a repeating background; keep ours single and sized. */
.fmf select.fmf-input {
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 16px 16px;
}

/* Human verification: signed arithmetic question or Turnstile */
.fmf .fmf-human {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 15px;
    border: 1px solid var(--fmf-border);
    border-radius: var(--fmf-radius);
    background: color-mix(in srgb, var(--fmf-surface) 94%, var(--fmf-ink) 6%);
}

.fmf .fmf-human.is-invalid {
    border-color: var(--fmf-error);
}

.fmf-human__head {
    display: flex;
    align-items: center;
    gap: 7px;
}

.fmf .fmf-human__title {
    color: var(--fmf-ink);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.fmf .fmf-human__question {
    margin: 0;
    color: var(--fmf-ink);
    font-size: .88rem;
    font-weight: 600;
}

.fmf-human__row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    max-width: 270px;
}

.fmf .fmf-human__input {
    width: 130px;
    min-height: 42px;
}

.fmf .fmf-human__refresh {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-height: 42px;
    border: 1px solid var(--fmf-border);
    border-radius: var(--fmf-radius);
    background: var(--fmf-surface);
    color: var(--fmf-muted);
    font-size: 1.05rem;
    cursor: pointer;
}

.fmf .fmf-human__refresh:hover {
    border-color: var(--fmf-primary);
    color: var(--fmf-primary);
}

.fmf .fmf-human__refresh:disabled {
    opacity: .5;
    cursor: wait;
}

.fmf .fmf-human .fmf-help,
.fmf .fmf-human .fmf-error {
    margin: 0;
}

.fmf .fmf-turnstile-placeholder {
    padding: 18px;
    border: 1px dashed var(--fmf-border-strong);
    border-radius: var(--fmf-radius);
    color: var(--fmf-muted);
    font-size: .82rem;
    text-align: center;
}

.fmf-human .cf-turnstile {
    min-height: 65px;
}
