/* 메시지방 링크 미리보기 카드(static/js/message_link_preview.js) — 메시지 창·메시지 화면·팀 채팅이 함께 쓴다.

   앱 카드(lib/features/chat_room/chat_link_preview_card.dart)와 같은 꼴: 테두리 1px·모서리 12px, 위는 1.91:1 썸네일, 아래는
   제목(굵게 두 줄)·설명(두 줄)·사이트 이름(한 줄). 썸네일이 없으면 가운데 56px 사이트 아이콘, 그것도 없으면 브랜드 파랑 첫 글자.
   색은 화면마다 그 화면의 토큰을 --mlp-* 에 잇는다 — 기본은 사이트 토큰(base-layout.css :root·[data-theme="dark"] 양쪽에 있다).
   어두운 화면의 사이트 값(--surface-color #383838·--border-color #474747)이 곧 앱 카드의 어두운 값이다. */

.mlp-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

.mlp-stack--mine {
    align-items: flex-end;
}

.mlp-card {
    --mlp-surface: var(--surface-color);
    --mlp-line: var(--border-color);
    --mlp-ink: var(--text-color);
    --mlp-muted: var(--text-muted);
    --mlp-placeholder: color-mix(in srgb, var(--text-color) 7%, var(--surface-color));

    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 280px;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--mlp-line);
    border-radius: 12px;
    background: var(--mlp-surface);
    color: var(--mlp-ink);
    font-size: 14px;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    white-space: normal;
    word-break: normal;
    cursor: pointer;
    transition: background-color .12s ease;
}

.mlp-card:hover {
    background: color-mix(in srgb, var(--mlp-ink) 4%, var(--mlp-surface));
    text-decoration: none;
}

.mlp-card:focus-visible {
    outline: 2px solid #0082FF;
    outline-offset: 2px;
}

/* 받는 동안에도 같은 크기 — 받은 뒤 카드가 끼어들며 대화가 튀지 않는다. */
.mlp-card__thumb {
    position: relative;
    display: block;
    flex: none;
    width: 100%;
    aspect-ratio: 1.91 / 1;
    overflow: hidden;
    background: var(--mlp-placeholder);
}

.mlp-card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mlp-card__icon {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    overflow: hidden;
    border-radius: 12px;
}

.mlp-card__icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 브랜드 파랑은 두 테마 모두 #0082FF(앱 _Letter 와 같다). */
.mlp-card__letter {
    background: #0082FF;
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
}

.mlp-card__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 10px 12px;
}

.mlp-card__title,
.mlp-card__desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.mlp-card__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--mlp-ink);
}

/* 받는 동안 제목 자리의 주소는 흐리게(앱과 같다). */
.mlp-card.is-loading .mlp-card__title {
    color: var(--mlp-muted);
    font-weight: 500;
}

.mlp-card__desc {
    margin-top: 3px;
    font-size: 12px;
    color: var(--mlp-muted);
}

.mlp-card__site {
    margin-top: 4px;
    overflow: hidden;
    font-size: 11px;
    color: var(--mlp-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ── 화면마다 ──────────────────────────────────────────────────────────── */

/* 메시지 창 — 창의 토큰(--cb-*, .msg-dock 안에 두 테마 모두 있다)에 잇는다. 창이 좁아 카드도 좁게. */
.msg-dock .mlp-card {
    --mlp-surface: var(--cb-canvas);
    --mlp-line: var(--cb-hairline);
    --mlp-ink: var(--cb-ink);
    --mlp-muted: var(--cb-muted);
    --mlp-placeholder: var(--cb-soft);
    width: 240px;
}

/* 메시지 화면 — 그 화면의 토큰(--msg-*, messages.html 의 .msg-shell 에 두 테마 모두 있다). */
.msg-shell .mlp-card {
    --mlp-surface: var(--msg-surface);
    --mlp-line: var(--msg-line);
    --mlp-ink: var(--msg-text);
    --mlp-muted: var(--msg-muted);
    --mlp-placeholder: color-mix(in srgb, var(--msg-text) 7%, var(--msg-surface));
    width: 300px;
}

/* 팀 채팅 — 말풍선 없는 글 아래(team_chat.js messageRow). 색은 사이트 토큰 그대로(.tc 도 그것을 쓴다). */
.mlp-block {
    margin-top: 6px;
}

.mlp-block .mlp-card {
    width: 320px;
}
