/*
Theme Name: Smartteller Blog
Theme URI: https://yourdomain.com
Author: Your Name
Author URI: https://yourdomain.com
Description: A custom engineering blog theme with terminal aesthetics, featured grids, skeleton loaders, and dark mode.
Version: 1.1.0
License: GPL v2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kernel
Tags: blog, engineering, responsive, custom-menu, featured-images, dark-mode
*/

:root {
    --primary: #086AD8;
    --primary-dark: #0552A8;
    --primary-tint: #EAF2FD;
    --ink: #212529;
    --ink-soft: #4B5561;
    --mute: #8A94A6;
    --line: #E7EAEF;
    --white: #FFFFFF;
    --bg: #F7F9FC;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(33, 37, 41, .06);
    --shadow-md: 0 8px 24px rgba(33, 37, 41, .08);
    --shadow-lg: 0 24px 60px rgba(8, 106, 216, .16);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--ink);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
.display-font {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

a {
    text-decoration: none;
    color: inherit;
}

::selection {
    background: var(--primary);
    color: #fff;
}

/* ---------- utility ---------- */
.container-xl {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

.eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.eyebrow::before {
    content: '';
    width: 16px;
    height: 1px;
    background: var(--primary);
    display: inline-block;
}

.btn-primary-kernel {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 9px;
    font-weight: 600;
    font-size: 14.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
    box-shadow: 0 4px 14px rgba(8, 106, 216, .28);
}

.btn-primary-kernel:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(8, 106, 216, .34);
    color: #fff;
}

.btn-ghost-kernel {
    background: transparent;
    border: 1.5px solid var(--line);
    color: var(--ink);
    padding: 11px 22px;
    border-radius: 9px;
    font-weight: 600;
    font-size: 14.5px;
    transition: border-color .18s ease, background .18s ease;
}

.btn-ghost-kernel:hover {
    border-color: var(--primary);
    background: var(--primary-tint);
    color: var(--primary);
}

/* ---------- nav ---------- */
.navbar-kernel {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.navbar-kernel .container-xl {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 20px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), #0AA5E0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(8, 106, 216, .35);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 34px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-soft);
    position: relative;
    padding: 6px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width .2s ease;
}

.nav-links a:hover {
    color: var(--ink);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    width: 220px;
    font-size: 13.5px;
    color: var(--mute);
}

.nav-search i {
    font-size: 13px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    background: #fff;
    transition: all .18s ease;
    font-size: 14px;
}

.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ---------- hero ---------- */
.hero {
    position: relative;
    padding: 96px 0 90px;
    background: var(--white);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(33, 37, 41, .07) 1px, transparent 0);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(ellipse 60% 55% at 30% 20%, black, transparent);
    mask-image: radial-gradient(ellipse 60% 55% at 30% 20%, black, transparent);
    pointer-events: none;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 56px;
    align-items: center;
    position: relative;
}

.hero h1 {
    font-size: 52px;
    line-height: 1.06;
    font-weight: 700;
    margin: 18px 0 22px;
}

.hero h1 .hl {
    color: var(--primary);
}

.hero p.lead-kernel {
    font-size: 17px;
    color: var(--ink-soft);
    line-height: 1.65;
    max-width: 480px;
    margin-bottom: 32px;
}

.hero-cta {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 38px;
}

.hero-meta {
    display: flex;
    gap: 28px;
}

.hero-meta div {
    display: flex;
    flex-direction: column;
}

.hero-meta strong {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    color: var(--ink);
}

.hero-meta span {
    font-size: 12.5px;
    color: var(--mute);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* terminal signature card */
.terminal-card {
    background: var(--ink);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: rotate(1.2deg);
    border: 1px solid #32383e;
}

.terminal-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    background: #181b1e;
    border-bottom: 1px solid #32383e;
}

.terminal-topbar span {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
}

.terminal-topbar .r {
    background: #FF5F57;
}

.terminal-topbar .y {
    background: #FEBC2E;
}

.terminal-topbar .g {
    background: #28C840;
}

.terminal-topbar .file {
    margin-left: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #8A94A6;
}

.terminal-body {
    padding: 24px 22px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.9;
    color: #C9D1D9;
}

.terminal-body .ln {
    color: #586069;
    display: inline-block;
    width: 22px;
    user-select: none;
}

.t-key {
    color: #0AA5E0;
}

.t-str {
    color: #79D97F;
}

.t-com {
    color: #6B7280;
}

.t-fn {
    color: #E3B341;
}

.cursor {
    display: inline-block;
    width: 7px;
    height: 15px;
    background: var(--primary);
    vertical-align: middle;
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* ---------- section heads ---------- */
.section {
    padding: 84px 0;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 36px;
}

.section-head h2 {
    font-size: 32px;
    margin: 10px 0 0;
}

.view-all {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-all i {
    font-size: 12px;
    transition: transform .18s ease;
}

.view-all:hover i {
    transform: translateX(4px);
}

/* ---------- featured grid ---------- */
.featured-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
}

.feat-main {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    height: 440px;
    box-shadow: var(--shadow-md);
}

.feat-side {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.feat-side .feat-card {
    height: 208px;
}

.feat-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.feat-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}

.feat-card:hover .feat-img,
.feat-main:hover .feat-img {
    transform: scale(1.05);
}

.feat-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(33, 37, 41, 0) 35%, rgba(15, 17, 20, .88) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 26px;
}

.feat-main .feat-overlay {
    padding: 34px;
}

.cat-pill {
    align-self: flex-start;
    background: var(--primary);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 100px;
    margin-bottom: 12px;
    letter-spacing: .02em;
}

.feat-overlay h3 {
    color: #fff;
    font-size: 23px;
    margin: 0 0 10px;
    line-height: 1.25;
}

.feat-main .feat-overlay h3 {
    font-size: 29px;
}

.feat-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12.5px;
    color: #C9CED6;
}

.feat-meta img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, .5);
}

/* ---------- latest / skeleton ---------- */
.latest-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
}

.article-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}

.article-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.article-thumb {
    height: 180px;
    width: 100%;
    object-fit: cover;
    display: block;
}

.article-body {
    padding: 20px;
}

.article-cat {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 10px;
    display: block;
}

.article-body h3 {
    font-size: 17.5px;
    line-height: 1.35;
    margin-bottom: 10px;
}

.article-excerpt {
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.6;
    margin-bottom: 16px;
}

.article-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    color: var(--mute);
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.article-foot .author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-foot img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

/* skeleton shimmer */
.skeleton {
    background: #eef1f5;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.sk-thumb {
    height: 180px;
    width: 100%;
}

.sk-line {
    height: 12px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.sk-line.w-80 {
    width: 80%;
}

.sk-line.w-60 {
    width: 60%;
}

.sk-line.w-40 {
    width: 40%;
}

.sk-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

/* ---------- trending + categories split ---------- */
.split-section {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 60px;
}

.trend-row {
    display: flex;
    gap: 18px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.trend-row:first-child {
    padding-top: 0;
}

.trend-num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--line);
    width: 38px;
    flex-shrink: 0;
}

.trend-row:hover .trend-num {
    color: var(--primary);
}

.trend-thumb {
    width: 76px;
    height: 76px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.trend-info span {
    font-size: 11.5px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
}

.trend-info h4 {
    font-size: 15.5px;
    margin: 5px 0 6px;
    line-height: 1.35;
}

.trend-info .meta {
    font-size: 12px;
    color: var(--mute);
}

.cat-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-radius: 11px;
    border: 1px solid var(--line);
    transition: all .18s ease;
}

.cat-item:hover {
    border-color: var(--primary);
    background: var(--primary-tint);
}

.cat-item .left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cat-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--primary-tint);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.cat-item:hover .cat-icon {
    background: var(--primary);
    color: #fff;
}

.cat-item h5 {
    font-size: 14.5px;
    margin: 0;
}

.cat-item .count {
    font-size: 12px;
    color: var(--mute);
}

/* ---------- newsletter ---------- */
.newsletter {
    background: var(--ink);
    border-radius: 22px;
    padding: 64px 60px;
    position: relative;
    overflow: hidden;
    color: #fff;
}

.newsletter::before {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(8, 106, 216, .35), transparent 70%);
    top: -160px;
    right: -120px;
}

.newsletter h2 {
    color: #fff;
    font-size: 30px;
    max-width: 600px;
}

.newsletter p {
    color: #B6BCC4;
    max-width: 700px;
    margin: 14px 0 28px;
    font-size: 15px;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 700px;
    position: relative;
}

.newsletter-form input,
.newsletter-form button {
    width: 100%;
}

/* Side-by-side on slightly larger screens */
@media (min-width: 480px) {
    .newsletter-form {
        flex-direction: row;
    }

    .newsletter-form input {
        flex: 1;
        width: auto;
    }

    .newsletter-form button {
        width: auto;
    }
}

.newsletter-form input {
    flex: 1;
    border-radius: 9px;
    border: 1px solid #3A4046;
    background: #2A2F34;
    color: #fff;
    padding: 13px 16px;
    font-size: 14px;
}

.newsletter-form input::placeholder {
    color: #8A94A6;
}

.newsletter-form input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ---------- footer ---------- */
footer {
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 64px 0 28px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 48px;
}

.footer-col h6 {
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mute);
    margin-bottom: 18px;
    font-weight: 700;
}

.footer-col a {
    display: block;
    font-size: 14px;
    color: var(--ink-soft);
    margin-bottom: 12px;
    transition: color .15s ease;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 28px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--mute);
}

.social-row {
    display: flex;
    gap: 10px;
}

/* back to top */
.back-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(8, 106, 216, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 999;
    border: none;
}

.back-top.show {
    opacity: 1;
    pointer-events: auto;
}

.back-top:hover {
    transform: translateY(-3px);
}

@media (max-width:991px) {

    .nav-links,
    .nav-search {
        display: none;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .featured-grid {
        grid-template-columns: 1fr;
    }

    .split-section {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .latest-grid {
        grid-template-columns: 1fr 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .newsletter {
        padding: 44px 28px;
    }

    .hero h1 {
        font-size: 38px;
    }
}

@media (max-width:576px) {
    .latest-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

/* ============================================================
   SEARCH BOX FIX — Form element styling
   ============================================================ */

.nav-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    width: 220px;
    font-size: 13.5px;
    color: var(--mute);
    transition: border-color 0.18s ease, background 0.18s ease;
}

.nav-search:hover,
.nav-search:focus-within {
    border-color: var(--primary);
    background: var(--white);
}

html.dark-mode .nav-search:hover,
html.dark-mode .nav-search:focus-within {
    background: var(--card-bg);
}

.nav-search i {
    font-size: 13px;
    flex-shrink: 0;
    color: var(--mute);
}

.nav-search input[type="search"] {
    border: none;
    background: transparent;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    color: var(--ink);
    width: 100%;
    padding: 0;
    margin: 0;
    -webkit-appearance: none;
}

.nav-search input[type="search"]::-webkit-search-decoration,
.nav-search input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

.nav-search input[type="search"]::placeholder {
    color: var(--mute);
}

/* ============================================================
   DARK MODE — Complete Theme Override
   ============================================================ */

/* Default (light) theme variables */
:root {
    --primary: #086AD8;
    --primary-dark: #0552A8;
    --primary-tint: #EAF2FD;
    --ink: #212529;
    --ink-soft: #4B5561;
    --mute: #8A94A6;
    --line: #E7EAEF;
    --white: #FFFFFF;
    --bg: #F7F9FC;
    --card-bg: #FFFFFF;
    --hero-bg: #FFFFFF;
    --terminal-bg: #212529;
    --terminal-topbar: #181b1e;
    --terminal-border: #32383e;
    --terminal-text: #C9D1D9;
    --terminal-ln: #586069;
    --terminal-cursor: #086AD8;
    --shadow-sm: 0 1px 2px rgba(33, 37, 41, .06);
    --shadow-md: 0 8px 24px rgba(33, 37, 41, .08);
    --shadow-lg: 0 24px 60px rgba(8, 106, 216, .16);
    --radius: 14px;
}

/* Dark theme variables — applied via class on <html> */
html.dark-mode {
    --primary: #3B9DFF;
    --primary-dark: #1A7AE8;
    --primary-tint: #1A2332;
    --ink: #E8ECF1;
    --ink-soft: #A0AAB8;
    --mute: #6B7685;
    --line: #2A3038;
    --white: #0D1117;
    --bg: #0D1117;
    --card-bg: #161B22;
    --hero-bg: #0D1117;
    --terminal-bg: #0D1117;
    --terminal-topbar: #161B22;
    --terminal-border: #30363D;
    --terminal-text: #C9D1D9;
    --terminal-ln: #484F58;
    --terminal-cursor: #3B9DFF;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px rgba(8, 106, 216, .2);
}

/* Smooth transition between themes */
html,
body,
.navbar-kernel,
.article-card,
.newsletter,
.cat-item,
.trend-row,
.icon-btn,
.btn-ghost-kernel,
.terminal-card,
.terminal-topbar {
    transition: background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* Dark mode specific overrides */
html.dark-mode body {
    background: var(--bg);
    color: var(--ink);
}

html.dark-mode .navbar-kernel {
    background: rgba(13, 17, 23, 0.85);
    border-bottom-color: var(--line);
}

html.dark-mode .article-card {
    background: var(--card-bg);
    border-color: var(--line);
}

html.dark-mode .newsletter {
    background: var(--card-bg);
}

html.dark-mode .newsletter::before {
    background: radial-gradient(circle, rgba(59, 157, 255, .25), transparent 70%);
}

html.dark-mode .newsletter-form input {
    background: #0D1117;
    border-color: var(--line);
    color: var(--ink);
}

html.dark-mode .cat-item:hover {
    background: var(--primary-tint);
}

html.dark-mode .trend-row {
    border-bottom-color: var(--line);
}

html.dark-mode .icon-btn {
    background: var(--card-bg);
    border-color: var(--line);
    color: var(--ink-soft);
}

html.dark-mode .btn-ghost-kernel {
    border-color: var(--line);
    color: var(--ink);
}

html.dark-mode .btn-ghost-kernel:hover {
    border-color: var(--primary);
    background: var(--primary-tint);
}

html.dark-mode .terminal-card {
    background: var(--terminal-bg);
    border-color: var(--terminal-border);
}

html.dark-mode .terminal-topbar {
    background: var(--terminal-topbar);
    border-bottom-color: var(--terminal-border);
}

html.dark-mode .terminal-body {
    color: var(--terminal-text);
}

html.dark-mode .terminal-body .ln {
    color: var(--terminal-ln);
}

html.dark-mode .cursor {
    background: var(--terminal-cursor);
}

html.dark-mode .hero::before {
    background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .04) 1px, transparent 0);
}

html.dark-mode footer {
    background: var(--bg);
    border-top-color: var(--line);
}

html.dark-mode .footer-bottom {
    border-top-color: var(--line);
}

html.dark-mode .nav-search {
    background: var(--card-bg);
    border-color: var(--line);
    color: var(--mute);
}

html.dark-mode .nav-search input {
    background: transparent;
    color: var(--ink);
}

html.dark-mode .nav-search input::placeholder {
    color: var(--mute);
}

/* Prevent flash on load — check localStorage before paint */
html.loading-theme {
    visibility: hidden;
}

/* ============================================================
   MOBILE NAVIGATION — Hamburger + Drawer
   ============================================================ */

.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 85vw);
    height: 100vh;
    background: var(--white);
    border-left: 1px solid var(--line);
    z-index: 1002;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-drawer.active {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.mobile-menu-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--ink);
    cursor: pointer;
}

.mobile-drawer-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mobile-nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-nav-links a {
    display: block;
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-soft);
    transition: background 0.15s ease, color 0.15s ease;
}

.mobile-nav-links a:hover {
    background: var(--primary-tint);
    color: var(--primary);
}

.mobile-drawer-search form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 14px;
}

.mobile-drawer-search input {
    border: none;
    background: transparent;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--ink);
    width: 100%;
}

.mobile-drawer-search input::placeholder {
    color: var(--mute);
}

.mobile-drawer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.mobile-drawer-actions .btn-primary-kernel {
    flex: 1;
    justify-content: center;
}

/* Dark mode drawer overrides */
html.dark-mode .mobile-menu-toggle,
html.dark-mode .mobile-menu-close {
    background: var(--card-bg);
    border-color: var(--line);
    color: var(--ink);
}

html.dark-mode .mobile-drawer {
    background: var(--card-bg);
    border-left-color: var(--line);
}

html.dark-mode .mobile-drawer-header {
    border-bottom-color: var(--line);
}

.brand-logo {
    position: relative;
}

.brand-logo img {
    width: 200px;
    height: auto;
}

.logo-dark {
    display: none;
}

html.dark-mode .logo-light {
    display: none;
}

html.dark-mode .logo-dark {
    display: block;
}

/* Mobile breakpoint: hide desktop nav, show hamburger */
@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .nav-links,
    .nav-search,
    .nav-actions {
        display: none !important;
    }

    .navbar-kernel .container-xl {
        height: 64px;
    }
}

@media (max-width: 576px) {
    .navbar-kernel .container-xl {
        padding: 0 16px;
    }
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    z-index: 100000;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* If --mute is too light for small text */
.article-foot,
.trend-info .meta {
    color: #6B7685;
    /* slightly darker */
}

/* Featured post image */
.featured-img {
    margin-bottom: 40px;
    border-radius: var(--radius);
    overflow: hidden;
    text-align: center;
}

.featured-img img {
    width: 100%;
    height: auto;
    display: block;
    /* margin: 0 auto; */
}

@media (min-width: 768px) {
    .featured-img img {
        width: 50%;
        max-width: 800px;
    }
}

/* POST background */
.article-thumb--fallback {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 18px;
    overflow: hidden;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;

    padding: 1.5rem;

    color: white;

    background:
        radial-gradient(circle at top right,
            rgba(255, 255, 255, .15),
            transparent 40%),
        linear-gradient(135deg,
            #0F172A,
            #1E40AF,
            #0EA5E9);
}

.article-thumb--fallback::before {
    content: "";
    position: absolute;
    inset: 0;

    background:
        linear-gradient(transparent,
            rgba(0, 0, 0, .45));
}

.article-thumb__category,
.article-thumb__title {
    position: relative;
    z-index: 1;
}

.article-thumb__category {
    align-self: flex-start;

    padding: .5rem;
    border-radius: 10%;

    background: rgba(250, 243, 243, 0.78);
    backdrop-filter: blur(8px);

    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.article-thumb__title {
    margin-top: .8rem;
    font-size: 1.5rem;
    color: white;

    font-weight: 700;
    line-height: 1.25;

    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Varying Backgrounds */
.theme-0 {
    background: linear-gradient(135deg, #0F172A, #2563EB);
}

.theme-1 {
    background: linear-gradient(135deg, #14532D, #16A34A);
}

.theme-2 {
    background: linear-gradient(135deg, #312E81, #7C3AED);
}

.theme-3 {
    background: linear-gradient(135deg, #7C2D12, #EA580C);
}

.theme-4 {
    background: linear-gradient(135deg, #1E293B, #0891B2);
}

.article-thumb--fallback::after {
    content: "";
    position: absolute;
    inset: 0;

    opacity: .08;

    background-image:
        radial-gradient(circle, #fff 1px, transparent 1px);

    background-size: 24px 24px;
}

/* Trending */
.trend-thumb--fallback {
    aspect-ratio: 1;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.trend-thumb__logo {
    width: 34px;
    height: auto;
    z-index: 2;
}

.trend-thumb--fallback::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right,
            rgba(255, 255, 255, .12),
            transparent 40%);
}

/* Featured Post */
.feat-img--fallback {
    position: relative;
    /* aspect-ratio: 16 / 9; */

    display: flex;
    align-items: flex-end;

    overflow: hidden;
    border-radius: 22px;

    padding: 3rem;

    color: #fff;
}


/* Decorative pattern */
.feat-pattern {
    position: absolute;
    inset: 0;

    opacity: .30;

    background:
        rgb(0, 110, 255) radial-gradient(circle, rgba(255, 255, 255, .15) 3px, transparent 0);

    background-size: 28px 28px;

    z-index: 0;
}

/* Logo */
.feat-logo {
    position: absolute;
    top: 3rem;
    right: 3rem;

    width: 120px !important;
    height: auto;

    opacity: .95;

    z-index: 2;
}