@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600&family=JetBrains+Mono:wght@300;400&display=swap');

/* CSS Variables for consistent theming */
:root {
    --primary-bg: rgba(8, 8, 8, 0.95);
    --secondary-bg: rgba(15, 15, 15, 0.8);
    --tertiary-bg: rgba(25, 25, 25, 0.6);
    --quaternary-bg: rgba(35, 35, 35, 0.4);
    --accent-blue: #4A90E2;
    --accent-blue-light: #6BB6FF;
    --accent-blue-lighter: #85C1E9;
    --accent-purple: #BB8FCE;
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --shadow-dark: rgba(0, 0, 0, 0.3);
    --shadow-light: rgba(255, 255, 255, 0.02);
    --glass-bg: rgba(255, 255, 255, 0.02);
    --hover-bg: rgba(255, 255, 255, 0.03);
    --gradient-primary: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-light));
    --gradient-secondary: linear-gradient(45deg, var(--tertiary-bg), var(--quaternary-bg));
}

/* Smooth scrolling and base styles */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    color: var(--text-primary);
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    backdrop-filter: blur(20px);
    letter-spacing: 0.01em;
}

/* Top Navigation Styles */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%; /* Full width */
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    padding: 0.8rem 0; /* Remove horizontal padding from nav */
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-sizing: border-box; /* Include padding in width calculation */
}

/* Container for nav content with max-width */
.top-nav > * {
    margin: 0 1.5rem; /* Add horizontal margin to nav children */
}

.top-nav .back-link {
    margin-left: 1.5rem; /* Ensure back link has proper margin */
}

.top-nav .nav-links {
    margin-right: 1.5rem; /* Ensure nav links have proper margin */
}

/* Alternative approach with a wrapper div */
.nav-container {
    max-width: 1200px; /* Optional: limit content width but keep full bar */
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem; /* Move padding to container */
}

.top-nav h1 {
    font-size: 1rem;
    font-weight: 400;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.back-link {
    color: var(--accent-blue-light);
    text-decoration: none;
    font-weight: 300;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    letter-spacing: 0.01em;
}

.back-link:hover {
    color: var(--accent-blue);
    transform: translateX(-2px);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 300;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    letter-spacing: 0.01em;
}

.nav-links a:hover {
    background: var(--hover-bg);
    border-color: var(--border-color);
    color: var(--accent-blue-light);
}

.content-wrapper {
    margin-top: 60px;
    padding: 1rem;
}

/* Enhanced Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    margin-top: 2.5em;
    margin-bottom: 1.2em;
    font-weight: 400;
    letter-spacing: -0.02em;
    position: relative;
}

h1 {
    font-size: 2.2rem;
    font-weight: 300;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background: var(--gradient-primary);
    border-radius: 1px;
}

h2 {
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--text-primary);
    border-left: 2px solid var(--accent-blue-light);
    padding-left: 15px;
    margin-left: -17px;
}

h3 {
    font-size: 1.3rem;
    font-weight: 400;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    position: relative;
}

h3::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 40px;
    height: 1px;
    background: var(--gradient-primary);
    border-radius: 1px;
}

h4 {
    font-size: 1.1rem;
    color: var(--accent-blue-light);
    font-weight: 400;
}

/* Enhanced Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 25px 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--shadow-dark);
    border: 1px solid var(--border-color);
}

th, td {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    text-align: left;
    color: var(--text-primary);
    transition: background-color 0.3s ease;
    font-weight: 300;
    font-size: 0.9rem;
}

th {
    background: var(--tertiary-bg);
    backdrop-filter: blur(10px);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

tr:hover td {
    background-color: var(--hover-bg);
}

tr:last-child td {
    border-bottom: none;
}

/* Enhanced Code Blocks */
pre {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: 0 4px 16px var(--shadow-dark);
    position: relative;
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    font-weight: 300;
    line-height: 1.5;
}

pre::before {
    content: 'Code';
    position: absolute;
    top: 8px;
    right: 12px;
    background: var(--tertiary-bg);
    backdrop-filter: blur(10px);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 9px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border-color);
}

code {
    background: var(--tertiary-bg);
    backdrop-filter: blur(10px);
    color: var(--accent-blue-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    font-size: 0.85em;
    font-weight: 300;
    border: 1px solid var(--border-color);
}

/* Enhanced Highlight Boxes */
.highlight {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 20px;
    margin: 25px 0;
    color: var(--text-primary);
    box-shadow: 0 4px 16px var(--shadow-dark);
    border-left: 2px solid var(--accent-blue-light);
    position: relative;
    transition: all 0.3s ease;
}

.highlight:hover {
    background: var(--hover-bg);
    border-color: var(--border-light);
}

.highlight::before {
    content: '💡';
    position: absolute;
    top: -8px;
    left: 16px;
    background: var(--secondary-bg);
    backdrop-filter: blur(10px);
    padding: 4px;
    border-radius: 50%;
    font-size: 1rem;
    border: 1px solid var(--border-color);
}

.paper-links {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-blue-light);
    border-radius: 12px;
    padding: 25px;
    margin: 30px 0;
    color: var(--text-primary);
    box-shadow: 0 6px 24px var(--shadow-dark);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.paper-links:hover {
    background: var(--hover-bg);
    border-color: var(--accent-blue);
}

.paper-links::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.02), transparent);
    transition: left 0.6s;
}

.paper-links:hover::before {
    left: 100%;
}

.paper-links a {
    color: var(--accent-blue-light);
    text-decoration: none;
    font-weight: 400;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
    font-size: 0.9rem;
}

.paper-links a:hover {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    transform: translateY(-1px);
}

/* Enhanced Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 25px auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 32px var(--shadow-dark);
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
}

img:hover {
    transform: translateY(-2px) scale(1.005);
    box-shadow: 0 12px 40px var(--shadow-dark);
    border-color: var(--border-light);
}

/* Enhanced Image Containers and Layouts - Remove window boxes */
.image-container {
    position: relative;
    margin: 2.5rem auto;
    width: 100%;
    max-width: 1000px;
    /* Removed: border-radius, overflow, box-shadow, border, background, backdrop-filter */
}

.image-container:hover {
    /* Removed: transform, box-shadow, border-color */
}

.image-container img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    border: none;
    border-radius: 0;
    transition: all 0.6s ease;
    opacity: 0;
    object-fit: contain;
    object-position: center;
    /* Removed: background, padding */
}

.image-container:hover img {
    transform: scale(1.01);
}

.image-caption {
    position: static; /* Changed from absolute */
    background: none; /* Removed gradient background */
    backdrop-filter: none; /* Removed blur */
    color: var(--text-muted);
    padding: 0.8rem 0; /* Only top/bottom padding */
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    line-height: 1.4;
    opacity: 1; /* Always visible */
    transform: none; /* No transform */
    transition: none; /* No transition */
    text-align: center;
    font-style: italic;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

/* Remove hover effects for captions */
.image-container:hover .image-caption {
    /* No special hover styles */
}

/* Image Size Classes - Clean layout */
.hero-image {
    max-width: 100%;
    margin: 3rem auto;
}

.large-image {
    max-width: 90%;
    margin: 2.5rem auto;
}

.medium-image {
    max-width: 80%;
    margin: 2rem auto;
}

.small-image {
    max-width: 60%;
    margin: 1.5rem auto;
}

/* Modified Image Grid - Clean single column */
.image-grid {
    display: block;
    margin: 3rem 0;
}

.image-grid .image-container {
    margin: 2rem auto;
    max-width: 90%;
}

/* Clean table styling */
table {
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    border-collapse: collapse;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Clean code block styling */
pre {
    max-width: 900px;
    margin: 2rem auto;
    overflow-x: auto;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

/* Specs grid - keep styled */
.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem auto;
    max-width: 1000px;
}

.spec-item {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .large-image {
        max-width: 95%;
    }
    
    .medium-image {
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .image-container {
        margin: 1.5rem auto;
        max-width: 100%;
    }
    
    .large-image,
    .medium-image,
    .small-image {
        max-width: 100%;
    }
    
    .image-caption {
        padding: 0.6rem 0;
        font-size: 0.8rem;
    }
    
    .specs-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .image-caption {
        padding: 0.5rem 0;
        font-size: 0.75rem;
    }
}

/* Remove special effects */
.hero-image::before {
    display: none; /* Remove shine effect */
}

/* Print styles for clean images */
@media print {
    .image-container {
        margin: 1rem auto;
        max-width: 100%;
    }
    
    .image-caption {
        color: #333;
        border-top: 1px solid #ccc;
        padding: 0.5rem 0;
    }
}

/* Enhanced Footer */
footer {
    text-align: center;
    margin-top: 60px;
    padding: 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    color: var(--text-primary);
    box-shadow: 0 8px 32px var(--shadow-dark);
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--accent-blue-light);
}

/* Enhanced Links */
a {
    color: var(--accent-blue-light);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 300;
}

a:hover {
    color: var(--accent-blue);
    text-shadow: 0 0 8px rgba(107, 182, 255, 0.2);
}

a:visited {
    color: var(--accent-purple);
}

/* Scroll-to-top button */
.scroll-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--shadow-dark);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    font-weight: 300;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-dark);
    background: var(--hover-bg);
    border-color: var(--border-light);
}

/* Loading animation for images */
img {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 15px 10px;
        font-size: 15px;
    }
    
    .top-nav {
        padding: 0.6rem 0;
    }
    
    .top-nav > * {
        margin: 0 1rem;
    }
    
    .top-nav .back-link {
        margin-left: 1rem;
    }
    
    .top-nav .nav-links {
        margin-right: 1rem;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.3rem;
        margin-left: 0;
        padding-left: 12px;
    }
    
    .specs-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .spec-item, .paper-links, .highlight {
        padding: 16px;
    }
    
    img {
        border-radius: 6px;
    }
    
    table {
        font-size: 13px;
        border-radius: 6px;
    }
    
    th, td {
        padding: 10px 12px;
    }
    
    pre {
        padding: 12px;
        border-radius: 6px;
        font-size: 12px;
    }
    
    .scroll-top {
        bottom: 20px;
        right: 20px;
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px 8px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .paper-links, .highlight, .spec-item {
        padding: 12px;
        border-radius: 8px;
    }
    
    pre {
        padding: 10px;
        font-size: 11px;
    }
}

/* Print styles - keep light for printing */
@media print {
    :root {
        --primary-bg: #ffffff;
        --secondary-bg: #f8f9fa;
        --tertiary-bg: #f0f0f0;
        --text-primary: #000000;
        --accent-blue: #2c3e50;
    }
    
    body {
        max-width: none;
        margin: 0;
        padding: 0;
        color: var(--text-primary);
        background: var(--primary-bg);
        font-size: 11pt;
    }
    
    h1, h2, h3, h4 {
        color: var(--text-primary);
        break-after: avoid;
    }
    
    .paper-links, .highlight, .spec-item {
        border: 1px solid #ccc;
        background: var(--secondary-bg);
        color: var(--text-primary);
        break-inside: avoid;
    }
    
    table, th, td {
        background-color: #fff;
        color: var(--text-primary);
        border: 1px solid #000;
    }
    
    a {
        color: var(--text-primary);
        text-decoration: underline;
    }
    
    img {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    
    footer {
        background: var(--secondary-bg);
        color: var(--text-primary);
    }
    
    .scroll-top {
        display: none;
    }
}

/* Custom selection */
::selection {
    background: rgba(74, 144, 226, 0.2);
    color: var(--text-primary);
}

/* Custom scrollbar */
/* Dark Mode Scrollbars */
/* For WebKit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

::-webkit-scrollbar-thumb:active {
    background: var(--accent-blue);
}

::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}

/* For code blocks and pre elements */
pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: var(--tertiary-bg);
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-primary);
}

pre {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--tertiary-bg);
}

/* For tables with horizontal scroll */
table::-webkit-scrollbar {
    height: 8px;
}

table::-webkit-scrollbar-track {
    background: var(--glass-bg);
    border-radius: 4px;
}

table::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

table::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Main body scrollbar styling */
body {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-primary);
}

/* Ensure scrollbars work in all containers */
.content-wrapper {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-primary);
}