/* 留言框「图片」上传：按钮、缩略图条、提示（comment-photo-upload.js） */

.comment-sticker-trigger.has-label,
.comment-photo-trigger {
    width: auto;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0 12px 0 10px;
    gap: 6px;
}

.comment-photo-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--air-primary);
    background: transparent;
    font-family: var(--air-font);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: color .18s ease, background .18s ease;
    -webkit-tap-highlight-color: transparent;
}

.comment-sticker-trigger.has-label i,
.comment-photo-trigger i {
    font-size: 18px;
}

.comment-tool-label {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.comment-photo-trigger:focus-visible {
    outline: 2px solid rgba(73, 104, 242, .46);
    outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
    .comment-photo-trigger:hover {
        background: var(--air-primary-soft);
    }
}

.comment-photo-strip {
    /* 最多 4 格（已选图片 + 「继续添加」），固定 4 列，手机上也排在一行 */
    display: grid;
    grid-template-columns: repeat(4, 72px);
    gap: 12px;
    margin: 12px 0 0;
    padding: 8px 8px 0 0;
}

.comment-photo-strip[hidden],
.comment-photo-message[hidden] {
    display: none !important;
}

.comment-photo-item,
.comment-photo-add {
    position: relative;
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    border-radius: 12px;
}

.comment-photo-item {
    background: var(--air-line-soft);
}

/* 全站 .airjournal-article img { height: auto !important } 会把方形缩略图拉变形 */
.comment-photo-item > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    object-fit: cover;
    border-radius: 12px;
}

.comment-photo-item.is-processing > img,
.comment-photo-item.is-uploading > img,
.comment-photo-item.is-error > img {
    opacity: .5;
}

.comment-photo-status {
    position: absolute;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100%;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    background: rgba(15, 23, 42, .38);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
}

.comment-photo-item.is-error .comment-photo-status {
    background: rgba(220, 53, 69, .62);
    cursor: pointer;
    pointer-events: auto;
}

.comment-photo-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    z-index: 1;
    display: flex;
    width: 24px;
    height: 24px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--air-surface-solid, #fff);
    border-radius: 50%;
    background: rgba(15, 23, 42, .82);
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* 手指点的热区比看上去大一圈 */
.comment-photo-remove::after {
    content: "";
    position: absolute;
    inset: -8px;
}

.comment-photo-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    border: 1.5px dashed var(--air-line);
    background: transparent;
    color: var(--air-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.comment-photo-add i {
    font-size: 15px;
}

@media (hover: hover) and (pointer: fine) {
    .comment-photo-add:hover {
        border-color: var(--air-primary);
        color: var(--air-primary);
    }
}

.comment-photo-message {
    margin: 8px 0 0;
    color: var(--air-muted);
    font-size: 13px;
    line-height: 1.6;
}

.comment-photo-message.is-error {
    color: #dc3545;
}

html[data-blog-theme="dark"] .comment-photo-message.is-error {
    color: #ff8a94;
}

@media (max-width: 480px) {
    .comment-photo-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        max-width: 312px;
        gap: 10px;
    }

    .comment-photo-item,
    .comment-photo-add {
        width: auto;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .comment-sticker-trigger.has-label,
    .comment-photo-trigger {
        padding: 0 9px 0 8px;
        gap: 5px;
    }
}

/* 审核通过后在留言列表里的样子。服务端内联的是 max-width: 100%，竖拍照片会铺满整列，
   这里收到 320px 以内；点开由全站的图片预览放大看原图。 */
.comment-content img[src*="/comment-img/"] {
    width: auto !important;
    height: auto !important;
    max-width: min(100%, 320px) !important;
    max-height: 320px !important;
    object-fit: contain;
    border-radius: 10px;
    cursor: zoom-in;
}

@media (max-width: 480px) {
    .comment-content img[src*="/comment-img/"] {
        max-width: min(100%, 240px) !important;
        max-height: 260px !important;
    }
}
