/* supplychain.wiki — Documentation Clean Slate */

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

/* ========== PALETTE ==========
   #0F172A — Midnight Ink (primary text)
   #334155 — Slate Prose (secondary text)
   #3B82F6 — Link Blue (hyperlinks and active states)
   #DBEAFE — Frost Panel (sidebar background)
   #F8FAFC — Snow Field (page background)
   #10B981 — Verified Green (status indicators)
   #F59E0B — Caution Amber (warning callouts)
   #FFFFFF — Pure White (content cards)
========== */

/* ========== BASE ========== */
html {
    scroll-behavior: smooth;
    scroll-margin-top: 80px;
}

body {
    background: #F8FAFC;
    color: #334155;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
}

a {
    color: #3B82F6;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #2563EB;
}

code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    background: #DBEAFE;
    padding: 2px 6px;
    border-radius: 3px;
    color: #0F172A;
}

/* ========== STICKY HEADER ========== */
.header {
    background: #FFFFFF;
    border-bottom: 1px solid rgba(51, 65, 85, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.site-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: #0F172A;
    letter-spacing: -0.02em;
}

.breadcrumb {
    font-size: 0.8rem;
    color: #334155;
}

.breadcrumb a {
    color: #3B82F6;
}

.breadcrumb .sep {
    margin: 0 0.25rem;
    color: #334155;
    opacity: 0.4;
}

/* ========== SEARCH HERO ========== */
.search-hero {
    max-width: 960px;
    margin: 0 auto;
    padding: 3rem 2rem 1.5rem;
    text-align: center;
}

.search-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: #0F172A;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.search-sub {
    font-size: 1.05rem;
    color: #334155;
    margin-bottom: 1.5rem;
}

.search-bar-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 520px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.5;
}

.search-input {
    width: 100%;
    background: #FFFFFF;
    border: 1px solid #DBEAFE;
    border-radius: 8px;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 1rem;
    color: #0F172A;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.cat-pills {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.pill {
    font-size: 0.8rem;
    font-weight: 600;
    color: #3B82F6;
    background: #DBEAFE;
    padding: 5px 14px;
    border-radius: 16px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.pill:hover,
.pill.active {
    background: #3B82F6;
    color: #FFFFFF;
}

/* ========== FLOW DIAGRAM ========== */
.flow-diagram {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.5rem 2rem 1rem;
}

.flow-svg {
    width: 100%;
    height: auto;
}

.flow-path {
    stroke: #3B82F6;
    stroke-width: 2;
    stroke-dasharray: 8 6;
    stroke-linecap: round;
    animation: flowDash 1.5s linear infinite;
}

@keyframes flowDash {
    to {
        stroke-dashoffset: -28;
    }
}

/* ========== CONTENT AREA: TWO-COLUMN ========== */
.content-area {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    gap: 2.5rem;
}

/* ========== STICKY TOC SIDEBAR ========== */
.toc-sidebar {
    width: 210px;
    flex-shrink: 0;
    position: sticky;
    top: 70px;
    align-self: flex-start;
    background: #DBEAFE;
    border-radius: 8px;
    padding: 1.25rem;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
}

.toc-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: #0F172A;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.toc-list {
    list-style: none;
}

.toc-item {
    margin-bottom: 0.35rem;
}

.toc-item a {
    font-size: 0.85rem;
    color: #334155;
    text-decoration: none;
    display: block;
    padding: 4px 0 4px 10px;
    border-left: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.toc-item a:hover {
    color: #3B82F6;
}

.toc-item.active a {
    color: #3B82F6;
    font-weight: 600;
    border-left-color: #3B82F6;
}

/* ========== ARTICLE CONTENT ========== */
.article-content {
    flex: 1;
    max-width: 72ch;
    min-width: 0;
}

.article-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: #0F172A;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    scroll-margin-top: 80px;
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.version-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #334155;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #10B981;
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 10px;
    border-radius: 4px;
}

.section-rule {
    border: none;
    border-top: 1px solid rgba(51, 65, 85, 0.12);
    margin: 2rem 0;
}

.sub-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #0F172A;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    scroll-margin-top: 80px;
}

.node-marker {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3B82F6;
    flex-shrink: 0;
    display: inline-block;
}

.article-text {
    font-size: 1rem;
    color: #334155;
    margin-bottom: 1rem;
}

/* ========== INLINE TOOLTIPS ========== */
.term-tooltip {
    color: #0F172A;
    border-bottom: 1px dashed #3B82F6;
    cursor: help;
    position: relative;
}

.tooltip {
    position: fixed;
    z-index: 200;
    background: #0F172A;
    color: #F8FAFC;
    font-size: 0.8rem;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 6px;
    max-width: 320px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== DATA TABLES ========== */
.data-table-wrap {
    overflow-x: auto;
    margin: 1.25rem 0 1.5rem;
    border: 1px solid rgba(51, 65, 85, 0.1);
    border-radius: 8px;
    background: #FFFFFF;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: #0F172A;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid rgba(51, 65, 85, 0.12);
    background: #F8FAFC;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.06);
    color: #334155;
}

.data-table tbody tr:nth-child(even) {
    background: rgba(219, 234, 254, 0.2);
}

.data-table tbody tr:hover {
    background: rgba(219, 234, 254, 0.4);
}

/* ========== RELATED BLOCK ========== */
.related-block {
    background: #FFFFFF;
    border: 1px solid rgba(51, 65, 85, 0.1);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    position: relative;
}

.related-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
}

.related-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: #0F172A;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.related-links {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #3B82F6;
    text-decoration: none;
    padding: 2px 0;
    transition: color 0.2s ease;
}

.related-link:hover {
    color: #2563EB;
}

/* ========== METHODOLOGY LIST ========== */
.methodology-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.methodology-item {
    background: #FFFFFF;
    border: 1px solid rgba(51, 65, 85, 0.08);
    border-radius: 8px;
    padding: 1.25rem;
    border-left: 3px solid #3B82F6;
    transition: box-shadow 0.2s ease;
}

.methodology-item:hover {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.methodology-name {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: #0F172A;
    letter-spacing: -0.01em;
    margin-bottom: 0.35rem;
}

.methodology-desc {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.65;
}

/* ========== TECH GRID ========== */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.tech-card {
    background: #FFFFFF;
    border: 1px solid rgba(51, 65, 85, 0.08);
    border-radius: 8px;
    padding: 1.25rem;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.tech-card:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transform: translateY(-2px);
}

.tech-icon {
    margin-bottom: 0.75rem;
}

.tech-name {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #0F172A;
    margin-bottom: 0.35rem;
}

.tech-desc {
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.6;
}

/* ========== BEST PRACTICES ========== */
.best-practices-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.practice-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.practice-num {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #DBEAFE;
    line-height: 1;
    min-width: 36px;
    text-align: right;
    padding-top: 2px;
    user-select: none;
}

.practice-body {
    flex: 1;
}

.practice-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: #0F172A;
    margin-bottom: 0.25rem;
}

.practice-desc {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.65;
}

/* ========== FAQ ACCORDION ========== */
.faq-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0 1.5rem;
}

.faq-item {
    border: 1px solid rgba(51, 65, 85, 0.1);
    border-radius: 8px;
    background: #FFFFFF;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #0F172A;
    cursor: pointer;
    text-align: left;
    gap: 1rem;
    transition: background 0.15s ease;
}

.faq-question:hover {
    background: rgba(219, 234, 254, 0.2);
}

.faq-chevron {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    color: #334155;
}

.faq-item.open .faq-chevron {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    padding: 0 1.25rem;
}

.faq-item.open .faq-answer {
    max-height: 400px;
    padding: 0 1.25rem 1rem;
}

.faq-answer p {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.65;
}

/* ========== RELATED TOPICS TREE ========== */
.related-topics-tree {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin: 1rem 0 1.5rem;
}

.tree-branch {
    padding-left: 0;
}

.tree-label {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #0F172A;
    display: block;
    margin-bottom: 0.4rem;
}

.tree-children {
    list-style: none;
    padding-left: 1rem;
    border-left: 2px solid #DBEAFE;
}

.tree-children li {
    padding: 3px 0 3px 12px;
    position: relative;
}

.tree-children li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 8px;
    height: 1px;
    background: #DBEAFE;
}

.tree-children a {
    font-size: 0.9rem;
    color: #3B82F6;
}

.tree-children a:hover {
    color: #2563EB;
}

/* ========== POPULAR TOPICS ========== */
.popular {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
}

.section-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #0F172A;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
}

.topic-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.topic-entry {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.06);
    transition: background 0.15s ease;
}

.topic-entry:hover {
    background: rgba(219, 234, 254, 0.25);
}

.topic-entry .node-marker {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3B82F6;
    flex-shrink: 0;
}

.topic-name {
    font-size: 0.95rem;
    color: #0F172A;
    flex: 1;
}

.topic-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #334155;
    background: #DBEAFE;
    padding: 2px 8px;
    border-radius: 4px;
}

.topic-entry.hidden {
    display: none;
}

/* ========== CALLOUT ========== */
.callout-section {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.callout {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.callout-amber {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #334155;
}

.callout-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.callout-body strong {
    color: #F59E0B;
}

/* ========== FOOTER ========== */
.footer {
    max-width: 960px;
    margin: 0 auto;
    padding: 3rem 2rem 2rem;
    border-top: 1px solid rgba(51, 65, 85, 0.1);
}

.footer-cats {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-col {
    min-width: 100px;
}

.fc-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: #0F172A;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.fc-link {
    display: block;
    font-size: 0.82rem;
    color: #334155;
    text-decoration: none;
    margin-bottom: 0.3rem;
    transition: color 0.15s ease;
}

.fc-link:hover {
    color: #3B82F6;
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(51, 65, 85, 0.06);
}

.suggest-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #3B82F6;
    text-decoration: none;
    margin-bottom: 0.75rem;
    transition: color 0.15s ease;
}

.suggest-edit:hover {
    color: #2563EB;
}

.footer-credits {
    font-size: 0.75rem;
    color: #334155;
    margin-bottom: 0.35rem;
}

.footer-credits .sep {
    margin: 0 0.35rem;
    opacity: 0.4;
}

.contributor-count {
    font-weight: 600;
}

.footer-copy {
    font-size: 0.7rem;
    color: #334155;
    opacity: 0.7;
}

/* ========== FADE-IN ANIMATION ========== */
.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== PAPER TEXTURE OVERLAY ========== */
.related-block,
.methodology-item,
.tech-card,
.faq-item {
    position: relative;
}

/* ========== SCROLL-MARGIN FOR ANCHORS ========== */
[id^="section-"] {
    scroll-margin-top: 80px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .content-area {
        flex-direction: column;
    }

    .toc-sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }

    .search-heading {
        font-size: 1.5rem;
    }

    .article-heading {
        font-size: 1.5rem;
    }

    .sub-heading {
        font-size: 1.2rem;
    }

    .tech-grid {
        grid-template-columns: 1fr;
    }

    .footer-cats {
        gap: 1.5rem;
    }

    .practice-num {
        font-size: 1.2rem;
        min-width: 28px;
    }

    .flow-diagram {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-inner {
        padding: 0.75rem 1rem;
    }

    .search-hero {
        padding: 2rem 1rem 1rem;
    }

    .content-area {
        padding: 1rem;
    }

    .popular {
        padding: 1.5rem 1rem;
    }

    .footer {
        padding: 2rem 1rem;
    }

    .callout-section {
        padding: 0 1rem 1.5rem;
    }
}
