.map-popup-attachment {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--link);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.map-popup-attachment:hover {
    color: var(--primary-hover);
}

.map-popup-attachment:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.attachment-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    box-shadow: none;
    overflow: hidden;
}

.attachment-modal[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-modal::backdrop {
    background: rgb(0 0 0 / 55%);
}

.attachment-viewer {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
    width: min(92vw, 1200px);
    height: 92vh;
    max-height: 92vh;
}

.attachment-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.attachment-main-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.attachment-thumbnails {
    display: flex;
    gap: 8px;
    justify-content: safe center;
    padding: 4px;
    overflow-x: auto;
}

.attachment-thumbnail {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    background: transparent;
    opacity: 0.7;
    overflow: hidden;
    cursor: pointer;
}

.attachment-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-thumbnail:hover {
    opacity: 1;
}

.attachment-thumbnail.is-selected {
    border-color: #ffffff;
    opacity: 1;
}

.attachment-thumbnail:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}
