/* ─── Blog Frontend Styles ────────────────────────────────────────────────── */
/* Extends landing.css design system — uses same variables and aesthetic       */

/* ─── Blog Variables ─────────────────────────────────────────────────────── */
:root {
    --blog-card: rgba(8, 24, 41, .55);
    --blog-card-hover: rgba(11, 29, 47, .7);
    --blog-border: rgba(154, 184, 220, .12);
    --blog-border-hover: rgba(97, 169, 255, .35);
    --blog-radius: 16px;
    --blog-radius-sm: 10px;
    --blog-radius-pill: 999px;
}

/* ─── Utility ────────────────────────────────────────────────────────────── */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

.blog-page .container {
    width: min(1220px, calc(100% - 48px));
    margin-inline: auto;
}

.blog-container { padding-bottom: 80px; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }

/* ─── Blog Hero ──────────────────────────────────────────────────────────── */
.blog-hero {
    position: relative;
    padding: 120px 0 40px;
    text-align: center;
    overflow: hidden;
}

.blog-hero::before {
    position: absolute; inset: 0;
    content: ""; pointer-events: none;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(25, 118, 243, .12), transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(32, 215, 244, .06), transparent 50%);
}

.blog-hero h1 {
    position: relative;
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1.1;
    margin: 0 0 8px;
    background: linear-gradient(135deg, #fff 30%, var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.blog-hero .muted {
    position: relative;
    color: var(--muted);
}

/* ─── Blog Filters (Categories + Search) ─────────────────────────────────── */
.blog-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 32px;
    padding: 16px 20px;
    background: var(--blog-card);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    backdrop-filter: blur(8px);
}

.blog-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.blog-category-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 16px;
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius-pill);
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: .01em;
    transition: all .2s ease;
}

.blog-category-link:hover {
    border-color: var(--blog-border-hover);
    color: var(--text);
    background: rgba(25, 118, 243, .06);
}

.blog-category-link.is-active {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
    box-shadow: 0 4px 16px rgba(25, 118, 243, .25);
}

.blog-category-link:focus-visible,
.blog-pagination a:focus-visible {
    outline: 2px solid rgba(97, 169, 255, .9);
    outline-offset: 2px;
}

.blog-filters .blog-search {
    flex: 0 1 380px;
    min-width: 260px;
}

/* ─── Result Count ───────────────────────────────────────────────────────── */
.blog-result-count {
    margin: -12px 0 20px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

/* ─── Blog Card Grid ─────────────────────────────────────────────────────── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    padding-bottom: 20px;
}

.blog-card {
    position: relative;
    background: var(--blog-card);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    overflow: hidden;
    transition: transform .28s ease, border-color .28s ease, box-shadow .28s ease;
}

.blog-card:hover {
    border-color: var(--blog-border-hover);
    transform: translateY(-4px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3), 0 0 0 1px rgba(25, 118, 243, .05);
}

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

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

.blog-card-img-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(154, 184, 220, .25);
    font-size: 48px;
}

.blog-card-body {
    padding: 20px 22px 22px;
}

.blog-card-category {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    background: rgba(25, 118, 243, .1);
    color: var(--blue-light);
    margin-bottom: 10px;
    text-decoration: none;
    transition: background .2s;
}

.blog-card-category:hover {
    background: rgba(25, 118, 243, .2);
    color: var(--cyan);
}

.blog-card-title {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 8px;
    letter-spacing: -.01em;
}

.blog-card-title a {
    color: var(--text);
    text-decoration: none;
    transition: color .2s;
}

.blog-card-title a:hover {
    color: var(--blue-light);
}

.blog-card-excerpt {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--blog-border);
    font-size: 12px;
    color: var(--muted);
}

.blog-read-more {
    color: var(--blue-light);
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: color .2s;
}

.blog-read-more:hover { color: var(--cyan); }

/* ─── Empty State ────────────────────────────────────────────────────────── */
.blog-empty {
    text-align: center;
    padding: 80px 20px 100px;
    color: var(--muted);
}

.blog-empty i {
    opacity: .4;
}

.blog-empty p {
    font-size: 16px;
    margin-top: 8px;
}

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.blog-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 40px 0 20px;
}

.blog-pagination a,
.blog-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px; height: 40px;
    padding: 0 12px;
    border-radius: var(--blog-radius-sm);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: all .2s ease;
}

.blog-pagination a {
    background: var(--blog-card);
    border: 1px solid var(--blog-border);
    color: var(--muted);
}

.blog-pagination a:hover {
    border-color: var(--blog-border-hover);
    color: var(--text);
    background: rgba(25, 118, 243, .08);
}

.blog-pagination .is-current {
    background: var(--blue);
    border: 1px solid var(--blue);
    color: #fff;
    box-shadow: 0 4px 16px rgba(25, 118, 243, .25);
}

.blog-pagination .ellipsis {
    min-width: 24px;
    padding: 0 4px;
    color: var(--muted);
}

/* ─── Search Form ────────────────────────────────────────────────────────── */
.blog-search {
    position: relative;
    display: flex;
    width: 100%;
    min-width: 0;
}

.blog-search-field {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius-sm);
    overflow: hidden;
    background: rgba(3, 9, 20, .5);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.blog-search-field:focus-within {
    border-color: rgba(97, 169, 255, .4);
    box-shadow: 0 0 0 3px rgba(25, 118, 243, .1);
}

.blog-search-input {
    min-width: 0; flex: 1;
    border: 0; outline: 0;
    padding: 9px 13px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
}

.blog-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.blog-search-input::-ms-clear { display: none; width: 0; height: 0; }
.blog-search-input::placeholder { color: var(--muted); }

.blog-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    border: 0;
    color: var(--muted);
    text-decoration: none;
    background: transparent;
    cursor: pointer;
    transition: color .2s;
}

.blog-search-clear[hidden] { display: none; }
.blog-search-clear:hover { color: var(--text); }

.blog-search-button {
    border: 0;
    border-left: 1px solid var(--blog-border);
    padding: 0 14px;
    background: rgba(25, 118, 243, .08);
    color: var(--blue-light);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
}

.blog-search-button:hover {
    background: var(--blue);
    color: #fff;
}

.blog-search-input:focus-visible,
.blog-search-button:focus-visible,
.blog-search-clear:focus-visible {
    outline: 2px solid rgba(97, 169, 255, .9);
    outline-offset: 2px;
}

.blog-search-spinner {
    display: inline-block;
    width: 13px; height: 13px;
    margin-left: 7px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -2px;
    animation: blog-search-spin .65s linear infinite;
}

.blog-search-spinner[hidden] { display: none; }

@keyframes blog-search-spin {
    to { transform: rotate(360deg); }
}

/* ─── Search Suggestions Dropdown ────────────────────────────────────────── */
.blog-search-suggestions {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0; right: 0;
    overflow: hidden;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(5, 16, 29, .98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .5);
    backdrop-filter: blur(12px);
}

.blog-search-suggestions[hidden] { display: none; }

.blog-search-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 11px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    transition: background .15s;
}

.blog-search-suggestion:hover,
.blog-search-suggestion.is-active {
    background: rgba(25, 118, 243, .12);
    color: #fff;
}

.blog-search-suggestion-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
}

.blog-search-suggestion-category {
    flex: 0 0 auto;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(25, 118, 243, .1);
    color: var(--blue-light);
    font-size: 11px;
    font-weight: 700;
}

/* ─── Article Hero ───────────────────────────────────────────────────────── */
.article-hero {
    position: relative;
    padding: 120px 0 20px;
    overflow: hidden;
}

.article-hero::before {
    position: absolute; inset: 0;
    content: ""; pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(25, 118, 243, .1), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(32, 215, 244, .05), transparent 40%);
}

.article-container {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px 40px;
}

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 20px;
    transition: color .2s;
}

.article-back:hover { color: var(--blue-light); }

.article-category {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    background: rgba(25, 118, 243, .1);
    color: var(--blue-light);
    margin-bottom: 14px;
}

.article-title {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: -1.5px;
    margin-bottom: 16px;
}

.article-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 24px;
}

.article-meta i { margin-right: 4px; }

/* ─── Article Layout (Content + Sidebar) ─────────────────────────────────── */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

.article-cover {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--blog-radius);
    margin-bottom: 32px;
    border: 1px solid var(--blog-border);
}

/* ─── Article Content Typography ─────────────────────────────────────────── */
.article-content {
    font-size: 16px;
    line-height: 1.85;
    color: var(--text);
}

.article-content h2 {
    font-size: 24px;
    font-weight: 800;
    margin: 40px 0 16px;
    letter-spacing: -.02em;
}

.article-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 32px 0 12px;
}

.article-content p { margin-bottom: 20px; }

.article-content a { color: var(--blue-light); transition: color .2s; }
.article-content a:hover { color: var(--cyan); }

.article-content blockquote {
    border-left: 3px solid var(--blue);
    padding: 14px 20px;
    margin: 24px 0;
    background: var(--blog-card);
    border-radius: 0 var(--blog-radius-sm) var(--blog-radius-sm) 0;
    color: var(--muted);
}

.article-content pre {
    background: rgba(3, 9, 20, .6);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius-sm);
    padding: 16px 20px;
    overflow-x: auto;
    margin: 24px 0;
}

.article-content code {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 14px;
}

.article-content p code {
    background: rgba(25, 118, 243, .08);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.article-content img {
    max-width: 100%;
    border-radius: var(--blog-radius-sm);
    margin: 16px 0;
}

.article-content ul,
.article-content ol {
    padding-left: 24px;
    margin-bottom: 20px;
}

.article-content li { margin-bottom: 8px; }

/* ─── Article Language Links ─────────────────────────────────────────────── */
.article-langs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--blog-border);
}

.article-langs span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.article-langs a {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--blog-border);
    text-decoration: none;
    transition: all .2s;
}

.article-langs a:hover {
    color: var(--text);
    border-color: var(--blog-border-hover);
}

.article-langs a.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.article-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 16px);
    align-self: start;
}

.sidebar-widget {
    background: var(--blog-card);
    border: 1px solid var(--blog-border);
    border-radius: var(--blog-radius);
    padding: 20px;
    margin-bottom: 16px;
}

.sidebar-widget:last-child { margin-bottom: 0; }

.sidebar-widget-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .01em;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--blog-border);
}

/* ─── Sidebar Search ────────────────────────────────────────────────────── */
.sidebar-search-widget .blog-search-field {
    background: rgba(3, 9, 20, .4);
}

/* ─── Sidebar Post Items ─────────────────────────────────────────────────── */
.sidebar-post-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    text-decoration: none;
    color: var(--text);
    transition: color .2s;
}

.sidebar-post-item:hover { color: var(--blue-light); }

.sidebar-post-item + .sidebar-post-item {
    border-top: 1px solid var(--blog-border);
}

.sidebar-post-thumb {
    width: 56px; height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-post-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.sidebar-post-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-post-date {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
}

/* ─── Sidebar Category List ──────────────────────────────────────────────── */
.sidebar-category-list {
    list-style: none;
    padding: 0; margin: 0;
}

.sidebar-category-list li { padding: 7px 0; }

.sidebar-category-list li + li {
    border-top: 1px solid var(--blog-border);
}

.sidebar-category-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    transition: color .2s;
}

.sidebar-category-list a:hover { color: var(--blue-light); }

.sidebar-category-count {
    font-size: 11px;
    color: var(--muted);
    background: rgba(25, 118, 243, .08);
    padding: 2px 8px;
    border-radius: var(--blog-radius-pill);
    font-weight: 700;
}

/* ─── 404 Not Found ──────────────────────────────────────────────────────── */
.blog-not-found .glass-card,
.blog-page .glass-card {
    background: var(--blog-card);
    border: 1px solid var(--blog-border);
    border-radius: 20px;
    backdrop-filter: blur(8px);
}

.btn-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    border-radius: var(--blog-radius-sm);
    background: var(--blue);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transition: all .2s;
}

.btn-main:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(25, 118, 243, .3);
}

.muted { color: var(--muted); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .article-layout {
        grid-template-columns: 1fr;
        padding: 0 16px 60px;
    }

    .article-sidebar { position: static; }
}

@media (max-width: 991px) {
    .blog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .blog-filters {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 12px;
    }

    .blog-filters .blog-search {
        flex-basis: auto;
        width: 100%;
        min-width: 0;
    }

    .blog-categories { width: 100%; }
}

@media (max-width: 576px) {
    .blog-hero { padding: 100px 0 30px; }

    .blog-page .container {
        width: calc(100% - 32px);
    }

    .blog-filters {
        padding: 12px 14px;
        border-radius: 12px;
    }

    .blog-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .blog-categories {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 2px 2px 6px;
        scrollbar-width: thin;
    }

    .blog-category-link { flex: 0 0 auto; }

    .blog-card-meta { align-items: flex-start; }

    .article-hero { padding: 100px 0 16px; }

    .article-container { padding: 0 12px 32px; }

    .article-layout { padding: 0 12px 48px; gap: 24px; }
}
