/* Memos 专用样式 - 卡片式备忘录布局 */

/* 覆盖 #content 背景为透明 */
.memos-section#content {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 2rem 0;
}

/* 隐藏 extras 区域 */
.memos-section ~ #extras {
    display: none;
}

.memos-section {
    margin: 0 auto;
}

.memos-header {
    text-align: left;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border-warm);
}

.memos-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--color-text-body);
    margin-bottom: 0.2rem;
}

.memos-subtitle {
    color: var(--color-text-muted);
    font-size: 0.92rem;
    font-style: normal;
    margin: 0;
}

.memos-feed-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 1rem;
    padding: 0.15rem 0 0.7rem 0.9rem;
    border-bottom: 1px solid var(--color-border-warm);
    position: relative;
}

.memos-feed-header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.2rem;
    bottom: 0.75rem;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #c74350 0%, #e06b75 100%);
}

.memos-feed-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.3;
    font-weight: 600;
    color: var(--color-accent-text);
}

.memos-feed-meta {
    margin: 0;
    font-size: 0.86rem;
    color: var(--color-text-muted);
}

.memos-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* 备忘录卡片 - 无下坠脏条的克制微轮廓与漫反射微光 */
.memo-card {
    background: #ffffff;
    border-radius: 10px;
    border: none;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: box-shadow 0.2s ease;
}

.memo-card:hover {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.05);
}

.memo-card::before {
    display: none;
}

.memo-header {
    padding: 0.85rem 1rem 0.3rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.memo-date {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: 400;
    background: transparent;
    padding: 0;
    border-radius: 0;
    white-space: nowrap;
}

.memo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 标签和“阅读更多”保留 ::after 的负偏移下划线；共享全局粗细与速度。
   代价是 ::after 用 left:0/right:0 绝对定位，折行的 inline 链接会画歪，
   所以这套写法只用在这两个短标签上，别往会折行的文本链接上推广。 */
.memos-section .memo-tag {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-weight: 400;
    text-decoration: none;
    display: inline-block;
    position: relative;
    text-shadow: none;
    transition: color 0.2s ease;
}

.memos-section .memo-tag::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: var(--underline-thickness);
    background: var(--color-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--underline-speed) ease;
}

.memos-section .memo-tag:hover {
    background: transparent;
    color: var(--color-accent-text);
    transform: none;
    text-shadow: none;
}

.memos-section .memo-tag:hover::after {
    transform: scaleX(1);
}

.memo-content {
    padding: 0 1rem 1rem;
}

.memo-content-text {
    color: var(--color-text-body);
    font-size: 1.03rem;
    line-height: 1.6;
    margin: 0.5rem 0 0;
    font-family: var(--font-sans);
}

.memo-content-text + .memo-footer {
    margin-top: 0.75rem;
}

/* 列表只展示实际小图；正文原图与原排版留在详情页。 */
.memo-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 1rem;
}

.memo-content > .memo-thumbnails:first-child {
    margin-top: 0.25rem;
}

.memos-section a.memo-thumbnail {
    --memo-height: 96px;
    --memo-max-width: 192px;
    display: block;
    flex: 0 1 auto;
    width: clamp(48px, calc(var(--memo-height) * var(--memo-ratio)), var(--memo-max-width));
    max-width: min(var(--memo-max-width), calc((100% - 8px) / 2));
    height: var(--memo-height);
    overflow: hidden;
    border-radius: 6px;
    background: var(--color-bg-subtle);
    outline: 1px solid color-mix(in srgb, var(--color-text-body) 8%, transparent);
    outline-offset: -1px;
    text-decoration: none;
    cursor: zoom-in;
}

.memos-section a.memo-thumbnail:only-child {
    --memo-height: 160px;
    --memo-max-width: 320px;
    max-width: 100%;
}

.memos-section a.memo-thumbnail:hover,
.memos-section a.memo-thumbnail:focus {
    background: var(--color-bg-subtle);
    text-decoration: none;
}

.memos-section a.memo-thumbnail:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

.memo-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin: 0;
    cursor: zoom-in;
}


@media (max-width: 768px) {
    .memos-section a.memo-thumbnail {
        --memo-height: 80px;
        --memo-max-width: 160px;
    }

    .memos-section a.memo-thumbnail:only-child {
        --memo-height: 120px;
        --memo-max-width: 240px;
    }
}

.glightbox-container .memo-lightbox-counter {
    position: absolute;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 10000;
    transform: translateX(-50%);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-pill);
    color: var(--color-text-inverse);
    background: var(--viewer-control-bg);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.memo-content-text p {
    margin-bottom: 0.8rem;
}

.memo-content-text p:last-child {
    margin-bottom: 0;
}

.memo-content-text h1, 
.memo-content-text h2, 
.memo-content-text h3,
.memo-content-text h4,
.memo-content-text h5,
.memo-content-text h6 {
    font-size: 1rem;
    margin: 0.5rem 0;
    color: #333;
}

.memo-content-text code {
    background: var(--color-bg-subtle);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.memo-content-text pre {
    background: var(--color-bg-subtle);
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    /* 自定义滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 var(--color-bg-subtle);
}

.memo-content-text pre::-webkit-scrollbar {
    height: 6px;
}

.memo-content-text pre::-webkit-scrollbar-track {
    background: var(--color-bg-subtle);
    border-radius: 3px;
}

.memo-content-text pre::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.memo-content-text pre::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.memo-content-text pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: #212529;
    font-family: var(--font-mono);
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
}

.memo-content-text blockquote {
    padding-left: 0.8rem;
    margin: 0.5rem 0;
    font-style: italic;
}

.memo-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0;
    border-top: 0;
}

.memos-section .memo-read-more {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 400;
    padding: 0;
    border-radius: 0;
    background: transparent;
    position: relative;
    text-shadow: none;
    transition: color 0.2s ease;
}

.memos-section .memo-read-more::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: var(--underline-thickness);
    background: var(--color-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--underline-speed) ease;
}

.memos-section .memo-read-more:hover {
    background: transparent;
    color: var(--color-accent-text);
    text-shadow: none;
}

.memos-section .memo-read-more:hover::after {
    transform: scaleX(1);
}

@media (min-width: 769px) {
    .memos-section#content {
        padding-top: 36px;
    }

    .memos-feed-header {
        padding: 0 30px 12px;
    }

    .memos-feed-header::before {
        left: 14px;
        top: 0;
        bottom: 12px;
    }

    .memos-feed-title {
        font-size: 1.75rem;
        line-height: 1.35;
    }

    .memo-header,
    .memo-content {
        padding-left: 30px;
        padding-right: 30px;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .memos-section#content {
        padding: 1.5rem 0.75rem;
    }
    
    .memos-container {
        gap: 1rem;
    }
    
    .memos-title {
        font-size: 2rem;
    }

    .memos-feed-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .memo-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .memo-tags {
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .memos-title {
        font-size: 1.75rem;
    }
    
    .memo-card {
        border-radius: 6px;
    }
    
    .memo-content {
        padding: 0 1rem 1rem;
    }
    
    .memo-content-text pre {
        padding: 0.75rem;
        margin: 0.75rem 0;
        font-size: 0.8rem;
        border-radius: 4px;
    }
}

/* 空状态样式 */
.memos-section .memos-header + .category-info {
    text-align: center;
    color: var(--color-text-muted);
    font-style: italic;
    margin-top: 2rem;
}

.memo-content-text ul,
.memo-content-text ol {
    margin: 0.6rem 0 1.2rem 0;
    padding-left: 0;
    list-style: none;
}

.memo-content-text li {
    position: relative;
    margin-bottom: 0.6rem;
    padding-left: 1.6rem;
    
    font-size: 1.05rem;   
    line-height: 1.7;   
    color: var(--color-text-body);
}

.memo-content-text li:last-child {
    margin-bottom: 0;
}

.memo-content-text ul > li::before {
    content: '';
    position: absolute;
    left: 0.4rem;        
    
    top: 0.75rem;         
    width: 4px;          
    height: 4px;
    
    background-color: var(--color-accent);
    border-radius: 50%;
    opacity: 0.8;      
}


.memo-content-text ol {
    counter-reset: memo-counter;
}

.memo-content-text ol > li::before {
    content: counter(memo-counter) ".";
    counter-increment: memo-counter;
    position: absolute;
    left: 0;
    
    top: 0.1rem;       
    font-size: 0.85em;   
    font-weight: 400;    
    
    font-family: var(--font-mono);
    color: var(--color-accent-text);
    width: 1.4rem;
    text-align: left;
}


.memo-content-text ul ul,
.memo-content-text ol ul,
.memo-content-text ul ol,
.memo-content-text ol ol {
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
    margin-left: 0.2rem;  
}

.memo-content-text ul ul > li::before {
    background-color: transparent;
    border: 1px solid var(--color-text-muted);
    box-sizing: border-box;
    width: 5px;  
    height: 5px;
    top: 0.72rem;
}

.memo-content-text ol ol > li::before { color: var(--color-text-muted); }

.memo-content-text li input[type="checkbox"] {
    margin-right: 0.5rem;
    position: absolute;
    left: 0;
    top: 0.45rem;
}

.memo-content-text li:has(input[type="checkbox"]) {
    padding-left: 1.8rem;
    list-style: none;
}
.memo-content-text li:has(input[type="checkbox"])::before {
    display: none;
}

/* 趣味漫画翻页控制区 */
.comic-pager {
    display: flex;
    align-items: stretch;
    margin: 2rem 0 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.comic-pager-btn {
    flex: 1 1 50%;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 1.1rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-secondary);
    text-decoration: none;
    background-image: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.comic-pager-btn-prev {
    justify-content: flex-start;
}

.comic-pager-btn-next {
    justify-content: flex-end;
}

a.comic-pager-btn:hover {
    color: var(--color-accent);
    background-color: rgba(199, 67, 80, 0.06);
}

.comic-pager-btn-disabled {
    color: var(--color-text-muted);
    opacity: 0.5;
    cursor: default;
}

.comic-pager-btn-icon {
    display: inline-flex;
    align-items: center;
}

.comic-pager-btn-icon svg {
    width: 0.85em;
    height: 0.85em;
}

.comic-pager-divider {
    width: 1px;
    background: var(--color-border);
}

@media screen and (max-width: 480px) {
    .comic-pager-btn {
        padding: 0.6rem 0.75rem;
        font-size: 0.82rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .memo-card,
    .memos-section .memo-tag,
    .memos-section .memo-tag::after,
    .memos-section .memo-read-more,
    .memos-section .memo-read-more::after {
        transition: none;
    }
}
