@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700;800&family=Montserrat:wght@300;400;500;600;700&display=swap'); /* Added Montserrat for headings */

:root {
    /* Refined Color Palette (Cool Tones with Vibrant Accents) */
    --bg-gradient-start: #e2e8f0; /* Light cool gray-blue */
    --bg-gradient-end: #cfd8dc;   /* Slightly darker cool gray-blue */

    --glass-base-color: 255, 255, 255; /* Base white for glass */
    --glass-color: rgba(var(--glass-base-color), 0.07); /* Even more transparent glass */
    --glass-border: rgba(var(--glass-base-color), 0.18); /* Subtle, lighter border */
    --glass-shadow: rgba(0, 0, 0, 0.06); /* Softer shadow */

    --text-dark: #1f2937; /* Dark charcoal for primary text */
    --text-light: #4b5563; /* Medium gray for secondary text/paragraphs */
    --text-subtle: #6b7280; /* Even lighter gray */

    --primary-color: #3b82f6; /* Vibrant blue for accents and links */
    --accent-color: #6366f1; /* Complementary indigo for hover/secondary accents */

    /* Frosted texture - unchanged as it's effective */
    --frosted-texture: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4" viewBox="0 0 4 4"><circle fill="%23fff" cx="2" cy="2" r="0.5"/></svg>');
    --frosted-texture-opacity: 0.04; /* Slightly less opaque for more subtlety */
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.75; /* Increased line height for better readability */
    font-weight: 400;
    color: var(--text-light);
    margin: 0;
    display: flex;
    min-width: 320px;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    background-attachment: fixed;
    background-size: cover;
    overflow-x: hidden;
}

.layout-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* Glassmorphism base style */
.glassmorphism {
    position: relative;
    background-color: var(--glass-color);
    backdrop-filter: blur(30px) saturate(250%) brightness(1.1); /* Stronger blur, saturation, and brightness for liquid crystal */
    -webkit-backdrop-filter: blur(30px) saturate(250%) brightness(1.1);
    border: 1px solid var(--glass-border);
    box-shadow: 0 12px 48px var(--glass-shadow), 0 0 0px 1px rgba(var(--glass-base-color),0.1); /* Refined shadow for depth */
    border-radius: 24px; /* Even more pronounced rounded corners */
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smoother cubic-bezier transition */
    overflow: hidden; /* Ensure pseudo-element stays within bounds */
    transform: perspective(1px) translateZ(0); /* Forcing hardware acceleration */
}

/* Frosted texture overlay */
.glassmorphism::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--frosted-texture);
    background-size: 4px 4px;
    opacity: var(--frosted-texture-opacity);
    pointer-events: none;
    mix-blend-mode: soft-light;
    z-index: 0; /* Behind content, but on top of glass background */
}

/* Main content and header elements should have z-index > 0 to be above ::before */
.header-content, .main-nav, #content-area, .footer-content {
    position: relative;
    z-index: 1;
}


/* Hover effect for glassmorphism elements - adding subtle 3D lift */
.glassmorphism:hover {
    box-shadow: 0 18px 70px rgba(0,0,0,0.18), 0 0 0px 1px rgba(var(--glass-base-color),0.2); /* Stronger lift on hover */
    transform: translateY(-7px) scale(1.01); /* More pronounced lift and slight scale */
}

.header {
    padding: 20px 45px; /* More padding */
    position: sticky;
    top: 25px; /* Stay slightly off the top */
    z-index: 1000;
    margin: 25px auto; /* Centered with more margin from edges */
    max-width: 1200px;
    width: calc(100% - 50px); /* Account for margin */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-family: 'Montserrat', sans-serif; /* Use Montserrat for titles */
    font-size: 2.6em; /* Larger title */
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
    letter-spacing: -1.5px; /* Tighter letter spacing */
    text-shadow: 0 2px 5px rgba(0,0,0,0.15); /* Clearer text shadow */
    display: flex;
    align-items: center;
    gap: 12px; /* Space between icon and text */
    transition: all 0.3s ease-in-out;
}

.site-title:hover {
    color: var(--primary-color);
    transform: scale(1.03); /* More pronounced scale */
}

.site-title i {
    font-size: 0.85em; /* Adjust icon size relative to text */
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.site-title:hover i {
    color: var(--accent-color);
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 45px; /* Increased gap */
}

.main-nav li {
    position: relative;
}

.main-nav a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.15em; /* Slightly larger */
    padding: 12px 0; /* More vertical padding */
    display: flex;
    align-items: center;
    gap: 10px; /* Space between icon and text */
    transition: color 0.3s ease, transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), text-shadow 0.3s ease;
    position: relative;
}

.main-nav a:hover {
    color: var(--primary-color);
    transform: translateY(-6px); /* More pronounced hover lift */
    text-shadow: 0 0 15px rgba(59, 130, 246, 0.7); /* Brighter glow from primary color */
}

/* Subtle underline effect */
.main-nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px; /* Thicker underline */
    bottom: -8px; /* More space from text */
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.main-nav a:hover::after {
    width: 100%;
}

.main-nav i {
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.main-nav a:hover i {
    color: var(--primary-color);
}

/* Dropdown styles */
.dropdown-content {
    display: block; /* Always block for animation control */
    position: absolute;
    min-width: 240px; /* Wider dropdown */
    z-index: 1001;
    padding: 15px 0;
    margin-top: 25px; /* More space from parent link */
    left: 50%;
    transform: translateX(-50%) translateY(20px); /* Deeper initial drop for animation */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out, transform 0.4s ease-out; /* Smoother transition */
    transform-origin: top center;
    top: 100%;
    pointer-events: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2), 0 0 0px 1px rgba(var(--glass-base-color),0.2); /* Enhanced shadow for dropdowns */
    border-radius: 16px; /* Consistent rounded corners */
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0); /* Animate to final position */
    pointer-events: auto;
}

.dropdown-content a {
    padding: 14px 28px; /* More padding */
    text-align: left;
    font-size: 1.05em; /* Slightly larger */
    font-weight: 300;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 12px; /* More space for icon and text */
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dropdown-content a:hover {
    background-color: rgba(var(--glass-base-color),0.2); /* More subtle background hover with glass base */
    color: var(--primary-color);
    transform: translateX(8px); /* More pronounced slide effect on hover */
}

.main-content {
    flex-grow: 1;
    max-width: 960px;
    margin: 20px auto;
    padding: 50px;
    min-height: 600px;
    transform: perspective(1px) translateZ(0); /* Force hardware acceleration */
}

.footer {
    padding: 25px 40px;
    text-align: center;
    color: var(--text-subtle); /* Use subtle text color */
    font-size: 0.95em;
    margin: 20px auto;
    max-width: 1200px;
    width: calc(100% - 40px);
    transform: perspective(1px) translateZ(0); /* Force hardware acceleration */
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Markdown specific styling */
/* Loading Spinner */
.loading-spinner {
    border: 6px solid rgba(0, 0, 0, 0.1);
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 0.9s ease-in-out infinite;
    margin: 80px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#content-area {
    line-height: 1.8; /* Further increased line height */
}

#content-area h1,
#content-area h2,
#content-area h3,
#content-area h4,
#content-area h5,
#content-area h6 {
    font-family: 'Montserrat', sans-serif; /* Use Montserrat for headings */
    color: var(--text-dark);
    font-weight: 700; /* Regular bold for headings */
    margin-top: 2.8em; /* More space above headings */
    margin-bottom: 1em; /* More space below headings */
}

#content-area h1 { font-size: 3.2em; } /* Even larger headings */
#content-area h2 { font-size: 2.5em; border-bottom: 1px solid rgba(var(--glass-base-color),0.4); padding-bottom: 0.8em; } /* Stronger, glass-like subtle border */
#content-area h3 { font-size: 2.1em; }
#content-area h4 { font-size: 1.7em; }

#content-area p {
    margin-bottom: 1.6em; /* More line spacing */
    font-weight: 300;
    color: var(--text-light);
}

#content-area a {
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

#content-area a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

#content-area ul,
#content-area ol {
    margin-bottom: 1.6em;
    padding-left: 40px; /* More padding */
}

#content-area code {
    background-color: rgba(var(--glass-base-color),0.2); /* Glass-like background for inline code */
    padding: 6px 10px; /* More padding */
    border-radius: 10px; /* More rounded */
    font-size: 0.9em;
}

#content-area pre {
    background-color: rgba(0, 0, 0, 0.85); /* Darker background for code blocks */
    color: #e0e0e0;
    padding: 35px; /* More padding */
    border-radius: 15px; /* More rounded */
    margin-bottom: 2.5em;
    box-shadow: inset 0 5px 12px rgba(0,0,0,0.5); /* Stronger inner shadow */
}

#content-area pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 1em;
}

#content-area blockquote {
    border-left: 8px solid var(--primary-color);
    padding-left: 28px; /* More padding */
    color: var(--text-subtle);
    background-color: rgba(var(--glass-base-color),0.05); /* More subtle glass-like background */
    border-radius: 12px; /* More rounded */
    padding-top: 25px;
    padding-bottom: 25px;
}

#content-area table {
    border-radius: 15px; /* More rounded */
    margin-bottom: 2.5em;
    background-color: rgba(var(--glass-base-color),0.1); /* Subtle background for table */
    box-shadow: 0 5px 20px rgba(0,0,0,0.05); /* Subtle shadow for table */
}

#content-area th,
#content-area td {
    border: 1px solid rgba(var(--glass-base-color), 0.25); /* Stronger glass-like borders */
    padding: 20px; /* More padding */
}

#content-area th {
    background-color: rgba(var(--glass-base-color), 0.15); /* Stronger subtle header background */
    font-weight: 600;
    color: var(--text-dark);
}

/* --- Responsive Design --- */
@media (max-width: 900px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 15px;
        width: 100%;
        margin-top: 15px;
    }

    .main-nav li {
        width: 100%;
    }

    .main-nav a {
        padding: 10px 0;
        display: block;
        text-align: left;
        font-size: 1.05em;
    }

    .dropdown-content {
        position: static;
        transform: translateX(0);
        left: auto;
        width: 100%;
        box-shadow: none;
        border: none;
        background-color: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding: 0;
        margin-top: 0;
        pointer-events: auto; /* Always allow interaction */
        opacity: 1; /* Always visible in mobile */
        visibility: visible;
        transform: none;
        transition: none;
    }

    .dropdown:hover .dropdown-content {
        transform: none;
    }

    .dropdown-content a {
        padding-left: 50px;
        text-align: left;
    }

    .site-title {
        margin-bottom: 15px;
    }

    .main-content {
        margin: 15px;
        padding: 30px;
    }

    .header, .footer {
        margin: 10px;
    }

    #content-area h1 { font-size: 2.5em; }
    #content-area h2 { font-size: 2em; }
    #content-area h3 { font-size: 1.6em; }
}

@media (max-width: 600px) {
    .header, .footer, .main-content {
        border-radius: 12px;
    }

    .header-content {
        padding: 0 15px;
    }

    .site-title {
        font-size: 2em;
    }

    .main-nav a {
        font-size: 1em;
        gap: 5px;
    }

    #content-area h1 { font-size: 2em; }
    #content-area h2 { font-size: 1.6em; }
    #content-area h3 { font-size: 1.3em; }
}
