/* Freeform uploads are buttons with .form-control, so they need their own
   treatment instead of the shared text-input underline. Keep Freeform's markup
   and state attributes in charge of picking, uploading and removing files. */
.web-form-section .freeform-file-dnd__input.form-control {
    --upload-text: #006c42;
    --upload-border: #82bfa4;
    --upload-background: #f5faf7;
    --upload-active-background: #eaf5ef;
    --upload-detail: #4d4d4d;
    display: block;
    width: 100%;
    height: auto;
    min-height: 152px;
    margin-top: 12px;
    margin-bottom: 24px;
    padding: 28px 24px;
    border: 2px dashed var(--upload-border);
    border-radius: 12px;
    background: var(--upload-background);
    color: var(--upload-text);
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
    white-space: normal;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.web-form-section .freeform-file-dnd__input.form-control:hover,
.web-form-section .freeform-file-dnd__input.form-control[data-dragging] {
    border-color: var(--upload-text);
    background: var(--upload-active-background);
}

.web-form-section .freeform-file-dnd__input.form-control:focus {
    border: 2px dashed var(--upload-text);
    box-shadow: none;
}

.web-form-section .freeform-file-dnd__input.form-control:focus-visible {
    outline: 3px solid var(--upload-text);
    outline-offset: 4px;
}

.web-form-section .freeform-file-dnd__input [data-placeholder] {
    color: var(--upload-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
}

.web-form-section .freeform-file-dnd__input [data-placeholder]::before {
    content: "";
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #e0f1e7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23006c42' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4m-5 5 5-5 5 5M4 16v4h16v-4'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
}

/* File previews and messages stay inside the box, with room for long names. */
.web-form-section .freeform-file-dnd__input [data-preview-zone] {
    grid-template-columns: repeat(auto-fit, minmax(0, 144px));
    justify-content: center;
    gap: 24px;
}

.web-form-section .freeform-file-dnd__input.form-control [data-preview-zone] [data-file-preview] [data-filename],
.web-form-section .freeform-file-dnd__input.form-control [data-preview-zone] [data-file-preview] [data-filesize] {
    color: var(--upload-detail);
    line-height: 1.5;
    overflow-wrap: anywhere;
    word-break: normal;
}

.web-form-section .freeform-file-dnd__input.form-control [data-preview-zone] [data-file-preview] [data-filename] {
    margin-top: 8px;
}

.web-form-section .freeform-file-dnd__input [data-messages],
.web-form-section .freeform-file-dnd__input [data-field-errors] {
    padding: 0;
    list-style: none;
    overflow-wrap: anywhere;
}

.web-form-section .freeform-file-dnd__input [data-messages]:not(:empty),
.web-form-section .freeform-file-dnd__input [data-field-errors]:not(:empty) {
    margin-top: 16px;
}

.web-form-section .freeform-file-dnd__input [data-messages] > li {
    color: var(--upload-text);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.web-form-section .freeform-file-dnd__input [data-messages] > li[data-error],
.web-form-section .freeform-file-dnd__input [data-field-errors] > li {
    color: #b42318;
}

/* Support the existing CMS dark-background option and Freeform's dark theme. */
.general-page-dark-bg-section .web-form-section .freeform-file-dnd__input.form-control,
.web-form-section .freeform-file-dnd__input.form-control[data-theme="dark"] {
    --upload-text: #a7e5c7;
    --upload-border: #6aab90;
    --upload-background: #1d3540;
    --upload-active-background: #254550;
    --upload-detail: #e4eeea;
}

.general-page-dark-bg-section .web-form-section .freeform-file-dnd__input [data-messages] > li[data-error],
.general-page-dark-bg-section .web-form-section .freeform-file-dnd__input [data-field-errors] > li,
.web-form-section .freeform-file-dnd__input[data-theme="dark"] [data-messages] > li[data-error],
.web-form-section .freeform-file-dnd__input[data-theme="dark"] [data-field-errors] > li {
    color: #ffb4ab;
}

@media (max-width: 575.98px) {
    .web-form-section .freeform-file-dnd__input.form-control {
        padding: 24px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .web-form-section .freeform-file-dnd__input.form-control {
        transition: none;
    }
}
