:root {
    /* Colors - Paper theme with premium accents */
    --color-bg: #fdfaf6;
    /* Creamy paper */
    --color-text: #2c3e50;
    --color-accent-dark: #1a252f;
    /* Graphite */
    --color-accent-blue: #2c3e50;
    /* Navy */
    --color-accent-green: #2ecc71;
    /* Subtle check mark green */
    --color-accent-gold: #c5a059;
    /* Premium gold */
    --color-line: rgba(44, 62, 80, 0.1);
    /* Typography */
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Montserrat', sans-serif;
    /* Dimensions */
    --page-width: 90vw;
    --page-height: 80vh;
    --max-content-width: 800px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: #f0ede9;
    /* Outer table/background */
    font-family: var(--font-sans);
    color: var(--color-text);
    overflow-x: hidden;
    line-height: 1.6;
}

.serif {
    font-family: var(--font-serif);
}

.italic {
    font-style: italic;
}

/* Loader Styles */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-accent-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-content p {
    color: var(--color-accent-gold);
    font-size: 1.8rem;
    text-align: center;
    opacity: 0;
}

/* Page Flipping Container */
.book-container {
    opacity: 0;
    /* Hidden until loaded */
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 2000px;
    touch-action: pan-y;
    /* Allow vertical scroll, but disable horizontal browser gestures */
}

.book {
    position: relative;
    width: var(--page-width);
    height: var(--page-height);
    max-width: 1200px;
    max-height: 800px;
    transform-style: preserve-3d;
    user-select: none;
    /* Prevent text selection during swipes */
}

/* Base Page Styles */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-bg);
    padding: 60px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    transform-origin: left center;
    transition: transform 0.1s ease-out;
    /* Fallback/Base */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* Paper Grain Texture (Subtle) */
.page::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://www.transparenttextures.com/patterns/natural-paper.png');
    opacity: 0.3;
    pointer-events: none;
}

.page-content {
    max-width: var(--max-content-width);
    margin: 0 auto;
    width: 100%;
    z-index: 1;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Specific Page Designs */
.page--cover {
    background-color: var(--color-accent-dark);
    color: var(--color-bg);
    text-align: center;
    border-left: 15px solid var(--color-accent-gold);
}

.cover-design {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.page--cover h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.page--cover .subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 3rem;
    font-weight: 300;
}

.logo-box {
    font-size: 2.5rem;
    border: 2px solid var(--color-accent-gold);
    color: var(--color-accent-gold);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 40px;
    font-weight: 700;
    flex-shrink: 0;
}

.ornament {
    width: 60px;
    height: 2px;
    background: var(--color-accent-gold);
    margin: 0 auto 30px;
    opacity: 0.5;
    flex-shrink: 0;
}

.cta-button {
    background: var(--color-accent-gold);
    color: white;
    border: none;
    padding: 18px 36px;
    font-size: 1rem;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, background 0.3s ease;
    border-radius: 2px;
}

.cta-button:hover {
    transform: translateY(-3px);
    background: #b58d4a;
}

.cover-credit {
    margin-top: 60px;
    font-size: 0.7rem;
    opacity: 0.4;
    font-weight: 300;
}

.cover-credit a {
    color: var(--color-accent-gold);
    text-decoration: none;
}

/* Chapter Headers */
.chapter-header {
    border-bottom: 1px solid var(--color-line);
    margin-bottom: 40px;
    padding-bottom: 20px;
}

.chapter-number {
    display: block;
    color: var(--color-accent-gold);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.chapter-header h2 {
    font-size: 2.5rem;
    color: var(--color-accent-dark);
}

/* Content Blocks */
.narrative {
    font-size: 1.15rem;
    color: #444;
}

.dropcap {
    float: left;
    font-family: var(--font-serif);
    font-size: 4.5rem;
    line-height: 1;
    padding-top: 4px;
    padding-right: 8px;
    color: var(--color-accent-gold);
}

.icons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 50px;
    text-align: center;
}

.icon-placeholder {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: rgba(197, 160, 89, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.icon-placeholder::after {
    content: "✓";
    color: var(--color-accent-gold);
    font-size: 1.5rem;
}

/* Services */
.services-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.service-item {
    padding: 20px;
    border: 1px solid var(--color-line);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    background: white;
}

.service-item:hover {
    padding-left: 30px;
    border-color: var(--color-accent-gold);
}

.service-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-accent-gold);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.service-item:hover::before {
    transform: scaleY(1);
}

.expand-hint {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #aaa;
    margin-top: 5px;
}

/* Workflow steps */
.workflow {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.step-num {
    font-size: 1.2rem;
    color: var(--color-accent-gold);
    font-weight: 700;
}

/* Footnotes */
.footnotes {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footnote {
    display: flex;
    gap: 10px;
    font-size: 0.95rem;
}

.footnote-mark {
    color: var(--color-accent-gold);
    font-weight: bold;
    font-size: 0.8rem;
    vertical-align: super;
}

/* Margin Notes (Reviews) */
.margin-notes {
    position: relative;
}

.note {
    font-style: italic;
    font-size: 1.2rem;
    margin-bottom: 40px;
    position: relative;
    padding-left: 30px;
    color: #555;
}

.note::before {
    content: '"';
    position: absolute;
    left: 0;
    top: -10px;
    font-size: 3rem;
    color: var(--color-accent-gold);
    opacity: 0.3;
}

.note cite {
    display: block;
    font-size: 0.8rem;
    font-style: normal;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 10px;
    color: #888;
}

/* Contact Details Page */
.contact-details {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.contact-method {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.contact-link {
    font-size: 2.2rem;
    color: var(--color-accent-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: var(--color-accent-gold);
}

.address {
    font-size: 1.2rem;
    color: #666;
    line-height: 1.4;
}

/* Page Stack & Animation Hooks */
.page {
    z-index: 1;
}

.signature {
    display: block;
    margin-left: auto;
    margin-top: 30px;
    width: 120px;
    height: auto;
    pointer-events: none;
    z-index: 10;
    /* Stamp effect */
    opacity: 0.9;
    filter: sepia(0.2);
    transform: translateY(-50%);
    /* Lift up by half height */
}

.scroll-area {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    padding-right: 15px;
    -webkit-overflow-scrolling: touch;
    max-height: 100%;
    min-height: 0;
    /* CRITICAL for flexbox overflow/scrolling */
}

.scroll-area>div:first-child {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding-bottom: 20px;
}

/* Hide scrollbar for a cleaner book look */
.scroll-area::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .page {
        padding: 30px 20px;
    }

    .page--cover h1 {
        font-size: 2.2rem;
    }

    .icons-grid {
        grid-template-columns: 1fr;
    }

    .book-container {
        padding: 10px;
    }

    .book {
        width: 100%;
        height: 90vh;
        /* Give some vertical breathing room */
        max-width: 100%;
    }
}