:root {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-muted: #f4f4f5;
    --surface-hover: #f4f4f5;
    --border: #e4e4e7;
    --text-main: #09090b;
    --text-muted: #71717a;
    --accent: #18181b;
    /* Black accent for light theme */
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --radius: 4px;
    --font-sans: 'Dosis', sans-serif;
    --sidebar-width: 250px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    overflow-y: auto;
    z-index: 50;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--surface-hover);
    color: var(--text-main);
}

.nav-link.active {
    background: var(--surface-muted);
    color: var(--text-main);
    font-weight: 500;
}

/* Main Content */
.container,
.main-content {
    margin-left: var(--sidebar-width);
    max-width: 1000px;
    /* Increased max-width for table */
    padding: 4rem 3rem;
    flex: 1;
}

/* Header */
.header {
    margin-bottom: 4rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta i {
    width: 16px;
    height: 16px;
}

/* Sections */
.section {
    margin-bottom: 4rem;
}

h2 {
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    border-left: 4px solid var(--text-main);
    padding-left: 1rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
}

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    border-color: var(--text-muted);
}

/* Accordion */
.accordion-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

details.accordion {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    transition: background 0.2s;
}

summary:hover {
    background: var(--surface-hover);
}

summary::-webkit-details-marker {
    display: none;
}

.accordion-content {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

/* Comparison Grid */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1rem;
}

.pros h4 {
    color: var(--success);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cons h4 {
    color: var(--danger);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

ul {
    list-style: none;
    padding-left: 0;
}

ul li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--border);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Cards Row */
.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.highlight-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card-icon {
    width: 40px;
    height: 40px;
    background: var(--surface-hover);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
}

/* Visualization Placeholders */
.visualization-container {
    margin-top: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
}

.vis-mockup {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.vis-side {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.heatmap-mock {
    width: 200px;
    height: 200px;
    background: #27272a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.heatmap-mock::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.3;
}

.red-focus::after {
    background: radial-gradient(circle at center, red, transparent 70%);
}

.green-focus::after {
    background: radial-gradient(circle at 30% 30%, green, transparent 40%),
        radial-gradient(circle at 70% 70%, green, transparent 40%);
}

.caption {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 1rem;
    font-style: italic;
}

/* Code Blocks */
.code-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.code-block {
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.code-block h4 {
    font-size: 0.875rem;
    color: #e2e8f0;
    background: #1e293b;
    padding: 0.75rem 1.25rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.025em;
    border-bottom: 1px solid #334155;
}

pre {
    border-radius: 0 !important;
    border: none !important;
    background: #0f172a !important;
    margin: 0 !important;
    padding: 1.5rem !important;
    overflow-x: auto;
    font-size: 0.9rem !important;
    line-height: 1.7 !important;
}

pre {
    color: #e2e8f0 !important;
}

pre code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Source Code Pro', 'Consolas', 'Monaco', monospace !important;
    font-size: 0.9rem !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    text-shadow: none !important;
    font-weight: 400;
    font-feature-settings: "liga" 1, "calt" 1;
}

/* Layer Diagram */
.layer-diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.layer-group {
    background: var(--surface-hover);
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    min-width: 120px;
}

.layer-group.highlight {
    border-color: var(--text-main);
    background: #27272a;
}

.layer-arrow {
    color: var(--text-muted);
    font-size: 1.5rem;
}

/* Pipeline Diagram */
.pipeline-diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 2rem 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 4px;
    min-width: 100px;
    text-align: center;
    font-size: 0.875rem;
}

.step.center {
    border-color: var(--text-main);
    background: var(--surface-hover);
}

.arrow {
    color: var(--text-muted);
}

/* Hardware Grid */
.hardware-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.hw-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.hw-item i {
    color: var(--text-main);
}

/* Utilities */
.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.875rem;
}

/* Table */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.comparison-table th,
.comparison-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.comparison-table th {
    background: var(--surface-muted);
    font-weight: 600;
    color: var(--text-main);
}

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

.comparison-table tr:hover {
    background: var(--surface-muted);
}

/* Attention Grid Visualization */
.attention-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    background: var(--border);
    padding: 2px;
    border-radius: 4px;
}

.grid-cell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-family: monospace;
    background: var(--surface);
    color: var(--text-main);
}

/* Heatmap Colors */
.cell-low {
    background: #f0fdf4;
    color: #166534;
}

.cell-mid {
    background: #bbf7d0;
    color: #14532d;
}

.cell-high {
    background: #22c55e;
    color: white;
    font-weight: bold;
}

.cell-base {
    background: #f4f4f5;
    color: #71717a;
}

/* Updates for Light Mode Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: none;
}

.card:hover {
    border-color: var(--text-muted);
    box-shadow: none;
}

.vis-image {
    box-shadow: none;
    border: 1px solid var(--border);
}

/* Enhanced Syntax Highlighting for Dark Theme */
pre code {
    color: #e2e8f0 !important;
}

/* Prism.js Dark Theme Customization */
pre[class*="language-"] {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    text-shadow: none !important;
}

code[class*="language-"] {
    color: #e2e8f0 !important;
    text-shadow: none !important;
}

/* Inline code snippets */
:not(pre) > code {
    background: #1e293b !important;
    color: #38bdf8 !important;
    padding: 0.2rem 0.4rem !important;
    border-radius: 2px !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace !important;
    font-size: 0.875em !important;
    font-weight: 500 !important;
    border: 1px solid #334155 !important;
}

/* Limitations Grid */
.limitations-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

/* Academic Limitations */
.academic-limitations {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.academic-limitation {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.academic-limitation summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    color: var(--text-main);
}

.academic-limitation summary:hover {
    background: var(--surface-hover);
}

.academic-limitation summary::after {
    content: '+';
    font-weight: 400;
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-left: 1rem;
}

.academic-limitation[open] summary::after {
    content: '−';
    /* Minus sign */
}

.academic-limitation .limitation-content {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface-muted);
}

.academic-limitation .limitation-content p {
    margin: 0;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Hide default details marker in WebKit */
.academic-limitation summary::-webkit-details-marker {
    display: none;
}

/* Custom Scrollbar for Code Blocks */
pre::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

pre::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Code Block Copy Button Hover Effect */
.code-block {
    position: relative;
}

.code-block:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Line Numbers (if needed in the future) */
pre code .line-number {
    display: inline-block;
    width: 2rem;
    margin-right: 1rem;
    color: #475569;
    text-align: right;
    user-select: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .container,
    .main-content {
        margin-left: 0;
        padding: 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .code-comparison {
        grid-template-columns: 1fr;
    }

    .pipeline-diagram {
        flex-direction: column;
    }

    .arrow {
        transform: rotate(90deg);
    }

    .limitations-grid {
        grid-template-columns: 1fr;
    }
}