* { box-sizing: border-box; }
body {
    background-color: #050505;
    color: #fff;
    margin: 0;
    padding: 0;
    font-family: 'Inter Tight', sans-serif;
    overflow: hidden; /* Main container handles scroll */
}

/* Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 30px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
}
.header-logo {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 2px 2px 4px #000;
    text-decoration: none;
    font-weight: bold;
}

/* Scroll Container */
.scroll-container {
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

/* Sections */
.page-section {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
    padding: 100px 20px;
}

/* Section 1: Basics */
.section-basics {
    background: radial-gradient(circle at center, #2a2a2a 0%, #000000 80%);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Background Video Carousel */
.bg-video-carousel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.bg-video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.bg-video {
    position: absolute;
    top: 0;
    left: 50%;
    width: auto;
    height: 100%;
    max-width: none;
    object-fit: contain;
    opacity: 0.2; /* Base opacity */
    transition: transform 1s ease-in-out, opacity 1s ease-in-out;
    transform: translateX(-50%);
}

.bg-video[data-pos="0"] { 
    left: 50%;
    transform: translateX(-150%); 
}
.bg-video[data-pos="1"] { 
    left: 50%;
    transform: translateX(-50%); 
    opacity: 0.4; /* Middle highlighted */
}
.bg-video[data-pos="2"] { 
    left: 50%;
    transform: translateX(50%); 
}

/* Wrapping state for instant move */
.bg-video.wrapping {
    transition: none;
    opacity: 0 !important;
}

.bg-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Vignette */
    background: radial-gradient(circle at center, rgba(0,0,0,0.3) 0%, #000 90%);
    z-index: 1;
}

.content-wrapper {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.book-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: clamp(3rem, 8vw, 6rem);
    margin-bottom: 1rem;
    color: #e0e0e0;
    text-shadow: 0 0 20px rgba(255, 200, 150, 0.3);
}
.book-subtitle {
    font-family: 'Encode Sans', sans-serif;
    font-size: 1.5rem;
    color: #aaa;
    margin-bottom: 3rem;
    max-width: 800px;
    line-height: 1.6;
}
.buy-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}
.btn {
    padding: 12px 30px;
    border: 1px solid #666;
    color: #fff;
    text-decoration: none;
    font-family: 'Teko', sans-serif;
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    border-radius: 4px;
}
.btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

/* Section 2: Video */
.section-video {
    background-color: #080808;
}
.video-container {
    width: 100%;
    max-width: 1000px;
    aspect-ratio: 16/9;
    background: #111;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}
.video-placeholder-text {
    color: #555;
    font-family: 'Teko', sans-serif;
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Section 3: Timeline */
.timeline-wrapper {
    height: 1000vh; /* Increased height for longer timeline */
    position: relative;
    scroll-snap-align: start;
}

.timeline-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.timeline-visual {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.timeline-overlay {
    z-index: 10;
    pointer-events: none;
    text-align: center;
    position: absolute;
    top: 10%; /* Aligned with top of nav bar */
    right: 80px; /* Positioned to the left of the nav bar */
    left: auto; /* Remove centering */
    transform: none; /* Remove centering */
}

.timeline-title {
    font-family: 'Inter Tight', sans-serif; /* Changed from Cinzel Decorative */
    font-size: 2rem; /* Reduced from 3rem */
    margin: 0;
    color: #e0e0e0;
    text-transform: uppercase; /* Added for cleaner look */
    letter-spacing: 2px; /* Added for cleaner look */
    font-weight: 300; /* Lighter weight */
}

.timeline-subtitle {
    font-family: 'Encode Sans';
    color: #aaa;
    margin-top: 10px;
}

.timeline-ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

/* Custom Timeline Scrollbar */
.timeline-nav {
    position: fixed;
    right: 40px; 
    top: 10%;
    height: 80%;
    width: 12px; /* Increased from 4px to 12px for better clickability */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px; /* Adjusted for new width */
    pointer-events: auto;
    cursor: pointer;
    z-index: 1000; 
    transition: width 0.2s, background 0.2s;
}
.timeline-nav::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; 
    height: 0; 
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid rgba(255, 255, 255, 0.5); /* CSS Triangle Up */
}
.timeline-nav::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; 
    height: 0; 
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid rgba(255, 255, 255, 0.5); /* CSS Triangle Down */
}
.timeline-nav:hover {
    width: 16px; /* Increased hover width */
    background: rgba(255, 255, 255, 0.2);
}
.timeline-progress-indicator {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 16px; /* Increased indicator size */
    height: 16px;
    background: #ffccaa;
    border-radius: 50%;
    box-shadow: 0 0 10px #ffccaa;
    transition: top 0.1s ease-out;
}
.timeline-year-marker {
    /* Re-purposed as generic label or removed? Keeping for now but might not use */
    position: absolute;
    right: 15px;
    font-family: 'Teko', sans-serif;
    color: #666;
    font-size: 0.8rem;
    transform: translateY(-50%);
}

.timeline-story-dot {
    position: absolute;
    left: 0; /* Align to left of container */
    width: 100%; /* Full width of the nav bar */
    height: 4px; /* Bar height */
    background: rgba(255, 255, 255, 0.3); /* Lighter, semi-transparent */
    border-radius: 2px; /* Slight rounding */
    transform: translateY(-50%); /* Only center vertically */
    pointer-events: auto; /* Enable hover events */
    transition: transform 0.2s, background 0.2s;
    z-index: 5;
}
.timeline-story-dot:hover {
    transform: translateY(-50%) scaleX(1.5); /* Expand width slightly on hover */
    background: #fff;
    z-index: 10;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}
/* Tooltip for dots */
.timeline-story-dot::after {
    content: attr(data-label);
    position: absolute;
    right: 25px; /* Position further to the left */
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #ffccaa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Encode Sans', sans-serif;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 204, 170, 0.3);
}
.timeline-story-dot:hover::after {
    opacity: 1;
}

.screen-marker {
    position: absolute;
    left: 50%;
    width: 14px;
    height: 14px;
    background: #ff7f50; /* Coral/Peach - more distinct */
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 8px rgba(255, 127, 80, 0.6);
    z-index: 2; /* Ensure above the bar */
}
.screen-marker::after {
    content: attr(data-label);
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff7f50;
    font-family: 'Teko', sans-serif;
    font-size: 1.2rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
}
.timeline-nav:hover .screen-marker::after {
    opacity: 1;
}

/* Timeline Controls */
.timeline-controls {
    position: fixed;
    top: 90%; /* Match year display */
    left: 40px; /* Moved to left side */
    transform: translateY(-50%); /* Center vertically relative to top */
    display: flex;
    flex-direction: column; /* Vertical stack */
    align-items: center;
    gap: 0; /* Joined buttons */
    z-index: 1000;
    background: transparent;
    padding: 0;
    border: none;
    backdrop-filter: none;
    
    opacity: 0; /* Hidden by default, shown via JS when active */
    transition: opacity 0.3s;
    pointer-events: none; /* Disable clicks when hidden */
}
.timeline-controls.active {
    opacity: 1;
    pointer-events: auto;
}

.control-btn {
    background: rgba(10, 10, 10, 0.7); /* Darker, high-contrast background */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: none; /* Remove bottom border for stacking */
    color: #eee;
    font-family: 'Inter Tight', sans-serif; 
    /* font-size removed as we use SVG size */
    width: 50px; /* Increased width */
    height: 44px; /* Increased height */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 0; /* Reset radius */
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px); /* Stronger blur */
    box-shadow: 0 4px 10px rgba(0,0,0,0.5); /* Deeper shadow */
}

.control-btn svg {
    width: 28px; /* Larger icons */
    height: 28px;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
    transition: transform 0.2s ease;
}

.control-btn:hover svg {
    transform: scale(1.15);
}

.control-btn:first-child {
    border-radius: 8px 8px 0 0; /* Slightly rounder corners */
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.control-btn:last-child {
    border-radius: 0 0 8px 8px; /* Slightly rounder corners */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); /* Restore bottom border */
}

.control-btn:hover {
    background: #ff7f50;
    color: #000;
    border-color: #ff7f50;
    z-index: 1; /* Bring to front on hover */
    box-shadow: 0 0 15px rgba(255, 127, 80, 0.5);
}
.control-btn:active {
    transform: scale(0.95);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}
.control-btn.active-btn {
    background: #ff7f50;
    color: #000;
    border-color: #ff7f50;
    box-shadow: 0 0 20px rgba(255, 127, 80, 0.7);
    z-index: 2;
    text-shadow: none;
}

/* Year Odometer */
.year-display {
    position: fixed;
    top: 90%; /* Moved further down */
    left: 120px; /* Moved to right of controls */
    transform: translateY(-50%); /* Vertical center only */
    display: flex;
    font-family: 'Cinzel Decorative', serif;
    font-size: 80px; /* Reduced from 100px to match "small" look */
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8); /* Black glow for readability */
    height: 240px; /* Reduced from 300px */
    overflow: hidden;
    pointer-events: none;
    z-index: 10;
    /* Alpha Mask for fade effect - Tighter mask to hide neighbors */
    mask-image: linear-gradient(to bottom, transparent 0%, transparent 30%, black 40%, black 60%, transparent 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 30%, black 40%, black 60%, transparent 70%, transparent 100%);
    opacity: 0; /* Hidden by default, toggled by JS */
    transition: opacity 0.5s ease-in-out, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s, text-shadow 0.3s;
}

.year-display.active-card {
    color: #ffccaa;
    text-shadow: 0 0 30px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.8); /* Strong black glow */
    transform: translateY(-50%) scale(1.15); /* Fixed transform to prevent horizontal shift */
    transform-origin: center center; /* Scale from center */
}

.year-digit-col {
    width: 50px; /* Reduced from 60px */
    height: 100%;
    position: relative;
}

.year-digit {
    position: absolute;
    left: 0;
    width: 100%;
    text-align: center;
    height: 80px; /* Reduced from 100px */
    line-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform; /* Optimize for animation */
}

/* Read Sample Modal */
.sample-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000; /* Above everything */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}
.sample-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.sample-content {
    background: #f9f5eb; /* Warmer cream paper color */
    color: #2a2a2a;
    width: 90%;
    max-width: 750px;
    height: 80vh;
    padding: 50px 60px; /* More generous padding */
    border-radius: 12px; /* Rounded edges */
    /* Depth: Deep shadow plus a subtle border and inner shadow for paper feel */
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5), 
        0 0 0 1px rgba(0,0,0,0.05),
        inset 0 0 80px rgba(160, 140, 100, 0.05); 
    overflow-y: auto;
    font-family: 'Encode Sans', sans-serif;
    line-height: 1.7;
    font-size: 1.15rem;
    user-select: none; /* Disable selection */
    -webkit-user-select: none;
    position: relative;
}

.sample-content h2 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 2rem;
    margin-bottom: 20px;
    color: #111;
    text-align: center;
}

.sample-content h3 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.3rem;
    font-weight: 100; /* Lighter weight */
    font-style: italic; /* Italicized */
    margin-top: -15px; /* Pull closer to h2 */
    margin-bottom: 30px;
    color: #555;
    text-align: center;
}

.sample-content p {
    margin-bottom: 20px;
    text-align: justify;
}

/* Scrollbar for sample content */
.sample-content::-webkit-scrollbar {
    width: 8px;
}
.sample-content::-webkit-scrollbar-track {
    background: #e0e0e0;
}
.sample-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}
.sample-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Section 4: Carousel */
.section-carousel {
    background: #0c0c0c;
}
.carousel-container {
    display: flex;
    gap: 30px;
    overflow-x: auto;
    max-width: 100%;
    padding: 40px 5%;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
}
.carousel-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* --- Responsive Adjustments --- */

@media (max-width: 1200px) {
    .timeline-nav {
        right: 20px;
    }
}

@media (max-width: 1024px) {
    /* Timeline Overlay Scaling */
    .timeline-title {
        font-size: 1.5rem; /* Reduced further for tablet */
    }
    .timeline-subtitle {
        font-size: 0.8rem;
    }
    .timeline-overlay {
        /* Keep top right position */
        top: 10%;
        right: 40px; /* Slightly closer to edge */
        left: auto;
        transform: none;
        text-align: right; /* Align text to right for cleaner edge */
    }

    /* Year Display Scaling */
    .year-display {
        font-size: 80px; /* Reduced from 100px */
        left: 90px; /* Right of controls */
        transform: translateY(-50%); /* Vertical center only */
        height: 240px;
    }
    .year-display.active-card {
        transform: translateY(-50%) scale(1.15); /* Keep vertical center */
        transform-origin: center center; /* Scale from center */
    }
    .year-digit-col {
        width: 50px; /* Reduced */
    }
    .year-digit {
        height: 80px; /* Reduced */
        line-height: 80px;
    }

    /* Speed Controls Scaling */
    .timeline-controls {
        top: 90%; /* Match year display */
        left: 20px; /* Left edge */
        bottom: auto;
        padding: 0;
        gap: 0;
    }
    .control-btn {
        width: 40px; /* Slightly smaller on tablet/mobile */
        height: 36px;
    }
    .control-btn svg {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 900px) {
    /* Typography */
    .book-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
    .book-subtitle {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .header-logo {
        font-size: 1.2rem;
    }

    /* Buttons */
    .buy-links {
        flex-direction: column;
        width: 100%;
        max-width: 250px; /* Constrain width */
    }
    .btn {
        width: 100%;
        text-align: center;
        padding: 10px 20px;
        font-size: 1.2rem;
    }

    /* Timeline Navigation */
    .timeline-nav {
        width: 8px;
        right: 25px; /* Increased from 10px to avoid scrollbar overlap */
    }
    .timeline-nav::before {
        border-left-width: 6px;
        border-right-width: 6px;
        border-bottom-width: 10px;
        top: -16px;
    }
    .timeline-nav::after {
        border-left-width: 6px;
        border-right-width: 6px;
        border-top-width: 10px;
        bottom: -16px;
    }
    
    /* Adjust indicator to match */
    .timeline-progress-indicator {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 500px) {
    .timeline-title {
        font-size: 1.2rem; /* Even smaller for mobile */
    }
    .buy-links {
        max-width: 200px;
    }

    .btn {
        font-size: 1rem;
        padding: 8px 12px;
    }

    .header-logo {
        font-size: 1rem;
    }
}

/* Mobile-specific override: Move timeline to edge on touch devices (no scrollbar gap needed) */
@media (max-width: 900px) and (hover: none) and (pointer: coarse) {
    .timeline-nav {
        right: 5px;
    }
}
