/* ============================================================
   CARD.CSS - Trang thiệp cưới (Premium Edition)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Great+Vibes&family=Be+Vietnam+Pro:wght@200;300;400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

.card-body {
    font-family: var(--font-body);
    color: var(--c-text);
    background: var(--c-bg);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Preview banner --- */
.preview-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: var(--c-primary);
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    z-index: 9999;
    letter-spacing: 1px;
}
.preview-banner a { color: var(--c-gold-light); text-decoration: underline; }

/* --- Music toggle --- */
.music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    color: var(--c-primary);
    border: 1px solid rgba(139,44,58,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}
.preview-mode .music-toggle { top: 44px; }
.music-toggle:hover { transform: scale(1.1); background: #fff; }
.music-toggle.playing { animation: musicPulse 2.5s ease infinite; }
@keyframes musicPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
    50% { box-shadow: 0 4px 30px rgba(139,44,58,0.25); }
}

/* --- Card container (cuộn ngang) --- */
.card-container {
    display: flex;
    width: 500vw;
    height: 100vh;
    transition: transform 1s cubic-bezier(0.77, 0, 0.175, 1);
    will-change: transform;
}
.card-container.preview-mode { padding-top: 38px; height: calc(100vh - 38px); }

.chapter {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Decorative corner ornaments */
.chapter::before, .chapter::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background-image: url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 10 Q60 10 60 60 Q60 10 110 10' stroke='%23c9a227' stroke-width='0.8' fill='none' opacity='0.15'/%3E%3Cpath d='M10 10 L40 10 M10 10 L10 40' stroke='%23c9a227' stroke-width='0.8' opacity='0.15'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
}
.chapter::before { top: 0; left: 0; }
.chapter::after { bottom: 0; right: 0; transform: rotate(180deg); }

/* --- Chương 1: Phong bì --- */
.chapter-envelope {
    background: linear-gradient(160deg, var(--c-bg) 0%, var(--c-accent) 100%);
}
.chapter-envelope::before, .chapter-envelope::after { opacity: 0.5; }

.envelope-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}
.envelope {
    position: relative;
    width: 340px;
    height: 230px;
    cursor: pointer;
    perspective: 1000px;
}
.envelope-back {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(139,44,58,0.25);
}
.envelope-back::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    border-radius: 6px;
}
.envelope-letter {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    background: linear-gradient(180deg, #fffefb, var(--c-bg));
    border-radius: 3px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
    box-shadow: inset 0 0 20px rgba(139,44,58,0.05);
}
.envelope.opened .envelope-letter {
    transform: translateY(-200px) scale(1.15) rotate(-2deg);
}
.envelope-letter-content {
    text-align: center;
    color: var(--c-primary);
    padding: 20px;
}
.letter-guest-name {
    font-family: var(--font-title);
    font-size: 32px;
    margin-bottom: 6px;
    line-height: 1.2;
}
.letter-hint {
    font-family: var(--font-serif);
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.5;
}
.letter-ornament {
    width: 40px;
    height: 1px;
    background: var(--c-gold);
    margin: 12px auto;
    opacity: 0.5;
}
.envelope-front {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    background: linear-gradient(135deg, var(--c-secondary), var(--c-primary));
    border-radius: 6px;
    z-index: 2;
    clip-path: polygon(0 100%, 0 30%, 50% 100%, 100% 30%, 100% 100%);
    box-shadow: 0 4px 20px rgba(139,44,58,0.15);
}
.envelope-front::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 30%);
    clip-path: polygon(0 100%, 0 30%, 50% 100%, 100% 30%, 100% 100%);
}
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    z-index: 3;
    transform-origin: top;
    transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.envelope-flap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.envelope.opened .envelope-flap {
    transform: rotateX(180deg);
    z-index: 0;
}
.envelope.opened .envelope-front { z-index: 3; }
.tap-hint {
    font-family: var(--font-serif);
    font-size: 17px;
    color: var(--c-primary);
    letter-spacing: 2px;
    animation: tapPulse 2.5s ease infinite;
    font-style: italic;
}
.envelope.opened ~ .tap-hint { opacity: 0; transition: opacity 0.5s; }
@keyframes tapPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- Chương 2: Lời mời --- */
.chapter-invitation {
    background: linear-gradient(180deg, var(--c-bg) 0%, var(--c-accent) 50%, var(--c-bg) 100%);
}
.chapter-invitation::before, .chapter-invitation::after { opacity: 0.3; }

.invitation-content {
    text-align: center;
    max-width: 580px;
    padding: 40px 28px;
    color: var(--c-primary);
    overflow-y: auto;
    max-height: 100vh;
}
.invitation-content::-webkit-scrollbar { width: 0; }
.invitation-ornament-top {
    margin-bottom: 24px;
    opacity: 0.35;
}
.invite-label {
    font-family: var(--font-serif);
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--c-text-light);
    opacity: 0;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.invite-guest {
    font-family: var(--font-title);
    font-size: clamp(36px, 8vw, 60px);
    margin-bottom: 24px;
    color: var(--c-primary);
    line-height: 1.2;
    opacity: 0;
}
.invite-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 20px 0;
    opacity: 0;
}
.divider-line {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--c-gold), transparent);
}
.divider-heart {
    color: var(--c-gold);
    font-size: 14px;
}
.invite-couple-label {
    font-family: var(--font-serif);
    font-size: 17px;
    color: var(--c-text-light);
    margin-bottom: 16px;
    opacity: 0;
    font-style: italic;
}
.invite-bride, .invite-groom {
    font-family: var(--font-serif);
    font-size: clamp(24px, 5vw, 34px);
    margin: 10px 0;
    color: var(--c-primary);
    opacity: 0;
    font-weight: 600;
}
.invite-and {
    font-family: var(--font-title);
    font-size: 32px;
    color: var(--c-gold);
    margin: 6px 0;
    opacity: 0;
}
.invite-date-venue {
    margin: 28px 0;
    opacity: 0;
    padding: 24px 20px;
    background: rgba(255,255,255,0.5);
    border-radius: 4px;
    border: 1px solid rgba(201,162,39,0.15);
}
.invite-date, .invite-time {
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 500;
    color: var(--c-text);
    margin: 4px 0;
}
.invite-venue {
    font-family: var(--font-serif);
    font-size: 18px;
    color: var(--c-primary);
    margin: 10px 0 4px;
    font-weight: 600;
}
.invite-address {
    font-size: 14px;
    color: var(--c-text-light);
    opacity: 0.8;
}
.invite-message {
    font-family: var(--font-serif);
    font-size: 16px;
    line-height: 1.9;
    color: var(--c-text);
    margin: 28px auto;
    max-width: 460px;
    opacity: 0;
    font-style: italic;
}

/* Typewriter animation */
.typewriter-line.visible {
    animation: typewriterIn 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes typewriterIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Buttons in card --- */
.btn-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 40px;
    border: 1px solid var(--c-primary);
    border-radius: 4px;
    background: transparent;
    color: var(--c-primary);
    font-family: var(--font-body);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.btn-card:hover {
    background: var(--c-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139,44,58,0.2);
}
.btn-continue {
    margin-top: 16px;
    opacity: 0;
}
.btn-continue.visible {
    animation: typewriterIn 1s ease forwards;
}
.btn-directions {
    background: var(--c-primary);
    color: #fff;
    margin: 28px 0;
    border-color: var(--c-primary);
}
.btn-directions:hover {
    background: #6d2230;
}

/* --- Chương 3: Album --- */
.chapter-album {
    background: linear-gradient(180deg, var(--c-bg) 0%, #fff 50%, var(--c-bg) 100%);
}
.chapter-album::before, .chapter-album::after { opacity: 0.3; }
.album-header {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 5;
}
.album-title {
    font-family: var(--font-title);
    font-size: clamp(30px, 7vw, 48px);
    color: var(--c-primary);
}
.album-subtitle {
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--c-text-light);
    margin-top: 6px;
    letter-spacing: 2px;
    font-style: italic;
}
.album-carousel {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.album-carousel::-webkit-scrollbar { display: none; }
.album-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    padding: 110px 24px 90px;
}
.album-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.12);
    transition: transform 0.5s ease;
}
.album-slide.active .album-img {
    transform: scale(1.02);
}
.album-placeholder {
    color: var(--c-primary);
    opacity: 0.3;
    font-size: 18px;
    font-family: var(--font-serif);
}
.album-indicator {
    position: absolute;
    bottom: 64px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--c-primary);
    font-family: var(--font-serif);
    font-size: 16px;
    z-index: 5;
    background: rgba(255,255,255,0.9);
    padding: 6px 20px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.album-dots {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}
.album-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--c-primary);
    opacity: 0.25;
    transition: all 0.4s;
}
.album-dot.active {
    opacity: 1;
    width: 28px;
    border-radius: 4px;
    background: var(--c-gold);
}

/* --- Chương 4: Thực đơn --- */
.chapter-menu {
    background: linear-gradient(180deg, var(--c-accent) 0%, var(--c-bg) 50%, var(--c-accent) 100%);
}
.chapter-menu::before, .chapter-menu::after { opacity: 0.3; }
.menu-header {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 5;
}
.menu-title {
    font-family: var(--font-title);
    font-size: clamp(30px, 7vw, 48px);
    color: var(--c-primary);
}
.menu-subtitle {
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--c-text-light);
    margin-top: 6px;
    letter-spacing: 2px;
    font-style: italic;
}
.menu-carousel {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding-top: 130px;
    padding-bottom: 110px;
}
.menu-carousel::-webkit-scrollbar { display: none; }
.menu-card {
    min-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    padding: 0 28px;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.menu-card-img {
    width: 100%;
    max-width: 360px;
    height: 280px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    position: relative;
}
.menu-card-img::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
    border-radius: 4px;
    pointer-events: none;
}
.menu-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s;
}
.menu-card-img:hover img { transform: scale(1.05); }
.menu-card-img-placeholder {
    background: var(--c-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-primary);
    opacity: 0.3;
}
.menu-card-body {
    text-align: center;
    max-width: 420px;
}
.menu-card-name {
    font-family: var(--font-serif);
    font-size: 26px;
    color: var(--c-primary);
    margin-bottom: 10px;
    font-weight: 600;
}
.menu-card-desc {
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--c-text-light);
    line-height: 1.7;
    font-style: italic;
}
.menu-indicator {
    position: absolute;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--c-primary);
    font-family: var(--font-serif);
    font-size: 16px;
    z-index: 5;
    background: rgba(255,255,255,0.9);
    padding: 6px 20px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.btn-collapse-menu {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

/* Menu grid (tóm gọn) */
.menu-grid {
    position: absolute;
    inset: 0;
    background: var(--c-bg);
    padding: 80px 24px 100px;
    overflow-y: auto;
    z-index: 10;
    animation: fadeInUp 0.6s ease;
}
.menu-grid::-webkit-scrollbar { width: 0; }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.menu-grid-title {
    text-align: center;
    font-family: var(--font-title);
    font-size: 40px;
    color: var(--c-primary);
    margin-bottom: 8px;
}
.menu-grid-subtitle {
    text-align: center;
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--c-text-light);
    letter-spacing: 2px;
    margin-bottom: 32px;
    text-transform: uppercase;
}
.menu-grid-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    max-width: 600px;
    margin: 0 auto 28px;
}
.menu-grid-item {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    transition: all 0.4s ease;
    opacity: 0;
    animation: gridItemIn 0.6s ease forwards;
    border: 1px solid rgba(139,44,58,0.05);
}
.menu-grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
@keyframes gridItemIn {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.menu-grid-item img {
    width: 100%;
    height: 110px;
    object-fit: cover;
}
.menu-grid-info {
    padding: 12px 14px;
}
.menu-grid-info h4 {
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--c-primary);
    margin-bottom: 4px;
    font-weight: 600;
}
.menu-grid-info p {
    font-size: 12px;
    color: var(--c-text-light);
    line-height: 1.5;
}
.menu-grid .btn-continue {
    display: block;
    margin: 0 auto;
    opacity: 1;
}

/* --- Chương 5: Kết thiệp --- */
.chapter-farewell {
    background: linear-gradient(180deg, var(--c-bg) 0%, var(--c-accent) 50%, var(--c-bg) 100%);
}
.chapter-farewell::before, .chapter-farewell::after { opacity: 0.3; }
.farewell-content {
    text-align: center;
    max-width: 520px;
    padding: 40px 28px;
    color: var(--c-primary);
    overflow-y: auto;
    max-height: 100vh;
}
.farewell-content::-webkit-scrollbar { width: 0; }
.farewell-ornament {
    margin-bottom: 28px;
    color: var(--c-gold);
    opacity: 0.5;
    animation: floatSlow 4s ease infinite;
}
.farewell-message {
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.9;
    color: var(--c-text);
    margin-bottom: 36px;
    font-style: italic;
}
.farewell-details {
    margin: 28px 0;
    padding: 28px 24px;
    background: rgba(255,255,255,0.6);
    border-radius: 4px;
    border: 1px solid rgba(201,162,39,0.15);
}
.farewell-detail-label {
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--c-text-light);
    margin-bottom: 10px;
    letter-spacing: 1px;
}
.farewell-venue {
    font-family: var(--font-serif);
    font-size: 22px;
    margin: 6px 0;
    font-weight: 600;
}
.farewell-address {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 10px;
}
.farewell-date, .farewell-time {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 500;
}
.farewell-goodbye {
    font-family: var(--font-title);
    font-size: clamp(26px, 6vw, 38px);
    margin: 28px 0;
    color: var(--c-primary);
    line-height: 1.4;
}
.farewell-couple {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid rgba(201,162,39,0.2);
}
.farewell-couple p {
    font-family: var(--font-serif);
    font-size: 22px;
    color: var(--c-primary);
    font-weight: 600;
}
.farewell-amp {
    font-family: var(--font-title);
    font-size: 28px;
    color: var(--c-gold) !important;
}

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

/* --- Responsive --- */
@media (max-width: 600px) {
    .envelope { width: 280px; height: 190px; }
    .invitation-content { padding: 70px 20px; }
    .menu-card-img { max-width: 300px; height: 220px; }
    .menu-grid-items { grid-template-columns: repeat(2, 1fr); }
    .chapter::before, .chapter::after { width: 80px; height: 80px; }
}
