/* Public answer gallery. Keep every rule inside this component. */
.answer-media,
.answer-media *,
.answer-media-editor,
.answer-media-editor * {
    box-sizing: border-box;
}

.answer-media {
    width: 100%;
    min-width: 0;
    margin: 2rem 0;
    font-family: inherit;
}

.answer-media > h2 {
    margin: 0 0 1rem;
    font-family: inherit;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.answer-media__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem;
    min-width: 0;
}

.answer-media__figure {
    min-width: 0;
    max-width: 100%;
    margin: 0;
}

.answer-media__enlarge {
    display: block;
    max-width: 100%;
    min-height: 44px;
    border-radius: 0.25rem;
}

.answer-media__enlarge:focus-visible,
.answer-media-editor a:focus-visible,
.answer-media-editor button:focus-visible,
.answer-media-editor input:focus-visible,
.answer-media-editor select:focus-visible,
.answer-media-editor textarea:focus-visible {
    outline: 3px solid #145ea8;
    outline-offset: 3px;
}

.answer-media__figure img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 0.25rem;
}

.answer-media__caption {
    margin-top: 0.75rem;
    font-family: inherit;
    font-size: 17px;
    line-height: 1.65;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.answer-media__dates {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    gap: 0.25rem 0.65rem;
    margin: 0.65rem 0 0;
    color: #555;
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.answer-media__dates dt {
    font-weight: 600;
}

.answer-media__dates dd {
    min-width: 0;
    margin: 0;
}

.answer-media__warning {
    margin: 0.75rem 0 0;
    padding: 0.7rem 0.85rem;
    border-left: 3px solid #9a6700;
    background: #fff8e6;
    color: #594000;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* Private editor. These styles do not change the surrounding CMS. */
.answer-media-editor {
    width: 100%;
    max-width: 1120px;
    min-width: 0;
    margin: 0 auto;
    padding: 1rem;
    color: #243344;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.answer-media-editor [hidden],
.answer-media [hidden] {
    display: none !important;
}

.answer-media-editor h1,
.answer-media-editor h2,
.answer-media-editor h3 {
    margin: 0 0 0.75rem;
    font-family: inherit;
    line-height: 1.35;
}

.answer-media-editor p {
    margin: 0 0 0.75rem;
}

.answer-media-editor form,
.answer-media-editor__list,
.answer-media-editor__fields,
.answer-media-editor__clinical,
.answer-media-editor__upload {
    min-width: 0;
}

.answer-media-editor__list {
    display: grid;
    gap: 1.25rem;
    margin: 1.25rem 0;
    padding: 0;
    list-style: none;
}

.answer-media-editor__card {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.8fr);
    align-items: start;
    gap: 1.25rem;
    min-width: 0;
    margin: 1.25rem 0;
    padding: 1.25rem;
    border: 1px solid #c9d3dd;
    border-radius: 0.5rem;
    background: #fff;
}

.answer-media-editor__card > h2,
.answer-media-editor__card > .answer-media-editor__actions {
    grid-column: 1 / -1;
}

.answer-media-editor__list > .answer-media-editor__card {
    margin: 0;
}

.answer-media-editor__preview {
    min-width: 0;
    margin: 0;
}

.answer-media-editor__preview img,
.answer-media-editor__preview-item img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 440px;
    object-fit: contain;
    border: 1px solid #d6dfe7;
    border-radius: 0.25rem;
    background: #f4f6f8;
}

.answer-media-editor__fields,
.answer-media-editor__clinical {
    display: grid;
    gap: 0.75rem;
}

.answer-media-editor label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    min-height: 44px;
    font-weight: 600;
}

.answer-media-editor input,
.answer-media-editor select,
.answer-media-editor textarea,
.answer-media-editor button {
    max-width: 100%;
    font: inherit;
}

.answer-media-editor input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.answer-media-editor select,
.answer-media-editor textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0.6rem 0.7rem;
    border: 1px solid #8293a4;
    border-radius: 0.25rem;
    background: #fff;
    color: #243344;
}

.answer-media-editor textarea {
    min-height: 112px;
    resize: vertical;
    line-height: 1.55;
}

.answer-media-editor input[type="checkbox"],
.answer-media-editor input[type="radio"] {
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0 0.25rem 0 0;
}

.answer-media-editor input[type="file"] {
    overflow: hidden;
    /* Keep the browser's selected filename out of the visible private UI. */
    color: transparent;
    font-size: 0;
}

.answer-media-editor input[type="file"]::file-selector-button {
    min-height: 44px;
    margin: 0 0.6rem 0 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid #8293a4;
    border-radius: 0.25rem;
    background: #edf2f7;
    color: #243344;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
}

.answer-media-editor__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    min-width: 0;
}

.answer-media-editor button,
.answer-media-editor__actions > a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.6rem 1rem;
    border: 1px solid #204d76;
    border-radius: 0.25rem;
    background: #204d76;
    color: #fff;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.answer-media-editor button:disabled {
    opacity: 0.6;
    cursor: default;
}

.answer-media-editor__notice,
.answer-media-editor__empty {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border: 1px solid #c9d3dd;
    border-radius: 0.3rem;
    background: #f4f7fa;
    line-height: 1.6;
}

.answer-media-editor [data-media-client-error] {
    margin: 0.75rem 0;
    padding: 0.85rem 1rem;
    border: 1px solid #b74436;
    border-radius: 0.3rem;
    background: #fff1ef;
    color: #8b2119;
    font-weight: 600;
}

.answer-media-editor__source,
.answer-media-editor__status {
    color: #46586a;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-line;
}

.answer-media-editor__clinical {
    padding: 0.9rem;
    border: 1px solid #dfc786;
    border-radius: 0.3rem;
    background: #fffaf0;
}

.answer-media-editor__upload {
    margin: 1.25rem 0;
    padding: 1.25rem;
    border: 1px dashed #8293a4;
    border-radius: 0.5rem;
    background: #f8fafc;
}

.answer-media-editor [data-media-new-preview] {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    min-width: 0;
    margin-top: 1rem;
}

.answer-media-editor [data-media-new-preview]:empty {
    display: none;
}

.answer-media-editor__preview-item {
    min-width: 0;
    margin: 0;
}

.answer-media-editor__preview-item figcaption {
    margin-top: 0.4rem;
    color: #46586a;
    font-size: 13px;
    line-height: 1.5;
}

@media (max-width: 680px) {
    .answer-media__grid,
    .answer-media-editor__card,
    .answer-media-editor [data-media-new-preview] {
        grid-template-columns: minmax(0, 1fr);
    }

    .answer-media-editor {
        padding: 0.75rem;
    }

    .answer-media-editor__card,
    .answer-media-editor__upload {
        padding: 1rem;
    }

    .answer-media-editor__actions > button,
    .answer-media-editor__actions > a {
        flex: 1 1 100%;
    }
}

.answer-media__caption p {
    font-size: inherit;
    line-height: inherit;
}
