/* --- CSS VARIABLES --- */
:root {
    /* The Journey Palette */
    --color-loss: #02060d;       /* Pitch Dark (Top) */
    --color-resilience: #163252; /* Deep Blue (Middle) */
    --color-hope: #5c4d1f;       /* Dark Gold/Bronze (Bottom) */
    
    --text-gold: #eebb5d;
    --text-gold-light: #fceeb5;
    --text-white: #f0f4f8;
    
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    
    /* Variables for 3D Book sizing */
    --book-width: 300px;
    --book-height: 450px; 
    --book-thickness: 50px; 
}

/* --- RESET & BASE STYLES --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--color-loss);
    color: var(--text-white);
    line-height: 1.6;
    overflow: hidden; 
    height: 100vh;
    width: 100vw;
    user-select: none; /* Prevent text selection while holding */
}

/* --- 3D FLIP ARCHITECTURE --- */
.perspective-wrapper {
    perspective: 1500px;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.page-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.page-flipper.flipped {
    transform: rotateY(-180deg);
}

.face {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow-y: auto; 
    overflow-x: hidden;
}

/* --- FRONT FACE: COUNTDOWN & SHAKE LOGIC --- */
.front-face {
    z-index: 2;
    transform: rotateY(0deg);
    display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 20px;
    background: radial-gradient(circle at center, var(--color-resilience), var(--color-loss));
}

.countdown-container {
    background: rgba(2, 6, 13, 0.7);
    backdrop-filter: blur(15px);
    padding: 50px;
    border-radius: 20px;
    border: 1px solid var(--text-gold);
    box-shadow: 0 0 60px rgba(238, 187, 93, 0.15);
    max-width: 800px; width: 90%;
    display: flex; flex-direction: column; align-items: center;
}

/* SHAKE ANIMATION */
@keyframes subtle-shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-2px, 0px) rotate(1deg); }
    30% { transform: translate(2px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-2px, 1px) rotate(0deg); }
    70% { transform: translate(2px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shaking {
    animation: subtle-shake 0.8s infinite;
}

.hold-btn-wrapper {
    position: relative;
    margin-top: 20px;
}

.enter-btn {
    background: transparent;
    color: var(--text-gold);
    border: 2px solid var(--text-gold);
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    cursor: pointer;
    border-radius: 50px;
    font-family: 'Montserrat', sans-serif;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* The filling effect background */
.btn-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0%;
    background: var(--text-gold);
    z-index: 1;
    transition: width 0s; /* Instant reset by default */
}

/* Text sits on top of the fill */
.btn-text {
    position: relative;
    z-index: 2;
    transition: color 0.3s;
}

/* Instruction Text */
.hold-instruction {
    margin-top: 15px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 1;
    transition: opacity 0.5s;
}

/* Active State (While Holding) */
.hold-btn-wrapper.active .enter-btn {
    animation: none; /* Stop shaking */
    transform: scale(0.98); 
    border-color: var(--text-gold-light);
    box-shadow: 0 0 30px rgba(238, 187, 93, 0.4);
}

.hold-btn-wrapper.active .btn-fill {
    width: 100%;
    transition: width 2s linear; /* Matches JS duration */
}

.hold-btn-wrapper.active .btn-text {
    color: var(--color-loss);
}

.hold-btn-wrapper.active .hold-instruction {
    opacity: 0;
}


/* --- BACK FACE: SCROLLYTELLING GRADIENT --- */
.back-face {
    transform: rotateY(180deg);
    background: linear-gradient(
        to bottom, 
        var(--color-loss) 0%, 
        var(--color-resilience) 50%, 
        var(--color-hope) 100%
    );
    background-attachment: local; 
}

/* --- TYPOGRAPHY & UTILITIES --- */
.countdown-title { font-family: 'Playfair Display', serif; color: var(--text-gold); font-size: 2.5rem; margin-bottom: 40px; letter-spacing: 2px; text-transform: uppercase; }
.timer-box { display: flex; justify-content: center; gap: 20px; margin-bottom: 50px; flex-wrap: wrap; }
.time-unit { display: flex; flex-direction: column; align-items: center; min-width: 80px; }
.time-value { font-family: 'Playfair Display', serif; font-size: 3.5rem; color: var(--text-white); font-weight: 700; line-height: 1; }
.time-label { font-size: 0.9rem; text-transform: uppercase; color: var(--text-gold); margin-top: 10px; letter-spacing: 2px; }

h1, h2, h3, h4 { font-family: 'Playfair Display', serif; color: var(--text-gold); letter-spacing: 1px; }
a { text-decoration: none; color: inherit; transition: 0.3s ease; }
section { padding: 80px 20px; max-width: 1200px; margin: 0 auto; position: relative; }
.hidden { opacity: 0; transform: translateY(30px); transition: all 1s ease-out; }
.show { opacity: 1; transform: translateY(0); }

.glass-card {
    background: var(--glass-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border); border-radius: 20px; padding: 40px; box-shadow: var(--glass-shadow);
}

/* NAV */
nav {
    position: sticky; top: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 20px 5%; z-index: 1000;
    background: rgba(2, 6, 13, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(238, 187, 93, 0.1);
}
.logo { font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 700; color: var(--text-gold); }
.nav-links { display: flex; list-style: none; gap: 30px; }
.nav-links li a { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-white); }
.nav-links li a:hover, .nav-links li a.active { color: var(--text-gold); }
.blog-btn { border: 1px solid var(--text-gold); padding: 8px 20px; border-radius: 50px; color: var(--text-gold) !important; }
.blog-btn:hover { background: var(--text-gold); color: var(--color-loss) !important; }
.hamburger { display: none; font-size: 1.5rem; color: var(--text-gold); cursor: pointer; }

/* HERO & BOOK & AUTHOR */
.hero { min-height: 90vh; display: flex; flex-direction: column-reverse; justify-content: center; align-items: center; padding-top: 50px; text-align: center; gap: 70px; }
@media(min-width: 768px) {
    .hero { flex-direction: row; text-align: left; justify-content: space-between; gap: 30px; }
    .hero-content { flex: 1; }
    .hero-image-container { flex: 1; display: flex; justify-content: center; align-items: center; padding: 40px; perspective: 2500px; }
}
.hero h1 { font-size: 3rem; margin-bottom: 10px; background: linear-gradient(to right, var(--text-gold), var(--text-gold-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.2; }
.hero h2 { font-size: 1.2rem; font-family: 'Montserrat', sans-serif; font-weight: 300; color: var(--text-white); margin-bottom: 30px; opacity: 0.9; text-transform: uppercase; letter-spacing: 2px; }
.hero-btn-group { margin-top: 30px; display: flex; gap: 20px; justify-content: center; }
@media(min-width: 768px) { .hero-btn-group { justify-content: flex-start; } }
.btn { padding: 15px 35px; border-radius: 5px; text-transform: uppercase; font-weight: 600; letter-spacing: 1px; cursor: pointer; border: none; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.btn-primary { background: linear-gradient(45deg, var(--text-gold), #b8860b); color: #000; }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(238, 187, 93, 0.4); }
.btn-secondary { background: transparent; border: 1px solid var(--text-white); color: var(--text-white); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

/* 3D BOOK & DETAILS */
.book-3d-wrap { width: var(--book-width); height: var(--book-height); position: relative; transform-style: preserve-3d; transform: rotateY(-35deg) rotateX(10deg); box-shadow: 25px 25px 50px -10px rgba(0,0,0,0.6); }
.book-cover-img { position: absolute; top:0; left:0; width: 100%; height: 100%; object-fit: cover; border-radius: 1px 4px 4px 1px; transform: translateZ(var(--book-thickness)); box-shadow: inset 3px 0px 8px rgba(0,0,0,0.2); }
.book-3d-wrap::before { content: ''; position: absolute; top: 2px; right: 0; width: var(--book-thickness); height: calc(100% - 4px); background: repeating-linear-gradient(to right, #e6e6e6, #e6e6e6 3px, #f1f1f1 3px, #f1f1f1 6px); transform: rotateY(90deg) translateX(calc(var(--book-thickness) / 2)) translateZ(calc(var(--book-thickness) / -2)); box-shadow: inset 5px 0px 10px rgba(0,0,0,0.1); }
.book-3d-wrap::after { content: ''; position: absolute; top: 0; left: 0; width: var(--book-thickness); height: 100%; background: #0f2b4d; transform: rotateY(90deg) translateX(calc(var(--book-thickness) / -2)) translateZ(calc(var(--book-thickness) / 2)); box-shadow: inset -5px 0px 15px rgba(0,0,0,0.4), inset 2px 0px 5px rgba(255,255,255,0.1); }
@media(max-width: 768px) { :root { --book-width: 220px; --book-height: 330px; --book-thickness: 40px; } .book-3d-wrap { transform: rotateY(-30deg) rotateX(10deg); } }

.section-title { text-align: center; font-size: 2.5rem; margin-bottom: 50px; position: relative; display: inline-block; left: 50%; transform: translateX(-50%); }
.section-title::after { content: ''; display: block; width: 60px; height: 3px; background: var(--text-gold); margin: 10px auto 0; }
.book-details { display: grid; grid-template-columns: 1fr; gap: 40px; }
@media(min-width: 768px) { .book-details { grid-template-columns: 1fr 1fr; } }
.buy-links { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 20px; }
.author-container { display: flex; flex-direction: column; align-items: center; gap: 30px; text-align: center; }
.author-img-placeholder { width: 200px; height: 200px; border-radius: 50%; background: linear-gradient(45deg, var(--glass-border), transparent); border: 2px solid var(--text-gold); display: flex; align-items: center; justify-content: center; font-size: 3rem; color: var(--text-gold); }

/* --- FOOTER & SOCIAL LINKS --- */
footer { text-align: center; padding: 50px 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.9rem; opacity: 0.8; background: rgba(0,0,0,0.2); }
.social-links { display: flex; justify-content: center; gap: 25px; margin-bottom: 25px; }
.social-links a { color: var(--text-white); font-size: 1.5rem; transition: all 0.3s ease; display: inline-block; }
.social-links a:hover { color: var(--text-gold); transform: translateY(-5px) scale(1.1); text-shadow: 0 0 10px rgba(238, 187, 93, 0.5); }

@media(max-width: 768px) {
    .nav-links { position: absolute; right: 0px; top: 70px; background: #02060d; height: 0; flex-direction: column; width: 100%; gap: 0; overflow: hidden; transition: height 0.3s ease; border-bottom: 1px solid var(--text-gold); }
    .nav-links.nav-active { height: 320px; }
    .nav-links li { width: 100%; text-align: center; padding: 20px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
    .hamburger { display: block; }
    .time-value { font-size: 2rem; }
    .countdown-title { font-size: 1.5rem; }
}
/* Update your existing nav block to include transition */
nav {
    position: sticky; 
    top: 0; 
    width: 100%; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 20px 5%; 
    z-index: 1000;
    background: rgba(2, 6, 13, 0.9); 
    backdrop-filter: blur(10px); 
    border-bottom: 1px solid rgba(238, 187, 93, 0.1);
    
    /* ADD THIS LINE for smooth sliding */
    transition: transform 0.3s ease-in-out;
}

/* ADD THIS NEW CLASS to handle the hiding */
nav.nav-hidden {
    transform: translateY(-100%);
}