:root {
    --bg-color: #050505;
    --card-bg: rgba(15, 15, 15, 0.85);
    --text-color: #e0e0e0;
    --accent-cyan: #00f3ff;
    --accent-magenta: #ff00ff;
    --accent-yellow: #fdf000;
    --border-glow: rgba(0, 243, 255, 0.3);
    --font-header: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Roboto Mono', monospace;
}

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

body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Cyberpunk Grid Background */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.08) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    z-index: 10;
}

/* CRT Scanlines Overlay */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.1) 50%
    );
    background-size: 100% 4px;
    z-index: 20;
    pointer-events: none;
    opacity: 0.15;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 5;
}

.layout-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
    align-items: start;
}

/* Sidebar Styling */
.sidebar {
    position: sticky;
    top: 2rem;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--accent-cyan);
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    box-shadow: -5px 0 15px rgba(0, 243, 255, 0.05);
}

.sidebar-header {
    text-transform: uppercase;
    border-bottom: 1px solid var(--accent-magenta);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.sidebar-header a {
    color: var(--accent-magenta);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-header a:hover {
    text-shadow: 0 0 10px var(--accent-magenta);
}

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

.sidebar-nav li {
    margin-bottom: 0.4rem;
    color: #666;
    white-space: nowrap;
}

.sidebar-nav .dir {
    color: var(--accent-cyan);
    font-weight: bold;
    margin-top: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav .dir.year {
    padding-left: 0.5rem;
    margin-top: 0.3rem;
    font-size: 0.8rem;
}

.sidebar-nav .file {
    padding-left: 1.2rem;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.sidebar-nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.1rem 0.3rem;
    transition: color 0.2s, background 0.2s;
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
}


.sidebar-nav a:hover {
    background: rgba(0, 243, 255, 0.1);
    border-left-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.sidebar-nav a.active {
    background: rgba(255, 0, 255, 0.1);
    border-left-color: var(--accent-magenta);
    color: var(--accent-magenta);
}

.sidebar-footer {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: #555;
    border-top: 1px solid #222;
    padding-top: 1rem;
}

@media (max-width: 900px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        margin-bottom: 2rem;
    }
    .nav-links {
        gap: 1rem;
        font-size: 0.75rem;
        flex-wrap: wrap;
    }
    .nav-bar {
        padding: 0.5rem;
    }
    header h1 {
        font-size: 2rem;
        letter-spacing: 2px;
    }
    article {
        padding: 1.5rem;
    }
}

header {
    margin-bottom: 1rem;
    text-align: center;
    padding-bottom: 2rem;
    position: relative;
}

header h1 {
    font-family: var(--font-header);
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--text-color);
    text-shadow: 
        2px 2px var(--accent-magenta),
        -2px -2px var(--accent-cyan);
    margin-bottom: 1rem;
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    overflow: hidden;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 20px var(--border-glow);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-bar {
    width: 100%;
    margin: 2rem auto 0;
    padding: 0.75rem;
    background: rgba(0, 243, 255, 0.03);
    border: 1px solid rgba(0, 243, 255, 0.2);
    position: relative;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.05);
}

.nav-tag-left, .nav-tag-right {
    position: absolute;
    top: -12px;
    font-size: 0.5rem;
    font-family: var(--font-mono);
    background: var(--bg-color);
    padding: 0 5px;
    color: var(--accent-magenta);
    letter-spacing: 1px;
    border: 1px solid rgba(255, 0, 255, 0.3);
}

.nav-tag-left {
    left: 10px;
}

.nav-tag-right {
    right: 10px;
}

/* Nav Bar Corner Accents */
.nav-bar::before, .nav-bar::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--accent-magenta);
}

.nav-bar::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.nav-bar::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.9rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    letter-spacing: 1px;
}

.nav-links a:hover {
    color: var(--accent-cyan);
    text-shadow: 0 0 8px var(--accent-cyan);
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-cyan);
    transition: width 0.3s;
}

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

/* Reader Mode Overrides */
body.reader-mode .nav-bar {
    background: transparent;
    border-color: #222;
    box-shadow: none;
    max-width: none;
}

body.reader-mode .nav-bar::before,
body.reader-mode .nav-bar::after,
body.reader-mode .nav-tag-left,
body.reader-mode .nav-tag-right {
    display: none;
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
    position: relative;
    cursor: pointer;
    background: transparent;
    border: none;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.9rem;
    padding-bottom: 5px;
}

.dropbtn:hover {
    color: var(--accent-cyan);
}

.dropdown-content {
    display: none;
    position: absolute;
    background: var(--bg-color);
    min-width: 160px;
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
    z-index: 200;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-content a:hover {
    background: rgba(0, 243, 255, 0.1);
    color: var(--accent-cyan);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Reader Mode Dropdown Overrides */
body.reader-mode .dropdown-content {
    background: #111;
    border-color: #222;
    box-shadow: none;
}

body.reader-mode .dropbtn {
    color: #999;
}

body.reader-mode .dropbtn:hover {
    color: #fff;
}

/* Post Cards */
.post-list {
    display: grid;
    gap: 2.5rem;
}

.post-card {
    background: var(--card-bg);
    border: 1px solid var(--accent-cyan);
    padding: 1.5rem;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 15px var(--border-glow);
}

/* Corner Accents for Cards */
.post-card::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    width: 15px;
    height: 15px;
    border-top: 2px solid var(--accent-magenta);
    border-left: 2px solid var(--accent-magenta);
}

.post-card::after {
    content: "";
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 15px;
    height: 15px;
    border-bottom: 2px solid var(--accent-magenta);
    border-right: 2px solid var(--accent-magenta);
}

.post-card h2 {
    font-family: var(--font-header);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-cyan);
}

.post-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 1rem;
}

.post-excerpt {
    font-size: 1rem;
    color: #ccc;
}

/* Article Styling */
article {
    background: var(--card-bg);
    border: 1px solid var(--accent-cyan);
    padding: 3rem;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

article a {
    color: var(--accent-magenta);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 0, 255, 0.2);
    transition: all 0.3s;
}

article a:hover {
    color: #fff;
    border-bottom-color: var(--accent-magenta);
    text-shadow: 0 0 10px var(--accent-magenta);
}

article h1 {
    font-family: var(--font-header);
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    word-wrap: break-word;
}

article .meta {
    font-family: var(--font-mono);
    margin-bottom: 2rem;
    color: var(--accent-magenta);
}

article h2 {
    font-family: var(--font-header);
    color: var(--accent-cyan);
    font-size: 1.3rem;
    margin: 2.5rem 0 1rem;
    letter-spacing: 1px;
}

article h3 {
    font-family: var(--font-header);
    color: var(--accent-magenta);
    font-size: 1.1rem;
    margin: 2rem 0 0.75rem;
    letter-spacing: 1px;
}

article hr {
    border: none;
    border-top: 1px solid rgba(0, 243, 255, 0.3);
    margin: 2.5rem 0;
}

article p, article li {
    margin-bottom: 1.5rem;
    word-wrap: break-word;
}

article ul, article ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

article li {
    margin-bottom: 0.5rem;
}

article ul li::marker {
    color: var(--accent-cyan);
}

article ol li::marker {
    color: var(--accent-magenta);
}

pre, code {
    font-family: var(--font-mono);
    max-width: 100%;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.3);
}

code {
    padding: 0.15rem 0.4rem;
    font-size: 0.9em;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

pre code {
    padding: 0;
    border: none;
    font-size: inherit;
}

pre {
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

article img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--accent-cyan);
    margin: 2rem auto;
    display: block;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

article img:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px var(--border-glow);
}

/* Support for legacy alignment classes from older posts */
article img.alignleft {
    float: left;
    margin: 0.5rem 1.5rem 1rem 0;
    display: inline;
}

article img.alignright {
    float: right;
    margin: 0.5rem 0 1rem 1.5rem;
    display: inline;
}

article img.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Clear floats after images */
article::after {
    content: "";
    display: table;
    clear: both;
}

footer {
    margin-top: 5rem;
    text-align: center;
    padding: 2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-cyber {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: transparent;
    border: 1px solid var(--accent-magenta);
    color: var(--accent-magenta);
    text-transform: uppercase;
    font-family: var(--font-header);
    text-decoration: none;
    letter-spacing: 2px;
    transition: all 0.3s;
    margin-top: 1rem;
}

.btn-cyber:hover {
    background: var(--accent-magenta);
    color: #fff;
    box-shadow: 0 0 20px var(--accent-magenta);
}

/* Reader Mode (Deciphered) Overrides */
body.reader-mode {
    --bg-color: #0d0d0d;
    --text-color: #bbbbbb;
    --card-bg: #111111;
    background: var(--bg-color);
    color: var(--text-color);
}

body.reader-mode::before,
body.reader-mode .scanlines {
    display: none;
}

body.reader-mode .container {
    max-width: 1100px;
}

body.reader-mode header h1 {
    color: #ffffff;
    text-shadow: none;
}

body.reader-mode .nav-links a {
    color: #888;
}

body.reader-mode .nav-links a:hover {
    color: #fff;
}

body.reader-mode .sidebar {
    background: #111;
    border-color: #222;
    box-shadow: none;
}

body.reader-mode .sidebar-header a {
    color: #eee;
}

body.reader-mode .sidebar-nav a {
    color: #888;
}

body.reader-mode article {
    background: #111;
    border: 1px solid #222;
    color: #ccc;
    box-shadow: none;
    padding: 3rem;
}

body.reader-mode .post-card {
    background: #111;
    border-color: #222;
    box-shadow: none;
}

body.reader-mode .post-card:hover {
    transform: none;
    box-shadow: none;
}

body.reader-mode .post-card::before,
body.reader-mode .post-card::after {
    display: none;
}

body.reader-mode .post-card h2 {
    color: #fff;
    font-family: var(--font-body);
    font-weight: 700;
}

body.reader-mode .btn-cyber {
    border-color: #444;
    color: #888;
    font-family: var(--font-body);
}

body.reader-mode article h2 {
    color: #fff;
    font-family: var(--font-body);
    font-weight: 700;
}

body.reader-mode article h3 {
    color: #ccc;
    font-family: var(--font-body);
    font-weight: 600;
}

body.reader-mode article hr {
    border-top-color: #333;
}

body.reader-mode article h1 {
    color: #ffffff;
    text-shadow: none;
    font-family: var(--font-body);
    font-weight: 700;
}

body.reader-mode article .meta {
    color: #666;
}

body.reader-mode article a {
    color: var(--accent-cyan);
    border-bottom: 1px solid rgba(0, 243, 255, 0.2);
}

body.reader-mode article a:hover {
    background: rgba(0, 243, 255, 0.05);
    text-shadow: none;
    color: #fff;
}

body.reader-mode pre, 
body.reader-mode code {
    background: #000;
    color: #ccc;
    border-color: #222;
}

/* View Toggle Button */
.view-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
}

body.reader-mode .view-toggle {
    border-color: #444;
    color: #666;
}

.view-toggle:hover {
    box-shadow: 0 0 10px var(--accent-cyan);
}
