/* ========================================
   ARTICLE PAGE 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;
    }
}