
:root {
    --parchment-bg: #f9f6f0;
    --text-color: #4a3b32;
    --accent-color: #d4b5b0;
}

/* ======== Base ======== */
body {
    margin: 0;
    padding: 0;
    background-color: var(--parchment-bg);
    background-image:
        radial-gradient(#eaddce 15%, transparent 16%),
        radial-gradient(#eaddce 15%, transparent 16%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    color: var(--text-color);
    font-family: 'Noto Serif SC', serif;
    line-height: 2;
    overflow-x: hidden;
}

/* ======== Hero: Love Timer ======== */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    box-sizing: border-box;
    position: relative;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 40%, rgba(212,181,176,0.12) 0%, transparent 70%);
    pointer-events: none;
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 1;
    animation: float-hint 2s ease-in-out infinite;
}

.scroll-hint .arrow {
    width: 10px;
    height: 10px;
    border-right: 1.5px solid #bba89e;
    border-bottom: 1.5px solid #bba89e;
    transform: rotate(45deg);
}

@keyframes float-hint {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* ======== Globe Section ======== */
.globe-section {
    padding: 60px 20px 80px;
    text-align: center;
    position: relative;
    background: radial-gradient(ellipse at 50% 50%, rgba(212,181,176,0.10) 0%, transparent 70%);
}

.globe-header {
    margin-bottom: 24px;
}

.globe-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #5a4b42;
    letter-spacing: 4px;
    margin: 0;
}

.globe-subtitle {
    font-size: 0.9rem;
    color: #8b7b72;
    margin: 8px 0 0;
    letter-spacing: 1px;
    font-style: italic;
}

#globe-container {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    margin: 0 auto;
    position: relative;
    cursor: grab;
}

#globe-container:active {
    cursor: grabbing;
}

#globe-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.globe-distance-text {
    margin-top: 24px;
    font-family: 'Noto Serif SC', serif;
}

#globe-distance {
    font-size: 1.3rem;
    font-weight: 600;
    color: #b58d87;
    letter-spacing: 2px;
}

.globe-distance-sub {
    display: block;
    font-size: 0.85rem;
    color: #8b7b72;
    margin-top: 4px;
    letter-spacing: 1px;
}

.globe-hint {
    font-size: 0.75rem;
    color: #bba89e;
    margin-top: 16px;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .globe-section {
        padding: 40px 16px 60px;
    }
    #globe-container {
        max-width: 340px;
    }
    .globe-title {
        font-size: 1.3rem;
    }
}

.hero-inner {
    position: relative;
    z-index: 1;
}

.hero-names {
    font-size: 2rem;
    font-weight: 600;
    color: #5a4b42;
    letter-spacing: 6px;
    margin: 0 0 40px 0;
}

.timer-display {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.timer-block {
    background: #fdf8f2;
    border-radius: 12px;
    padding: 24px 18px 18px;
    min-width: 80px;
    box-shadow:
        0 8px 24px rgba(0,0,0,0.04),
        inset 0 0 40px rgba(168,143,121,0.08);
}

.timer-number {
    display: block;
    font-size: 2.8rem;
    font-weight: 600;
    color: #b58d87;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    font-family: 'Noto Serif SC', serif;
}

.timer-label {
    display: block;
    font-size: 0.85rem;
    color: #8b7b72;
    margin-top: 6px;
    letter-spacing: 2px;
}


/* ======== Letters Section ======== */
.letters-section {
    max-width: 760px;
    margin: 0 auto 80px auto;
    padding: 0 20px;
}

/* ======== Envelope Card ======== */
.envelope-card {
    margin-bottom: 36px;
}

/* Envelope front */
.envelope-front {
    position: relative;
    background: #f5ede4;
    border-radius: 8px;
    user-select: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.05);
    transition: box-shadow 0.4s ease, transform 0.4s ease;
    overflow: visible;
}

.envelope-card.open .envelope-front {
    border-radius: 8px 8px 0 0;
    box-shadow: none;
    cursor: default;
}

/* Envelope flap triangle */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(180deg, #ece0d3, #e0cebc);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
    border-radius: 8px 8px 0 0;
}

.envelope-card.open .envelope-flap {
    transform: perspective(700px) rotateX(-170deg);
    opacity: 0;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease 0.8s;
}

/* Wax seal */
.envelope-seal {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    background: #d4a99a;
    border-radius: 50%;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(180,130,120,0.3);
    cursor: pointer;
    transition: transform 0.5s ease, opacity 0.4s ease, box-shadow 0.3s ease;
}

.envelope-seal:hover {
    transform: translateX(-50%) scale(1.15);
    box-shadow: 0 4px 16px rgba(180,130,120,0.5);
}

.envelope-card.open .envelope-seal {
    transform: translateX(-50%) translateY(-10px);
    opacity: 0;
    cursor: default;
}

/* Envelope body content */
.envelope-body-content {
    padding: 64px 30px 36px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.envelope-date {
    font-size: 0.85rem;
    color: #8b7b72;
    margin: 0;
    letter-spacing: 1px;
}

.editor-entry {
    margin: 72px auto 0;
    text-align: center;
    color: #8b7b72;
}

.editor-entry-rule {
    display: block;
    width: 64px;
    height: 1px;
    margin: 0 auto 24px;
    background: var(--accent-color);
    opacity: 0.65;
}

.editor-entry-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 19px;
    border: 1px solid rgba(181, 141, 135, 0.5);
    border-radius: 999px;
    color: #6e5a50;
    text-decoration: none;
    font-size: 0.86rem;
    letter-spacing: 0.12em;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.editor-entry-link:hover,
.editor-entry-link:focus-visible {
    background: #b58d87;
    color: #fffaf6;
    transform: translateY(-1px);
    outline: none;
}

.editor-entry p {
    margin: 12px 0 0;
    font-size: 0.7rem;
    font-style: italic;
    letter-spacing: 0.08em;
    color: #aa9990;
}


/* ======== Expanded letter content ======== */
.letter-wrapper {
    height: 0;
    overflow: hidden;
    transition: height 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fdf8f2;
    border-radius: 0 0 8px 8px;
}

.envelope-card.open .letter-wrapper {
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}

.letter-inner {
    padding: 20px 0 0 0;
}

/* Collapse button */
.close-btn {
    display: block;
    margin: 0 auto 10px;
    padding: 8px 24px;
    background: transparent;
    border: 1px solid #d4b5b0;
    color: #8b7b72;
    font-family: 'Noto Serif SC', serif;
    font-size: 0.85rem;
    letter-spacing: 2px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #d4b5b0;
    color: #fff;
}

/* ======== Letter body (preserved original styles) ======== */
.letter-container {
    max-width: 700px;
    margin: 0 auto 20px auto;
    padding: 60px 50px;
    background-color: #fdf8f2;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
    box-shadow:
        0 15px 35px rgba(0,0,0,0.06),
        inset 0 0 60px rgba(168,143,121,0.15),
        inset 0 0 15px rgba(212,181,176,0.05);
    border-radius: 4px;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: all 1.5s ease-out;
}

.letter-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.letter-container::before, .letter-container::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 1px;
    background: var(--accent-color);
    opacity: 0.5;
}
.letter-container::before { top: 30px; }
.letter-container::after { bottom: 30px; }

h1.greeting {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 40px;
    color: #3d2f28;
}

.content p {
    font-size: 1.1rem;
    text-align: justify;
    margin-bottom: 20px;
    text-indent: 2em;
    line-height: 2.2;
}

.poetry-block {
    margin: 30px 0 30px 2em;
    padding-left: 15px;
    border-left: 2px solid var(--accent-color);
}

.poetry-block p {
    text-indent: 0;
    margin-bottom: 12px;
    color: #5a4b42;
}

.sign-off {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.sign-off p {
    margin: 5px 0;
    text-align: left;
}

.sign-off .blessing {
    font-size: 1.1rem;
    letter-spacing: 2px;
}

.sign-off .signature {
    margin-top: 15px;
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--accent-color);
}

/* ======== Music player ======== */
.music-player-container {
    max-width: 700px;
    margin: 0 auto 80px auto;
    padding: 0 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 1.5s ease-out;
    box-sizing: border-box;
}

.music-player-container.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ======== Divider / Gallery / Video (preserved) ======== */
.divider {
    text-align: center;
    margin: 80px 0;
    color: var(--accent-color);
    font-size: 24px;
    letter-spacing: 15px;
}

.gallery-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
}

.polaroid {
    background: white;
    padding: 15px 15px 50px 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    width: calc(33% - 40px);
    min-width: 250px;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    opacity: 0;
    transform: translateY(40px);
}

.polaroid:nth-child(even) { transform: translateY(40px) rotate(3deg); }
.polaroid:nth-child(odd) { transform: translateY(40px) rotate(-2deg); }
.polaroid:nth-child(3n) { transform: translateY(40px) rotate(-4deg); }

.polaroid.visible { opacity: 1; }
.polaroid.visible:nth-child(even) { transform: translateY(0) rotate(3deg); }
.polaroid.visible:nth-child(odd) { transform: translateY(0) rotate(-2deg); }
.polaroid.visible:nth-child(3n) { transform: translateY(0) rotate(-4deg); }

.polaroid:hover {
    transform: scale(1.05) rotate(0deg) !important;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    z-index: 10;
}

.polaroid img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
    filter: sepia(10%) contrast(95%);
}

.video-section {
    max-width: 800px;
    margin: 100px auto 100px auto;
    padding: 0 20px;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: all 1.5s ease;
}

.video-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.video-wrapper {
    padding: 15px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    border-radius: 4px;
}

video {
    width: 100%;
    border-radius: 2px;
    outline: none;
}

.video-title {
    margin-top: 30px;
    font-size: 1.2rem;
    color: var(--accent-color);
    letter-spacing: 2px;
}

/* ======== Responsive ======== */
@media (max-width: 768px) {
    .hero-names { font-size: 1.4rem; letter-spacing: 3px; }
    .timer-display { gap: 8px; }
    .timer-block { padding: 14px 10px 10px; min-width: 58px; border-radius: 8px; }
    .timer-number { font-size: 1.8rem; }
    .timer-label { font-size: 0.7rem; }

    .letter-container { padding: 40px 25px; margin: 0 15px 20px 15px; }
    .content p { text-indent: 1.5em; }
    .polaroid { width: 100%; margin-bottom: 20px; }

    .envelope-body-content { padding: 56px 20px 30px; }
    .envelope-flap { height: 48px; }
    .envelope-seal { width: 30px; height: 30px; font-size: 0.85rem; bottom: -15px; }
}
