/* Social embed cards - static, build-time facades for quoting Mastodon /
   Twitter / Bluesky posts inside article content. No platform script loads. Migrated tweets use the twitter
   variant; avatars live in /img/site/avatars/. Loaded (with the
   social-logos.svg preload) only on pages that contain a card - see
   Site.stripUnusedLoaders. */

article .embed_social {
    --accent: var(--link);
    --embed-bg: var(--bg-secondary);
    --embed-border: var(--border);
    --embed-text: var(--text);
    --embed-text-secondary: var(--text-secondary);
    background: var(--embed-bg);
    border-radius: 22px;
    corner-shape: squircle;
    border: 1px solid var(--embed-border);
    min-width: 270px;
    max-width: 600px;
    padding: 20px 24px;
    /* Top margin for cards that follow bare text (migrated posts often have
       text outside a <p>); after a paragraph the margins collapse. */
    margin: 1.25em auto 1.75em;
}

article .embed_social::before {
    content: none;
}

article .embed_social[data-platform="mastodon"] {
    --accent: #6364FF;
    --embed-bg: #FFFFFF;
    --embed-border: #C0CDD9;
    --embed-text: #191B22;
    --embed-text-secondary: #606984;
}

article .embed_social[data-platform="twitter"] {
    --accent: #1DA1F2;
    --embed-bg: #F5F8FA;
    --embed-border: #E1E8ED;
    --embed-text: #14171A;
    --embed-text-secondary: #657786;
}

article .embed_social[data-platform="bluesky"] {
    --accent: #0085FF;
    --embed-bg: #FFFFFF;
    --embed-border: #D4DBE2;
    --embed-text: #0B0F19;
    --embed-text-secondary: #42576C;
}

article .embed_social[data-platform="instagram"] {
    --accent: #E1306C;
    --embed-bg: #FFFFFF;
    --embed-border: #DBDBDB;
    --embed-text: #000000;
    --embed-text-secondary: #737373;
}

[data-color-scheme="dark"] article .embed_social[data-platform="instagram"] {
    --accent: #F56A92;
    --embed-bg: #000000;
    --embed-border: #363636;
    --embed-text: #F5F5F5;
    --embed-text-secondary: #A8A8A8;
}

[data-color-scheme="dark"] article .embed_social[data-platform="mastodon"] {
    --accent: #8C8DFF;
    --embed-bg: #282C37;
    --embed-border: #393F4F;
    --embed-text: #FFFFFF;
    --embed-text-secondary: #9BAEA0;
}

[data-color-scheme="dark"] article .embed_social[data-platform="twitter"] {
    --embed-bg: #15202B;
    --embed-border: #38444D;
    --embed-text: #FFFFFF;
    --embed-text-secondary: #8899A6;
}

[data-color-scheme="dark"] article .embed_social[data-platform="bluesky"] {
    --accent: #208BFE;
    --embed-bg: #161E27;
    --embed-border: #2E3641;
    --embed-text: #FFFFFF;
    --embed-text-secondary: #8D9AAA;
}

.embed_social .header {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 40px;
    align-items: center;
    margin-bottom: 16px;
}

.embed_social .avatar {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    corner-shape: squircle;
    margin: 0;
    display: block;
}

.embed_social[data-platform="twitter"] .avatar,
.embed_social[data-platform="instagram"] .avatar,
.embed_social[data-platform="bluesky"] .avatar {
    border-radius: 50%;
    /* These are circular; reset the squircle inherited from the base
       .avatar rule so corner-shape doesn't turn them into rounded squares. */
    corner-shape: round;
}

.embed_social a.name_header {
    line-height: 22px;
    display: grid;
    gap: 10px;
    grid-template-columns: 46px 1fr;
    align-items: center;
    text-decoration: none;
}

.embed_social a.name_header:hover .display_name {
    text-decoration: underline;
    text-decoration-color: var(--embed-text);
}

.embed_social .name {
    min-width: 0;
}

.embed_social .name .display_name,
.embed_social .name .account_name {
    display: block;
    font-size: 15px;
}

.embed_social .name .display_name {
    font-weight: 600;
    color: var(--embed-text);
}

.embed_social .name .account_name {
    color: var(--embed-text-secondary);
}

.embed_social .embed_logo {
    width: 40px;
    height: auto;
    color: var(--accent);
}
/* The bird and the Instagram camera are solid glyphs that read heavier than
   the other logos. */
.embed_social[data-platform="twitter"] .embed_logo,
.embed_social[data-platform="instagram"] .embed_logo {
    width: 30px;
    justify-self: end;
    /* Top-aligned and dropped so the glyph sits as far from the card's top
       edge as from its right (the 20px top padding is less than the 24px
       sides). */
    align-self: start;
    margin-top: 2px;
}

.embed_social .text {
    color: var(--embed-text);
    font-size: 19px;
    line-height: 24px;
    margin: 0;
    white-space: pre-wrap;
}

.embed_social .text a,
.embed_social .meta a {
    text-decoration: none;
}

.embed_social .text a {
    color: var(--accent);
}

.embed_social .text a:hover,
.embed_social .meta a:hover {
    text-decoration: underline;
}

.embed_social .meta {
    margin: 16px 0 0;
}

.embed_social .meta a {
    color: var(--embed-text-secondary);
    font-size: 14px;
}

.embed_social .media {
    margin-top: 12px;
    display: grid;
    gap: 4px;
    grid-template-columns: 1fr 1fr;
}

.embed_social .media:has(> a:only-child),
.embed_social .media:has(> .media-missing) {
    grid-template-columns: 1fr;
}

.embed_social .media a {
    display: block;
    line-height: 0;
}

.embed_social .media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    border-radius: 8px;
    corner-shape: squircle;
    margin: 0;
}

/* A photo deleted from Instagram since it was embedded: a grey square holds
   its place, so the card keeps its shape and caption. */
.embed_social .media-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 8px;
    corner-shape: squircle;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.4;
}

/* Instagram leads with the photo, so the caption sits below it. */
.embed_social[data-platform="instagram"] .media {
    margin: 0 0 12px;
}

/* Instagram's glyph is plain black on the light card and white on the dark
   one, like the app's own chrome (the pink accent stays on caption links). */
.embed_social[data-platform="instagram"] .embed_logo {
    color: #000;
    /* The camera fills its viewBox edge to edge (the bird doesn't), so it
       drops further for the same even corner. */
    margin-top: 4px;
}
[data-color-scheme="dark"] .embed_social[data-platform="instagram"] .embed_logo {
    color: #fff;
}

/* A bigger name sitting tighter over the handle. */
.embed_social[data-platform="instagram"] .name .display_name {
    font-size: 17px;
    line-height: 20px;
}
.embed_social[data-platform="instagram"] .name .account_name {
    line-height: 18px;
}

/* Name and handle tucked a little closer to the avatar. */
.embed_social[data-platform="instagram"] a.name_header {
    gap: 7px;
}
