/*
Theme Name: Arestia Theme
Theme URI: https://www.artesiumpress.com
Author: Kevin A. Karr	
Author URI: https://www.artesiumpress.com
Description: A custom Wordpress theme designed for authors and specifical designed for my Artesia line of middlegrade fantasy books written by me, Kevin A. Karr
Version: 4.8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: custom, blog, responsive
Text Domain: artesia-theme
*/

/* --- 1. VARIABLES (COLORS & FONTS) --- */
:root {
    --midnight-blue: #0b1e33;
    --burnished-gold: #c5a059;
    --leather-brown: #5c4033;
    --parchment: #fcf5e5;
    --text-dark: #333;
    --white: #ffffff;
}

/* --- 2. GLOBAL RESET & TYPOGRAPHY --- */
*, *::before, *::after {
    box-sizing: border-box; /* Global box-sizing reset */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Georgia', serif; 
    background-color: var(--parchment);
    color: var(--text-dark);
}

h1, h2, h3, h4 {
    font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
    color: var(--midnight-blue);
    transition: 0.3s;
}

/* --- 3. HEADER & NAVIGATION --- */
header {
    background: var(--midnight-blue); 
    padding: 0 2rem; 
    height: 90px;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    border-bottom: 3px solid var(--burnished-gold); 
    
    /* FIXED POSITIONING & Z-INDEX LAYERING */
    position: fixed !important; 
    top: 0; 
    left: 0;
    width: 100%;
    
    /* Priority Level: 1000 */
    z-index: 1000 !important; 
    
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    transition: top 0.3s ease; 
}

/* WORDPRESS ADMIN BAR ADJUSTMENT */
body.admin-bar header {
    top: 32px !important;
}

@media screen and (max-width: 782px) {
    body.admin-bar header {
        top: 46px !important; 
    }
}

/* Logo Area */
.logo-container {
    display: flex; 
    align-items: center; 
    gap: 15px;
}

.custom-logo {
    height: 60px; 
    width: auto; 
    background: #fff; 
    border: 1px solid var(--burnished-gold); 
    padding: 2px;
}

.site-title {
    font-family: 'Palatino Linotype', 'Book Antiqua', serif; 
    color: #fff; 
    font-size: 1.4rem; 
    letter-spacing: 1px; 
    border: 1px solid var(--burnished-gold); 
    padding: 5px 15px; 
    text-transform: uppercase;
}

/* Menu Layout */
.main-navigation {
    max-width: 100%; 
}

.main-navigation ul {
    list-style: none; 
    display: flex; 
    gap: 20px; 
    padding: 0; 
    margin: 0; 
    align-items: center;
}

.main-navigation li {
    position: relative; 
    margin: 0;
}

/* Link Styling */
.main-navigation a {
    text-decoration: none; 
    color: #ccc; 
    font-weight: 700; 
    text-transform: uppercase; 
    font-size: 0.9rem; 
    transition: 0.3s;
    padding: 10px 0;
    display: block;
}

.main-navigation a:hover {
    color: var(--burnished-gold);
    border-bottom: none; 
}

/* --- DROPDOWN MENUS (DESKTOP ONLY) --- */
/* FIX: This entire block is now wrapped in a Media Query. */
/* It will ONLY run on screens larger than 850px. */
@media (min-width: 851px) {
    
    /* Level 2 (Standard Dropdown) */
    .main-navigation ul ul {
        display: none; 
        position: absolute; 
        top: 100%; 
        left: 0;
        background: var(--midnight-blue); 
        border: 1px solid var(--burnished-gold);
        
        /* LAYOUT: Vertical Stack, Left Aligned, Full Width */
        flex-direction: column; 
        align-items: stretch; 
        text-align: left;     
        
        min-width: 220px; 
        gap: 0; 
        padding: 10px 0;
        
        /* DROPDOWN PRIORITY: 2000 */
        z-index: 2000 !important;
    }

    /* Level 3 (Grandchild / Flyout) */
    .main-navigation ul ul ul {
        top: 0 !important;      
        left: 100% !important;  
        margin-left: -2px;      
        border-top: 1px solid var(--burnished-gold); 
    }

    /* Show Submenus on Hover */
    .main-navigation li:hover > ul {
        display: flex; 
    }

    /* Targeted List Items inside Dropdown */
    .main-navigation ul ul li {
        display: block;
        width: 100%;
        margin: 0;
        text-align: left;
        position: relative; 
    }

    /* Link Styling inside Dropdown */
    .main-navigation ul ul a {
        padding: 12px 20px; 
        color: #aaa;
        border-bottom: 1px solid #1a2a44;
        text-align: left !important; 
        display: flex; 
        width: 100%;
        white-space: normal; 
    }

    .main-navigation ul ul a:hover {
        color: #fff; 
        background: #1a2a44;
    }
}
/* --- END DESKTOP DROPDOWNS --- */


/* --- 4. HERO & LAYOUT --- */
.hero-block {
    position: relative;
    background-color: var(--midnight-blue);
    color: var(--white);
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: flex-start;
    padding: 6rem 2rem 8rem; 
    min-height: 600px;
    overflow: hidden;
    z-index: 10;
}

/* --- THEATER MODE VIDEO SECTION --- */
.video-theater-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px; 
    margin-bottom: 4rem; 
    transition: all 1.2s ease-in-out;
    max-height: 600px; 
    opacity: 1;
    z-index: 100; 
}

.video-theater-wrapper.closed {
    max-height: 0;
    margin-bottom: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50px); 
}

.video-slider-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    background: #000;
    border: 3px solid var(--burnished-gold);
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}

.video-slide {
    display: none; 
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

.video-slide.active {
    display: block; 
}

.video-frame iframe {
    width: 100%; height: 100%;
    position: absolute; top: 0; left: 0;
}

/* --- CLOSE BUTTON (THE "X") --- */
.close-theater {
    position: absolute;
    top: -20px; 
    right: -20px;
    background: var(--burnished-gold);
    color: var(--midnight-blue);
    border: 2px solid var(--white);
    width: 30px; 
    height: 30px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center; 
    justify-content: center;
    padding: 0;
    opacity: 0; 
    transition: opacity 0.3s ease;
}

.video-theater-wrapper:hover .close-theater {
    opacity: 1;
}

.close-theater:hover {
    background: #fff;
    color: #ff0000; 
    transform: scale(1.1);
}

/* --- NAVIGATION ARROWS --- */
.vid-nav {
    position: absolute;
    top: 0; bottom: 0; margin: auto; 
    height: 50px; width: 30px;
    background-color: rgba(11, 30, 51, 0.8);
    color: var(--burnished-gold);
    border: 1px solid var(--burnished-gold);
    cursor: pointer;
    display: flex;
    align-items: center; justify-content: center;
    font-size: 1.2rem;
    transition: 0.3s;
    z-index: 25;
}
.vid-nav:hover {
    background-color: var(--burnished-gold);
    color: var(--midnight-blue);
}
.vid-nav.prev { left: -40px; } 
.vid-nav.next { right: -40px; }

.video-theater-wrapper.is-playing .vid-nav {
    opacity: 0;
    pointer-events: none;
}

/* --- BOOK CAROUSEL --- */
.hero-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 2;
}

.carousel-slide {
    display: none; 
    display: flex; 
    align-items: center;
    gap: 2rem;
    width: 100%;
    justify-content: center; 
}
.carousel-slide.active { display: flex; }

.book-3d {
    width: 300px; height: 450px;
    background-size: cover; background-position: center;
    box-shadow: 10px 10px 20px rgba(0,0,0,0.5);
    border: 2px solid var(--burnished-gold);
}

.hero-text {
    flex: 1; max-width: 600px; padding-left: 2rem;
}
.hero-text h1 {
    font-size: 3.5rem; color: var(--burnished-gold);
    margin-bottom: 1rem; text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* --- 5. BUTTONS --- */
.btn-magic {
    display: inline-block;
    background: var(--burnished-gold);
    color: var(--midnight-blue);
    padding: 15px 30px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
    border: 1px solid var(--burnished-gold);
}
.btn-magic:hover {
    background: transparent;
    color: var(--burnished-gold);
}

/* --- 6. HIGHLIGHTS / SYNOPSIS WRAPPER --- */
.synopsis-wrapper {
    max-width: 900px; 
    margin: -60px auto 4rem; 
    padding: 3rem;
    background: #fff; 
    border: 2px solid var(--burnished-gold);
    position: relative; 
    overflow: visible; 
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    min-height: 200px; 
}

.synopsis-slide {
    display: none;
    animation: textFade 1.2s ease-in-out;
}

.synopsis-slide.active {
    display: block;
}

.synopsis-slide.active .owl-float {
    animation: owlGlide 1.5s cubic-bezier(0.22, 1, 0.36, 1); 
}

@keyframes textFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes owlGlide {
    0% {
        opacity: 0;
        transform: translateX(80px) rotate(15deg); 
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotate(0deg); 
    }
}

.owl-float {
    position: absolute; 
    top: -60px; 
    right: -50px;
    width: 150px; 
    height: 150px;
    background-size: cover; 
    background-position: center;
    border-radius: 50%; 
    border: 5px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    background-color: var(--midnight-blue); 
}

.synopsis-title {
    border-bottom: 2px solid var(--burnished-gold);
    display: inline-block; 
    margin-bottom: 20px;
    font-size: 2rem;
    color: var(--midnight-blue);
}

/* --- 7. PAGE TITLE HEADER --- */
.entry-header {
    position: relative; 
    z-index: 10 !important; 
    margin-bottom: 3rem;	
    padding: 0.8rem 1rem !important; 
    min-height: auto;
    background-color: var(--midnight-blue);
    border-bottom: 4px solid var(--burnished-gold);
    border-top: 1px solid var(--burnished-gold); 
    text-align: center;
}

.entry-header .entry-title {
    color: var(--burnished-gold) !important;
    font-size: 2.2rem !important; 
    margin: 0;
    line-height: 1.2;
}

/* --- 8. GLOBAL OFFSET (GAP STRATEGY) --- */
.hero-block, 
.entry-header {
    margin-top: 95px !important; 
}

/* --- 9. RESPONSIVE LAYOUT CLASSES --- */
.page-container-responsive {
    max-width: 1100px;
    margin: 0 auto 4rem;
    padding: 0 1.5rem; 
}

@media (min-width: 900px) {
    .page-container-responsive {
        padding: 0 2rem 0 6rem;
    }
}

.book-flex-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 4rem;
    align-items: flex-start;
}

/* --- 10. FOOTER LAYOUT --- */
.site-footer {
    background-color: var(--midnight-blue);
    color: #ccc; 
    border-top: 5px solid var(--burnished-gold);
    margin-top: 4rem;
    font-size: 0.95rem;
}

.footer-widgets-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 3rem;
}

.footer-col {
    flex: 1;
    min-width: 280px; 
}

.footer-left { text-align: left; }
.footer-center { text-align: center; }
.footer-right { text-align: right; }

.widget-title {
    color: var(--burnished-gold);
    font-family: 'Palatino Linotype', serif;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(197, 160, 89, 0.3); 
    display: inline-block;
    padding-bottom: 5px;
}

.site-footer a {
    color: #fff;
    text-decoration: none;
    transition: 0.3s;
}
.site-footer a:hover {
    color: var(--burnished-gold);
}

.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.widget ul li {
    margin-bottom: 10px;
}

.site-info {
    background-color: #081626; 
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
    color: #777;
    border-top: 1px solid #1a2a44;
}

@media (max-width: 850px) {
    .footer-widgets-wrapper {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .footer-left, .footer-center, .footer-right {
        text-align: center;
    }
    .footer-col {
        width: 100%;
        margin-bottom: 2rem;
    }
}

/* --- 11. WORDPRESS ALIGNMENT FIXES --- */
.alignleft {
    float: left;
    margin-right: 2rem; 
    margin-bottom: 1rem;
    max-width: 50%; 
}

.alignright {
    float: right;
    margin-left: 2rem;
    margin-bottom: 1rem;
    max-width: 50%;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
}

.entry-content::after {
    content: "";
    display: table;
    clear: both;
}

/* --- 12. MOBILE SPECIFICS (MEDIA QUERY) --- */
@media (max-width: 850px) {
    
    header {
        height: auto !important; 
        position: relative !important; 
        flex-direction: column;
        padding: 2rem 1rem !important; /* Added vertical padding */
        gap: 1.5rem;
    }

    /* --- FIX 1: TITLE BOX ALIGNMENT --- */
    .logo-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
    }

    .custom-logo {
        margin: 0 auto 15px !important; /* Space below logo */
        display: block !important;
    }

    .site-title {
        display: table !important; /* Shrinks box to fit text */
        margin: 0 auto !important; /* Centers the box horizontally */
        text-align: center !important;
        line-height: 1.4 !important;
        white-space: normal !important;
        width: auto !important; /* Ensures it doesn't stretch to edges */
        max-width: 100%;
    }

    /* --- FIX 2: VERTICAL MENU STACKING --- */
    .main-navigation {
        width: 100%;
    }

    .main-navigation ul {
        flex-direction: column !important; /* Stack items vertically */
        width: 100%;
        align-items: stretch !important; /* Make items fill width */
        gap: 0 !important;
    }

    .main-navigation li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(197, 160, 89, 0.15); /* Separator lines */
        margin: 0 !important;
    }

    /* Big tappable links */
    .main-navigation a {
        padding: 15px 0 !important;
        display: block;
        width: 100%;
    }

    /* --- FIX 3: BUY BUTTON (OWN ROW) --- */
    .menu-item-buy {
        border-bottom: none !important;
        margin-top: 20px !important; /* Separate from the list */
        margin-bottom: 10px !important;
        display: flex;
        justify-content: center;
    }

    .menu-item-buy a {
        display: inline-block !important; /* Restore pill shape */
        width: auto !important; /* Don't stretch full width */
    }

    /* --- FIX 4: SUBMENU OVERLAPS & BEHAVIOR --- */
    /* This overrides the desktop flyout logic */
    .main-navigation ul ul,
    .main-navigation ul ul ul {
        position: relative !important; /* Flow naturally, don't float */
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        background: rgba(0,0,0,0.15) !important; /* Darker bg for hierarchy */
        
        /* Layout Reset */
        display: none; 
        flex-direction: column !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Indent 3rd Level deeply so it's obvious */
    .main-navigation ul ul ul a {
        padding-left: 30px !important; 
        color: #bbb !important;
        font-size: 0.85rem;
    }

    /* OPEN MENU LOGIC */
    /* On mobile, tapping 'hovers'. This reveals the nested list below. */
    .main-navigation li:hover > ul {
        display: flex !important;
    }

    /* ---------------------------------- */
    
    /* Layout Adjustments */
    .hero-block, .entry-header { margin-top: 10px !important; }
    .hero-wrapper { flex-direction: column-reverse; align-items: center; gap: 3rem; }
    .video-row-wrapper { width: 100%; max-width: 500px; }
    .carousel-slide { flex-direction: column; text-align: center; }
    .book-3d { margin: 0 auto 20px; }
    .hero-text { padding-left: 0; }
    .synopsis-wrapper { margin: 2rem 1rem; padding: 2rem 1rem; }
    .owl-float { right: 0; left: 0; margin: 0 auto; top: -75px; width: 120px; height: 120px; }
    .hero-text h1 { font-size: 2.5rem; }
    .entry-header .entry-title { font-size: 2rem !important; }
}

/* --- THE "BUY NOW" BUTTON IN MENU --- */
.menu-item-buy {
    margin-left: 0 !important; 
}

.menu-item-buy a {
    background: #00aaff !important; /* Magic Cyan + Important */
    color: #fff !important; 
    padding: 10px 25px !important; 
    border-radius: 30px !important; 
    box-shadow: 0 0 10px #00aaff;
    margin-left: 10px; 
    white-space: nowrap; 
    border: none !important;
}
.menu-item-buy a:hover {
    background: #fff !important;
    color: #00aaff !important;
    box-shadow: 0 0 15px #fff;
}

/* --- BLOG / NEWS FEED STYLING --- */

.blog-feed-container {
    max-width: 800px; /* Keep text readable width */
    margin: 0 auto;
}

.blog-entry {
    margin-bottom: 4rem;
}

.blog-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.blog-title a {
    color: var(--midnight-blue);
    text-decoration: none;
}
.blog-title a:hover {
    color: var(--burnished-gold);
}

.blog-meta {
    font-style: italic;
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    display: inline-block;
}

.blog-thumbnail img {
    width: 100%;
    height: auto;
    border: 2px solid var(--burnished-gold);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.blog-thumbnail a:hover img {
    transform: scale(1.01); /* Subtle zoom effect */
}

.blog-excerpt {
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* Small version of the magic button for the blog */
.btn-small {
    padding: 10px 20px !important;
    font-size: 0.8rem !important;
    margin-top: 0 !important;
}

.blog-separator {
    border: 0;
    border-bottom: 1px solid var(--burnished-gold);
    margin-top: 3rem;
    opacity: 0.3;
}

/* Pagination Styling */
.blog-pagination {
    margin-top: 4rem;
    text-align: center;
}

.blog-pagination .page-numbers {
    display: inline-block;
    padding: 10px 15px;
    background: var(--midnight-blue);
    color: #fff;
    margin: 0 5px;
    border-radius: 4px;
    border: 1px solid var(--midnight-blue);
}

.blog-pagination .page-numbers.current {
    background: var(--burnished-gold);
    border-color: var(--burnished-gold);
    color: var(--midnight-blue);
    font-weight: bold;
}

.blog-pagination a.page-numbers:hover {
    background: #fff;
    color: var(--midnight-blue);
}