/*
Theme Name: Travelconnectreview
Description: Modern travel blog theme with masonry layout and multi-image display, optimized for multilingual content
Version: 1.0.0
Author: Travel Connect Review
Text Domain: travelconnectreview
*/

/* CSS Variables - Travel Connect Review Color System */
: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: #000000;
        --color-primary-label: #ffffff;
        --color-secondary-label: #cccccc;
        --color-tertiary-label: #999999;
        --color-quaternary-label: #666666;
        --color-border: #333333;
        --color-active-background: #1a1a1a;
        --elevation-high-background: #111111;
    }
    
    .main-content {
        background: #000000 !important;
    }
    
    .site-header {
        background: rgba(17, 17, 17, 0.95) !important;
        border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    }
    
    .post-card {
        background: #111111 !important;
        border-color: rgba(255, 255, 255, 0.05) !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3) !important;
    }
    
    .post-card:hover {
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5) !important;
        border-color: rgba(255, 46, 77, 0.2) !important;
    }
    
    .post-images {
        background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%) !important;
    }
    
    .post-meta {
        border-top-color: rgba(255, 255, 255, 0.05) !important;
    }
    
    .post-tag {
        background: rgba(255, 255, 255, 0.06) !important;
        color: var(--color-secondary-label) !important;
    }
    
    .author-avatar {
        border-color: rgba(255, 255, 255, 0.1) !important;
    }
}

/* 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;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: var(--color-red);
    color: var(--color-white);
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    z-index: 999999;
}

.skip-link:focus {
    position: absolute;
    left: 6px;
    top: 7px;
    width: auto;
    height: auto;
    overflow: visible;
}

/* Screen Reader Text */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.screen-reader-text:focus {
    background-color: var(--color-active-background);
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: var(--color-primary-label);
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Header Styles */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    z-index: 1000;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.02);
}

.site-title {
    font-size: 20px;
    font-weight: 700;
    margin-right: auto;
    margin: 0;
}

.site-title a {
    color: var(--color-red);
    text-decoration: none;
}

.site-title a:hover {
    opacity: 0.8;
}

.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: 88px;
    min-height: 100vh;
    background: #fafafa;
}

/* Masonry Layout - Travel Cards Grid */
.masonry-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    columns: 5;
    column-gap: 16px;
}

@media (max-width: 1440px) {
    .masonry-container {
        columns: 4;
        max-width: 1200px;
    }
}

@media (max-width: 1024px) {
    .masonry-container {
        columns: 3;
        padding: 20px;
        column-gap: 14px;
    }
}

@media (max-width: 768px) {
    .masonry-container {
        columns: 2;
        padding: 16px;
        column-gap: 12px;
    }
}

@media (max-width: 480px) {
    .masonry-container {
        columns: 2;
        padding: 12px;
        column-gap: 10px;
    }
}

@media (max-width: 360px) {
    .masonry-container {
        columns: 1;
        padding: 16px;
    }
}

/* Post Card Styles */
.post-card {
    break-inside: avoid;
    margin-bottom: 16px;
    background: var(--elevation-high-background);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.post-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    border-color: rgba(255, 46, 77, 0.1);
}

/* Post Images */
.post-images {
    position: relative;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    aspect-ratio: 3 / 4;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-image {
    transform: scale(1.03);
}

/* 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: 20px;
}

.post-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-primary-label);
    margin: 0 0 10px 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.post-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-title a:hover {
    color: var(--color-red);
}

.post-excerpt {
    font-size: 13px;
    color: var(--color-secondary-label);
    line-height: 1.5;
    margin: 0 0 16px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.005em;
}

/* Post Meta */
.post-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.post-author {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--color-tertiary-label);
    font-weight: 500;
}

.author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 6px;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
}

.post-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-tertiary-label);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.stat-item:hover {
    color: var(--color-red);
    background: rgba(255, 46, 77, 0.05);
}

/* Post Tags */
.post-tags {
    margin: 12px 0 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 60px;
    overflow: hidden;
}

.post-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-tertiary-label);
    background: rgba(0, 0, 0, 0.04);
    padding: 5px 10px;
    border-radius: 14px;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.post-tag:hover {
    background: var(--color-red);
    color: var(--color-white);
    transform: translateY(-1px);
}

/* 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 16px;
        height: 56px;
    }
    
    .site-title {
        font-size: 18px;
    }
    
    .main-content {
        padding-top: 72px;
        background: #fafafa;
    }
    
    .post-card {
        margin-bottom: 12px;
    }
    
    .post-content {
        padding: 16px;
    }
    
    .post-title {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .post-excerpt {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }
    
    .post-tag {
        font-size: 10px;
        padding: 4px 8px;
    }
    
    .post-author {
        font-size: 11px;
    }
    
    .author-avatar {
        width: 18px;
        height: 18px;
    }
}

/* 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);
}