:root {
    --bg: #040810;
    --bg2: #080f18;
    --bg3: #0c1720;
    --accent: #00e5ff;
    --accent2: #ff3c5f;
    --accent3: #39ff14;
    --amber: #ffcc00;
    --text: #c8d8e2;
    --muted: #4a6070;
    --border: rgba(0, 229, 255, 0.12);
    --border2: rgba(0, 229, 255, 0.25);
    --mono: 'Share Tech Mono', monospace;
    --sans: 'Syne', sans-serif;
    --body: 'Inter', sans-serif;
    --glow: 0 0 30px rgba(0, 229, 255, 0.15);
    --glow2: 0 0 30px rgba(255, 60, 95, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

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

/* ── CURSOR ── */
#cursor {
    width: 16px;
    height: 16px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width .2s, height .2s, border-color .2s, background .2s;
    mix-blend-mode: screen;
}

#cursor.hovered {
    width: 36px;
    height: 36px;
    background: rgba(0, 229, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.6);
}

#cursor-dot {
    width: 3px;
    height: 3px;
    background: var(--accent);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px var(--accent);
}

/* ── NOISE OVERLAY ── */
#noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9997;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ── SCANLINES ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.04) 2px, rgba(0, 0, 0, 0.04) 4px);
    pointer-events: none;
    z-index: 9996;
}

/* ── CANVAS BG ── */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.35;
}

/* ── NAV ── */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 5vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(4, 8, 16, 0.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav-logo {
    font-family: var(--sans);
    font-weight: 800;
    font-size: 1rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-logo-bracket {
    color: var(--muted);
    font-size: 1.2em;
}

.nav-logo span {
    color: var(--accent2);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

nav a {
    font-family: var(--mono);
    color: var(--text);
    text-decoration: none;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    transition: color .2s;
    position: relative;
}

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

nav a:hover, nav a.active {
    color: var(--accent);
}

nav a:hover::after, nav a.active::after {
    width: 100%;
}

.nav-status {
    font-family: var(--mono);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.6rem;
    color: var(--accent3);
    letter-spacing: 0.15em;
    padding: 0.3rem 0.8rem;
    border: 1px solid rgba(57, 255, 20, 0.2);
    background: rgba(57, 255, 20, 0.05);
}

.nav-status-dot {
    width: 6px;
    height: 6px;
    background: var(--accent3);
    border-radius: 50%;
    animation: pulse-green 2s ease infinite;
}

@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(57, 255, 20, 0.4);
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 0 0 4px rgba(57, 255, 20, 0);
    }
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: none;
    padding: 4px;
}

.hamburger span {
    width: 22px;
    height: 1.5px;
    background: var(--muted);
    transition: all .3s;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    background: rgba(4, 8, 16, 0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 5vw;
    z-index: 999;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-menu a {
    font-family: var(--mono);
    color: var(--text);
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    transition: color .2s;
}

.mobile-menu a:hover {
    color: var(--accent);
}

.mobile-menu.open {
    display: flex;
}

/* ── BLOG HEADER ── */
.blog-header {
    position: relative;
    z-index: 1;
    padding: 8rem 8vw 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.eyebrow-line {
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent));
}

.eyebrow-text {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.35em;
    color: var(--accent);
    text-transform: uppercase;
}

.blog-main-title {
    font-family: var(--sans);
    font-size: clamp(2.5rem, 5vw, 4.2rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.blog-main-title span {
    color: var(--accent);
}

.blog-desc {
    font-size: 0.95rem;
    color: var(--muted);
    max-width: 650px;
    line-height: 1.8;
    margin-bottom: 3rem;
}

/* ── FILTER & SEARCH CONTROLS ── */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: rgba(8, 15, 24, 0.85);
    border: 1px solid var(--border);
    margin-bottom: 3rem;
    backdrop-filter: blur(8px);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 280px;
    background: rgba(4, 8, 16, 0.9);
    border: 1px solid var(--border2);
    padding: 0.6rem 1rem;
    transition: border-color .2s;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: var(--mono);
    font-size: 0.75rem;
    width: 100%;
    letter-spacing: 0.1em;
}

.search-box input::placeholder {
    color: var(--muted);
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all .2s;
    text-transform: uppercase;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    box-shadow: var(--glow);
}

/* ── FEATURED POST ── */
.featured-post {
    background: rgba(8, 15, 24, 0.92);
    border: 1px solid var(--border2);
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2.5rem;
    padding: 2.5rem;
    margin-bottom: 4rem;
    position: relative;
    overflow: hidden;
    transition: border-color .3s, transform .3s;
}

.featured-post:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--glow);
}

.featured-badge {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.25em;
    color: var(--accent3);
    background: rgba(57, 255, 20, 0.08);
    border: 1px solid rgba(57, 255, 20, 0.3);
    padding: 0.3rem 0.8rem;
    display: inline-block;
    margin-bottom: 1.25rem;
}

.featured-img-container {
    width: 100%;
    height: 100%;
    min-height: 280px;
    border: 1px solid var(--border);
    background: var(--bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.featured-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.featured-post:hover .featured-img-container img {
    transform: scale(1.03);
}

/* ── BLOG GRID ── */
.blog-grid {
    position: relative;
    z-index: 1;
    padding: 0 8vw 6rem;
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 2.5rem;
}

.blog-card {
    background: rgba(8, 15, 24, 0.9);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: all .3s;
}

.blog-card:hover {
    border-color: var(--border2);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 229, 255, 0.08);
}

.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    transform: scaleX(0);
    transition: transform .4s;
}

.blog-card:hover::before {
    transform: scaleX(1);
}

.blog-card-img {
    width: 100%;
    height: 200px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    overflow: hidden;
}

.blog-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
}

.blog-card:hover .blog-card-img img {
    transform: scale(1.05);
}

.blog-card-body {
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
}

.blog-meta .category {
    color: var(--accent);
    border: 1px solid var(--border);
    padding: 0.2rem 0.6rem;
    background: rgba(0, 229, 255, 0.04);
}

.blog-title {
    font-family: var(--sans);
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.35;
    margin-bottom: 1rem;
    transition: color .2s;
}

.blog-card:hover .blog-title {
    color: var(--accent);
}

.blog-excerpt {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.7;
    opacity: 0.8;
    margin-bottom: 1.5rem;
    flex: 1;
}

.blog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.read-btn {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.15em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: gap .2s;
}

.blog-card:hover .read-btn {
    gap: 0.7rem;
}

/* ── ARTICLE MODAL ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 16, 0.95);
    backdrop-filter: blur(12px);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 3vw;
    opacity: 0;
    transition: opacity .3s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg2);
    border: 1px solid var(--border2);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 3rem;
    box-shadow: 0 0 50px rgba(0, 229, 255, 0.1);
}

.modal-close {
    position: sticky;
    top: 0;
    float: right;
    background: var(--accent2);
    color: #fff;
    border: none;
    font-family: var(--mono);
    font-size: 0.7rem;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    letter-spacing: 0.15em;
    transition: background .2s;
    z-index: 10;
}

.modal-close:hover {
    background: #ff123d;
}

.article-body {
    line-height: 1.9;
    font-size: 0.95rem;
    color: var(--text);
    margin-top: 2rem;
}

.article-body h3 {
    font-family: var(--sans);
    color: #fff;
    margin: 2rem 0 1rem;
    font-size: 1.3rem;
    border-left: 3px solid var(--accent);
    padding-left: 0.8rem;
}

.article-body pre {
    font-family: var(--mono);
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 1rem;
    display: block;
    margin: 1.5rem 0;
    color: var(--accent3);
    font-size: 0.8rem;
    overflow-x: auto;
}

.article-body code {
    font-family: var(--mono);
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 0.2rem 0.4rem;
    display: inline;
    color: var(--accent3);
    font-size: 0.85em;
    border-radius: 3px;
}

.article-body pre code {
    display: block;
    padding: 0;
    background: transparent;
    border: none;
    font-size: inherit;
    border-radius: 0;
    color: inherit;
    margin: 0;
    overflow-x: visible;
}

.modal-cover-container {
    width: 100%;
    height: 320px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 2rem;
    background: var(--bg);
}

/* ── FOOTER ── */
footer {
    position: relative;
    z-index: 1;
    padding: 3rem 8vw;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 0.15em;
    background: var(--bg2);
}

/* ── RESPONSIVE ── */
@media (max-width: 960px) {
    #cursor, #cursor-dot {
        display: none !important;
    }
    body {
        cursor: auto !important;
    }
    .blog-header {
        padding: 6rem 5vw 2rem;
    }
    .featured-post {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2rem;
    }
    .featured-img-container {
        min-height: 220px;
        height: 220px;
    }
    nav ul {
        display: none;
    }
    .hamburger {
        display: flex;
    }
    .blog-grid {
        grid-template-columns: 1fr;
        padding: 0 5vw 4rem;
        gap: 2.5rem;
    }
    .modal-content {
        padding: 1.75rem;
        max-height: 95vh;
    }
    .controls-bar {
        padding: 1.25rem;
        margin-bottom: 2.5rem;
    }
}

@media (max-width: 640px) {
    .blog-header {
        padding: 5.5rem 5vw 1.5rem;
    }
    .blog-main-title {
        font-size: 2.2rem;
    }
    .blog-desc {
        font-size: 0.88rem;
        line-height: 1.65;
        margin-bottom: 2rem;
    }
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }
    .search-box {
        width: 100%;
        min-width: 100%;
    }
    .filter-tags {
        justify-content: flex-start;
        gap: 0.4rem;
    }
    .filter-btn {
        font-size: 0.6rem;
        padding: 0.4rem 0.8rem;
        flex-grow: 1;
        text-align: center;
    }
    .featured-post {
        padding: 1.25rem;
        margin-bottom: 2.5rem;
        border-color: var(--border);
    }
    .featured-badge {
        font-size: 0.55rem;
        padding: 0.2rem 0.6rem;
        margin-bottom: 0.75rem;
    }
    .featured-post .blog-title {
        font-size: 1.3rem !important;
        margin: 0.75rem 0 !important;
    }
    .featured-post .blog-excerpt {
        font-size: 0.85rem !important;
        margin-bottom: 1.25rem !important;
    }
    .featured-img-container {
        height: 180px;
        min-height: 180px;
    }
    
    /* Modal Mobile Refinements */
    .modal-overlay {
        align-items: flex-start;
        padding: 0;
    }
    .modal-content {
        max-height: 100vh;
        height: 100%;
        max-width: 100vw;
        padding: 1.25rem;
        margin: 0;
        border: none;
        display: flex;
        flex-direction: column;
        box-shadow: none;
    }
    #modal-body {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 3rem;
        margin-top: 0.5rem;
    }
    .modal-close {
        align-self: flex-end;
        margin-bottom: 0.5rem;
        position: relative;
        top: auto;
        right: auto;
        float: none;
        width: auto;
        font-size: 0.65rem;
        padding: 0.4rem 1rem;
    }
    .esc-hint {
        display: none !important;
    }
    .modal-cover-container {
        height: 180px;
        margin-bottom: 1.25rem;
    }
    .article-body {
        font-size: 0.88rem;
        line-height: 1.7;
        margin-top: 1.5rem;
    }
    .article-body h3 {
        font-size: 1.15rem;
        margin: 1.5rem 0 0.75rem;
    }
    .article-body pre {
        padding: 0.75rem;
        margin: 1.25rem 0;
        font-size: 0.75rem;
        border-radius: 4px;
    }
    .article-body code {
        font-size: 0.8em;
        padding: 0.1rem 0.3rem;
    }
    
    footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 2rem 5vw;
        font-size: 0.6rem;
    }
}
