

/* 全局颜色 */
:root {
    --cream: #f2eee5;
    --paper: #fffaf2;
    --gold: #99854e;
    --brown: #72513d;
    --dark: #58483e;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--dark);
    font-family: Georgia, "Noto Serif SC",
        "Songti SC", "SimSun", serif;
    text-align: center;
    line-height: 1.9;
}

h1, h2, h3 {
    font-weight: normal;
    color: var(--gold);
}

h1 {
    font-size: clamp(30px, 7vw, 56px);
    line-height: 1.2;
}

h2 {
    font-size: clamp(24px, 5vw, 36px);
}

.subtitle {
    letter-spacing: 3px;
    font-size: 12px;
    color: var(--gold);
}

/* 首页 */
#entrance {
    min-height: 100vh;
    padding: 55px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 信封 */
.envelope {
    position: relative;
    width: min(320px, 85vw);
    height: 205px;
    background: #d6b99c;
    margin: 45px auto 25px;
    box-shadow: 0 15px 30px #72513d22;
    perspective: 1000px;
}

.letter {
    position: absolute;
    inset: 12px;
    background: var(--paper);
    padding: 25px;
    transition: transform 0.8s ease;
    color: var(--gold);
}

.envelope-front {
    position: absolute;
    inset: 0;
    background: #dfc7ab;
    clip-path: polygon(
        0 0, 50% 52%, 100% 0,
        100% 100%, 0 100%
    );
    z-index: 2;
}

.flap {
    position: absolute;
    inset: 0;
    background: #ead5ba;
    clip-path: polygon(0 0, 100% 0, 50% 65%);
    transform-origin: top;
    transition: transform 0.7s;
    z-index: 3;
}

/* 火漆印章 */
#seal {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translateX(-50%);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #80513e;
    color: #f4d9b3;
    border: 4px double #ba8c72;
    font-size: 28px;
    cursor: pointer;
    z-index: 4;
}

.envelope.open .flap {
    transform: rotateX(180deg);
    z-index: 0;
}

.envelope.open #seal {
    opacity: 0;
    pointer-events: none;
}

.envelope.open .letter {
    transform: translateY(-80px);
}

/* 通用按钮 */
.button {
    border: 1px solid var(--gold);
    background: var(--brown);
    color: var(--paper);
    padding: 12px 32px;
    font-family: inherit;
    letter-spacing: 2px;
    cursor: pointer;
    transition: background 0.3s;
}

.button:hover {
    background: var(--gold);
}

.button:disabled {
    opacity: 0.6;
}

/* 请柬内容 */
#invitation {
    max-width: 800px;
    margin: auto;
    padding: 24px 16px;
    animation: appear 1s ease;
}

.page {
    background: var(--paper);
    border: 1px solid #c9b78e;
    outline: 1px solid #c9b78e;
    outline-offset: -8px;
    padding: 50px 25px;
    margin-bottom: 28px;
    box-shadow: 0 5px 25px #72513d0c;
}

.page p {
    max-width: 540px;
    margin: 18px auto;
}

.names {
    font-size: 30px;
    line-height: 1.5;
}

.theme {
    font-style: italic;
}

.line {
    width: 80px;
    height: 1px;
    background: var(--gold);
    margin: 30px auto;
}

.date {
    letter-spacing: 3px;
    color: var(--gold);
}

footer {
    padding: 35px 15px;
    font-size: 13px;
}

/* 淡入动画 */
@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 手机适配 */
@media (max-width: 600px) {
    .page {
        padding: 40px 22px;
    }

    .subtitle {
        letter-spacing: 2px;
    }
}
h1.montecarlo-regular {
    font-family: "MonteCarlo", cursive;
    font-size: 65px;
    font-weight: 400;
    font-style: normal;
}
.wedding-art {
    width: 80%;
    max-width: 500px;
    height: auto;
    display: block;
    margin: 25px auto;
}

/* ===== 高级信封设计 ===== */

.envelope {
    position: relative;
    width: min(360px, 82vw);
    height: 230px;

    background: #DED5CA;

    margin: 130px auto 35px;

    perspective: 1200px;

    box-shadow:
        0 18px 40px rgba(70, 50, 35, 0.12),
        0 2px 6px rgba(70, 50, 35, 0.08);

    transition: transform 1.2s ease;
}

/* 信纸 */
.letter {
    position: absolute;

    inset: auto 6% 10px;
    width: 88%;
    height: 205px;

    background: linear-gradient(
        135deg,
        #FFFDF9,
        #F6F2EB
    );

    border: 1px solid #DED6CA;

    box-shadow: 0 2px 12px rgba(0,0,0,0.05);

    z-index: 2;

    transition:
        transform 1.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 信封正面 */
.envelope-front {
    position: absolute;
    inset: 0;

    background: linear-gradient(
        155deg,
        #EEE8DE,
        #DCD1C3
    );

    clip-path: polygon(
        0 0,
        50% 58%,
        100% 0,
        100% 100%,
        0 100%
    );

    z-index: 3;
}

/* 信封盖 */
.flap {
    position: absolute;
    inset: 0;

    background: linear-gradient(
        160deg,
        #EBE4DA,
        #DDD1C2
    );

    clip-path: polygon(
        0 0,
        100% 0,
        50% 65%
    );

    transform-origin: top center;

    transform: rotateX(0deg);

    transition:
        transform 1s cubic-bezier(0.4, 0, 0.2, 1);

    z-index: 4;
}

/* 火漆印章 */
#seal {
    width: 58px;
    height: 58px;

    background: radial-gradient(
        circle at 30% 25%,
        #AA8576,
        #77594D
    );

    border: 3px double #B99A8D;
    border-radius: 47% 53% 50% 48%;

    color: #F1DFCE;

    box-shadow: 0 3px 8px rgba(0,0,0,0.15);

    transition:
        opacity 0.45s ease,
        transform 0.45s ease;

    z-index: 5;
}

/* 阶段一：火漆淡出 */
.envelope.unsealed #seal {
    opacity: 0;

    transform: translateX(-50%) scale(1.15);

    pointer-events: none;
}

/* 阶段二：信封盖翻开 */
.envelope.unfold .flap {
    transform: rotateX(180deg);

    z-index: 1;
}

/* 阶段三：信纸向上抽出 */
.envelope.lift .letter {
    transform: translateY(-125px);
}

/* 信封轻微下沉 */
.envelope.lift {
    transform: translateY(30px);
}

/* 阶段四：首页缓慢淡出 */
#entrance.fade-out {
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}


/* 邀请函淡入 */
#invitation {
    animation: invitationAppear 1.4s ease;
}

@keyframes invitationAppear {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.envelope .flap {
    transform-origin: top center;
    transition: transform 1s ease;
}

.envelope:hover .flap {
    transform: rotateX(180deg);
}

/* 滚动渐显动画 */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    filter: blur(10px);

    transition:
        opacity 0.8s ease,
        transform 2s ease-out,
        filter 2.5s linear;
}


.reveal.visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0px);
}
.delay-1 { 
    transition-delay: 0s;
 }
.delay-2 { 
    transition-delay: 0.3s;
 }
.delay-3 { 
    transition-delay: 0.6s; 
}
.delay-4 {
     transition-delay: 0.9s;
 }
.delay-5 { 
    transition-delay: 1.2s;
 }
.delay-6 { 
    transition-delay: 1.5s;
 }

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }
}

/* ===== 婚礼留言簿 ===== */

.comment-form {
    width: 100%;
    max-width: 600px;
    margin: 35px auto;
}

/* 昵称输入框与留言输入框 */

#commentName,
#commentText {
    display: block;
    width: 100%;

    padding: 15px;
    margin-bottom: 12px;

    background: #fffdf8;
    border: 1px solid #d8c9ad;
    border-radius: 3px;

    color: #58483e;
    font-family: inherit;
    font-size: 14px;

    outline: none;
    transition: border-color 0.3s ease;
}

/* 点击输入框时的效果 */

#commentName:focus,
#commentText:focus {
    border-color: #99854e;
}

/* 留言框 */

#commentText {
    min-height: 120px;
    resize: vertical;
    line-height: 1.8;
}

/* 底部工具栏 */

.comment-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 字数统计 */

#commentLength {
    font-size: 12px;
    color: #a99b86;
}

/* 发送按钮 */

.comment-send {
    padding: 12px 25px;
    background: #99854e;
    color: #fffaf2;

    border: 1px solid #99854e;

    font-family: inherit;
    font-size: 13px;

    cursor: pointer;
    transition: background 0.3s ease;
}

.comment-send:hover {
    background: #72513d;
}

/* 评论展示区域 */

.comment-area {
    max-width: 600px;
    margin: 45px auto 0;
}

#commentCount {
    color: #99854e;
    font-size: 12px;
}

/* 单条评论 */

.comment-item {
    display: flex;
    gap: 15px;

    padding: 20px 0;
    border-bottom: 1px solid #e5dbca;

    text-align: left;
}

/* 评论头像 */

.comment-avatar {
    width: 40px;
    height: 40px;

    flex-shrink: 0;
    border-radius: 50%;

    background: #eee3d4;
    color: #99854e;

    display: flex;
    justify-content: center;
    align-items: center;
}

/* 评论正文 */

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-author {
    color: #99854e;
    font-size: 14px;
}

.comment-message {
    color: #58483e;
    font-size: 14px;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.comment-time {
    font-size: 11px;
    color: #a99b86;
}

/* ===== 评论互动功能 ===== */

/* 回复提示栏 */

#replyBox {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 10px 15px;
    margin-bottom: 12px;

    background: #f2eee5;
    border-left: 2px solid #99854e;

    font-size: 12px;
    color: #99854e;
}

/* 取消回复按钮 */

#cancelReply {
    background: transparent;
    border: none;

    color: #99854e;
    font-size: 20px;
    cursor: pointer;
}

/* 评论操作区域 */

.comment-actions {
    display: flex;
    align-items: center;
    gap: 20px;

    margin-top: 10px;
}

/* 点赞、回复、撤回按钮 */

.comment-action {
    background: transparent;
    border: none;
    padding: 4px 0;

    font-family: inherit;
    font-size: 12px;
    color: #99854e;

    cursor: pointer;
    transition: color 0.3s ease;
}

.comment-action:hover {
    color: #72513d;
}

/* 点赞后的颜色 */

.comment-action.liked {
    color: #c47c8c;
}

/* 回复对象 */

.comment-reply {
    background: #f2eee5;
    border-left: 2px solid #c9b78e;

    padding: 8px 12px;
    margin-top: 10px;

    font-size: 12px;
    color: #99854e;
}

