/* ============================================================
   Memos 页面样式（多站点合并时间轴版）
   全部使用主题变量，自动适配明暗主题
   ============================================================ */

/* ------------------------------------------------------------
   1. 时间轴容器
   ------------------------------------------------------------ */

.memos-container {
    position: relative;
    min-height: 200px;
    padding-left: 0;
}

/* 竖直渐变线 */
.memos-container::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 91px;
    width: 1px;
    background: linear-gradient(
        to bottom,
        var(--accent-1),
        var(--accent-2) 55%,
        rgba(244, 114, 182, 0.18)
    );
}

/* ------------------------------------------------------------
   2. 单条 memo：左时间 / 右内容
   ------------------------------------------------------------ */

.memos-item {
    position: relative;
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 44px;
    padding-bottom: 28px;
}

.memos-item:last-child {
    padding-bottom: 0;
}

/* 左侧时间列 */
.memos-header {
    position: relative;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-top: 0;
    text-align: right;
}

.memos-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

/* 圆点 */
.memos-header::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 85px;
    width: 9px;
    height: 9px;
    transform: translateY(-50%);
    border: 2px solid var(--bg);
    border-radius: 50%;
    background: var(--accent-2);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.14);
}

/* 时间链接 */
.memos-time {
    display: inline-block;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.83rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    transition: color 180ms ease-out;
}

.memos-time:hover {
    color: var(--accent-2);
}

/* 来源标签：与时间垂直居中 */
.memos-site-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    line-height: 1;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-2);
    white-space: nowrap;
    box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.24);
}

.memos-site-laohe {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.24);
}

.memos-site-yezhiyun {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.24);
}

.memos-site-mrhe {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-1);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.24);
}

/* ------------------------------------------------------------
   3. 右侧内容卡片
   ------------------------------------------------------------ */

.memos-content {
    min-width: 0;
    padding: 21px 22px;
    border-radius: var(--radius-small);
    background: var(--card-surface);
    box-shadow: var(--shadow-border);
    color: var(--text-soft);
    font-size: 0.98rem;
    line-height: 1.9;
    overflow-wrap: anywhere;
    word-break: break-word;
    transition: background-color 200ms ease-out, box-shadow 200ms ease-out, transform 200ms ease-out;
}

.memos-content:hover {
    background: var(--card-surface-hover);
    box-shadow: var(--shadow-border), 0 14px 34px rgba(0, 0, 0, 0.16), 0 0 22px rgba(6, 182, 212, 0.1);
    transform: translateY(-2px);
}

/* ------------------------------------------------------------
   4. Markdown 内容排版
   ------------------------------------------------------------ */

.memos-markdown-content h1,
.memos-markdown-content h2,
.memos-markdown-content h3,
.memos-markdown-content h4 {
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    color: var(--text);
    font-weight: 700;
    line-height: 1.4;
}

.memos-markdown-content h1 { font-size: 1.5rem; }
.memos-markdown-content h2 { font-size: 1.28rem; }
.memos-markdown-content h3 { font-size: 1.12rem; }
.memos-markdown-content h4 { font-size: 1rem; }

.memos-markdown-content p {
    margin: 0 0 0.82em;
}

.memos-markdown-content p:last-child {
    margin-bottom: 0;
}

.memos-markdown-content a {
    color: var(--accent-2);
    text-decoration: underline;
    text-decoration-color: rgba(6, 182, 212, 0.35);
    text-underline-offset: 3px;
    transition: text-decoration-color 180ms ease-out;
}

.memos-markdown-content a:hover {
    text-decoration-color: currentColor;
}

.memos-markdown-content ul,
.memos-markdown-content ol {
    padding-left: 1.35em;
    margin: 0.5em 0 0.9em;
}

.memos-markdown-content li {
    margin: 0.3em 0;
}

.memos-markdown-content blockquote {
    padding-left: 14px;
    margin: 0.9em 0;
    border-left: 2px solid var(--accent-2);
    color: var(--text-muted);
}

.memos-markdown-content code {
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--text);
    background: var(--bg-2);
    font-family: var(--font-mono);
    font-size: 0.88em;
}

.memos-markdown-content pre {
    padding: 13px 15px;
    overflow-x: auto;
    border-radius: 6px;
    background: var(--bg-2);
    font-family: var(--font-mono);
    font-size: 0.86rem;
    line-height: 1.7;
    margin: 1em 0;
}

.memos-markdown-content pre code {
    padding: 0;
    background: transparent;
}

/* ------------------------------------------------------------
   5. 图片
   ------------------------------------------------------------ */

.memos-img-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 7px;
    margin: 12px 0;
}

.memos-img-group img {
    width: 100%;
    height: auto;
    max-height: 240px;
    object-fit: contain;
    border-radius: 6px;
    margin: 0;
    display: block;
    background: var(--bg-2);
    cursor: zoom-in;
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}

.memos-img-group img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    z-index: 1;
}

.memos-img-group:has(img:only-child) {
    grid-template-columns: 1fr;
    justify-items: center;
}

.memos-img-group:has(img:only-child) img {
    width: auto;
    max-width: 100%;
    max-height: 300px;
    margin: 0 auto;
}

.memos-markdown-content p > img {
    max-width: 100%;
    max-height: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    margin: 8px 0;
    display: block;
    background: var(--bg-2);
    cursor: zoom-in;
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}

.memos-markdown-content p > img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

@supports not selector(:has(*)) {
    .memos-img-group {
        display: block;
    }
    .memos-img-group img {
        width: auto;
        max-width: 100%;
        max-height: 240px;
        margin: 8px 0;
    }
}

/* ------------------------------------------------------------
   6. 标签
   ------------------------------------------------------------ */

.memos-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.memos-label {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    line-height: 1.4;
}

/* ------------------------------------------------------------
   7. 附件
   ------------------------------------------------------------ */

.memos-attachment-image img {
    max-width: 100%;
    max-height: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    display: inline-block;
    background: var(--bg-2);
    cursor: zoom-in;
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}

.memos-attachment-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.memos-attachment-file a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--bg-2);
    color: var(--accent-2);
    text-decoration: none;
    font-size: 0.82rem;
    transition: background-color 180ms ease-out, color 180ms ease-out;
}

.memos-attachment-file a:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.memos-attachment-size {
    color: var(--text-muted);
    font-size: 0.72rem;
}

/* ------------------------------------------------------------
   8. 分页
   ------------------------------------------------------------ */

.memos-pagination {
    display: flex;
    margin-top: 38px;
    padding: 0;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.memos-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    min-height: 42px;
    padding: 8px 18px;
    border-radius: 8px;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-border);
    text-decoration: none;
    font-size: 0.86rem;
    transition: color 180ms ease-out, background-color 180ms ease-out, box-shadow 180ms ease-out, transform 180ms ease-out;
}

.memos-page-btn:hover {
    color: var(--accent-2);
    background: var(--surface-hover);
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.5);
    transform: translateY(-2px);
}

.memos-page-btn:active {
    transform: scale(0.96);
}

.memos-page-info {
    min-width: 68px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    text-align: center;
}

/* ------------------------------------------------------------
   9. 空状态 / 错误
   ------------------------------------------------------------ */

.memos-error {
    padding: 18px;
    border-radius: 8px;
    color: #fda4af;
    background: rgba(244, 63, 94, 0.1);
    box-shadow: inset 0 0 0 1px rgba(244, 63, 94, 0.24);
    text-align: center;
    font-size: 0.88rem;
}

.memos-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ------------------------------------------------------------
   10. 响应式
   ------------------------------------------------------------ */

@media (max-width: 768px) {
    .memos-container::before {
        left: 7px;
    }

    .memos-item {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding-bottom: 24px;
        padding-left: 28px;
    }

    .memos-header {
        min-height: 0;
        padding-top: 0;
        align-items: flex-start;
        justify-content: flex-start;
        text-align: left;
    }

    .memos-header::before {
        top: 8px;
        left: 3px;
        transform: none;
    }

    .memos-header-left {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .memos-time {
        font-size: 0.78rem;
    }

    .memos-content {
        padding: 18px;
        font-size: 0.94rem;
        line-height: 1.8;
    }

    .memos-img-group {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 6px;
    }

    .memos-img-group img,
    .memos-markdown-content p > img {
        max-height: 180px;
    }

    .memos-img-group:has(img:only-child) img {
        max-height: 260px;
    }

    .memos-attachment-image img {
        max-height: 180px;
    }

    .memos-pagination {
        gap: 8px;
    }

    .memos-page-btn {
        min-width: 80px;
        padding-inline: 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 420px) {
    .memos-content {
        padding: 16px;
    }

    .memos-site-badge {
        font-size: 0.68rem;
        padding: 2px 7px;
    }
}