/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Oswald:wght@300;400;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Lato:wght@300;400;700&display=swap');

:root {
    --gold: #D4AF37;
    --black: #0a0a0a;
    --dark-gray: #1a1a1a;
    --white: #ffffff;
    --page-width: 500px;
    /* A4 Ratio approx */
    --page-height: 700px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--dark-gray);
    color: var(--black);
    font-family: 'Lato', sans-serif;
    overflow: hidden;
    /* Hide scrollbars for the app container */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Magazine Container */
#magazine {
    width: 1000px;
    /* 2x Page Width */
    height: 700px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

/* Page Styling */
.page {
    background-color: var(--white);
    padding: 0;
    /* Content padding handled inside */
    overflow: hidden;
    position: relative;
    border-right: 1px solid #eee;
    /* Subtle spine */
}

/* Page Variations */
.page-cover {
    background-color: var(--black);
    color: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.cover-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.6;
    z-index: 1;
}

.cover-content {
    z-index: 2;
    position: relative;
    padding: 2rem;
    width: 80%;
    height: 90%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.page-content {
    padding: 2rem;
    height: 100%;
    position: relative;
}

/* Typography & Elements */
h1 {
    font-family: 'Cinzel', serif;
    font-size: 3.5rem;
    color: var(--white);
    margin: 0;
}

h2 {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--gold);
    border-bottom: 2px solid var(--gold);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
    color: var(--black);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

p {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    text-align: justify;
    line-height: 1.5;
}

.quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--gold);
    margin: 1.5rem 0;
    text-align: center;
}

/* Images */
.full-page-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.content-img {
    width: 100%;
    max-width: 100%;
    /* Page height is 700px. 60% is 420px. 45vh on large screen is >450px. */
    max-height: 350px;
    object-fit: contain;
    margin: 1rem 0;
    border: 1px solid var(--gold);
}

.mini-logo {
    width: 80px;
    margin: 1rem auto;
    display: block;
}

/* Specific Page Classes */
.text-page {
    display: flex;
    flex-direction: column;
}

.toc-list {
    list-style: none;
    margin-top: 2rem;
}

.toc-list li {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    padding: 0.5rem 0;
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
}

.page-number {
    position: absolute;
    bottom: 1rem;
    font-family: 'Oswald', sans-serif;
    color: #999;
}

.--left .page-number {
    left: 2rem;
}

.--right .page-number {
    right: 2rem;
}

/* Inverted Page (Black Background) */
.page-dark {
    background-color: var(--black);
    color: var(--white);
}

.page-dark h3 {
    color: var(--gold);
}

.page-dark p {
    color: #ccc;
}

/* Responsive Warning */
@media (max-width: 1024px) {
    #magazine {
        transform: scale(0.8);
    }
}

/* Optimizations for Printing / PDF Export */
@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        margin: 0;
        padding: 0;
        overflow: visible !important;
        height: auto !important;
        background: white;
        display: block !important;
    }

    #magazine {
        width: 100% !important;
        height: auto !important;
        box-shadow: none !important;
        transform: none !important;
        margin: 0 !important;
        display: block !important;
    }

    .page {
        width: 100% !important;
        /* A4 aspect ratio height or exact mm */
        height: 297mm !important;
        page-break-after: always !important;
        break-after: always !important;
        page-break-inside: avoid !important;
        margin: 0 !important;
        border: none !important;
        /* Ensure backgrounds print */
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        background-color: white !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        float: none !important;
        overflow: hidden !important;
    }

    /* Force background images to print */
    .page-cover,
    .cover-bg,
    .page-content {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide page-flip UI or controls if existing */
    .stf__block,
    .stf__item {
        display: block !important;
        position: relative !important;
    }

    /* Reset font sizes for better readability on paper if needed */
    p {
        font-size: 12pt;
        color: black !important;
    }

    h1,
    h2,
    h3 {
        color: black !important;
        page-break-after: avoid;
    }

    /* Allow images to be high-res */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
}