/* ==========================================================================
   Modern Enhancements for Casper Theme
   Elegant, refined, understated, classy improvements for a creative blog
   ========================================================================== */

/* Modern Typography Improvements */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

/* Enhanced Root Variables for Modern Design */
:root {
    --primary-color: #1a1a1a;
    --secondary-color: #4a4a4a;
    --accent-color: #8b5a3c;
    --light-accent: #a67c5a;
    --text-color: #2c2c2c;
    --light-text: #6a6a6a;
    --background-color: #fefefe;
    --card-background: #ffffff;
    --border-color: #e8e8e8;
    --hover-color: #f8f8f8;
    --shadow-light: rgba(0, 0, 0, 0.04);
    --shadow-medium: rgba(0, 0, 0, 0.08);
    --shadow-strong: rgba(0, 0, 0, 0.12);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-gentle: all 0.2s ease-out;
    --border-radius: 8px;
    --border-radius-small: 4px;
    --border-radius-large: 12px;
}

/* Modern Typography Enhancement */
body {
    font-family: 'Crimson Text', 'Merriweather', serif;
    font-weight: 400;
    font-size: 1.8rem;
    line-height: 1.75;
    color: var(--text-color);
    background-color: var(--background-color);
    font-feature-settings: 'kern' 1, 'liga' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Headings with Better Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.25;
    margin: 0 0 1rem 0;
    letter-spacing: -0.02em;
}

h1 { 
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

h2 { 
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 600;
}

h3 { 
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    font-weight: 600;
}

/* Enhanced Body Text for Reading */
p, ul, ol, dl {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.8rem;
    line-height: 1.75;
    color: var(--text-color);
    margin: 0 0 1.75rem 0;
}

/* Modern Link Styling */
a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--transition-gentle);
    border-bottom: 1px solid transparent;
}

a:hover {
    color: var(--light-accent);
    border-bottom-color: var(--light-accent);
}

/* Enhanced Main Header with Modern Gradient Overlay */
.main-header {
    height: 85vh;
    background-attachment: fixed;
    position: relative;
    display: table;
    width: 100%;
    text-align: center;
}

/* Compact header for pages without cover images */
.no-cover.main-header {
    height: 85px !important;
    min-height: 0 !important;
    margin-bottom: 0 !important;
    background: transparent !important;
}

/* Add spacing below navigation for pages without cover images */
.no-cover + main.content {
    padding-top: 2rem !important;
}

.main-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(26, 26, 26, 0.4) 0%,
        rgba(74, 74, 74, 0.2) 50%,
        rgba(139, 90, 60, 0.3) 100%
    );
    z-index: 1;
}

.main-header .inner {
    position: relative;
    z-index: 2;
}

/* Modern Page Title with Better Typography and Centering */
.page-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 8vw, 7rem);
    letter-spacing: -0.04em;
    color: #ffffff;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    margin: 0 0 1.5rem 0;
    text-align: center;
}

.page-description {
    font-family: 'Crimson Text', serif;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 400;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

/* Ensure main header content is properly centered */
.main-header-content {
    text-align: center;
    width: 100% !important;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Override the inner class constraints for header content */
.main-header .main-header-content.inner {
    width: 100% !important;
    max-width: 800px !important;
}

/* Fix vertical centering */
.main-header .vertical {
    display: table-cell;
    vertical-align: middle;
    width: 100%;
    height: 85vh;
    text-align: center;
}

/* Enhanced Navigation - Fix Pointer Events and Full-Width Background */
.main-nav {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative !important;
    z-index: 100 !important;
    pointer-events: auto !important; /* Enable pointer events for navigation */
}

/* Ensure overlay navigation spans full width with proper background */
.main-nav.overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 70px !important;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%,rgba(0,0,0,0) 100%) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    z-index: 1000 !important;
}

/* Ensure vertical div doesn't interfere */
.vertical {
    pointer-events: none !important;
}

.vertical > * {
    pointer-events: auto !important;
}

/* Fix main-header and navigation positioning */
.main-header {
    position: relative;
}

/* Only apply relative positioning to non-overlay navigation */
.main-header .main-nav:not(.overlay) {
    position: relative !important;
    z-index: 1000 !important;
    background: transparent !important;
    margin-bottom: 0 !important;
}

/* Modern Logo Text Styling */
.logo-text {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: #ffffff;
    font-size: 1.8rem;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: var(--transition-gentle);
    padding: 8px 12px;
    display: inline-block;
}

/* Enhanced Blog Logo Link - Force Clickability */
.blog-logo {
    position: relative !important;
    z-index: 1001 !important; /* Above the fixed navigation */
    display: block !important;
    cursor: pointer !important;
    text-decoration: none !important;
    border: none !important;
    pointer-events: auto !important; /* Force clickable */
    float: left !important;
    background: none !important;
}

.blog-logo:hover {
    cursor: pointer !important;
}

.blog-logo:hover .logo-text {
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    cursor: pointer !important;
}

.blog-logo:hover img {
    transform: translateY(-1px);
    opacity: 0.9;
    cursor: pointer !important;
}

/* Ensure the logo text itself is clickable */
.logo-text {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Menu button styles removed - no longer needed */

/* Comprehensive fix for blog logo clickability */
.main-header::before,
.main-header::after {
    pointer-events: none !important;
}

.main-nav::before,
.main-nav::after {
    pointer-events: none !important;
}

/* Clean blog logo styling - clickable and properly positioned */
.main-header .main-nav .blog-logo,
.main-nav.overlay .blog-logo,
nav.main-nav .blog-logo,
.blog-logo {
    position: relative !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    display: block !important;
    float: left !important;
    background: none !important;
    border: none !important;
    padding: 5px !important;
    margin: 0 !important;
}

/* Force cursor on all child elements */
.blog-logo *,
.blog-logo .logo-text,
.blog-logo img {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Clean link styling */
a.blog-logo {
    text-decoration: none !important;
    color: inherit !important;
    background: none !important;
    border: none !important;
}

/* Ensure proper link behavior */
nav a.blog-logo[href] {
    pointer-events: auto !important;
    cursor: pointer !important;
    display: block !important;
}

/* Modern Post Cards */
.post {
    background: var(--card-background);
    border-radius: var(--border-radius-large);
    padding: 3rem;
    margin: 3rem auto;
    box-shadow: 0 2px 20px var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), var(--light-accent));
}

.post:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 40px var(--shadow-medium);
}

.post:after {
    display: none; /* Remove the old circle decoration */
}

/* Enhanced Modern Post Styling */
.modern-post .post-excerpt p {
    font-family: 'Crimson Text', serif;
    font-size: 1.6rem;
    line-height: 1.7;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.read-more {
    color: var(--accent-color);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid transparent;
    transition: var(--transition-gentle);
}

.read-more:hover {
    border-bottom-color: var(--accent-color);
}

/* Modern Meta Information */
.meta-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.post-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background: var(--accent-color);
    color: #ffffff;
    padding: 0.4rem 1rem;
    border-radius: var(--border-radius-small);
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition-gentle);
}

.tag:hover {
    background: var(--light-accent);
    transform: translateY(-1px);
}

/* Enhanced Post Titles */
.post-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.3;
    margin: 0 0 1rem 0;
    transition: var(--transition-gentle);
}

.post-title a {
    color: inherit;
    border: none;
}

.post-title a:hover {
    color: var(--accent-color);
    border: none;
}

/* Modern Post Meta */
.post-meta {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--light-text);
    margin: 1.5rem 0 0 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.post-date {
    background: var(--hover-color);
    padding: 0.4rem 1rem;
    border-radius: var(--border-radius-small);
    font-size: 1.3rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    margin: 0;
}

/* Enhanced Blockquotes */
blockquote {
    border-left: 4px solid var(--accent-color);
    background: var(--hover-color);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-family: 'Crimson Text', serif;
    font-style: italic;
    font-size: 2rem;
    color: var(--secondary-color);
}

/* Modern Code Styling */
code, tt {
    background: var(--hover-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 1.5rem;
    padding: 0.3rem 0.6rem;
}

pre {
    background: #f7f7f7;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 1.4rem;
    line-height: 1.5;
    box-shadow: 0 2px 10px var(--shadow-light);
}

pre code {
    background: none;
    border: none;
    color: inherit;
    padding: 0;
}

/* Refined Scroll Down Button */
.scroll-down {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.scroll-down:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Enhanced Tables */
table {
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-background);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-light);
    border: 1px solid var(--border-color);
}

table th {
    background: var(--hover-color);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.6rem;
    color: var(--primary-color);
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

table td {
    padding: 1rem;
    font-size: 1.6rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

table tbody > tr:nth-child(odd) > td {
    background: rgba(248, 248, 248, 0.5);
}

/* Modern Form Elements */
input, textarea, select {
    font-family: 'Inter', sans-serif;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    background: var(--background-color);
    color: var(--text-color);
    transition: var(--transition-gentle);
    font-size: 1.6rem;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(139, 90, 60, 0.1);
}

/* Enhanced Button Styling */
button, .button {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1.6rem;
    background: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-transform: none;
    letter-spacing: 0.25px;
}

button:hover, .button:hover {
    background: var(--light-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 90, 60, 0.3);
}

/* Responsive Design Improvements */
@media (max-width: 768px) {
    .main-header {
        height: 70vh;
        background-attachment: scroll;
    }
    
    .post {
        margin: 2rem 1rem;
        padding: 2rem 1.5rem;
    }
    
    .main-nav {
        padding: 20px;
    }
}

/* Modern Content Spacing */
.content {
    padding: 0 2rem;
}

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

.post {
    animation: fadeInUp 0.6s ease-out;
}

.post:nth-child(2) { animation-delay: 0.1s; }
.post:nth-child(3) { animation-delay: 0.2s; }
.post:nth-child(4) { animation-delay: 0.3s; }

/* Enhanced Hover Effects */
.post-title a {
    position: relative;
    overflow: hidden;
}

.post-title a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.post-title a:hover::after {
    width: 100%;
}

/* Improved Focus States for Accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .post {
        animation: none;
    }
}

/* Dark Mode Support - Removed for now to avoid jarring contrast */
/* Will be implemented as a user toggle in future updates */

/* Modern Footer */
.modern-footer {
    background: var(--primary-color);
    color: #ffffff;
    padding: 3rem 0 2rem;
    margin-top: 4rem;
    border-top: 3px solid var(--accent-color);
}

.footer-content {
    max-width: 710px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-content p {
    font-family: 'Inter', sans-serif;
    font-size: 1.4rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}

.footer-content a {
    color: var(--light-accent);
    border: none;
}

.footer-content a:hover {
    color: #ffffff;
    border: none;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Print Styles */
@media print {
    .main-nav,
    .scroll-down,
    .menu-button,
    .modern-footer {
        display: none;
    }
    
    .main-header {
        height: auto;
        padding: 2rem 0;
    }
    
    .post {
        box-shadow: none;
        border: 1px solid #ccc;
        margin: 1rem 0;
        padding: 1rem;
    }
}