:root { 
    --bg-dark: #050B1A;
    --royal-blue: rgba(15, 23, 42, 0.88);
    --royal-card: rgba(15, 23, 42, 0.78);
    --royal-border: rgba(59, 130, 246, 0.3);
    --royal-gradient: linear-gradient(135deg, rgba(30, 58, 138, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    --gold-accent: #E5C158;
    --gold-glow: rgba(229, 193, 88, 0.35);
    --text-primary: #F8FAFC;
    --text-muted: #94A3B8;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    --font-script: 'Pinyon Script', cursive;
}

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

html { 
    scroll-behavior: auto !important; 
}

body { 
    font-family: var(--font-sans); 
    background-color: var(--bg-dark); 
    color: var(--text-primary); 
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(30, 58, 138, 0.25) 0%, transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(15, 23, 42, 0.8) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Nav Bar */
.top-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 60;
    padding: 1.2rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(5, 11, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--royal-border);
}

.brand-monogram {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold-accent);
    letter-spacing: -0.03em;
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.nav-link {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s;
    letter-spacing: 0.5px;
}
.nav-link:hover, .nav-link.active { 
    opacity: 1; 
    font-weight: 700; 
}

.btn-tv-mode {
    background: rgba(229, 193, 88, 0.12);
    border: 1px solid var(--royal-border);
    color: var(--gold-accent);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-tv-mode:hover {
    background: rgba(229, 193, 88, 0.25);
    transform: scale(1.05);
}

/* Page Sections Switcher */
.page-view { 
    display: none; 
}
.page-view.active { 
    display: block; 
}

/* HOME SECTION - STRICT SINGLE VIEWPORT */
#home-view {
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

.hero-wrapper {
    position: relative;
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5rem 1.75rem 1.75rem 1.75rem;
    background: linear-gradient(to bottom, rgba(5, 11, 26, 0.25) 0%, rgba(5, 11, 26, 0.85) 100%),
                url('../assets/images/hero-amirul.webp') center/cover no-repeat;
}

.hero-center-content {
    margin-top: 24vh;
    text-align: center;
    max-width: 1100px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.hero-monogram-badge {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid var(--royal-border);
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
    font-family: var(--font-serif);
    color: var(--gold-accent);
    font-size: 1.15rem;
    font-weight: 700;
}

.hero-prefix {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}

.hero-names-title {
    font-family: var(--font-serif);
    font-size: clamp(2.8rem, 8vw, 6.2rem);
    font-weight: 400;
    color: #FFFFFF;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    text-shadow: 0 4px 20px rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-names-title .name-part { 
    display: inline-block; 
}

.hero-names-title .ampersand {
    font-family: var(--font-serif);
    font-weight: 300;
    font-style: italic;
    color: var(--gold-accent);
    padding: 0 0.25em;
}

.btn-cta-hero {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--royal-gradient);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #FFFFFF;
    padding: 0.9rem 1.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1px solid var(--royal-border);
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: all 0.2s;
}
.btn-cta-hero:hover { 
    transform: translateY(-2px); 
    border-color: rgba(255, 255, 255, 0.4); 
}

.hero-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 1rem;
}

.hero-date-text {
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
}

.hero-credit-text {
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
}

/* GUESTBOOK FEED SECTION */
.guestbook-wrapper {
    max-width: 680px;
    margin: 0 auto;
    padding: 6.5rem 1.25rem 8rem 1.25rem;
}

.guestbook-header {
    text-align: center;
    margin-bottom: 3rem;
}

.guestbook-title {
    font-family: var(--font-serif);
    font-size: 2.3rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.guestbook-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.wish-card-clean {
    background: var(--royal-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--royal-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    transition: border-color 0.2s;
}

.wish-photo-stage {
    width: 100%;
    background: #000;
    overflow: hidden;
}

.photo-grid-clean {
    display: grid;
    gap: 2px;
    width: 100%;
}
.photo-grid-clean.grid-1 { grid-template-columns: 1fr; aspect-ratio: 4/3; }
.photo-grid-clean.grid-2 { grid-template-columns: 1fr 1fr; aspect-ratio: 16/9; }
.photo-grid-clean.grid-3 { grid-template-columns: 2fr 1fr; aspect-ratio: 16/9; }
.photo-grid-clean.grid-4 { grid-template-columns: 1fr 1fr; aspect-ratio: 1/1; }

.photo-grid-clean img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wish-card-body {
    padding: 1.5rem;
}

.wish-message {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--text-primary);
    font-style: italic;
    margin-bottom: 1.25rem;
}

.wish-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
}

.wish-author {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gold-accent);
}

.wish-social {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.like-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: color 0.2s;
}
.like-btn.liked { 
    color: #E5484D; 
}

/* Floating Royal Blue Button */
.fab-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 50;
    background: var(--royal-gradient);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #FFFFFF;
    padding: 0.9rem 1.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1px solid var(--royal-border);
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, border-color 0.2s;
}
.fab-button:hover { 
    transform: translateY(-2px); 
    border-color: rgba(255, 255, 255, 0.4); 
}

/* Modal Clean */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(5, 11, 26, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.modal-overlay.visible { 
    display: flex; 
}

.modal-card {
    background: #0F172A;
    border: 1px solid var(--royal-border);
    width: 100%;
    max-width: 500px;
    border-radius: 16px;
    padding: 2rem;
    max-height: 90vh;
    overflow-y: auto;
}

.form-input {
    width: 100%;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--royal-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus { 
    border-color: var(--gold-accent); 
}

.btn-submit {
    width: 100%;
    padding: 1rem;
    background: var(--royal-gradient);
    color: #FFF;
    border: 1px solid var(--royal-border);
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
}

/* =========================================================
   REALISTIC 3D BOOK PAGE FLIP DISPLAY FOR TV (ROYAL BLUE)
   ========================================================= */
#liveWallOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: radial-gradient(ellipse at center, #0F172A 0%, #030712 100%);
    padding: 0;
    align-items: center;
    justify-content: center;
    perspective: 2000px;
}
#liveWallOverlay.visible { 
    display: flex; 
}

.tv-book-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: none;
    border-radius: 0;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    transform-style: preserve-3d;
}

/* Spine shadow down center of open book (only shown when book is split into 2 pages) */
.tv-book-container::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 50%;
    width: 3px;
    background: linear-gradient(to bottom, transparent, var(--gold-accent), transparent);
    box-shadow: 0 0 20px 8px rgba(0, 0, 0, 0.85);
    transform: translateX(-50%);
    z-index: 10;
}

/* Text-only wish (no photo): hide the center spine line, it looks bad on a single full-bleed page */
.tv-book-container.no-spine::after {
    display: none;
}

/* Individual Book Pages */
.tv-book-page {
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 100%;
    width: 100%;
}

.tv-book-page.left {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(10, 16, 30, 0.4);
    padding: 0;
}

.tv-book-page.right {
    background: rgba(15, 23, 42, 0.4);
    padding: 3rem 3.5rem;
}

.tv-book-page.full-spread {
    grid-column: 1 / -1;
    padding: 4rem 5rem;
    text-align: center;
}

.tv-book-photo {
    width: 100%;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
    object-fit: contain;
}

.tv-book-quote {
    font-family: var(--font-serif);
    color: #FFFFFF;
    font-style: italic;
    line-height: 1.4;
    margin-bottom: 1.5rem;
    text-align: center;
}

.tv-book-quote.split-view {
    font-size: clamp(1.8rem, 3.4vw, 3.2rem);
    color: var(--gold-accent);
}

.tv-book-quote.full-spread {
    font-size: clamp(2.2rem, 3.8vw, 3.6rem);
    color: #FFFFFF;
    max-width: 950px;
}

.tv-book-author {
    font-size: clamp(1.5rem, 2.4vw, 2.1rem);
    color: #FFFFFF;
    font-weight: 800;
    letter-spacing: 1px;
    text-align: center;
}

.tv-book-social {
    font-size: clamp(1.05rem, 1.4vw, 1.4rem);
    color: var(--gold-accent);
    opacity: 0.9;
    margin-top: 4px;
    text-align: center;
}

.tv-book-footer {
    position: absolute;
    bottom: 1.2rem;
    left: 2rem;
    right: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Selak Buku - real page-turn (single continuous direction, hinge at spine edge,
   revealing the next spread underneath, NOT a card flip) */
.tv-page-layer {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.tv-page-layer.behind { z-index: 1; }
.tv-page-layer.front { z-index: 2; transform-origin: left center; }

.page-turn-anim {
    animation: pageTurn 1s cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards;
}

@keyframes pageTurn {
    0%   { transform: rotateY(0deg);    filter: brightness(1); }
    35%  { filter: brightness(0.75); }
    50%  { transform: rotateY(-95deg);  filter: brightness(0.55); }
    100% { transform: rotateY(-178deg); filter: brightness(1); }
}

/* Toast */
#toast {
    position: fixed; top: 20px; left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #0F172A;
    border: 1px solid var(--gold-accent);
    color: #FFF;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 200;
    transition: transform 0.3s ease;
}
#toast.show { 
    transform: translateX(-50%) translateY(0); 
}

@media (max-width: 900px) {
    .tv-book-container {
        grid-template-columns: 1fr;
        height: 100dvh;
        max-height: 100dvh;
        overflow-y: auto;
    }
    .tv-book-container::after { display: none; }
}

@media (max-width: 768px) {
    .top-navbar { padding: 1rem 1.25rem; }
    .nav-links { gap: 0.8rem; }
    .nav-link { font-size: 0.75rem; }

    .hero-wrapper { padding: 5rem 1.25rem 1.25rem 1.25rem; }
    .hero-center-content { margin-top: 18vh; }

    .hero-names-title {
        flex-direction: column;
        line-height: 1.1;
    }
    .hero-names-title .ampersand {
        margin: 0.1em 0;
        font-size: 0.75em;
    }

    .hero-bottom-bar { flex-direction: row; justify-content: space-between; }
    .hero-date-text, .hero-credit-text { font-size: 0.72rem; }
    .fab-button { bottom: 1.5rem; right: 1.5rem; padding: 0.8rem 1.2rem; }
}
