@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono:wght@400;700&display=swap');
        
:root {
    /* Dark theme (default) */
    --bg-primary: #0a0a0a;
    --bg-secondary: rgba(0, 20, 20, 0.3);
    --bg-accent: rgba(0, 20, 20, 0.5);
    --text-primary: #00ff88;
    --text-secondary: #ccffcc;
    --text-accent: #00ffcc;
    --text-meta: #ffaa00;
    --text-link: #00aaff;
    --border-primary: #334455;
    --border-accent: #00ff88;
    --shadow-color: rgba(0, 255, 136, 0.1);
    --blur-amount: 0.15px;
    /* Retro CRT scanlines effect */
    --scanlines: repeating-linear-gradient(0deg, transparent 0px, transparent 3px, rgba(0, 0, 0, 0.15) 3px, rgba(0, 0, 0, 0.15) 4px);
}

[data-theme="light"] {
    /* Light theme */
    --bg-primary: #f8f8f8;
    --bg-secondary: rgba(240, 240, 240, 0.8);
    --bg-accent: rgba(230, 230, 230, 0.9);
    --text-primary: #2d5a2d;
    --text-secondary: #333333;
    --text-accent: #0066aa;
    --text-meta: #cc6600;
    --text-link: #0066cc;
    --border-primary: #cccccc;
    --border-accent: #2d5a2d;
    --shadow-color: rgba(0, 0, 0, 0.1);
    /* Dark scanlines for light theme */
    --scanlines: repeating-linear-gradient(0deg, transparent 0px, transparent 3px, rgba(0, 0, 0, 0.08) 3px, rgba(0, 0, 0, 0.08) 4px);
    --blur-amount: 0px;
}

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

body {
    background: var(--bg-primary);
    font-family: 'Share Tech Mono', monospace;
    overflow-x: hidden;
    min-height: 100vh;
    color: var(--text-primary);
    /* Reduced transition scope to only color properties */
    transition: background-color 0.3s ease, color 0.3s ease;
}

.crt-screen {
    position: relative;
    min-height: 100vh;
    background: var(--bg-primary);
    /* Removed 3D transform - expensive for power */
    transition: background-color 0.3s ease;
}

.crt-content {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 40px;
    font-size: 16px;
    line-height: 1.6;
    /* Subtle CRT blur effect for authenticity */
    filter: blur(var(--blur-amount)) contrast(1.05);
    /* Very slight scale for CRT screen curvature effect */
    transform: scale(1.01, 1.005);
    transition: background-color 0.3s ease;
}

/* Simplified scanlines - only for dark theme and no animation */
.crt-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--scanlines);
    pointer-events: none;
    z-index: 2;
    transition: background 0.3s ease;
}

/* Removed continuous flicker animation and static noise overlay */
/* These were the biggest power drains */

.blog-container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
}

.blog-header {
    border-bottom: 2px solid var(--border-accent);
    padding-bottom: 20px;
    margin-bottom: 40px;
    text-align: center;
    transition: border-color 0.3s ease;
}

.blog-title {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--text-accent);
    /* Simplified glow - only on hover to save power */
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

/* Glow effects only on hover/focus to reduce power consumption */
.blog-title:hover {
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.3);
}

[data-theme="light"] .blog-title:hover {
    text-shadow: none;
}

.blog-subtitle {
    font-size: 1.1em;
    color: var(--text-primary);
    opacity: 0.8;
    transition: color 0.3s ease;
}

.nav-menu {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-link);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--text-link);
    border-radius: 3px;
    /* Reduced transition properties */
    transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: 700;
    cursor: pointer;
}

.nav-link:hover, .nav-link.active {
    background: var(--text-link);
    color: var(--bg-primary);
    /* Simplified shadow - smaller and less intense */
    box-shadow: 0 2px 8px rgba(0, 170, 255, 0.2);
}

[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link.active {
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

.post-preview {
    margin-bottom: 40px;
    padding: 25px;
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    background: var(--bg-secondary);
    /* Reduced transition scope */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.post-preview:hover {
    border-color: var(--border-accent);
    /* Lighter shadow */
    box-shadow: 0 4px 12px var(--shadow-color);
}

.post-title {
    font-size: 1.8em;
    color: var(--text-accent);
    margin-bottom: 10px;
    font-weight: 700;
    transition: color 0.3s ease;
}

.post-title a {
    color: inherit;
    text-decoration: none;
    /* Removed constant transition */
}

.post-title a:hover {
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.4);
}

[data-theme="light"] .post-title a:hover {
    text-shadow: none;
    text-decoration: underline;
}

.post-meta {
    color: var(--text-meta);
    font-size: 0.9em;
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.post-excerpt {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.read-more {
    color: var(--text-link);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 1px dotted var(--text-link);
    transition: color 0.2s ease;
}

.read-more:hover {
    text-shadow: 0 0 3px rgba(0, 170, 255, 0.4);
}

[data-theme="light"] .read-more:hover {
    text-shadow: none;
    text-decoration: underline;
}

.article-content {
    color: var(--text-secondary);
    line-height: 1.8;
    transition: color 0.3s ease;
}

.article-content h1, .article-content h2, .article-content h3 {
    color: var(--text-accent);
    margin: 30px 0 15px 0;
    font-weight: 700;
    transition: color 0.3s ease;
}

.article-content h1 { font-size: 2.2em; }
.article-content h2 { font-size: 1.8em; }
.article-content h3 { font-size: 1.4em; }

.article-content p {
    margin-bottom: 20px;
}

.article-content code {
    background: rgba(0, 255, 136, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-primary);
    font-family: inherit;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="light"] .article-content code {
    background: rgba(45, 90, 45, 0.1);
}

.article-content pre {
    background: var(--bg-accent);
    padding: 20px;
    border-radius: 5px;
    border-left: 4px solid var(--border-accent);
    overflow-x: auto;
    margin: 20px 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.article-content blockquote {
    border-left: 4px solid var(--text-meta);
    padding: 15px 25px;
    margin: 20px 0;
    background: rgba(255, 170, 0, 0.05);
    color: #ffcc88;
    font-style: italic;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

[data-theme="light"] .article-content blockquote {
    background: rgba(204, 102, 0, 0.05);
    color: #cc6600;
}

.article-content ul, .article-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.article-content li {
    margin-bottom: 8px;
}

.article-content a {
    color: var(--text-link);
    transition: color 0.3s ease;
}

.loading {
    text-align: center;
    color: var(--text-primary);
    font-size: 1.2em;
    margin: 40px 0;
    transition: color 0.3s ease;
}

.error {
    text-align: center;
    color: #ff4444;
    font-size: 1.2em;
    margin: 40px 0;
    border: 1px solid #ff4444;
    padding: 20px;
    border-radius: 5px;
    background: rgba(255, 68, 68, 0.1);
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--text-link);
    text-decoration: none;
    border: 1px solid var(--text-link);
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.back-link:hover {
    background: var(--text-link);
    color: var(--bg-primary);
}

.blog-footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border-primary);
    margin-top: 60px;
    color: var(--text-secondary);
    opacity: 0.7;
    transition: color 0.3s ease, border-color 0.3s ease;
}
.theme-controls {
    position: fixed;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: row;
    gap: 5px;
    z-index: 100;
}

.theme-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #555;
    color: #fff;
    padding: 4px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-btn:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--border-accent);
}

.theme-btn.active {
    background: var(--text-accent);
    color: var(--bg-primary);
    border-color: var(--text-accent);
}

[data-theme="light"] .theme-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-color: #ccc;
}

[data-theme="light"] .theme-btn:hover {
    background: rgba(45, 90, 45, 0.1);
    border-color: var(--border-accent);
    color: var(--text-primary);
}

.tag {
    display: inline-block;
    background: rgba(0, 170, 255, 0.2);
    color: var(--text-link);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    margin-right: 5px;
    border: 1px solid var(--text-link);
    transition: background-color 0.2s ease, color 0.2s ease;
}

[data-theme="light"] .tag {
    background: rgba(0, 102, 204, 0.1);
}

.hidden {
    display: none;
}

/* Preference for reduced motion - completely disable animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Post page specific styles */
.post-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-accent);
}

.post-title-main {
    font-size: 2.5em;
    color: var(--text-accent);
    margin-bottom: 15px;
    font-weight: 700;
    line-height: 1.2;
    transition: color 0.3s ease;
}

.post-meta-main {
    color: var(--text-meta);
    font-size: 1.1em;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.post-navigation {
    display: flex;
    justify-content: space-between;
    margin: 40px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border-primary);
    transition: border-color 0.3s ease;
}

.nav-button {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: inherit;
    cursor: pointer;
}

.nav-button:hover {
    background: var(--text-accent);
    color: var(--bg-primary);
    box-shadow: 0 0 15px var(--shadow-color);
}

.nav-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-button.disabled:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: none;
}

.loading-container {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-primary);
    border-radius: 50%;
    border-top-color: var(--text-accent);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-container {
    text-align: center;
    padding: 60px 20px;
    color: #ff4444;
}

.error-container h2 {
    margin-bottom: 20px;
    color: #ff4444;
}

.back-to-home {
    display: inline-block;
    margin-top: 20px;
    background: var(--text-accent);
    color: var(--bg-primary);
    padding: 12px 24px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.back-to-home:hover {
    box-shadow: 0 0 20px var(--shadow-color);
    transform: translateY(-2px);
}

.top-back-button {
    display: inline-block;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.9em;
}

.top-back-button:hover {
    background: var(--text-accent);
    color: var(--bg-primary);
    box-shadow: 0 0 10px var(--shadow-color);
}

/* Gates page specific styles */
.terminal-header {
    border-bottom: 2px solid var(--border-accent);
    padding-bottom: 20px;
    margin-bottom: 40px;
    text-align: center;
    transition: border-color 0.3s ease;
}

.gates-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.gate-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    padding: 25px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.gate-card:hover {
    border-color: var(--border-accent);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.gate-title {
    font-size: 1.8em;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
    color: var(--text-accent);
    transition: color 0.3s ease;
}

.gate-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 25px 0;
    min-height: 300px;
}

.gate-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.input-section {
    display: flex;
    flex-direction: row;
    gap: 40px;
    justify-content: center;
    width: 100%;
}

.input-wire {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.input-label {
    font-weight: 700;
    width: 20px;
    text-align: center;
    color: var(--text-meta);
    transition: color 0.3s ease;
}

.input-button {
    width: 45px;
    height: 45px;
    border: 2px solid var(--border-primary);
    border-radius: 3px;
    cursor: pointer;
    font-weight: 700;
    font-size: 18px;
    font-family: 'Share Tech Mono', monospace;
    transition: all 0.2s ease;
    background: var(--bg-accent);
}

.input-button.off {
    color: #ff4444;
    border-color: #ff4444;
}

.input-button.on {
    color: var(--text-accent);
    border-color: var(--border-accent);
    box-shadow: 0 0 8px var(--shadow-color);
}

.input-button:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.wire {
    width: 4px;
    height: 40px;
    border-radius: 2px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.wire.off {
    background: #ff4444;
}

.wire.on {
    background: var(--text-accent);
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.3);
}

.gate-symbol {
    width: 80px;
    height: 100px;
    background: var(--bg-accent);
    border: 2px solid var(--border-primary);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s ease;
    margin: 0 auto;
}

.gate-symbol:hover {
    border-color: var(--border-accent);
}

.gate-symbol svg {
    width: 60px;
    height: 80px;
}

.output-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.output-label {
    font-weight: 700;
    color: var(--text-meta);
    transition: color 0.3s ease;
}

.output-led {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-primary);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    font-family: 'Share Tech Mono', monospace;
    transition: all 0.3s ease;
    background: var(--bg-accent);
}

.output-led.off {
    color: #ff4444;
    border-color: #ff4444;
}

.output-led.on {
    color: var(--text-accent);
    border-color: var(--border-accent);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

.truth-table {
    margin-top: 25px;
    background: var(--bg-accent);
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    padding: 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.truth-table h4 {
    margin: 0 0 15px 0;
    text-align: center;
    font-size: 1.2em;
    color: var(--text-accent);
    font-weight: 700;
    transition: color 0.3s ease;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px auto;
    font-family: 'Share Tech Mono', monospace;
    table-layout: fixed;
}

th, td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border-primary);
    font-size: 14px;
    transition: border-color 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Article content tables */
.article-content table {
    margin: 20px 0;
    width: 100%;
    table-layout: fixed;
}

.article-content th, .article-content td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border-primary);
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.article-content th {
    text-align: center;
    font-weight: 700;
}

.article-content tr:nth-child(even) {
    background: rgba(0, 255, 136, 0.05);
}

[data-theme="light"] .article-content tr:nth-child(even) {
    background: rgba(45, 90, 45, 0.05);
}

.article-content tr:hover {
    background: rgba(0, 255, 136, 0.1);
}

[data-theme="light"] .article-content tr:hover {
    background: rgba(45, 90, 45, 0.1);
}

th {
    background: rgba(0, 255, 136, 0.1);
    font-weight: 700;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

td {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.current-row {
    background: rgba(0, 255, 204, 0.15);
    color: var(--text-accent);
    font-weight: 700;
}

@media (max-width: 768px) {
    .crt-content {
        padding: 20px;
        font-size: 14px;
    }
    
    .blog-title {
        font-size: 2em;
    }
    
    .nav-menu {
        gap: 15px;
    }
    
    .post-preview {
        padding: 20px;
    }
    
    .theme-controls {
        top: 10px;
        right: 10px;
        gap: 3px;
    }
    
    .theme-btn {
        width: 20px;
        height: 20px;
        font-size: 8px;
    }
    
    /* Post page mobile styles */
    .post-title-main {
        font-size: 2em;
    }
    
    .post-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-button {
        text-align: center;
    }
    
    .top-back-button {
        font-size: 0.8em;
        padding: 6px 12px;
    }
    
    /* Gates page mobile styles */
    .gate-card {
        padding: 20px;
    }
    
    .input-section {
        gap: 30px;
    }
    
    /* Mobile table styles */
    .article-content table {
        font-size: 12px;
        margin: 15px 0;
    }
    
    .article-content th, .article-content td {
        padding: 8px;
        font-size: 12px;
    }
    
    /* Stack table cells on very small screens */
    @media (max-width: 480px) {
        .article-content table, 
        .article-content thead, 
        .article-content tbody, 
        .article-content th, 
        .article-content td, 
        .article-content tr {
            display: block;
        }
        
        .article-content thead tr {
            position: absolute;
            top: -9999px;
            left: -9999px;
        }
        
        .article-content tr {
            border: 1px solid var(--border-primary);
            margin-bottom: 10px;
            padding: 10px;
            border-radius: 3px;
            background: var(--bg-secondary);
        }
        
        .article-content td {
            border: none;
            position: relative;
            padding-left: 50%;
            text-align: right;
        }
        
        .article-content td:before {
            content: attr(data-label) ": ";
            position: absolute;
            left: 6px;
            width: 45%;
            padding-right: 10px;
            white-space: nowrap;
            font-weight: bold;
            color: var(--text-accent);
        }
    }
}