/*
Theme Name: CyberTerm Dynamic
Description: A cyberpunk, terminal-inspired theme powered by ACF.
Author: Touhid
Version: 1.0
*/

/* =========================================================
   1. CYBERPUNK COLOR PALETTE (Variables)
   ========================================================= */
:root {
    --bg-color: #0b0c10;           /* Deep void black/blue */
    --text-main: #c5c6c7;          /* Soft silver/grey for easy reading */
    --text-muted: #666666;
    
    /* Neon Accents */
    --neon-cyan: #66fcf1;          /* Primary accent */
    --neon-magenta: #ff00ff;       /* Secondary accent */
    --neon-amber: #f2a900;         /* Warnings / tertiary accent */
    
    --border-color: #1f2833;
    --code-bg: #111216;
    --font-main: 'Courier New', Courier, monospace;
}

/* =========================================================
   2. BASE STYLES
   ========================================================= */
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    margin: 0;
    line-height: 1.6;
}

/* Ensure the body text doesn't hide behind the sticky header */
html {
    scroll-padding-top: 100px; 
}

a { 
    color: var(--neon-cyan); 
    text-decoration: none; 
    transition: 0.3s; 
}

a:hover { 
    color: var(--neon-magenta); 
    text-shadow: 0 0 5px var(--neon-magenta); 
}

/* =========================================================
   3. LAYOUT & CONTAINERS
   ========================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.layout-with-sidebar {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 40px;
}

@media (max-width: 768px) {
    .layout-with-sidebar { grid-template-columns: 1fr; }
}

.terminal-box, .post-card {
    border: 1px solid var(--border-color);
    padding: 20px;
    background: var(--code-bg);
}

/* =========================================================
   4. TYPOGRAPHY & HEADINGS
   ========================================================= */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-main);
    text-transform: uppercase;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    letter-spacing: 1px;
}

h1 {
    color: var(--neon-cyan);
    border-bottom: 2px solid var(--neon-cyan);
    padding-bottom: 10px;
}

h2 {
    color: var(--neon-magenta);
    border-bottom: 1px dashed var(--neon-magenta);
    padding-bottom: 8px;
}

h3 {
    color: var(--neon-amber);
}

/* =========================================================
   5. UPGRADED TERMINAL NAVBAR & LOGO
   ========================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 9999;
    background-color: #050505; /* Solid dark background so it doesn't blend */
    border-bottom: 2px solid var(--neon-cyan) !important;
    border-top: 4px solid var(--neon-magenta); /* Extra top definition */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    padding: 0 !important; /* Removed padding to let links fill the height */
    margin: 0 0 40px 0;
}

.nav-container { 
    display: flex; 
    justify-content: space-between; 
    align-items: stretch; /* Stretches children to fill the header height */
    padding: 0 20px;
    min-height: 65px; /* Ensures a good clickable area */
}

.logo { 
    display: flex;
    align-items: center; /* Centers logo vertically */
    font-size: 1.3rem; 
    font-weight: bold; 
    text-shadow: 0 0 10px var(--neon-cyan); 
}

.logo a {
    color: var(--neon-cyan);
    border-bottom: none; /* Removes link underline from logo */
}

/* =========================================================
   6. UI TAB DROPDOWN MENUS (Primary Navbar)
   ========================================================= */
.main-menu {
    display: flex;
    align-items: center;
}

.main-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: stretch; 
    gap: 0; /* Remove gap; we will use borders to separate items */
}

/* Base style for top-level navbar items */
.main-menu > ul > li {
    position: relative;
    display: flex;
    padding: 0; /* Reset global list padding */
    border-left: 1px solid var(--border-color); /* Separator lines */
}

.main-menu > ul > li:last-child {
    border-right: 1px solid var(--border-color); /* Cap the end of the menu */
}

/* CRITICAL FIX: Strip the global [+] bullet from the navbar */
.main-menu ul li::before {
    content: none !important; 
}

/* Navbar Link Styling (The Tabs) */
.main-menu a {
    display: flex;
    align-items: center;
    padding: 0 25px;
    color: var(--text-main);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    border-bottom: 2px solid transparent !important; /* Prep for hover state */
    transition: all 0.2s ease-in-out;
}

/* Hover effect for top-level tabs */
.main-menu > ul > li:hover > a {
    background-color: rgba(102, 252, 241, 0.05); /* Slight cyan glow */
    color: var(--neon-cyan);
    border-bottom: 2px solid var(--neon-cyan) !important;
}

/* --- OVERRIDES: STRICT NAVBAR DROPDOWNS --- */
.site-header .main-menu ul.sub-menu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: -1px; /* Align perfectly with left border */
    flex-direction: column;
    background: var(--bg-color);
    border: 1px solid var(--neon-cyan);
    border-top: none;
    min-width: 220px;
    z-index: 10000;
    box-shadow: 5px 5px 0px rgba(102, 252, 241, 0.1); /* Cyberpunk block shadow */
}

/* Force show on hover */
.site-header .main-menu li:hover > ul.sub-menu {
    display: flex !important;
}

/* Submenu items */
.site-header .main-menu ul.sub-menu li {
    padding: 0;
    border: none;
    border-bottom: 1px dashed var(--border-color);
}

.site-header .main-menu ul.sub-menu li:last-child {
    border-bottom: none;
}

/* Submenu links */
.site-header .main-menu ul.sub-menu a {
    padding: 15px 20px;
    width: 100%;
    box-sizing: border-box;
}

.site-header .main-menu ul.sub-menu a:hover {
    background-color: var(--code-bg);
    padding-left: 25px; /* Push text slightly right on hover for a terminal effect */
}

/* Indicators for dropdowns */
.main-menu li.menu-item-has-children > a::after {
    content: " \25BC"; /* Unicode down arrow */
    font-size: 0.7em;
    margin-left: 8px;
    color: var(--neon-magenta);
}

/* =========================================================
   7. LISTS (Fixed Overlap)
   ========================================================= */
ul, ol {
    margin: 20px 0;
    color: var(--text-main);
}

/* Unordered Lists */
ul {
    list-style-type: none;
    padding-left: 0;
}

ul li {
    position: relative;
    margin-bottom: 10px;
    padding-left: 40px; /* INCREASED PADDING: Fixed overlap */
}

/* ul li::before {
    content: "[+]";
    color: var(--neon-cyan);
} */

/* ul li::before {
    content: "[+] ";
    position: absolute;
    left: 10;
	right: 100
    color: var(--neon-cyan);
    font-weight: bold;
} */

/* Ordered Lists */
ol {
    padding-left: 20px;
}

ol li {
    margin-bottom: 10px;
    padding-left: 10px;
}

ol li::marker {
    color: var(--neon-amber);
    font-weight: bold;
}

/* =========================================================
   8. CODE BLOCKS
   ========================================================= */
pre {
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--neon-magenta);
    color: #e0e0e0;
    padding: 15px 20px;
    overflow-x: auto;
    font-size: 0.95rem;
    margin: 20px 0;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.8);
}

pre::-webkit-scrollbar {
    height: 8px;
}
pre::-webkit-scrollbar-track {
    background: var(--code-bg);
}
pre::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
pre::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
}

code {
    background-color: rgba(102, 252, 241, 0.1);
    color: var(--neon-cyan);
    padding: 2px 6px;
    border: 1px solid rgba(102, 252, 241, 0.2);
    border-radius: 3px;
    font-size: 0.9em;
}

pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border: none;
}

/* =========================================================
   9. BUTTONS ("Execute Read")
   ========================================================= */
.read-more {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 15px;
    background-color: rgba(102, 252, 241, 0.05);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan) !important;
    text-transform: uppercase;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    z-index: 10;
    transition: all 0.2s ease-in-out;
}

.read-more:hover {
    background-color: var(--neon-cyan);
    color: var(--bg-color) !important;
    box-shadow: 0 0 10px var(--neon-cyan);
}

/* =========================================================
   10. FOOTER (Full Width)
   ========================================================= */

/* Updated the CSS Footer */
.site-footer {
    grid-column: 1 / -1 !important; /* Forces it to span all columns if trapped in a grid */
    clear: both !important;         /* Clears any floating elements */
    
    width: 100%;
    clear: both;
    background-color: var(--bg-color);
    border-top: 2px solid var(--neon-cyan);
    padding: 50px 0;
    margin-top: 60px;
    display: block;
    position: relative;
    box-sizing: border-box;
}

.site-footer .container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.footer-widget h3 {
    color: var(--neon-magenta);
    font-size: 1.2rem;
    margin-top: 0;
}

/* Remove [+] from footer list items and use >> */
.footer-widget ul li {
    padding-left: 25px; 
}

.footer-widget ul li::before {
    content: ">> ";
    color: var(--neon-cyan);
}


/* =========================================================
   11. IMMERSIVE TERMINAL EFFECTS
   ========================================================= */

/* CRT Scanline Overlay */
body::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 99999;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none; /* Allows clicking through the effect */
}

/* Global Terminal Scrollbar */
::-webkit-scrollbar { 
    width: 10px; 
}
::-webkit-scrollbar-track { 
    background: var(--bg-color); 
    border-left: 1px solid var(--border-color); 
}
::-webkit-scrollbar-thumb { 
    background: var(--border-color); 
}
::-webkit-scrollbar-thumb:hover { 
    background: var(--neon-cyan); 
}

/* Hover Glitch Effect for specific links */
.glitch-link:hover {
    animation: glitch-skew 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    color: var(--neon-magenta) !important;
    text-shadow: 2px 2px var(--neon-cyan), -2px -2px var(--neon-amber);
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    20% { transform: skew(-10deg); }
    40% { transform: skew(10deg); }
    60% { transform: skew(-5deg); }
    80% { transform: skew(5deg); }
    100% { transform: skew(0deg); }
}

/* Dashboard Grid Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.target-node {
    border: 1px solid var(--border-color);
    background: var(--code-bg);
    padding: 15px;
    position: relative;
    transition: 0.3s;
}
.target-node:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(102, 252, 241, 0.2);
}
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}
.status-active { background-color: var(--neon-cyan); box-shadow: 0 0 5px var(--neon-cyan); }
.status-pwned { background-color: var(--neon-magenta); box-shadow: 0 0 5px var(--neon-magenta); }


/* =========================================================
   12. ADVANCED UI EFFECTS
   ========================================================= */

/* Replace default cursor with a retro crosshair */
body {
    cursor: crosshair !important;
}

/* Change cursor to a 'cell' (thick plus sign) when hovering over links/buttons */
a, button, input, .read-more, .target-node {
    cursor: cell !important; 
}

/* Live Typing Animation for Headers */
.typing-effect {
    display: inline-block;
    overflow: hidden; 
    white-space: nowrap; 
    border-right: 12px solid var(--neon-cyan); /* The blinking block cursor */
    border-bottom: none !important; /* Removes default h1 border to look cleaner */
    animation: typing 1.5s steps(30, end) forwards, blink-caret 0.8s step-end infinite;
    max-width: fit-content;
    padding-right: 5px;
}

/* Keyframes for typing */
@keyframes typing { 
    from { width: 0; } 
    to { width: 100%; } 
}

/* Keyframes for blinking cursor */
@keyframes blink-caret { 
    from, to { border-color: transparent; } 
    50% { border-color: var(--neon-cyan); } 
}

/* =========================================================
   13. MOBILE RESPONSIVE (BREAKPOINT PATCH)
   ========================================================= */

/* Hide the toggle button on desktop */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--neon-cyan);
    font-family: var(--font-main);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.mobile-menu-toggle:hover {
    text-shadow: 0 0 8px var(--neon-cyan);
}

/* --- MOBILE SPECIFIC RULES (Under 768px) --- */
@media screen and (max-width: 768px) {
    
    /* 1. Adjust the header layout */
    .nav-container {
        flex-wrap: wrap; /* Allows menu to drop below logo */
        align-items: center;
        min-height: auto;
        padding: 15px 20px;
    }

    /* 2. Show the toggle button */
    .mobile-menu-toggle {
        display: block;
    }

    /* 3. Hide the main menu by default, configure it for dropdown */
    .main-menu {
        display: none; /* Hidden until Javascript toggles it */
        width: 100%;
        margin-top: 15px;
        background-color: var(--bg-color);
        border-top: 1px dashed var(--neon-cyan);
        padding-top: 10px;
    }

    /* 4. The class added by Javascript to show the menu */
    .main-menu.active {
        display: block;
        animation: slideDown 0.3s ease-in-out forwards;
    }

    /* 5. Reformat the horizontal links into a vertical list */
    .main-menu ul {
        flex-direction: column;
    }

    .main-menu > ul > li {
        border-left: none; /* Remove desktop vertical dividers */
        border-bottom: 1px dashed var(--border-color); /* Add horizontal dividers */
        width: 100%;
    }

    .main-menu > ul > li:last-child {
        border-right: none;
        border-bottom: none;
    }

    .main-menu a {
        padding: 15px 10px;
        justify-content: space-between; /* Pushes dropdown arrows to the far right */
    }

    /* 6. Fix Sub-menus on mobile so they don't fly off the screen */
    .site-header .main-menu ul.sub-menu {
        position: relative; /* Push content down instead of floating over it */
        top: 0;
        left: 0;
        min-width: 100%;
        border: none;
        border-top: 1px solid var(--border-color);
        background: var(--code-bg);
        box-shadow: none;
    }

    .site-header .main-menu ul.sub-menu a {
        padding-left: 30px; /* Indent sub-menus so they look nested */
        color: var(--neon-magenta);
    }
}

/* Simple dropdown animation for the mobile menu */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* =========================================================
   14. MOBILE OVERFLOW & CONTENT PATCH
   ========================================================= */

/* 1. Prevent large images or iframes from blowing out the container */
.content-body img, 
.content-body iframe {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

/* 2. Force long URLs, Base64 strings, and hashes to wrap */
.content-body, 
.post-card,
.terminal-box {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word; /* Hard break for unbreakable strings */
    min-width: 0; /* CRITICAL: Allows Flexbox/Grid containers to shrink */
}

/* 3. Keep inline code from stretching the screen */
p code, li code {
    word-break: break-all;
    white-space: normal;
}

/* 4. Ensure large code blocks scroll horizontally instead of breaking the page */
pre {
    max-width: 100vw;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* --- MOBILE SPECIFIC FAILSAFES (Under 768px) --- */
@media screen and (max-width: 768px) {
    
    /* Global failsafe to kill horizontal scrolling */
    body, html {
        overflow-x: hidden;
    }

    /* Fix the Typing Effect for long titles on phones */
    .typing-effect {
        white-space: normal !important; /* Allow the title to drop to the next line */
        animation: none !important;     /* Disable typing animation on mobile so it doesn't clip */
        border-right: none !important;  /* Hide the blinking cursor */
        width: auto !important;         /* Reset width constraints */
        max-width: 100%;
    }
    
    /* Ensure the single post container has proper breathing room */
    .single-post-content .post-card {
        padding: 15px; /* Slightly smaller padding for mobile */
    }
    
    /* Ensure the target info box doesn't break */
    .target-info {
        word-break: break-all;
    }
}



/* =========================================================
   15. TERMINAL COMMENTS SECTION
   ========================================================= */
.comments-area {
    padding: 30px;
    background: var(--code-bg);
}

/* Individual Comment Blocks */
.comment-list .comment {
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
    background: var(--bg-color);
}

/* Remove default bullets from WordPress comment wrappers */
.comment-list li {
    padding-left: 0;
}
.comment-list li::before {
    content: none;
}

/* Comment Header (Avatar + Name + Date) */
.comment-meta {
    border-bottom: 1px dashed var(--text-muted);
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.comment-meta img.avatar {
    border: 1px solid var(--neon-cyan);
    border-radius: 4px;
}

.comment-meta a {
    color: var(--neon-cyan);
}

/* Reply Link */
.reply a {
    display: inline-block;
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--neon-amber);
    text-transform: uppercase;
}

.reply a::before {
    content: "> ";
}
.reply a:hover {
    color: var(--neon-magenta);
}

/* Form Input Glow Effects */
#comment:focus, #author:focus, #email:focus, #url:focus {
    border-color: var(--neon-magenta) !important;
    outline: none;
    box-shadow: inset 0 0 8px rgba(255, 0, 255, 0.2);
}

/* Make inputs responsive on mobile */
@media screen and (max-width: 768px) {
    .comment-form-author label, 
    .comment-form-email label, 
    .comment-form-url label {
        display: block !important;
        margin-bottom: 5px;
    }
    .comment-form-author input, 
    .comment-form-email input, 
    .comment-form-url input {
        width: 100%;
        box-sizing: border-box;
    }
}