/*
Theme Name: 小红书风格主题 (XiaoHongShu Style)
Description: 基于小红书设计的WordPress多语言博客主题，支持瀑布流布局和多图片展示
Version: 1.0.0
Author: AI Assistant
Text Domain: xiaohongshu-theme
*/

/* CSS Variables - 小红书色彩系统 */
:root {
    --color-red: #ff2e4d;
    --color-background: #ffffff;
    --color-primary-label: #333333;
    --color-secondary-label: #666666;
    --color-tertiary-label: #999999;
    --color-quaternary-label: #cccccc;
    --color-border: #e8e8e8;
    --color-active-background: #f5f5f5;
    --color-white: #ffffff;
    --color-link: #ff2e4d;
    --elevation-high-background: #ffffff;
    --elevation-high-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --elevation-low-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --mask-backdrop: rgba(0, 0, 0, 0.5);
    --mask-note-card: rgba(0, 0, 0, 0.05);
    --note-card-corner-radius: 12px;
}

/* Dark Mode Variables */
@media (prefers-color-scheme: dark) {
    :root {
        --color-background: #1a1a1a;
        --color-primary-label: #ffffff;
        --color-secondary-label: #cccccc;
        --color-tertiary-label: #999999;
        --color-quaternary-label: #666666;
        --color-border: #333333;
        --color-active-background: #2a2a2a;
        --elevation-high-background: #2a2a2a;
    }
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--color-background);
    color: var(--color-primary-label);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Header Styles */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--elevation-high-background);
    box-shadow: var(--elevation-high-shadow);
    z-index: 1000;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.site-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-red);
    text-decoration: none;
    margin-right: auto;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-switcher a {
    color: var(--color-secondary-label);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.language-switcher a:hover,
.language-switcher a.current {
    background: var(--color-active-background);
    color: var(--color-primary-label);
}

/* Main Content */
.main-content {
    padding-top: 80px;
    min-height: 100vh;
}

/* Masonry Layout - 瀑布流布局 */
.masonry-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    columns: 4;
    column-gap: 20px;
}

@media (max-width: 1024px) {
    .masonry-container {
        columns: 3;
    }
}

@media (max-width: 768px) {
    .masonry-container {
        columns: 2;
        padding: 15px;
        column-gap: 15px;
    }
}

@media (max-width: 480px) {
    .masonry-container {
        columns: 1;
        padding: 10px;
    }
}

/* Post Card Styles */
.post-card {
    break-inside: avoid;
    margin-bottom: 20px;
    background: var(--elevation-high-background);
    border-radius: var(--note-card-corner-radius);
    overflow: hidden;
    box-shadow: var(--elevation-low-shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.post-card:hover {
    box-shadow: var(--elevation-high-shadow);
    transform: translateY(-2px);
}

/* Post Images */
.post-images {
    position: relative;
    overflow: hidden;
    border-radius: var(--note-card-corner-radius) var(--note-card-corner-radius) 0 0;
}

.post-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.post-card:hover .post-image {
    transform: scale(1.05);
}

/* Multiple Images Layout */
.post-images.multiple {
    display: grid;
    gap: 2px;
}

.post-images.count-2 {
    grid-template-columns: 1fr 1fr;
}

.post-images.count-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.post-images.count-3 .post-image:first-child {
    grid-row: 1 / 3;
}

.post-images.count-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.post-images.count-5,
.post-images.count-6 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);
}

.post-images.count-5 .post-image:first-child,
.post-images.count-6 .post-image:first-child {
    grid-row: 1 / 3;
}

.post-images.count-7,
.post-images.count-8 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: repeat(3, 1fr);
}

/* Post Content */
.post-content {
    padding: 16px;
}

.post-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary-label);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-excerpt {
    font-size: 14px;
    color: var(--color-secondary-label);
    line-height: 1.4;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Post Meta */
.post-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.post-author {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--color-tertiary-label);
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid var(--color-border);
}

.post-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--color-tertiary-label);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-item:hover {
    color: var(--color-red);
}

/* Post Tags */
.post-tags {
    margin: 8px 0 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-tag {
    font-size: 12px;
    color: var(--color-tertiary-label);
    background: var(--color-active-background);
    padding: 4px 8px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s;
}

.post-tag:hover {
    background: var(--color-red);
    color: var(--color-white);
}

/* Loading Animation */
.loading-skeleton {
    background: var(--color-active-background);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.loading-skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .site-header {
        padding: 0 15px;
        height: 50px;
    }
    
    .site-title {
        font-size: 18px;
    }
    
    .main-content {
        padding-top: 70px;
    }
    
    .post-card {
        margin-bottom: 15px;
    }
    
    .post-content {
        padding: 12px;
    }
}

/* Post detail layout - 左图右文布局 */
.xhs-post {
    display: grid;
    grid-template-columns: minmax(320px, 560px) 1fr;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 24px;
}

@media (max-width: 1024px) {
    .xhs-post {
        grid-template-columns: 1fr;
    }
}

.xhs-post__left {
    position: relative;
    overflow: hidden; /* 防止左侧卡片溢出遮挡右侧文字 */
}

/* 重叠卡片式图片滑动 */
.xhs-slider {
    --xhs-stack-offset: 36; /* 每张卡片的水平偏移（px），JS 会读取 */
    position: relative;
    overflow: hidden; /* 防止溢出到右侧 */
}

.xhs-slider__viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5; /* 近似小红书图片比例 */
    border-radius: 16px;
    overflow: hidden; /* 视口裁剪，保证叠放只在左列内部可见 */
}

.xhs-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--elevation-high-shadow);
    transition: transform .3s ease, opacity .25s ease;
    background: var(--color-active-background);
}

.xhs-slide img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.xhs-slider__btn {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px;
    border-radius: 50%; border: 1px solid var(--color-border);
    background: var(--elevation-high-background);
    color: var(--color-secondary-label);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: var(--elevation-low-shadow);
}
.xhs-slider__btn:hover { color: var(--color-primary-label); background: var(--color-active-background); }
.xhs-slider__btn:disabled { opacity: .4; cursor: not-allowed; }
.xhs-slider__btn.prev { left: 8px; }
.xhs-slider__btn.next { right: 8px; }

.xhs-slider__dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.xhs-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--color-border); border: none; padding: 0; cursor: pointer;
}
.xhs-dot.is-active { background: var(--color-red); }

/* 右侧：标题 / 内容 / 评论 */
.xhs-post__right { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }
.xhs-post__header { margin-top: 4px; margin-bottom: 8px; }
.xhs-post__title { font-size: 24px; font-weight: 700; margin: 0; color: var(--color-primary-label); }

.xhs-post__content { overflow: auto; padding-right: 8px; }
.xhs-post__content img, .xhs-post__content figure { display: none !important; }
.xhs-post__content .post-tags { margin-top: 12px; }

.xhs-post__comments { margin-top: 16px; }

/* 展示用的单行评论框样式 */
.xhs-comment-demo { display:flex; align-items:center; gap:8px; margin-top:8px; }
.xhs-comment-demo .xhs-comment-input { flex:1; height:38px; border:1px solid var(--color-border); border-radius:20px; padding:0 12px; background:var(--color-active-background); color:var(--color-secondary-label); outline:none; }
.xhs-comment-demo .xhs-comment-input::placeholder { color: var(--color-tertiary-label); }
.xhs-comment-demo .btn.btn-secondary { height:36px; padding:0 14px; border-radius:18px; opacity:.6; cursor:not-allowed; }

/* Utilities */
.text-center {
    text-align: center;
}

.hidden {
    display: none;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-red);
    color: var(--color-white);
}

.btn-primary:hover {
    background: #e02940;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--color-active-background);
    color: var(--color-secondary-label);
}

.btn-secondary:hover {
    background: var(--color-border);
    color: var(--color-primary-label);
}