/* Inline link previews — used in post content (Feed, Profile, PrivateFeed). */

.link-preview-wrap {
    margin-top: 0.5rem;
}

.link-preview {
    display: block;
    text-decoration: none !important;
    color: inherit !important;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f8f9fa;
    transition: border-color 0.15s ease, transform 0.05s ease;
}

.link-preview:hover {
    border-color: #adb5bd;
}

.link-preview:active {
    transform: scale(0.998);
}

/* ── YouTube ──────────────────────────────────────────────── */

.link-preview--youtube .link-preview__yt-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    background-size: cover;
    background-position: center;
    /* Reset native button styles so the thumbnail looks identical. */
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    appearance: none;
}

.link-preview--youtube .link-preview__yt-thumb--playing {
    cursor: default;
    background-image: none !important;
}

.link-preview__yt-iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.link-preview__yt-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 2;
    transition: background-color 0.15s ease;
}

.link-preview__yt-close:hover {
    background-color: rgba(0, 0, 0, 0.85);
}

.link-preview__yt-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: rgba(255, 0, 0, 0.92);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    padding-left: 4px; /* visual centering of the triangle */
}

.link-preview__yt-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 3px 7px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.link-preview__yt-footer {
    padding: 8px 12px;
    font-size: 11px;
    color: #6c757d;
}

.link-preview__yt-host {
    color: inherit;
    text-decoration: none;
}

.link-preview__yt-host:hover {
    text-decoration: underline;
}

/* ── Generic site card ────────────────────────────────────── */

.link-preview--site {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
}

.link-preview__icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background-color: rgba(255, 85, 0, 0.10);
    color: #FF5500;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 1px solid rgba(255, 85, 0, 0.25);
}

.link-preview__body {
    flex: 1 1 auto;
    min-width: 0;
}

.link-preview__host {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #FF5500;
    margin-bottom: 2px;
}

.link-preview__url {
    font-size: 13px;
    font-weight: 600;
    color: #212529;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
}

.link-preview__open {
    flex: 0 0 auto;
    color: #6c757d;
    font-size: 13px;
}

/* Dark mode parity (if site.css ever opts in via `prefers-color-scheme`). */
@media (prefers-color-scheme: dark) {
    .link-preview {
        background-color: #1c1c22;
        border-color: #2e2e36;
    }

    .link-preview:hover {
        border-color: #45454f;
    }

    .link-preview__yt-footer {
        color: #a1a1aa;
    }

    .link-preview__url {
        color: #fafafa;
    }
}
