/* ============================================================
   Evermore · Romantic Pearl
   珍珠轻奢 / 法式浪漫 / 温柔复古
   ------------------------------------------------------------
   配色比例：珍珠白·奶油象牙白 65% ｜ 鼠尾草绿·深橄榄绿 20%
             香槟金 10% ｜ 灰玫瑰粉 5%
   ============================================================ */

/* ===== 主题变量（全站唯一色值来源） ===== */
:root {
    /* 珍珠白 / 奶油象牙白 */
    --pearl: #F8F6F1;
    --pearl-soft: #FBFAF7;
    --ivory: #EEE9DF;
    --ivory-deep: #E6E0D4;

    /* 鼠尾草绿 / 深橄榄绿 */
    --sage: #A5B29B;
    --sage-soft: #C7D0BE;
    --sage-mist: rgba(165, 178, 155, 0.16);
    --olive: #68765F;
    --olive-deep: #55614D;

    /* 香槟金 */
    --champagne: #C6AD83;
    --champagne-soft: #DCCBAE;

    /* 灰玫瑰粉（仅少量点缀） */
    --rose: #D7BFC0;

    /* 文字 */
    --ink: #3E463A;
    --ink-soft: #6E7365;
    --ink-light: #8F9387;

    /* 线条与阴影 */
    --line: rgba(104, 118, 95, 0.16);
    --line-gold: rgba(198, 173, 131, 0.45);
    --shadow-soft: 0 8px 24px rgba(104, 118, 95, 0.08);
    --shadow-lift: 0 18px 40px rgba(104, 118, 95, 0.14);

    /* 字体 */
    --font-serif: Georgia, "Times New Roman", "Songti SC", "STSong", "SimSun", serif;
    --font-body: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
    --font-hand: "Segoe Script", "Bradley Hand", "KaiTi", "STKaiti", cursive;
}

/* ===== 全局基础设置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--ink);
    line-height: 1.8;
    background-color: var(--pearl);
    background-image:
        radial-gradient(circle at 12% -4%, rgba(198, 173, 131, 0.10), transparent 42%),
        radial-gradient(circle at 90% 2%, rgba(165, 178, 155, 0.12), transparent 38%),
        radial-gradient(circle at 50% 108%, rgba(215, 191, 192, 0.08), transparent 55%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* ===== 网站顶部（只作用于页面顶层 header，避免影响文章内的 <header>） ===== */
body > header {
    position: relative;
    text-align: center;
    padding: 36px 20px 26px;
    background: linear-gradient(180deg, rgba(251, 250, 247, 0.97), rgba(248, 246, 241, 0.72));
    border-bottom: 1px solid var(--line-gold);
}

body > header::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1px;
    transform: translateX(-50%);
    width: 76px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--champagne), transparent);
}

body > header h1 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(26px, 3.6vw, 34px);
    letter-spacing: 0.14em;
    color: var(--olive);
    margin-bottom: 14px;
}

/* ===== 导航栏 ===== */
nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
}

nav a {
    position: relative;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 14px;
    letter-spacing: 0.1em;
    padding-bottom: 5px;
    transition: color 0.3s;
}

nav a::after {
    content: "";
    position: absolute;
    left: 50%;
    right: 50%;
    bottom: 0;
    height: 1px;
    background-color: var(--champagne);
    transition: left 0.3s ease, right 0.3s ease;
}

nav a:hover,
nav a.is-current {
    color: var(--olive);
}

nav a:hover::after,
nav a.is-current::after {
    left: 0;
    right: 0;
}

/* ===== 首页欢迎区域 ===== */
.welcome {
    text-align: center;
    padding: 78px 20px 32px;
}

.welcome h2 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(24px, 3.2vw, 32px);
    letter-spacing: 0.1em;
    color: var(--olive);
    margin-bottom: 14px;
}

.welcome p {
    color: var(--ink-light);
    font-size: 15px;
    letter-spacing: 0.08em;
}

/* ===== 首页照片轮播 ===== */
.hero-carousel {
    width: 88%;
    max-width: 760px;
    margin: 0 auto 62px;
}

.carousel-frame {
    position: relative;
    aspect-ratio: 1 / 1;
    padding: clamp(10px, 1.8vw, 18px);
    background: linear-gradient(160deg, #FDFCFA 0%, var(--ivory) 100%);
    border: 1px solid var(--line-gold);
    border-radius: 22px;
    box-shadow: var(--shadow-lift);
    overflow: hidden;
}

.carousel-frame::before {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(198, 173, 131, 0.26);
    border-radius: 16px;
    pointer-events: none;
}

.carousel-layer {
    position: absolute;
    inset: clamp(10px, 1.8vw, 18px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 1.3s ease;
    will-change: opacity;
}

.carousel-layer.is-active {
    opacity: 1;
}

.carousel-photo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    background-color: var(--pearl-soft);
    box-shadow: 0 12px 30px rgba(104, 118, 95, 0.20);
}

.carousel-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--ink-light);
    font-size: 13.5px;
    letter-spacing: 0.14em;
    transition: opacity 0.6s ease, visibility 0.6s;
}

.carousel-empty-ring {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--line-gold);
    box-shadow:
        inset 0 0 0 6px rgba(251, 250, 247, 0.92),
        inset 0 0 0 7px rgba(198, 173, 131, 0.32);
}

.hero-carousel[data-state="ready"] .carousel-empty {
    opacity: 0;
    visibility: hidden;
}

.carousel-caption {
    min-height: 18px;
    margin-top: 16px;
    text-align: center;
    font-size: 11.5px;
    letter-spacing: 0.18em;
    color: var(--champagne);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.carousel-caption.is-visible {
    opacity: 1;
}

/* ===== 恋爱计时器 ===== */
.love-counter {
    position: relative;
    width: 86%;
    max-width: 640px;
    margin: 0 auto 82px;
    padding: 42px 28px;
    text-align: center;
    background: linear-gradient(165deg, var(--pearl-soft), var(--ivory));
    border: 1px solid var(--line-gold);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
}

/* 计时器卡片的四角细线装饰 */
.love-counter::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    width: 26px;
    height: 26px;
    border-top: 1px solid rgba(198, 173, 131, 0.5);
    border-left: 1px solid rgba(198, 173, 131, 0.5);
    border-radius: 8px 0 0 0;
    pointer-events: none;
}

.love-counter::after {
    content: "";
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-bottom: 1px solid rgba(198, 173, 131, 0.5);
    border-right: 1px solid rgba(198, 173, 131, 0.5);
    border-radius: 0 0 8px 0;
    pointer-events: none;
}

.love-counter h2 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 21px;
    letter-spacing: 0.14em;
    color: var(--olive);
    margin-bottom: 16px;
}

#love-days {
    color: var(--ink);
    font-size: 18px;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
}

/* ===== 网站底部 ===== */
footer {
    text-align: center;
    padding: 30px 20px 34px;
    border-top: 1px solid var(--line-gold);
    color: var(--ink-light);
    font-size: 12px;
    letter-spacing: 0.2em;
}

/* 退出访问（只在通过服务器访问时显示） */
.logout-form {
    margin-top: 12px;
}

.logout-form button {
    border: none;
    background: none;
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--ink-light);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

.logout-form button:hover {
    color: var(--olive);
}

/* ===== 相册分类筛选 ===== */
.gallery-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 20px 34px;
}

.filter-btn {
    font-family: inherit;
    font-size: 14px;
    letter-spacing: 0.06em;
    padding: 9px 22px;
    border-radius: 999px;
    cursor: pointer;
    color: var(--ink-soft);
    background-color: rgba(238, 233, 223, 0.55);
    border: 1px solid transparent;
    transition: color 0.3s, background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.filter-btn:hover {
    color: var(--olive);
    background-color: var(--ivory);
    border-color: var(--line-gold);
}

.filter-btn.active {
    color: var(--pearl);
    background-color: var(--olive);
    border-color: var(--olive);
    box-shadow: 0 10px 22px rgba(104, 118, 95, 0.24);
}

/* ===== 相册卡片 ===== */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    width: 90%;
    max-width: 880px;
    margin: 0 auto 80px;
}

.gallery-card {
    background: linear-gradient(170deg, var(--pearl-soft) 0%, var(--ivory) 100%);
    border: 1px solid var(--line-gold);
    border-radius: 20px;
    padding: 16px 16px 24px;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.gallery-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lift);
    border-color: rgba(198, 173, 131, 0.8);
}

/* 卡片封面：整张照片完整显示，不裁剪 */
.gallery-placeholder {
    width: 100%;
    height: 280px;
    margin-bottom: 16px;
    background-color: var(--ivory);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 0 1px rgba(198, 173, 131, 0.25);
}

.gallery-cover {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gallery-card h3 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 19px;
    letter-spacing: 0.06em;
    color: var(--olive);
    margin-bottom: 6px;
}

.gallery-card .gallery-summary {
    color: var(--ink-light);
    font-size: 13.5px;
    letter-spacing: 0.04em;
}

/* 照片数据容器：只供预览窗口读取，不在卡片中直接显示 */
.gallery-photos {
    display: none;
}

/* ===== 照片放大预览窗口 ===== */
.photo-modal {
    display: none;
    position: fixed;
    z-index: 999;
    inset: 0;
    background: rgba(62, 70, 58, 0.62);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.photo-modal-content {
    position: relative;
    background: linear-gradient(170deg, var(--pearl-soft), var(--ivory));
    border: 1px solid var(--line-gold);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    border-radius: 22px;
    box-shadow: 0 30px 70px rgba(62, 70, 58, 0.35);
    text-align: center;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 18px;
    border: none;
    background: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: var(--ink-light);
    transition: color 0.25s;
}

.close-modal:hover {
    color: var(--olive);
}

.photo-modal-content h2 {
    margin-bottom: 10px;
    padding-right: 30px;
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 21px;
    letter-spacing: 0.06em;
    color: var(--olive);
}

.photo-modal-content p {
    margin-top: 8px;
    color: var(--ink-soft);
}

/* ===== 多照片浏览器布局 ===== */
.photo-viewer {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0 16px;
}

/* 照片预览区域：统一居中，保持原始比例，不裁剪 */
.modal-photo {
    width: 100%;
    min-height: 300px;
    max-height: 60vh;
    padding: 0 55px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--pearl);
    border: 1px solid rgba(198, 173, 131, 0.28);
    border-radius: 14px;
    overflow: hidden;
    color: var(--ink-light);
    font-size: 15px;
}

.modal-photo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(60vh - 4px);
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(104, 118, 95, 0.18);
}

/* 图片加载失败时的友好提示 */
.photo-error {
    padding: 0 10px;
    color: var(--ink-light);
    font-size: 15px;
    line-height: 1.9;
}

/* 左右箭头：保持原有圆形设计，固定在预览窗口两侧 */
.photo-arrow {
    display: flex !important;
    position: absolute !important;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1005;
    width: 45px;
    height: 45px;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 50%;
    background: var(--olive) !important;
    color: var(--pearl) !important;
    font-size: 22px;
    cursor: pointer;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: 0 8px 18px rgba(85, 97, 77, 0.28);
    transition: background-color 0.25s;
}

.photo-arrow:hover {
    background: var(--olive-deep) !important;
}

#prevPhoto {
    left: 10px;
}

#nextPhoto {
    right: 10px;
}

#photoCounter {
    color: var(--champagne);
    font-size: 13px;
    letter-spacing: 0.24em;
}

#modalDate {
    color: var(--ink-light);
    font-size: 13px;
    letter-spacing: 0.1em;
}

#modalStory {
    color: var(--ink);
    font-size: 15px;
}

/* ===== 平板适配 ===== */
@media (max-width: 900px) {
    .hero-carousel {
        max-width: 640px;
    }
}

/* ===== 手机屏幕适配 ===== */
@media (max-width: 600px) {
    body > header {
        padding: 28px 16px 22px;
    }

    body > header h1 {
        font-size: 23px;
        letter-spacing: 0.1em;
    }

    nav {
        gap: 18px;
    }

    nav a {
        font-size: 13px;
    }

    .welcome {
        padding: 56px 18px 26px;
    }

    .welcome h2 {
        font-size: 23px;
    }

    .hero-carousel {
        width: 92%;
        margin-bottom: 48px;
    }

    .carousel-frame {
        aspect-ratio: 1 / 1;
        border-radius: 18px;
    }

    .love-counter {
        width: 92%;
        padding: 32px 20px;
        margin-bottom: 60px;
    }

    .love-counter h2 {
        font-size: 19px;
    }

    #love-days {
        font-size: 16px;
        line-height: 1.9;
    }

    .gallery {
        width: 92%;
        grid-template-columns: 1fr;
        gap: 22px;
        margin-bottom: 56px;
    }

    .gallery-placeholder {
        height: 240px;
    }

    .filter-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .photo-modal-content {
        padding: 22px 16px;
    }

    .modal-photo {
        min-height: 220px;
        max-height: 55vh;
        padding: 0 45px;
    }

    .modal-photo img {
        max-height: calc(55vh - 4px);
    }

    .photo-arrow {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* ===== 尊重系统「减少动态效果」 ===== */
@media (prefers-reduced-motion: reduce) {
    .carousel-layer {
        transition: none;
    }

    .carousel-empty,
    .carousel-caption,
    .gallery-card,
    .filter-btn,
    nav a::after,
    .close-modal,
    .photo-arrow {
        transition: none;
    }

    .gallery-card:hover {
        transform: none;
    }
}
