/* Images shown inside a conversation: the pictures a user attached
   to a question, and the pictures an image search retrieved for an
   answer.

   Its own file because two very different pages need it — the app
   shell (base.html) and the standalone published-conversation page,
   which loads a deliberately minimal stylesheet set and must not
   pull in search.css to show a thumbnail. */

/* ---- Attached images shown with the answer ---- */

.answer-uploads {
    margin-bottom: var(--space-md);
}

.answer-uploads-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.answer-uploads-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    list-style: none;
    margin: 0;
    padding: 0;
}

/* .asset-open carries the viewer click hook, whose list-row layout
   (flex row, padding) does not apply to a bare thumbnail. */
.answer-upload-link {
    display: block;
    padding: 0;
    flex: none;
    border-radius: var(--radius-sm);
}

/* Height-bound with the aspect ratio kept: these are the images the
   answer is about, so cropping them to a square would hide the very
   detail the user uploaded. */
.answer-upload-thumb {
    display: block;
    height: 104px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background-color: var(--color-bg);
}

.answer-upload-link:hover .answer-upload-thumb,
.answer-upload-link:focus-visible .answer-upload-thumb {
    border-color: var(--color-accent);
}

/* ---- Images the image search retrieved for this answer ---- */

.retrieved-images {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.retrieved-images-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-sm);
}

.retrieved-images-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Each tile is a fixed-width column so captions of different lengths
   do not shear the row of thumbnails out of alignment. */
.retrieved-image {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 200px;
}

.retrieved-image-link {
    display: block;
    border-radius: var(--radius-sm);
}

/* Remote images of unknown dimensions: bound the height and keep the
   aspect ratio rather than cropping detail out of a diagram. */
.retrieved-image-thumb {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background-color: var(--color-bg);
}

.retrieved-image-link:hover .retrieved-image-thumb,
.retrieved-image-link:focus-visible .retrieved-image-thumb {
    border-color: var(--color-accent);
}

.retrieved-image-title {
    font-size: 0.8rem;
    line-height: 1.3;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.retrieved-image-site {
    font-size: 0.7rem;
    line-height: 1.3;
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}
