:root {
    --bg-primary: rgba(52, 28, 11, 0.582);
    --bg-secondary: rgba(61, 48, 39, 0.55);
    --bg-surface: rgba(39, 30, 24, 0.5);
    --text-primary: #faf6f0;
    --text-muted: #a38c78;
    --accent: #cc7029;
    --accent-hover: #e88d46;
    --accent-contrast: #140f0d;
    --border-color: #7a4b28;
    --stitch-color: #e8dbce;
    --font-display: 'Rye', serif;
    --font-accent: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Lora', Georgia, serif;
}

body {
    background-color: var(--bg-primary);
    background-image: url('your-western-photo.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    padding-top: 64px;
    position: relative;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
h4,
.font-accent {
    font-family: var(--font-accent);
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.rounded-xl,
.rounded-2xl,
.rounded-3xl,
.rounded-lg {
    border-radius: 2px !important;
}

.glass-panel,
.rustic-border,
footer,
#mobile-menu,
#buy-modal > div {
    --bg-primary: #2c221b !important;
    --bg-secondary: #3d3027 !important;
    --bg-surface: #4f3e33 !important;
    --text-primary: #e8dbce !important;
    --text-muted: #a38c78 !important;
    --border-color: #7a4b28 !important;
    --stitch-color: #e8dbce !important;
    color: var(--text-primary);
}

.glass-panel {
    background-color: var(--bg-secondary) !important;
    border-bottom: 3px double var(--border-color) !important;
}

.rustic-border {
    border: 2px solid var(--border-color) !important;
    outline: 1px dashed var(--stitch-color) !important;
    outline-offset: -6px;
    border-radius: 2px !important;
    background-color: var(--bg-surface) !important;
}

/* ==================================================
   TRUE 3D HARDCOVER GEOMETRY
   ================================================== */
.book-stage {
    perspective: 1600px;
}

.perfect-3d-book {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateY(-26deg) rotateX(6deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.perfect-3d-book:hover {
    transform: rotateY(-14deg) rotateX(2deg) translateY(-5px);
}

.book-plane {
    position: absolute;
    backface-visibility: hidden;
}

.book-front {
    inset: 0;
    transform: translateZ(25px);
    background-color: #1a1a1a;
    border-radius: 2px 5px 5px 2px;
    box-shadow: inset 4px 0 10px rgba(0, 0, 0, 0.3);
    z-index: 10;
    overflow: hidden;
}

.book-hinge {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 2px;
    width: 24px;
    background: linear-gradient(to right, 
        rgba(255,255,255,0) 0%, 
        rgba(0,0,0,0.7) 30%, 
        rgba(0,0,0,0.95) 45%, 
        rgba(0,0,0,0.95) 55%, 
        rgba(255,255,255,0.3) 80%, 
        rgba(255,255,255,0) 100%);
    z-index: 20;
    pointer-events: none;
}

.book-spine {
    left: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    transform-origin: left;
    transform: translateZ(25px) rotateY(-90deg);
    background: linear-gradient(to right, #1a1a1a, #2a2a2a, #0a0a0a);
    border-radius: 5px 0 0 5px;
    box-shadow: inset 5px 0 15px rgba(0,0,0,0.6);
}

.book-page {
    inset: 4px 4px 4px 35px;
    background-color: #f7f7f7;
    border-right: 1px solid #e0e0e0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 0 2px 2px 0;
    box-shadow: 1px 1px 1px rgba(0,0,0,0.02);
}

.book-back {
    inset: 0;
    transform: translateZ(-25px);
    background-color: #1a1a1a;
    border-radius: 2px 5px 5px 2px;
    box-shadow: -5px 10px 30px rgba(0,0,0,0.7);
}

.protected-art {
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.reader-scroll::-webkit-scrollbar {
    width: 8px;
}

.reader-scroll::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
}

.reader-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 0px;
}

.double-border {
    border-style: double;
}

.theme-border {
    border-color: var(--border-color);
}

/* ==================================================
   MOBILE MENU BREAKPOINT OVERRIDE (932px)
   ================================================== */
/* Apply mobile layout for screens 932px and below */
@media (max-width: 1015px) {
    /* Hide the desktop navigation */
    nav[aria-label="Primary Navigation"] {
        display: none !important;
    }

    /* Show the hamburger button */
    #mobile-menu-btn {
        display: block !important;
    }

    /* Force the mobile menu to show when toggled, overriding Tailwind's md:hidden */
    #mobile-menu:not(.hidden) {
        display: block !important;
    }
}

/* Enforce desktop layout for screens 933px and above */
@media (min-width: 933px) {
    #mobile-menu,
    #mobile-menu-btn {
        display: none !important;
    }

    nav[aria-label="Primary Navigation"] {
        display: flex !important;
    }
}
