/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    --bg-color: #050505;
    --text-color: #e0e0e0;
    --accent: #ff4d4d;
    --sidebar-width: 260px;
    
    /* Cursor & Light Logic */
    --cursor-x: 50vw;
    --cursor-y: 50vh;
    --light-size: 250px; 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    cursor: none; /* Custom cursor active */
    
    /* Noise Texture Overlay */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    
    /* Page Load Fade-in */
    animation: fadeIn 1.2s ease-in-out;
}

@keyframes fadeIn {
    0% { opacity: 0; filter: blur(5px); }
    100% { opacity: 1; filter: blur(0); }
}

a { text-decoration: none; color: inherit; transition: 0.3s; cursor: none; }
button { cursor: none; }
ul { list-style: none; }

/* Accessibility */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* =========================================
   2. FLASHLIGHT & LIGHT SWITCH
   ========================================= */
#flashlight {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 1;
    
    background: radial-gradient(
        circle var(--light-size) at var(--cursor-x) var(--cursor-y),
        transparent 5%,
        rgba(0, 0, 0, 0.5) 20%,
        rgba(0, 0, 0, 0.85) 40%,
        rgba(0, 0, 0, 0.96) 100%
    );
    mix-blend-mode: multiply;
    transition: background 0.2s ease, opacity 0.5s ease;
}

/* Light Switch Button */
#light-switch {
    position: fixed;
    bottom: 20px;
    right: 150px;
    background: transparent;
    border: 1px solid #333;
    color: #666;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10002;
    transition: all 0.3s ease;
}

#light-switch:hover {
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

/* Disabled State */
#light-switch.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #333;
    color: #333;
    pointer-events: none;
}

/* Lights On / Dying States */
body.lights-on #flashlight { opacity: 0; pointer-events: none; transition: opacity 0.5s ease-out; }
body.battery-dying #flashlight { opacity: 1; pointer-events: none; transition: opacity 10s ease-in; }
body.lights-on { cursor: auto; }

/* =========================================
   3. SIDEBAR NAVIGATION (UPDATED)
   ========================================= */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--bg-color);
    z-index: 100;
    transition: transform 0.3s ease;
    
    /* Enable Scrolling for long content */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

/* Custom Scrollbar for Sidebar */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background-color: #333; border-radius: 4px; }

.nav-content {
    /* Ensures the top part takes available space but allows scrolling */
    flex: 1; 
    display: flex;
    flex-direction: column;
}

.brand {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2rem; /* Added spacing */
    flex-shrink: 0; /* Prevents logo from squishing */
}

.nav-links li { margin-bottom: 1.5rem; }

.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    opacity: 1;
    color: var(--accent);
    padding-left: 10px;
}

/* Secondary Legal Menu */
.legal-menu { 
    margin-top: 1rem; 
    padding-top: 1.5rem; 
    border-top: 1px solid rgba(255, 255, 255, 0.1); 
    margin-bottom: 2rem;
}

.legal-menu li { margin-bottom: 1rem; }

.legal-menu a { 
    font-size: 0.85rem; 
    opacity: 0.5; 
}

.legal-menu a:hover {
    color: var(--accent);
    opacity: 1;
    padding-left: 5px;
}

.socials {
    display: flex;
    gap: 15px;
    font-size: 1.4rem;
    margin-top: auto; /* Pushes to bottom if space permits */
    padding-top: 1rem;
    flex-shrink: 0;
}

/* =========================================
   4. MAIN CONTENT AREA
   ========================================= */
.content-wrapper {
    margin-left: var(--sidebar-width);
    padding: 4rem 6rem;
    max-width: 1200px;
}

.hero h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.2rem; opacity: 0.8; margin-bottom: 4rem; }

/* =========================================
   5. BLOG & CARDS
   ========================================= */
.recent-posts h2 {
    margin-bottom: 2rem;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    display: inline-block;
}

.card {
    border: 1px solid #222;
    padding: 2rem;
    margin-bottom: 2rem;
    transition: 0.3s;
    background: #0a0a0a;
}

.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-date { font-size: 0.85rem; color: #666; margin-bottom: 0.5rem; }

.read-more {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--accent);
}

/* Single Post Styles */
.blog-post { max-width: 800px; margin-bottom: 4rem; }
.post-header h1 { font-size: 3rem; margin-top: 1rem; color: var(--accent); }
.post-header .back-link { font-size: 0.9rem; opacity: 0.6; display: inline-block; margin-bottom: 1rem; }
.post-header .back-link:hover { opacity: 1; transform: translateX(-5px); }
.divider { border: 0; height: 1px; background: #333; margin: 2rem 0; }
.post-body p { font-size: 1.1rem; line-height: 1.8; margin-bottom: 1.5rem; opacity: 0.9; }
.post-body h2 { margin-top: 3rem; margin-bottom: 1rem; color: #fff; }
.post-body blockquote { border-left: 3px solid var(--accent); padding-left: 1.5rem; margin: 2rem 0; font-style: italic; color: #888; }
.post-body pre { background: #111; padding: 1.5rem; border: 1px solid #333; overflow-x: auto; margin: 2rem 0; font-family: 'Courier New', monospace; color: #b5b5b5; }

/* Loading Indicator */
#loading-indicator {
    opacity: 0.5; 
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =========================================
   6. PROJECTS GRID
   ========================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.project-card {
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid #222;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: rgba(15, 15, 15, 0.9);
}

.project-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.project-card h3 { font-size: 1.4rem; color: #fff; margin-bottom: 0.5rem; }

.status-dot { height: 8px; width: 8px; border-radius: 50%; background: #444; box-shadow: 0 0 5px #444; }
.status-dot.completed { background: #00ff88; box-shadow: 0 0 8px #00ff88; }
.status-dot.in-progress { background: #ffcc00; box-shadow: 0 0 8px #ffcc00; }
.status-dot.archived { background: #666; }

.project-card p { font-size: 0.95rem; color: #888; line-height: 1.6; margin-bottom: 2rem; }

.tech-stack { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.tech-tag { font-size: 0.75rem; border: 1px solid #333; padding: 4px 10px; border-radius: 20px; color: #666; transition: 0.3s; }
.project-card:hover .tech-tag { border-color: var(--accent); color: var(--text-color); }

.project-link {
    margin-top: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--accent);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}
.project-card:hover .project-link { opacity: 1; transform: translateX(0); }

/* =========================================
   7. JOURNAL TIMELINE
   ========================================= */
.timeline-container {
    border-left: 2px solid #333;
    padding-left: 2rem;
    margin-left: 1rem;
    position: relative;
}

.log-entry { margin-bottom: 3rem; position: relative; }
.log-entry::before {
    content: '';
    position: absolute;
    left: -2.6rem;
    top: 5px;
    width: 12px;
    height: 12px;
    background: #222;
    border: 2px solid #555;
    border-radius: 50%;
    transition: 0.3s;
}
.log-entry:hover::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px var(--accent); }

.log-meta { font-size: 0.8rem; color: #666; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 10px; }
.log-entry h3 { font-size: 1.5rem; margin-bottom: 0.5rem; color: #ddd; }
.log-entry p { color: #888; font-size: 0.95rem; margin-bottom: 1rem; }
.log-link { font-size: 0.85rem; color: var(--accent); opacity: 0.7; }
.log-link:hover { opacity: 1; text-decoration: underline; }

/* =========================================
   8. ABOUT / PROFILE PAGE
   ========================================= */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 2rem;
}

.profile-section { margin-bottom: 2rem; }
.profile-section h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}
.profile-section h2 i { color: var(--accent); }

.bio-content p { font-size: 1.05rem; line-height: 1.7; margin-bottom: 1rem; color: #aaa; }
.bio-content strong { color: #fff; }

.data-box, .crypto-card {
    background: #0a0a0a;
    border: 1px solid #222;
    padding: 1.2rem;
    margin-bottom: 1rem;
    transition: 0.3s;
}
.crypto-card:hover, .data-box:hover { border-color: var(--accent); background: #0f0f0f; }

.coin-header { display: flex; align-items: center; gap: 8px; font-weight: bold; color: #ccc; margin-bottom: 0.8rem; }

.copy-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
    padding: 8px 12px;
    border: 1px dashed #444;
}

.copy-target {
    font-family: monospace;
    color: var(--accent);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
    min-width: 0; 
}

.copy-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.1rem;
    transition: 0.2s;
    flex-shrink: 0;
}
.copy-btn:hover { color: #fff; transform: scale(1.1); }

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #000;
    background: var(--accent);
    padding: 10px 20px;
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 10px;
    transition: 0.3s;
}
.action-btn:hover { box-shadow: 0 0 15px rgba(255, 77, 77, 0.5); background: #fff; }

.social-links-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; }
.social-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #0a0a0a;
    border: 1px solid #222;
    color: #888;
    transition: 0.3s;
}
.social-card i { font-size: 1.8rem; margin-bottom: 0.5rem; }
.social-card:hover { border-color: var(--accent); color: #fff; transform: translateY(-3px); }

/* Feedback Toast */
.feedback-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #111;
    border: 1px solid var(--accent);
    color: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10005;
    opacity: 0;
    transition: all 0.4s ease;
}
.feedback-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* User Guide Anchor */
.user-guide {
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 10001;
    color: #444;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    animation: breathe 4s infinite ease-in-out;
    pointer-events: none;
}

@keyframes breathe {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* =========================================
   9. MOBILE & RESPONSIVE
   ========================================= */
#menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 101;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

@media (max-width: 900px) {
    .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body { cursor: auto; }

    #sidebar {
        transform: translateX(-100%);
        width: 100%;
        border-right: none;
        /* Mobile Specific: Ensure full scroll access */
        padding-bottom: 80px; 
    }
    #sidebar.active { transform: translateX(0); }

    .content-wrapper {
        margin-left: 0;
        padding: 6rem 2rem 2rem 2rem;
    }

    #menu-toggle { display: block; }
    
    .hero h1 { font-size: 2.5rem; }
    
    .user-guide { display: none; }
    #light-switch { right: 20px; bottom: 80px; background: rgba(0,0,0,0.8); }
    
    /* Ensure legal links don't wrap awkwardly on very small screens */
    .legal-menu a { font-size: 1rem; padding: 10px 0; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 2rem; }
    .data-box, .crypto-card { padding: 1rem; }
    .copy-target { font-size: 0.8rem; }
}

/* =========================================
   10. AGE GATE (POPUP)
   ========================================= */
.age-gate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95); /* Deep dark background */
    backdrop-filter: blur(5px); /* Blurs the content behind */
    z-index: 99999; /* Higher than everything, even the flashlight */
    display: none; /* Hidden by default, JS enables it */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.age-gate-overlay.active {
    display: flex;
}

.age-gate-box {
    border: 1px solid var(--accent);
    background: #050505;
    padding: 3rem;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 77, 77, 0.2);
    animation: glitchEntry 0.3s ease-out;
}

.age-gate-box i {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 1rem;
    display: block;
}

.age-gate-box h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.age-gate-box p {
    color: #888;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.age-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.gate-btn {
    background: transparent;
    border: 1px solid #333;
    color: #666;
    padding: 12px 24px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: 0.3s;
    text-transform: uppercase;
}

.gate-btn.confirm:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.gate-btn.deny:hover {
    border-color: #fff;
    color: #fff;
}

@keyframes glitchEntry {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}