/* Google Fonts are now loaded in base.html */

:root {
    /* Palette: Sophisticated Whimsy */
    --color-midnight: #0F172A;
    /* Deep Navy - Slate 900 base */
    --color-midnight-light: #1E293B;
    /* Lighter navy for cards/nav */
    --color-parchment: #FDF6E3;
    /* Warm background */
    --color-parchment-dark: #F0E6D2;
    /* Darker parchment for headers/sections */

    --color-teal: #2A9D8F;
    /* Vibrant Teal */
    --color-teal-dark: #264653;

    --color-gold: #E9C46A;
    /* Muted Gold */
    --color-gold-hover: #F4A261;

    --color-text-main: #2C3E50;
    /* Deep Grey for readability on parchment */
    --color-text-light: #F8FAFC;
    /* Light text for midnight backgrounds */

    /* Typography */
    --font-serif: 'Crimson Text', serif;
    --font-sans: 'Nunito', sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Borders & Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --border-width: 2px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-parchment);
    color: var(--color-text-main);
    font-family: var(--font-serif);
    font-size: 1.125rem;
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-serif);
    color: var(--color-midnight);
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 {
    font-size: 3rem;
    font-weight: 700;
}

h2 {
    font-size: 2.25rem;
}

h3 {
    font-size: 1.75rem;
    color: var(--color-teal-dark);
}

a {
    color: var(--color-teal-dark);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-gold-hover);
}

/* UI Elements (Sans-Serif) */
button,
.btn,
.btn-primary,
nav,
footer,
.label {
    font-family: var(--font-sans);
}

.btn-primary {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--color-gold);
    color: var(--color-midnight);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
    background-color: var(--color-gold-hover);
    color: var(--color-midnight);
}

.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--color-midnight);
    color: var(--color-gold);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
    color: var(--color-parchment);
}

.btn-secondary {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: transparent;
    border: 2px solid var(--color-midnight);
    color: var(--color-midnight);
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: var(--color-midnight);
    color: var(--color-parchment);
}

.btn-outline-parchment {
    background-color: transparent;
    border: 2px solid var(--color-parchment);
    color: var(--color-parchment);
}

.btn-outline-parchment:hover {
    background-color: var(--color-parchment);
    color: var(--color-midnight);
}

/* Layout Classes */
.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

/* Navbar */
.navbar {
    background-color: var(--color-midnight);
    color: var(--color-parchment);
    padding: var(--spacing-sm) 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
}

.nav-brand {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gold);
}

.nav-links {
    display: flex;
    gap: var(--spacing-md);
    list-style: none;
}

.nav-links a {
    color: var(--color-parchment);
    font-weight: 600;
}

.nav-links a:hover {
    color: var(--color-gold);
}

/* Footer */
footer {
    background-color: var(--color-midnight-light);
    color: var(--color-parchment);
    padding: var(--spacing-xl) 0;
    margin-top: var(--spacing-xl);
    text-align: center;
    border-top: 4px solid var(--color-gold);
}

/* Dropdown Menu */
/* Improved Dropdown Hover Stability */
.dropdown {
    position: relative;
    display: inline-block;
    padding-bottom: 0.5rem;
    /* Add padding to bridge gap */
    margin-bottom: -0.5rem;
    /* Compensate for padding */
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    /* Position directly below */
    background-color: var(--color-midnight-light);
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-gold);
    z-index: 1000;
    /* Removed margin-top to prevent gap */
}

.dropdown-content a,
.dropdown-content button {
    color: var(--color-parchment);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    text-align: left;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
}

.dropdown-content a:hover,
.dropdown-content button:hover {
    background-color: var(--color-teal-dark);
    color: var(--color-gold);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--color-teal-dark);
    margin: 4px 0;
}

/* Cards */
.card {
    background-color: #fff;
    border: 1px solid var(--color-parchment-dark);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.08);
}

/* Utility */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    /* Start hidden */
}

.stagger-delay-1 {
    animation-delay: 0.2s;
}

.stagger-delay-2 {
    animation-delay: 0.4s;
}

.stagger-delay-3 {
    animation-delay: 0.6s;
}

/* Hero Section */
.hero-section {
    position: relative;
    background-image: linear-gradient(to bottom, rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.9)), url('../images/hero_bg.png');
    background-size: cover;
    background-position: center;
    color: var(--color-parchment);
    padding: 8rem 2rem 6rem;
    text-align: center;
    border-bottom: 4px solid var(--color-gold);
    overflow: hidden;
    margin-top: -60px;
    /* Pull up behind navbar if transparent, or just purely flush */
}

.hero-section h1,
.hero-section p {
    color: var(--color-parchment);
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    background: linear-gradient(to right, #FDF6E3, #E9C46A);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.hero-subtitle {
    font-size: 1.5rem;
    max-width: 700px;
    margin: 0 auto 3rem;
    opacity: 0.9;
    line-height: 1.6;
}

/* Lane Cards */
.lane-card {
    background-color: var(--color-midnight);
    /* Solid Navy */
    border: 1px solid var(--color-gold);
    border-radius: var(--radius-md);
    padding: 2.5rem 2rem;
    color: var(--color-parchment);
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.lane-card::before {
    /* Top accent line */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--color-gold), var(--color-teal));
    opacity: 0.8;
}

.lane-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--color-gold-hover);
    background-color: #1a2236;
    /* Slightly lighter navy */
}

.lane-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(253, 246, 227, 0.1);
    padding-bottom: 1rem;
}

.lane-number {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-gold);
    opacity: 0.8;
}

.lane-card h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-parchment);
}

.lane-card p {
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgba(253, 246, 227, 0.8);
    flex-grow: 1;
    /* Push arrow to bottom */
    margin-bottom: 1.5rem;
}

.lane-arrow {
    display: flex;
    justify-content: flex-end;
    color: var(--color-gold);
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.3s ease;
}

.lane-card:hover .lane-arrow {
    transform: translateX(5px);
    color: var(--color-gold-hover);
}

/* Reader Styles */
p.dialogue {
    margin-left: 2rem;
    margin-right: 2rem;
    font-style: italic;
    color: var(--color-midnight-light);
    /* mapped from #3a3a3a */
}

p.emphasis {
    font-style: italic;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--color-midnight);
    /* mapped from #4a4a4a */
    border-top: 1px solid var(--color-parchment-dark);
    border-bottom: 1px solid var(--color-parchment-dark);
    padding: 1rem 0;
}

p.short {
    text-align: center;
    margin: 1rem 0;
    font-weight: 300;
    font-size: 1.25em;
    /* Slightly larger for impact */
    letter-spacing: 0.05em;
}

.term {
    font-style: italic;
    color: var(--color-teal-dark);
    font-weight: 600;
}

.thought {
    font-style: italic;
    color: var(--color-midnight-light);
}

/* Book Detail Styles */
.book-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    margin-top: 2rem;
}

.cover-container {
    aspect-ratio: 2/3;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-midnight-light);
}

.meta-text {
    font-size: 1.25rem;
    color: var(--color-teal-dark);
    margin-bottom: 1.5rem;
}

.meta-label {
    font-weight: bold;
    color: var(--color-midnight);
}

.book-desc {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    margin-bottom: 2rem;
}

.product-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    font-size: 0.95rem;
    color: var(--color-midnight);
}

/* Grids & Layout Utilities */
.lanes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.featured-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.featured-image-container {
    text-align: right;
}

.featured-text-container {
    text-align: left;
}

/* Mobile Responsiveness */
@media (max-width: 992px) {

    /* Tablet/Smaller Laptop Adjustments */
    .hero-title {
        font-size: 3.5rem;
    }

    .featured-grid {
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    /* Mobile/Tablet Portrait */

    /* Typography Scaling */
    html {
        font-size: 90%;
        /* Scale down base size slightly */
    }

    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 2rem;
    }

    /* Navbar Stacking */
    .navbar-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: var(--spacing-sm);
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Hero adjustments */
    .hero-section {
        padding-top: 8rem;
        padding-bottom: 4rem;
        margin-top: -60px;
        /* Adjust for smaller nav overlap if needed */
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem !important;
        /* Override inline style if present, but better to move to class */
    }

    /* Stack Featured Section */
    .featured-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .featured-image-container {
        text-align: center;
        margin-bottom: 2rem;
        order: -1;
        /* Ensure image is on top */
    }

    .featured-text-container {
        text-align: center;
    }

    .featured-text-container h1 {
        font-size: 2.5rem !important;
    }

    .featured-text-container p {
        margin-left: auto;
        margin-right: auto;
    }

    /* Center buttons in featured section */
    .featured-text-container .btn-group {
        justify-content: center;
    }

    /* Lanes */
    .lanes-grid {
        grid-template-columns: 1fr;
        /* Force single column on smaller screens */
    }

    /* Dropdown adjustment for mobile (simplified) */
    .dropdown:hover .dropdown-content {
        position: relative;
        /* Static flow for mobile */
        box-shadow: none;
        border: none;
        background: transparent;
        padding-left: 1rem;
    }

    /* Reader Styles (Mobile) */
    p.dialogue {
        margin-left: 1rem !important;
        margin-right: 1rem !important;
    }

    /* Book Detail Stacking */
    .book-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .product-details-grid {
        grid-template-columns: 1fr;
    }
}