/* ==========================================================================
   Base Styles & Typography (Parchment / Book Theme)
   ========================================================================== */
:root {
    /* 
       THEME COLOR: "Lapis Lazuli" / Deep Royal Blue 
       Replaces the default Bootstrap #0d6efd 
    */
    --landing-primary: #154c79; 
    --landing-primary-hover: #103a5e;
}

body {
    /* Warm, off-white "Cream/Parchment" background */
    background-color: #fdfbf7; 
    /* Deep "Ink" charcoal for high contrast readability */
    color: #2c241b; 
}

/* --- Links inside Landing Page Feature Sections --- */
section .lead a {
    color: var(--landing-primary) !important;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

section .lead a:hover {
    color: var(--landing-primary-hover) !important;
}

/* --- Navigation & Buttons Overrides --- */

/* Update the Navbar text hover color */
.landing-header .nav-link:hover {
    color: var(--landing-primary) !important;
}

/* Override Bootstrap Primary Buttons for this page */
.btn-primary {
    background-color: var(--landing-primary);
    border-color: var(--landing-primary);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--landing-primary-hover) !important;
    border-color: var(--landing-primary-hover) !important;
}

.landing-header {
    /* White with a slight warm tint, semi-transparent */
    background-color: rgba(253, 251, 247, 0.95); 
    border-bottom: 1px solid #e5e0d8; 
}

/* Ensure the navbar links are visible on the light background */
.landing-header .navbar-brand,
.landing-header .nav-link {
    color: #2c241b !important;
}

h1, h2, h3, h4, .display-4 {
    font-family: 'Lora', serif;
    font-weight: 600; /* Slightly bolder for headings in ink color */
    color: #1a1612; /* Almost black */
}

p, li, a, span, div {
    font-family: 'Source Sans 3', sans-serif;
}

.lead {
    font-size: 1.25rem;
    color: #594a3c; /* A warm brownish-grey for subtext */
}

/* ==========================================================================
   Book-Themed Table of Contents Sidebar
   ========================================================================== */
#toc-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    border-left: 2px solid #e5e0d8; /* Thicker, softer border */
    padding-left: 1.5rem;
}

/* Remove default nav styling */
#toc-sidebar.nav-pills .nav-link {
    background: none;
    border-radius: 0;
}

#toc-sidebar .nav-link {
    color: #8c7b6d; /* Muted brown for inactive */
    font-size: 0.95rem;
    padding: 0.6rem 0 0.6rem 1rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease-in-out;
    display: block;
    text-decoration: none;
    line-height: 1.3;
}

#toc-sidebar .nav-link .toc-prefix {
    display: block;
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: #a8998d;
    margin-bottom: 0.1rem;
}

#toc-sidebar .nav-link .toc-title {
    display: block;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 500;
}

/* Sidebar Hover/Active States using the new Royal Blue */
#toc-sidebar .nav-link:hover .toc-title {
    color: var(--landing-primary);
}

#toc-sidebar .nav-link.active .toc-prefix {
    color: var(--landing-primary);
}

#toc-sidebar .nav-link.active .toc-title {
    color: #2c241b; /* Active title goes dark ink */
}

#toc-sidebar .nav-link.active {
    border-left-color: var(--landing-primary);
}

/* ==========================================================================
   Content Section Styling
   ========================================================================== */
.landing-section {
    /* Reduced from 5rem to tighten the gap between navbar and content */
    padding-top: 3rem; 
    padding-bottom: 5rem;
    border-bottom: 1px solid #e5e0d8; 
}

/* --- Base Hero Structure --- */
.hero-section {
    /* Reduced from 90vh to 80vh to pull the visual center upwards */
    min-height: 80vh; 
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* --- Style 1: Text Overlay (Legacy) --- */
.hero-overlay {
    background-size: cover;
    background-position: center;
    color: white; 
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

.hero-overlay .container {
    background-color: rgba(0,0,0,0.6);
    padding: 2.5rem;
    border-radius: 0.5rem;
    position: relative; 
    z-index: 2;
}

/* --- Style 2: Frontispiece (The "Book" Look) --- */
.hero-split {
    background-color: transparent; 
}

/* 
   THE GRADIENT BLEED EFFECT
   This uses a CSS mask to fade the image from 100% opacity to 0% 
   as it moves towards the text, creating a seamless blend.
*/
.hero-split .frontispiece-image {
    max-height: 75vh; /* Slightly smaller to fit the tighter height */
    width: 100%;
    object-fit: contain;
    
    /* The Mask: Opaque on the left (or center), transparent on the edge facing the text */
    -webkit-mask-image: linear-gradient(to right, black 60%, transparent 100%);
    mask-image: linear-gradient(to right, black 60%, transparent 100%);
    
    /* Add a sepia filter to make the art feel "aged" and fit the paper */
    filter: sepia(0.2) contrast(1.1);
}

/* Specifically for when image is on the right, flip the gradient */
.hero-split .order-lg-last .frontispiece-image {
    -webkit-mask-image: linear-gradient(to left, black 60%, transparent 100%);
    mask-image: linear-gradient(to left, black 60%, transparent 100%);
}


.hero-split h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    color: #2c241b;
}

.hero-split .lead {
    font-size: 1.4rem;
    font-weight: 300;
    margin-bottom: 2rem;
    color: #594a3c;
}

/* --- Feature & CTA Sections --- */
.feature-section .feature-image {
    max-width: 100%;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(44, 36, 27, 0.15); /* Softer, warmer shadow */
}

.final-cta-section {
    background-color: #f0ebe4; /* Slightly darker cream for footer */
    border-bottom: none;
    color: #2c241b;
}

/* ==========================================================================
   Mobile Navigation Improvements
   ========================================================================== */
@media (max-width: 991.98px) {
    /* Align links to the right for a cleaner mobile drawer feel */
    .navbar-collapse {
        text-align: right;
        padding-top: 1rem;
        padding-bottom: 1rem;
        border-top: 1px solid #e5e0d8;
        margin-top: 1rem;
    }

    /* Ensure dropdown menus open nicely without overlapping */
    .dropdown-menu {
        text-align: right;
        background-color: transparent;
        border: none;
        padding-right: 0;
    }
    
    .dropdown-item {
        padding-right: 0;
        color: #594a3c;
    }

    /* Make the Login/Signup buttons full width and stacked */
    .landing-header .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
        text-align: center;
    }
    
    /* Reset margins for the button container */
    .nav-item.ms-lg-3 {
        margin-left: 0 !important;
        margin-top: 1rem;
    }
}