/* ========================================
   MAIN STYLES — EndüstriHub
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700;800&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0d0f1a;
    --surface: #141827;
    --surface2: #1c2135;
    --border: rgba(255, 255, 255, 0.08);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --accent2: #8b5cf6;
    --green: #10b981;
    --yellow: #f59e0b;
    --red: #ef4444;
    --teal: #14b8a6;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    line-height: 1.85;
}

/* ---- NAV ---- */
.article-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 15, 26, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 14px 5%;
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: opacity .2s;
}

.back-btn:hover {
    opacity: .7;
}

.nav-category {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .5px;
}

/* ---- ARTICLE CONTAINER ---- */
.article-page {
    max-width: 860px;
    margin: 0 auto;
    padding: 50px 24px 100px;
}

/* ---- HEADER ---- */
.article-hero {
    margin-bottom: 40px;
}

.article-meta-top {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.reading-time,
.article-date {
    color: var(--text-muted);
    font-size: 13px;
}

.article-page h1 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
    margin-bottom: 20px;
}

.article-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.7;
    border-left: 3px solid var(--accent);
    padding-left: 16px;
}

.article-hero-img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: 16px;
    margin: 32px 0;
    border: 1px solid var(--border);
}

/* ---- BODY ---- */
.article-body h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    margin: 52px 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.article-body h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #c7d2fe;
    margin: 28px 0 12px;
}

.article-body h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 20px 0 8px;
}

.article-body p {
    color: #cbd5e1;
    margin-bottom: 18px;
}

.article-body ul,
.article-body ol {
    padding-left: 24px;
    margin-bottom: 18px;
    color: #cbd5e1;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body strong {
    color: #e2e8f0;
}

.article-body em {
    color: #a5b4fc;
}

/* ---- TABLE OF CONTENTS ---- */
.toc-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    padding: 22px 28px;
    margin-bottom: 40px;
}

.toc-box h4 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.toc-box ol {
    padding-left: 20px;
    margin: 0;
}

.toc-box li {
    margin-bottom: 6px;
}

.toc-box a {
    color: #a5b4fc;
    text-decoration: none;
    font-size: 15px;
    transition: color .2s;
}

.toc-box a:hover {
    color: #fff;
}

/* ---- CALLOUTS ---- */
.callout {
    display: flex;
    gap: 14px;
    border-radius: 12px;
    padding: 18px 22px;
    margin: 28px 0;
    font-size: 15px;
    line-height: 1.7;
}

.callout-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.callout-blue {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.callout-green {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.callout-yellow {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.callout-purple {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.callout-red {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ---- INFO PANEL ---- */
.info-panel {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 28px;
    margin: 28px 0;
}

.info-panel h4 {
    color: #a5b4fc;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 14px;
}

.info-panel ol,
.info-panel ul {
    color: #cbd5e1;
}

/* ---- FORMULA BOX ---- */
.formula-box {
    background: #0a0d18;
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 10px;
    padding: 18px 22px;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    color: #a5b4fc;
    margin: 18px 0 28px;
    line-height: 1.6;
}

.formula-box small {
    color: var(--text-muted);
}

/* ---- PRINCIPLES GRID ---- */
.principles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin: 24px 0;
}

.principle-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    transition: border-color .3s;
}

.principle-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.p-num {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 12px;
}

.principle-card h4 {
    color: #e2e8f0;
    margin-bottom: 8px;
}

.principle-card p {
    color: #94a3b8;
    font-size: 14px;
    margin: 0 0 10px;
}

.p-example {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
}

/* ---- WASTE GRID ---- */
.waste-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin: 24px 0;
}

.waste-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    transition: border-color .3s;
}

.waste-card:hover {
    border-color: rgba(239, 68, 68, 0.3);
}

.waste-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.waste-card h4 {
    font-size: 15px;
    color: #f87171;
    margin-bottom: 8px;
}

.waste-card p {
    color: #94a3b8;
    font-size: 14px;
    margin: 0 0 10px;
}

.waste-example {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
}

/* ---- TOOLS ACCORDION ---- */
.tools-accordion {
    margin: 24px 0;
}

.tool-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
}

.tool-emoji {
    font-size: 22px;
}

.tool-header h4 {
    color: #e2e8f0;
    font-size: 15px;
}

.tool-body {
    padding: 0 22px 22px;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.7;
}

.tool-body p {
    color: #94a3b8;
    margin-bottom: 12px;
}

.tool-body ul,
.tool-body ol {
    color: #94a3b8;
    padding-left: 20px;
}

.tool-body li {
    margin-bottom: 6px;
}

.tool-body strong {
    color: #c7d2fe;
}

/* ---- TABLE ---- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

th {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 10px 14px;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* ---- CASE STUDY ---- */
.case-study {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--green);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 18px 0;
    color: #94a3b8;
    font-size: 15px;
}

.cs-header {
    margin-bottom: 10px;
}

.cs-company {
    font-weight: 600;
    color: #6ee7b7;
    font-size: 16px;
}

/* ---- FAIL LIST ---- */
.failure-list {
    margin: 20px 0;
}

.failure-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.failure-item:last-child {
    border-bottom: none;
}

.f-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.failure-item strong {
    color: #fca5a5;
    display: block;
    margin-bottom: 4px;
}

.failure-item p {
    color: #94a3b8;
    font-size: 14px;
    margin: 0;
}

/* ---- SIGMA TABLE ---- */
.sigma-table {
    margin: 20px 0;
}

.sigma-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
}

.sigma-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.sigma-info strong {
    display: block;
    font-size: 15px;
    color: #e2e8f0;
}

.sigma-info span {
    font-size: 13px;
    color: var(--text-muted);
}

.sigma-bar-wrap {
    flex: 1;
}

.sigma-bar {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* ---- TWO COL ---- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 18px 0;
}

@media (max-width: 640px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

.two-col h4 {
    color: #c7d2fe;
    margin-bottom: 10px;
}

.two-col p,
.two-col ul {
    color: #94a3b8;
    font-size: 15px;
}

/* ---- STEP LIST ---- */
.step-list {
    margin: 20px 0;
}

.step-item {
    display: flex;
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}

.step-item:last-child {
    border-bottom: none;
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.step-item strong {
    display: block;
    font-size: 15px;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.step-item p {
    color: #94a3b8;
    font-size: 14px;
    margin: 0;
}

/* ---- TAGS ---- */
.article-tags {
    margin: 56px 0 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
}

.tag:hover {
    background: rgba(99, 102, 241, 0.25);
    cursor: default;
}

/* ---- FOOTER NAV ---- */
.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.btn-back,
.btn-next {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all .25s;
}

.btn-back {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-back:hover {
    border-color: var(--accent);
    color: #a5b4fc;
}

.btn-next {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
}

.btn-next:hover {
    opacity: .85;
}

/* ---- CATEGORY TAGS ---- */
.category-tag {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .4px;
}

.cat-yalin {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.cat-kalite {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.cat-yoneylem {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.cat-tedarik {
    background: rgba(236, 72, 153, 0.2);
    color: #f9a8d4;
}

.cat-dijital {
    background: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
}

.cat-ergonomi {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.cat-proje {
    background: rgba(168, 85, 247, 0.2);
    color: #d8b4fe;
}

.cat-simulasyon {
    background: rgba(20, 184, 166, 0.2);
    color: #5eead4;
}

.cat-yapay {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.cat-envanter {
    background: rgba(251, 146, 60, 0.2);
    color: #fdba74;
}

.cat-tesis {
    background: rgba(52, 211, 153, 0.2);
    color: #6ee7b7;
}

.cat-temel {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

/* ---- RESPONSIVE — TABLET (≤ 768px) ---- */
@media (max-width: 768px) {

    /* Article page container */
    .article-page {
        padding: 28px 16px 60px;
    }

    /* Grids: single column */
    .waste-grid,
    .principles-grid {
        grid-template-columns: 1fr;
    }

    /* Footer buttons: full width */
    .article-footer {
        flex-direction: column;
        text-align: center;
    }

    .btn-back,
    .btn-next {
        width: 100%;
        text-align: center;
        display: block;
    }

    /* Tables: make horizontally scrollable */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        border-radius: 8px;
    }

    table thead,
    table tbody,
    table tfoot {
        display: table;
        width: 100%;
    }

    /* Info panel: reduce padding */
    .info-panel {
        padding: 18px 16px;
    }

    /* Callout: tighter on tablet */
    .callout {
        padding: 14px 16px;
        gap: 10px;
    }

    /* Formula box: smaller font */
    .formula-box {
        font-size: 13px;
        padding: 14px 16px;
        overflow-x: auto;
    }

    /* TOC box */
    .toc-box {
        padding: 16px 18px;
    }

    /* Article hero image */
    .article-hero-img {
        max-height: 260px;
        margin: 20px 0;
    }

    /* Section headings */
    .article-body h2 {
        font-size: 1.35rem;
        margin: 36px 0 14px;
    }

    .article-body h3 {
        font-size: 1.05rem;
    }

    /* Two-column: single column */
    .two-col {
        grid-template-columns: 1fr;
    }

    /* Nav: wrap on small tablets */
    .article-nav {
        padding: 12px 16px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .back-btn {
        font-size: 13px;
    }

    /* Case study */
    .case-study {
        padding: 16px 18px;
    }

    /* Sigma rows: show differently */
    .sigma-row {
        flex-wrap: wrap;
    }

    .sigma-bar-wrap {
        width: 100%;
        margin-top: 8px;
    }
}

/* ---- RESPONSIVE — MOBILE PHONE (≤ 480px) ---- */
@media (max-width: 480px) {
    body {
        font-size: 15px;
        line-height: 1.75;
    }

    .article-page {
        padding: 20px 12px 50px;
    }

    /* H1 on mobile */
    .article-page h1 {
        font-size: 1.6rem;
        line-height: 1.25;
    }

    .article-subtitle {
        font-size: 0.95rem;
    }

    /* Top meta: stack */
    .article-meta-top {
        gap: 8px;
    }

    /* TOC: compact */
    .toc-box {
        padding: 14px;
    }

    .toc-box a {
        font-size: 13px;
    }

    .toc-box li {
        margin-bottom: 4px;
    }

    /* Callout: very compact */
    .callout {
        flex-direction: column;
        gap: 8px;
        padding: 12px 14px;
        font-size: 13px;
    }

    .callout-icon {
        font-size: 18px;
    }

    /* Formula box */
    .formula-box {
        font-size: 12px;
        padding: 12px;
        line-height: 1.5;
    }

    .formula-box code {
        font-size: 12px;
    }

    /* Info panel */
    .info-panel {
        padding: 14px 12px;
        font-size: 14px;
    }

    /* Tool accordion */
    .tool-header {
        padding: 14px 16px;
        gap: 10px;
    }

    .tool-body {
        padding: 0 16px 16px;
        font-size: 13px;
    }

    .tool-header h4 {
        font-size: 14px;
    }

    /* Waste / Principle cards */
    .waste-card,
    .principle-card {
        padding: 14px 16px;
    }

    .waste-card h4 {
        font-size: 14px;
    }

    /* Step list */
    .step-item {
        gap: 12px;
        padding: 14px 0;
    }

    .step-num {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    /* Case study */
    .case-study {
        padding: 14px;
        font-size: 14px;
    }

    .cs-company {
        font-size: 14px;
    }

    /* Tags */
    .article-tags {
        gap: 6px;
        margin: 36px 0 24px;
    }

    .tag {
        font-size: 12px;
        padding: 4px 10px;
    }

    /* Footer buttons */
    .btn-back,
    .btn-next {
        padding: 12px 16px;
        font-size: 13px;
    }

    /* pre/code blocks */
    pre {
        font-size: 11px !important;
        overflow-x: auto;
    }

    /* Tables on phone: very small padding */
    th {
        padding: 8px 10px;
        font-size: 12px;
    }

    td {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Simplex tables: keep readable */
    .simplex-table th,
    .simplex-table td {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* TEMPORARY FIX: Restoring missing Hero & Grid css from overwriting incident. */
.hero {
    padding: 120px 24px 60px;
    text-align: left;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.hero h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 48px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    color: var(--text-color);
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 40px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
}

.stat-divider {
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    position: relative;
    z-index: 100;
    margin-top: 24px;
}

.hero-cta {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}

.search-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    padding: 20px;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.search-panel.active {
    transform: translateY(0);
}

.search-panel-inner {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 16px 48px;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 16px;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-clear {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.search-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.search-meta {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.search-overlay-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.search-overlay-bg.visible {
    opacity: 1;
    pointer-events: auto;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 50px;
    /* Butonu sola çekerek sağ kenardan uzaklaştırır */
}

.search-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 0;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    padding: 15px 0;
    background: rgba(13, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-icon {
    font-size: 28px;
    color: var(--accent);
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 24px;
    color: #fff;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 32px;
    list-style: none;
    margin: 0 auto;
    /* push them roughly to the center */
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: 0.2s;
    padding: 8px 16px;
    border-radius: 8px;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.hamburger {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px 16px;
    color: var(--text);
    transition: all 0.2s;
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: 0.3s;
}

footer {
    border-top: 1px solid var(--border);
    padding: 40px 0;
    margin-top: 60px;
    text-align: center;
    color: var(--text-muted);
}

.footer-brand {
    margin-bottom: 12px;
    font-weight: 600;
    color: #fff;
    font-size: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--accent2);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* --- CATEGORY FILTERS --- */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    margin-bottom: 40px;
}

.filter-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 100px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.15);
}

.filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* --- ARTICLE CARDS --- */
.article-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.article-card:hover {
    transform: translateY(-8px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(99, 102, 241, 0.1);
}

.article-card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.category-tag {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
    padding: 6px 14px;
    border-radius: 100px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.article-emoji {
    font-size: 24px;
    background: var(--surface2);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

.card-excerpt {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

.reading-time {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.read-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: 0.2s;
}

.article-card:hover .read-link {
    color: var(--accent2);
    transform: translateX(4px);
}

.hidden {
    display: none !important;
}

.search-hidden {
    display: none !important;
}

/* --- SEARCH PANEL & OVERLAY --- */
.search-panel {
    position: fixed;
    top: -100px;
    /* Hidden start state */
    left: 0;
    width: 100%;
    background: var(--surface);
    z-index: 1002;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
}

.search-panel.open {
    top: 0;
    opacity: 1;
    visibility: visible;
}

.search-panel-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 48px;
    font-size: 18px;
    color: var(--text);
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-clear {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    display: none;
    /* Shown via JS */
}

.search-clear:hover {
    color: var(--text);
}

.search-meta {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-muted);
    text-align: right;
    min-height: 20px;
}

.search-overlay-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.search-overlay-bg.visible {
    opacity: 1;
    visibility: visible;
}

/* No Results Message inside Grid */
.no-results-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 16px;
    display: none;
}

.no-results-msg.visible {
    display: block;
}

.no-results-emoji {
    font-size: 40px;
    display: block;
    margin-bottom: 16px;
}

.search-highlight {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
    padding: 0 2px;
    border-radius: 3px;
}

/* Remove button default styles specifically for search toggles */
.search-toggle,
.hamburger {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-toggle:hover {
    color: var(--accent);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ========================================
   NAV SEARCH BAR
   ======================================== */
.nav-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-search-input {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    padding: 7px 36px 7px 36px;
    width: 220px;
    transition: width .3s, border-color .2s;
    outline: none;
}

.nav-search-input:focus {
    border-color: var(--accent);
    width: 280px;
}

.nav-search-icon {
    position: absolute;
    left: 10px;
    font-size: 13px;
    pointer-events: none;
    opacity: .6;
}

.nav-search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    line-height: 1;
}

.nav-search-clear:hover {
    color: var(--text);
}

/* Search results dropdown */
.nav-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 360px;
    overflow-y: auto;
    z-index: 2000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: none;
}

.nav-search-results.open {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background .15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(99, 102, 241, 0.12);
}

.sri-cat {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    flex-shrink: 0;
    padding-top: 2px;
}

.sri-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.sri-title mark {
    background: rgba(99, 102, 241, 0.35);
    color: #fff;
    border-radius: 3px;
    padding: 0 2px;
}

.nav-search-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ========================================
   SIDEBAR DRAWER
   ======================================== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

.sidebar-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.sidebar-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 95vw;
    height: 100vh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 3100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .2s ease-out;
    overflow: hidden;
}

.sidebar-drawer.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-close {
    background: rgba(255, 255, 255, 0.07);
    border: none;
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    padding: 8px 16px;
    outline: none;
    transition: border-color .2s;
}

.sidebar-search input:focus {
    border-color: var(--accent);
}

.sidebar-cats {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Category group */
.sidebar-cat-group {
    border-bottom: 1px solid var(--border);
}

.sidebar-cat-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background .15s;
    user-select: none;
}

.sidebar-cat-title:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-cat-title .cat-count {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

.sidebar-cat-title .cat-arrow {
    margin-left: 6px;
    transition: transform .2s;
    font-size: 11px;
}

.sidebar-cat-title.expanded .cat-arrow {
    transform: rotate(90deg);
}

.sidebar-article-list {
    display: none;
    padding: 4px 0 8px;
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-article-list.open {
    display: block;
}

.sidebar-article-link {
    display: block;
    padding: 8px 28px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color .15s, background .15s;
    line-height: 1.4;
}

.sidebar-article-link:hover {
    color: var(--text);
    background: rgba(99, 102, 241, 0.08);
}

.sidebar-article-link.hidden-search {
    display: none;
}

@media (max-width: 480px) {
    .nav-search-input {
        width: 140px;
        font-size: 13px;
    }

    .nav-search-input:focus {
        width: 180px;
    }
}

/* Fix fixed navbar overlap */
#categories,
section[id] {
    scroll-margin-top: 100px;
}