/*
Theme Name: NodeWeaver Custom
Theme URI: https://thenodeweaver.com/
Author: The Node Weaver
Author URI: https://thenodeweaver.com/
Description: A minimal black-and-white theme with liquid glass, retro-game styling, dark mode, and interactive particle effects for The Node Weaver.
Version: 2.4.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nodeweaver-custom
Tags: blog, one-column, custom-menu, custom-logo, featured-images, theme-options
*/

/* --------------------------------------------------------
   0. CSS Custom Properties (Light / Dark)
   -------------------------------------------------------- */

:root {
    --grid-line-color: 0, 0, 0;
    --bg: #f0f0f0;
    --bg-rgb: 240, 240, 240;
    --text: #111;
    --text-muted: #666;
    --text-faint: #999;
    --surface: rgba(255, 255, 255, 0.45);
    --surface-hover: rgba(255, 255, 255, 0.65);
    --surface-solid: #fff;
    --border: rgba(255, 255, 255, 0.5);
    --border-subtle: rgba(0, 0, 0, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.06);
    --glass-blur: 16px;
    --header-bg: rgba(0, 0, 0, 0.85);
    --header-text: #fff;
    --header-nav: #ccc;
    --footer-bg: rgba(0, 0, 0, 0.9);
    --footer-text: #fff;
    --grid-opacity: 0.06;
    --glow: rgba(0, 0, 0, 0.08);
    --accent: #000;
    --accent-glow: rgba(0, 0, 0, 0.15);
    --code-bg: #f5f5f5;
    --code-border: #e0e0e0;
    --dropdown-bg: rgba(255, 255, 255, 0.85);
    --dropdown-hover: rgba(245, 245, 245, 0.9);
    --particle-color: rgba(0, 0, 0, 0.25);
    --particle-line: rgba(0, 0, 0, 0.08);
    --btn-border: #333;
    --btn-text: #333;
    --btn-glow: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] {
    --grid-line-color: 255, 255, 255;
    --bg: #0a0a0a;
    --bg-rgb: 10, 10, 10;
    --text: #e0e0e0;
    --text-muted: #aaa;
    --text-faint: #777;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-hover: rgba(255, 255, 255, 0.12);
    --surface-solid: #1a1a1a;
    --border: rgba(255, 255, 255, 0.1);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --glass-shadow: rgba(0, 0, 0, 0.3);
    --header-bg: rgba(10, 10, 10, 0.85);
    --header-text: #e0e0e0;
    --header-nav: #999;
    --footer-bg: rgba(10, 10, 10, 0.95);
    --footer-text: #e0e0e0;
    --grid-opacity: 0.08;
    --glow: rgba(255, 255, 255, 0.04);
    --accent: #e0e0e0;
    --accent-glow: rgba(255, 255, 255, 0.08);
    --code-bg: #1a1a1a;
    --code-border: #333;
    --dropdown-bg: rgba(30, 30, 30, 0.9);
    --dropdown-hover: rgba(50, 50, 50, 0.9);
    --particle-color: rgba(255, 255, 255, 0.2);
    --particle-line: rgba(255, 255, 255, 0.06);
    --btn-border: #bbb;
    --btn-text: #ccc;
    --btn-glow: rgba(255, 255, 255, 0.1);
}

/* --------------------------------------------------------
   0b. Reset & Base
   -------------------------------------------------------- */

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

body {
    font-family: 'Courier Prime', 'Courier New', Courier, monospace;
    color: var(--text);
    line-height: 1.6;
    background-color: var(--bg);
    background-image:
        linear-gradient(rgba(var(--grid-line-color), var(--grid-opacity)) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--grid-line-color), var(--grid-opacity)) 1px, transparent 1px);
    background-size: 20px 20px;
    transition: background-color 0.4s, color 0.4s;
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.site-header,
.site-main,
.site-footer {
    position: relative;
    z-index: 1;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    opacity: 0.7;
}

img {
    max-width: 100%;
    height: auto;
}

/* --------------------------------------------------------
   1. Header — frosted glass bar
   -------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--header-text);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-branding a {
    color: var(--header-text);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7875rem;
    font-weight: 400;
    letter-spacing: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Dark-mode toggle */

.dark-mode-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: var(--header-text);
    font-size: 0.8rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
    padding: 0;
    line-height: 1;
}

.dark-mode-toggle .toggle-icon {
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.dark-mode-toggle:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
}

.dark-mode-toggle .light-icon { display: flex; }
.dark-mode-toggle .dark-icon { display: none; }
[data-theme="dark"] .dark-mode-toggle .light-icon { display: none; }
[data-theme="dark"] .dark-mode-toggle .dark-icon { display: flex; }

.dark-mode-li {
    display: flex;
    align-items: center;
}

/* Primary navigation */

.main-navigation {
    display: flex;
    align-items: center;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.main-navigation a {
    color: var(--header-nav);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5665rem;
    font-weight: 400;
    padding: 0.5rem 0;
    transition: color 0.2s, text-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main-navigation a:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    text-decoration: none;
    opacity: 1;
}

/* Dropdown — liquid glass */

.main-navigation li {
    position: relative;
}

.main-navigation .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--dropdown-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 180px;
    flex-direction: column;
    gap: 0;
    padding: 0.4rem 0;
    z-index: 1001;
    box-shadow: 0 8px 32px var(--glass-shadow);
}

.main-navigation li:hover > .sub-menu {
    display: flex;
}

.main-navigation .sub-menu a {
    color: var(--text);
    font-family: 'Press Start 2P', monospace;
    padding: 0.75rem 1rem;
    display: block;
    font-size: 0.45rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.main-navigation .sub-menu a:hover {
    background: var(--dropdown-hover);
    color: var(--accent);
    text-decoration: none;
    opacity: 1;
    text-shadow: none;
}

/* Mobile toggle */

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-family: 'Courier Prime', 'Courier New', Courier, monospace;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
}

/* --------------------------------------------------------
   2. Hero Section
   -------------------------------------------------------- */

.hero-section {
    text-align: center;
    padding: 0 2rem;
    max-width: 800px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-section h1 {
    font-family: 'Merriweather', Georgia, serif;
    font-size: 3.2rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 2.5rem;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.btn-cta {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--surface);
    color: var(--btn-text);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    border: 3px solid var(--btn-border);
    text-transform: uppercase;
    letter-spacing: 2px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 2px;
    transition: background 0.3s, box-shadow 0.3s, transform 0.2s;
    cursor: pointer;
}

.btn-cta:hover {
    background: var(--surface-hover);
    box-shadow: 0 0 16px var(--btn-glow);
    transform: translateY(-1px);
    opacity: 1;
}

.btn-arrow {
    margin-left: 0.3em;
}

.btn-cursor {
    animation: blink 1s step-end infinite;
    margin-left: 0.2em;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* --------------------------------------------------------
   3. Category Cards — liquid glass
   -------------------------------------------------------- */

.categories-section {
    max-width: 1100px;
    margin: 0 auto 4rem;
    padding: 0 2rem;
}

.categories-section h2 {
    text-align: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    border-radius: 12px;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: 0 4px 24px var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.category-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px var(--glass-shadow), 0 0 20px var(--accent-glow);
}

.category-card h3 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.category-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.category-card a {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    font-weight: 400;
    color: var(--accent);
    border-bottom: 1px solid var(--accent);
    padding-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: text-shadow 0.2s;
}

.category-card a:hover {
    opacity: 1;
    text-shadow: 0 0 8px var(--accent-glow);
}

/* --------------------------------------------------------
   4. Featured / Latest Post — liquid glass
   -------------------------------------------------------- */

.featured-section {
    max-width: 1100px;
    margin: 0 auto 4rem;
    padding: 0 2rem;
}

.featured-section h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 1.5rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.featured-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2.5rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    border-radius: 12px;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: 0 4px 24px var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.featured-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px var(--glass-shadow), 0 0 20px var(--accent-glow);
}

.featured-card .featured-thumb {
    flex: 0 0 300px;
    max-width: 300px;
}

.featured-card .featured-thumb img {
    width: 100%;
    display: block;
    border-radius: 8px;
}

.featured-card .featured-content {
    flex: 1;
}

.featured-card .featured-meta {
    font-size: 0.8rem;
    color: var(--text-faint);
    margin-bottom: 0.5rem;
}

.featured-card h3 {
    font-family: Merriweather, Georgia, 'Times New Roman', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.featured-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.featured-card .read-more {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    font-weight: 400;
    color: var(--accent);
    border-bottom: 1px solid var(--accent);
    padding-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.featured-card .read-more:hover {
    opacity: 1;
    text-shadow: 0 0 8px var(--accent-glow);
}

/* --------------------------------------------------------
   5. Footer — frosted glass
   -------------------------------------------------------- */

.site-footer {
    background: var(--footer-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--footer-text);
    padding: 3rem 2rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-columns {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    align-items: start;
}

.footer-col h4 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    font-weight: 400;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
}

[data-theme="dark"] .footer-col h4 {
    color: #e0e0e0;
}

.footer-col ul {
    list-style: none;
    padding: 0;
}

.footer-col li {
    margin-bottom: 0.5rem;
}

.footer-col a {
    color: #ccc;
    font-size: 0.85rem;
    transition: color 0.2s, text-shadow 0.2s;
}

.footer-col a:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
    opacity: 1;
}

.footer-col p {
    color: #ccc;
    font-size: 0.85rem;
    line-height: 1.5;
}

.footer-tagline {
    font-family: 'Courier Prime', 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 0.25rem;
}

.footer-newsletter input[type="email"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-family: 'Courier Prime', 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.footer-newsletter input[type="email"]:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
}

.footer-newsletter input[type="email"]::placeholder {
    color: #777;
}

.footer-newsletter button {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    transition: background 0.2s, border-color 0.2s;
}

.footer-newsletter button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* --------------------------------------------------------
   6. Single Post / Page — glass cards
   -------------------------------------------------------- */

.content-area {
    max-width: 800px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.content-area article {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2.5rem;
    margin-bottom: 2rem;
    border-radius: 12px;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: 0 4px 24px var(--glass-shadow);
}

.content-area .entry-header h1 {
    font-family: Merriweather, Georgia, 'Times New Roman', serif;
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.content-area .entry-meta {
    font-size: 0.8rem;
    color: var(--text-faint);
    margin-bottom: 1.5rem;
}

.content-area .entry-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
}

.content-area .entry-content p {
    margin-bottom: 1.25rem;
}

.content-area .entry-content h2,
.content-area .entry-content h3,
.content-area .entry-content h4 {
    font-family: Merriweather, Georgia, 'Times New Roman', serif;
    color: var(--accent);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.content-area .entry-content a {
    border-bottom: 1px solid var(--accent);
}

.content-area .entry-content img {
    margin: 1.5rem 0;
    border-radius: 8px;
}

.content-area .entry-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-style: italic;
}

.content-area .entry-content pre,
.content-area .entry-content code {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text);
    border-radius: 4px;
}

.content-area .entry-content pre {
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.content-area .entry-content code {
    padding: 0.15rem 0.35rem;
}

/* Post navigation */

.post-navigation {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem;
}

.post-navigation a {
    font-weight: 700;
}

/* --------------------------------------------------------
   7. Archive
   -------------------------------------------------------- */

.archive-header {
    max-width: 800px;
    margin: 3rem auto 1rem;
    padding: 0 2rem;
}

.archive-header h1 {
    font-family: Merriweather, Georgia, 'Times New Roman', serif;
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1.4;
}

.archive-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* Pagination */

.pagination {
    max-width: 800px;
    margin: 0 auto 3rem;
    padding: 0 2rem;
    text-align: center;
}

.pagination .nav-links {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    font-family: 'Courier Prime', 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 4px;
    background: var(--surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: border-color 0.2s, background 0.2s;
}

.pagination .page-numbers:hover {
    border-color: var(--accent);
}

.pagination .page-numbers.current {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

/* --------------------------------------------------------
   8. Responsive
   -------------------------------------------------------- */

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .main-navigation ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        right: 0;
        background: var(--header-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        width: 250px;
        padding: 1rem;
        gap: 0;
        border-radius: 0 0 0 12px;
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .main-navigation.toggled ul {
        display: flex;
    }

    .main-navigation li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .main-navigation a {
        display: block;
        padding: 0.75rem 0;
    }

    .main-navigation .sub-menu {
        position: static;
        background: rgba(255, 255, 255, 0.03);
        border: none;
        min-width: auto;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .main-navigation .sub-menu a {
        color: var(--header-nav);
        padding-left: 1.5rem;
    }

    .main-navigation li:hover > .sub-menu {
        display: flex;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .btn-cta {
        font-size: 0.55rem;
        padding: 0.8rem 1.5rem;
    }

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

    .featured-card {
        flex-direction: column;
    }

    .featured-card .featured-thumb {
        flex: none;
        max-width: 100%;
    }

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

    .dark-mode-toggle {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
}

/* --------------------------------------------------------
   9. WordPress Admin Bar offset
   -------------------------------------------------------- */

.admin-bar .site-header {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}
