/**
 * 老苏 · 视频 / 音乐 / 链接卡片 —— 前台样式
 *
 * 颜色全部走主题变量 + 兜底值：在「老苏」主题下完全融入，
 * 换到别的主题（没有这套变量）时也不会变成透明或黑块。
 * 类名统一 ls-embed 前缀，避免和主题、其它插件的 .card / .player 撞车。
 */

.entry-content .ls-embed,
.ls-embed {
    margin: 1.4em 0;
}

/* 视频与音乐播放器只占内容宽度的 75%，居中显示；
   卡片不在此列，仍然通栏。窄屏放不下 75% 时退回全宽。 */
.ls-embed.ls-embed--video,
.ls-embed.ls-embed--audio {
    width: 75%;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {

    .ls-embed.ls-embed--video,
    .ls-embed.ls-embed--audio {
        width: 100%;
    }
}

/* ------------------------------------------------------------------- 视频 */

.ls-embed__frame {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    background: #0e1216;
    box-shadow: 0 1px 2px rgba(20, 35, 48, 0.06);
}

.ls-embed__frame iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.ls-embed--video video {
    display: block;
    width: 100%;
    border-radius: var(--radius-lg, 12px);
    background: #0e1216;
}

.ls-embed__cap {
    margin: 0.55em 0 0;
    font-size: 12px;
    line-height: 1.6;
    text-align: right;
    color: var(--text-muted, #8a94a6);
}

.ls-embed__cap a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

.ls-embed__cap a:hover {
    color: var(--primary, #2f6bff);
}

/* 短代码里塞了不是网址的内容时，只回显原文，不生成任何可点元素 */

.ls-embed-bad {
    color: var(--text-muted, #8a94a6);
    border-bottom: 1px dashed currentColor;
}

/* ------------------------------------------------------------------- 音频 */

/* 官方外链播放器（版权受限时才会出现） */
.ls-embed--audio iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    border: 0;
    border-radius: var(--radius, 8px);
}

/* --------------------------------------------------------------- 音乐播放器 */

/*
 * 自建播放器：扁平风格 —— 一层浅底、一条 1px 细边、一个实心圆按钮，
 * 没有渐变、没有投影、没有描边拟物。尺寸和圆角都跟主题卡片对齐，
 * 放在正文里像是主题自己长出来的一个组件。
 */
.ls-music {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    width: 75%;
    margin: 1.4em auto;
    padding: 10px 14px;
    border: 1px solid var(--border, #e3e9f0);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-soft, #f7f9fc);
}

@media (max-width: 768px) {
    .ls-music {
        width: 100%;
        gap: 10px;
        padding: 10px 12px;
    }
}

.ls-music__cover {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--primary-weak, #eef3ff);
    color: var(--primary, #2f6bff);
    font-size: 20px;
    line-height: 1;
}

.ls-music__cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ls-music__main {
    flex: 1 1 140px;
    min-width: 0;
}

.ls-music__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    min-width: 0;
}

.ls-music__title {
    min-width: 0;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text, #2b3445);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ls-music__artist {
    flex: 0 1 auto;
    overflow: hidden;
    max-width: 11em;
    font-size: 12px;
    color: var(--text-muted, #8a94a6);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 「来自网易云音乐」—— 出处，推到标题行右侧，不抢注意力 */
.ls-music__from {
    flex: 0 0 auto;
    max-width: 10em;
    margin-left: auto;
    overflow: hidden;
    font-size: 11.5px;
    color: var(--text-muted, #8a94a6);
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-bottom: 1px dotted currentColor;
}

.ls-music__from:hover {
    color: var(--primary, #2f6bff);
}

.ls-music__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.ls-music__track {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    height: 16px;
    cursor: pointer;
    outline: none;
    touch-action: none;
}

.ls-music__track::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 999px;
    background: var(--border, #e3e9f0);
}

.ls-music__track:focus-visible::before {
    box-shadow: 0 0 0 2px var(--primary-weak, #eef3ff);
}

.ls-music__fill {
    position: relative;
    z-index: 1;
    height: 3px;
    width: 0;
    border-radius: 999px;
    background: var(--primary, #2f6bff);
}

.ls-music__dot {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 0;
    width: 9px;
    height: 9px;
    margin: -4.5px 0 0 -4.5px;
    border-radius: 50%;
    background: var(--primary, #2f6bff);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.ls-music__track:hover .ls-music__dot,
.ls-music[data-state="playing"] .ls-music__dot {
    opacity: 1;
}

.ls-music__time {
    flex: 0 0 auto;
    font-size: 11.5px;
    color: var(--text-muted, #8a94a6);
    font-variant-numeric: tabular-nums;
}

.ls-music__time span + span::before {
    content: " / ";
}

/* 按钮区：两个圆形按钮，实心主色是播放，描边是静音 */
.ls-music__toggle,
.ls-music__vol {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-family: inherit;
}

.ls-music__toggle {
    width: 40px;
    height: 40px;
    background: var(--primary, #2f6bff);
    color: #fff;
    transition: background 0.15s ease;
}

.ls-music__toggle:hover {
    background: var(--primary-hover, #1f58e6);
}

.ls-music__toggle svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.ls-music__i-pause {
    display: none;
}

.ls-music[data-state="playing"] .ls-music__i-play {
    display: none;
}

.ls-music[data-state="playing"] .ls-music__i-pause {
    display: block;
}

/* 缓冲/载入：按钮压暗，不给读者一根没反应的进度条 */
.ls-music[data-state="loading"] .ls-music__toggle {
    background: var(--border-strong, #b9c6d8);
}

.ls-music__vol {
    width: 32px;
    height: 32px;
    background: none;
    color: var(--text-muted, #8a94a6);
    border: 1px solid transparent;
}

.ls-music__vol:hover {
    color: var(--text, #2b3445);
    border-color: var(--border, #e3e9f0);
}

.ls-music__vol svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ls-music__vol svg path:first-child {
    fill: currentColor;
    stroke: none;
}

.ls-music__mute {
    display: none;
}

.ls-music[data-muted="1"] .ls-music__wave {
    display: none;
}

.ls-music[data-muted="1"] .ls-music__mute {
    display: block;
}

.ls-music[data-muted="1"] .ls-music__vol {
    color: var(--text-muted, #8a94a6);
}

/* 播不了时的提示行（和兜底的官方播放器占满一行） */
.ls-music__tip {
    flex: 0 0 100%;
    margin: 0;
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-muted, #8a94a6);
}

.ls-music__tip a {
    color: var(--primary, #2f6bff);
    text-decoration: none;
}

.ls-music.is-failed .ls-music__bar {
    opacity: 0.4;
}

.ls-music__frame {
    flex: 0 0 100%;
    overflow: hidden;
    border-radius: 8px;
}

.ls-music__frame iframe {
    display: block;
    width: 100%;
    height: 66px;
    border: 0;
}

/*
 * 会员专享：和播放器同一副骨架，但没有进度条 —— 这里本来就没有音频可放。
 * 说明文字代替进度条的位置，右侧换成「去听」，读者不会以为是自己不会点。
 */
.ls-music--locked {
    border-style: dashed;
}

.ls-music--locked .ls-music__title {
    color: var(--text, #2b3445);
}

.ls-music__why {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-muted, #8a94a6);
}

.ls-music__go {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 36px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--primary, #2f6bff);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.ls-music__go:hover {
    background: var(--primary-hover, #1f58e6);
    color: #fff;
}

/* ------------------------------------------------------------------- 卡片 */

/* 和播放器同一套扁平语言：细边、浅底、75% 居中。
   上下结构：上部 16:9 网页截图，下部标题 / 描述 / 出处。 */
.ls-embed-card {
    display: block;
    box-sizing: border-box;
    width: 75%;
    margin: 1.4em auto;
    overflow: hidden;
    border: 1px solid var(--border, #e3e9f0);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-soft, #f7f9fc);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.ls-embed-card:hover {
    border-color: var(--primary, #2f6bff);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(25, 43, 62, 0.08);
}

.ls-embed-card__shot {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(
        135deg,
        hsl(var(--ls-tint, 210) 55% 93%),
        hsl(var(--ls-tint, 210) 48% 86%)
    );
}

/* object-position 用 top：网页截图顶部是站点头图和标题，最有辨识度 */
.ls-embed-card__img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    /* 整张卡就是一个链接：图片不接事件，点击直接落到外层 <a> 上。
       否则主题的看图灯箱会把它当普通正文图弹出来，卡片上半部分就「点不动」了 */
    pointer-events: none;
}

.ls-embed-card__initial {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 44px;
    font-weight: 700;
    color: hsl(var(--ls-tint, 210) 45% 42%);
    letter-spacing: 0.02em;
}

/* 占位时的小字提示：截图在后台生成中，不占地方也不误导 */
.ls-embed-card__initial::after {
    content: attr(data-tip);
    font-size: 11.5px;
    font-weight: 400;
    letter-spacing: 0;
    color: hsl(var(--ls-tint, 210) 35% 52%);
}

.ls-embed-card__body {
    padding: 12px 14px 13px;
}

.ls-embed-card__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text, #2b3445);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ls-embed-card__desc {
    margin-top: 5px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-muted, #7b8798);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .ls-embed-card {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .ls-embed-card__shot {
        aspect-ratio: 2 / 1;
    }

    .ls-embed-card__initial {
        font-size: 32px;
    }

    .ls-embed-card__title {
        font-size: 14px;
        -webkit-line-clamp: 2;
    }

    .ls-embed-card__desc {
        display: none;
    }
}

/* 打印时播放器没有意义，卡片留个地址更实用 */

@media print {
    .ls-embed__frame,
    .ls-embed--audio iframe,
    .ls-music {
        display: none;
    }

    .ls-embed-card {
        border: 1px solid #ccc;
        background: none;
    }
}
