:root {
    /* Colors */
    --color-bg-dark: #0a1f30;
    /* Midnight Blue */
    --color-bg-darker: #050f18;
    /* Darker shade for gradients */
    --color-text-main: #e0e0e0;
    /* Off-white for text */
    --color-text-muted: #a0a0a0;
    /* Muted grey */
    --color-accent: #c5a059;
    /* Antique Gold */
    --color-accent-hover: #e6c278;
    /* Lighter Gold */
    --color-primary: #8a1c1c;
    /* Crimson Red (Action) */
    --color-primary-hover: #ab2828;
    --color-dark-grey: #1a1a1a;

    /* Fonts */
    --font-heading: 'Cinzel', serif;
    --font-body: 'Lato', sans-serif;

    /* Spacing */
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-dark);
    color: var(--color-text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    color: var(--color-accent);
    font-weight: 700;
}

a {
    text-decoration: none;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* Utilities */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 2px;
    cursor: pointer;
    text-align: center;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    border: 1px solid var(--color-primary);
    box-shadow: 0 4px 15px rgba(138, 28, 28, 0.4);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(138, 28, 28, 0.6);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
}

.btn-secondary:hover {
    background-color: rgba(197, 160, 89, 0.1);
    color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: var(--spacing-md);
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--color-accent);
}

/* Hero Section */
#hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('assets/background.jpg');
    /* Fallback or specific background */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding: var(--spacing-xl) 0;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            rgba(10, 31, 48, 0.8),
            rgba(10, 31, 48, 0.95));
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg);
}

.hero-text {
    flex: 1;
    animation: fadeIn 1.5s ease-out;
}

.subtitle {
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.main-title {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    color: white;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.author {
    font-size: 1.5rem;
    color: var(--color-accent);
    margin-bottom: 2rem;
    font-weight: 300;
}

.cta-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: fit-content;
    /* Allows the container to shrink to the width of the button row so centering works relative to them */
}

.cta-buttons-row {
    display: flex;
    gap: 1rem;
    /* 
       On desktop, we want the buttons to align with the text (left-aligned).
       Previously it was 'center'.
    */
    justify-content: flex-start;
    flex-wrap: wrap;
}

.btn-autor {
    /* On desktop, align left to match text */
    align-self: flex-start;
    min-width: 200px;
    /* Optional: Ensure a nice width for the single button */
}


/* 3D Book Animation - Final Corrected */
.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    perspective: 2000px;
    z-index: 10;
}

.book-container {
    width: 320px;
    height: 480px;
    position: relative;
    transform: translateY(20px);
    cursor: pointer;
    transform-style: preserve-3d;
}

.book {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(-25deg) rotateX(10deg);
    transition: transform 0.6s ease;
}

.book-part {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform-origin: left;
    border-radius: 3px 6px 6px 3px;
    backface-visibility: hidden;
}

/* --- STACKING STRUCTURE (Closed Book) --- */

/* Back Cover (Bottom of stack) */
/* Back Cover (Bottom of stack) */
.back-side {
    background: #1a1a1a;
    transform: translateZ(0px) rotateY(180deg);
    z-index: 1;
    transform-origin: center;
}

.back-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Pages (Middle of stack) */
.page {
    background: linear-gradient(to right, #e3e3e3 0%, #fff 5%, #fff 100%);
    box-shadow: inset 1px 0px 2px rgba(0, 0, 0, 0.1);
}

/* Page Stack Z-Positions (Relative to Base 0) */
/* We build from bottom (Back) to top (Front) */
/* Page Stack Z-Positions are now handled via JS */

/* Front Cover (Top of stack) */
.front-side {
    transform: translateZ(50px);
    z-index: 20;
}

.front-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px 6px 6px 3px;
    box-shadow: inset 4px 0 5px rgba(255, 255, 255, 0.2);
}

/* Spine */
.spine-side {
    width: 50px;
    left: 0;
    height: 100%;
    background: #111;
    transform: rotateY(-90deg) translateX(-25px);
    transform-origin: left;
    z-index: 15;
}

.page-content {
    display: none;
}


/* --- ANIMATION: Wind Burst + Spin --- */

/* Book Rotation */
.book-container.wind-active .book {
    animation: bookSpin 8s forwards;
}

@keyframes bookSpin {
    0% {
        transform: rotateY(-25deg) rotateX(10deg);
    }

    100% {
        transform: rotateY(-200deg) rotateX(0deg);
    }
}

/* Ruffle Animation */
.book-container.wind-active .front-side {
    animation: ruffle 6s forwards;
    animation-delay: 0s;
}

.book-container.wind-active .page {
    animation: ruffle 6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Page animation delays are now handled via JS */

@keyframes ruffle {
    0% {
        transform: translateZ(var(--tz, 0)) rotateY(0deg);
    }

    30% {
        transform: translateZ(var(--tz, 0)) rotateY(-60deg);
    }

    100% {
        transform: translateZ(var(--tz, 0)) rotateY(0deg);
    }
}

/* Fix CSS Var for TZ */
/* Page TZ vars are now handled via JS */

.front-side {
    --tz: 50px;
}

/* Entrance Animation */
@keyframes bookEnter {
    0% {
        transform: translateY(100px) rotateY(-90deg);
        opacity: 0;
    }

    100% {
        transform: translateY(20px) rotateY(-30deg) rotateX(10deg);
        opacity: 1;
    }
}

.book {
    animation: bookEnter 1.5s ease-out forwards;
}


.scroll-down {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-accent);
    font-size: 2rem;
    z-index: 2;
    animation: bounce 2s infinite;
    cursor: pointer;
}

/* Sections */
section {
    padding: var(--spacing-xl) 0;
}

#sinopsis {
    background-color: var(--color-bg-darker);
}

.synopsis-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.hook {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-main);
    margin-bottom: var(--spacing-md);
    font-style: italic;
}

.synopsis-text p {
    margin-bottom: 1.5rem;
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

/* Author Section */
#autor {
    background: linear-gradient(135deg, var(--color-dark-grey) 0%, var(--color-bg-dark) 100%);
}

.author-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.author-image-wrapper {
    flex: 0 0 400px;
    display: flex;
    justify-content: center;
}

.author-img {
    width: 350px;
    height: 350px;
    object-fit: cover;
    object-position: 100% 20%;
    border-radius: 50%;
    border: 2px solid var(--color-accent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.author-bio {
    flex: 1;
}

.author-bio .section-title {
    text-align: left;
    margin-left: 0;
}

.author-bio .section-title::after {
    left: 0;
    transform: none;
}

.social-links {
    margin-top: 1.5rem;
}

.social-links a {
    color: var(--color-text-muted);
    font-size: 1.5rem;
    margin-right: 1.5rem;
}

.social-links a:hover {
    color: var(--color-accent);
}

/* Purchase Section */
#compra {
    background-color: var(--color-bg-dark);
    text-align: center;
    /* Reduce padding to fit cards better on screen */
    padding-top: 2rem;
    padding-bottom: 4rem;
}

#compra .section-title {
    margin-bottom: 0.5rem;
}

.compra-intro {
    font-size: 1.5rem;
    font-family: var(--font-heading);
    margin-bottom: 2rem;
    color: var(--color-primary);
}

.pricing-cards {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.card {
    background-color: var(--color-bg-darker);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 2rem;
    width: 300px;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-10px);
    border-color: var(--color-accent);
}

.card.featured {
    border: 1px solid var(--color-accent);
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.2);
    transform: scale(1.05);
}

.card.featured:hover {
    transform: scale(1.05) translateY(-10px);
}

.card-header {
    margin-bottom: 2rem;
    position: relative;
}

.ribbon {
    position: absolute;
    top: -2.5rem;
    right: -2.5rem;
    background-color: var(--color-primary);
    color: white;
    padding: 0.25rem 2rem;
    font-size: 0.8rem;
    font-weight: bold;
    transform: rotate(45deg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.card h3 {
    font-size: 1.5rem;
    color: white;
}

.format {
    color: var(--color-text-muted);
    font-style: italic;
}

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-body ul {
    margin-bottom: 2rem;
    flex: 1;
    text-align: left;
}

.card-body li {
    margin-bottom: 0.8rem;
    color: var(--color-text-muted);
}

.card-body li i {
    color: var(--color-accent);
    margin-right: 0.5rem;
}

.full-width {
    width: 100%;
}

/* Footer */
footer {
    background-color: black;
    padding: 2rem 0;
    text-align: center;
    color: var(--color-text-muted);
    border-top: 1px solid #222;
}

.credits i {
    color: var(--color-accent);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0) translateX(-50%);
    }

    40% {
        transform: translateY(-10px) translateX(-50%);
    }

    60% {
        transform: translateY(-5px) translateX(-50%);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }

    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
        padding-top: 2rem;
        align-items: center;
        /* Vital for centering the cta-group which has width: fit-content */
    }

    .cta-group {
        width: 100%;
        align-items: center;
        margin: 0 auto;
    }

    .cta-buttons-row {
        justify-content: center;
    }

    .btn-autor {
        align-self: center;
    }

    .hero-image {
        margin-bottom: 2rem;
    }

    .section-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Author Section Specific Responsive Fix (For Tablets & Mobile) */
@media (max-width: 1024px) {
    .author-container {
        flex-direction: column !important;
        text-align: center;
        gap: 2rem;
    }

    .author-image-wrapper {
        flex: 0 0 auto;
        width: 100%;
        justify-content: center;
    }

    .author-img {
        width: 280px;
        height: 280px;
        margin: 0 auto;
    }

    .author-bio {
        width: 100%;
    }

    .author-bio .section-title {
        text-align: center;
    }

    .author-bio .section-title::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .social-links {
        justify-content: center;
        display: flex;
    }
}



/* --- Checkout Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(135deg, var(--color-bg-darker) 0%, #1a1a1a 100%);
    border: 1px solid var(--color-accent);
    padding: 2.5rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--color-primary);
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.modal-header h3 {
    color: var(--color-accent);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.price-tag {
    font-size: 2rem;
    color: white;
    font-weight: 700;
    margin: 0.5rem 0;
}

.shipping-note {
    display: inline-block;
    background: rgba(197, 160, 89, 0.1);
    color: var(--color-accent);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-text-main);
    font-size: 0.9rem;
}

input,
textarea {
    width: 100%;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    border-radius: 4px;
    color: white;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.1);
}

.payment-action {
    margin-top: 2rem;
    text-align: center;
}

.payment-methods {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal-content {
        padding: 1.5rem;
    }
}