/* ===========================
   sbom.study — Stylesheet
   Palette:
     Page:      #fefefe
     Text:      #2d3748
     Heading:   #1a202c
     Accent:    #2b6cb0
     Code BG:   #edf2f7
     Callout BG:#ebf8ff
     Border:    #e2e8f0
     Surface:   #f7fafc
   Fonts:
     Headings:  Merriweather 700
     Body:      Source Sans 3 400/600
     Code:      Fira Mono 400
=========================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #fefefe;
    color: #2d3748;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 1.0625rem;
    line-height: 1.85;
}

/* ---- Reading Progress Bar ---- */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: #2b6cb0;
    width: 0%;
    z-index: 1000;
    transition: width 50ms linear;
}

/* ---- Site Header ---- */
.site-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 56px 24px 0;
    margin-bottom: 56px;
}

.header-inner {
    max-width: 680px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.brand-icon {
    color: #2b6cb0;
    font-size: 0.75rem;
    opacity: 0.7;
}

.site-title {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    color: #1a202c;
    letter-spacing: -0.02em;
}

.site-subtitle {
    font-size: 1rem;
    color: #718096;
    margin-left: 0;
    line-height: 1.5;
}

/* ---- Table of Contents Navigation ---- */
.toc-nav {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    padding: 16px 0;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
}

.toc-label {
    color: #a0aec0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 4px;
}

.toc-link {
    color: #718096;
    text-decoration: none;
    white-space: nowrap;
    transition: color 120ms;
}

.toc-link:hover {
    color: #2b6cb0;
}

.toc-link.active {
    color: #2b6cb0;
    font-weight: 600;
}

/* ---- Content Column ---- */
.content-column {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
}

/* ---- Chapter Layout ---- */
.chapter {
    margin-bottom: 80px;
    position: relative;
}

.chapter-heading {
    display: flex;
    align-items: baseline;
    gap: 20px;
    margin-bottom: 28px;
}

.chapter-num {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 3rem;
    color: #2b6cb0;
    line-height: 1;
    opacity: 0.25;
    letter-spacing: -0.04em;
    min-width: 64px;
    text-align: right;
    flex-shrink: 0;
}

.chapter h2 {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: clamp(1.3rem, 2.5vw, 1.75rem);
    color: #1a202c;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.chapter h3 {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 1.0625rem;
    color: #1a202c;
    margin: 36px 0 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e2e8f0;
}

.chapter p {
    margin-bottom: 18px;
}

.chapter ul,
.chapter ol {
    padding-left: 1.5rem;
    margin-bottom: 18px;
}

.chapter li {
    margin-bottom: 6px;
}

.chapter code {
    font-family: 'Fira Mono', monospace;
    font-size: 0.875em;
    background: #edf2f7;
    color: #1a202c;
    padding: 1px 5px;
    border-radius: 3px;
}

.chapter strong {
    font-weight: 600;
    color: #1a202c;
}

.chapter em {
    font-style: italic;
    color: #4a5568;
}

/* ---- Summary Box ---- */
.summary-box {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    background: #f7fafc;
    margin-bottom: 28px;
}

.summary-box strong {
    display: block;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: #2b6cb0;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.summary-box ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.summary-box li {
    font-size: 0.9375rem;
    color: #4a5568;
    margin-bottom: 5px;
    padding-left: 1.25rem;
    position: relative;
}

.summary-box li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: #a0aec0;
    font-size: 0.75rem;
    top: 3px;
}

/* ---- Concept Callout Box ---- */
.callout-box {
    border-left: 4px solid #2b6cb0;
    background: #ebf8ff;
    padding: 1rem 1.25rem;
    border-radius: 0 6px 6px 0;
    margin: 24px 0;
    font-size: 0.9375rem;
    color: #2d3748;
    line-height: 1.7;
}

.callout-box strong {
    color: #2b6cb0;
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.callout-box ol {
    margin-top: 10px;
    padding-left: 1.25rem;
}

.callout-box ol li {
    margin-bottom: 8px;
}

.callout-box ol li strong {
    display: inline;
    color: #1a202c;
    text-transform: none;
    letter-spacing: 0;
    font-size: inherit;
}

/* ---- Code Blocks ---- */
.code-block {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin: 24px 0;
}

.code-header {
    background: #edf2f7;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #718096;
    border-bottom: 1px solid #e2e8f0;
    font-family: 'Fira Mono', monospace;
}

.copy-btn {
    background: #2b6cb0;
    color: #fff;
    border: none;
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: #2c5282;
}

.copy-btn.copied {
    background: #276749;
}

.code-block pre {
    font-family: 'Fira Mono', monospace;
    font-size: 0.875rem;
    padding: 18px 20px;
    background: #1a202c;
    color: #e2e8f0;
    overflow-x: auto;
    line-height: 1.7;
    tab-size: 2;
}

/* Syntax-like color hints (non-highlighting approach) */
.code-block pre .comment { color: #68d391; }

/* ---- Comparison Table ---- */
.comparison-table {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin: 20px 0 24px;
    font-size: 0.9rem;
}

.comparison-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1.5fr;
    gap: 0;
    border-bottom: 1px solid #e2e8f0;
}

.comparison-row:last-child {
    border-bottom: none;
}

.comparison-row span {
    padding: 10px 14px;
    border-right: 1px solid #e2e8f0;
    color: #4a5568;
    line-height: 1.5;
}

.comparison-row span:last-child {
    border-right: none;
}

.comparison-header {
    background: #f7fafc;
}

.comparison-header span {
    font-weight: 600;
    font-size: 0.8rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comparison-row strong {
    color: #1a202c;
}

/* ---- Margin Annotations ---- */
.margin-note {
    float: right;
    clear: right;
    width: 180px;
    margin: 4px -220px 16px 0;
    font-size: 0.8125rem;
    color: #a0aec0;
    line-height: 1.5;
    font-style: italic;
    border-left: 2px solid #e2e8f0;
    padding-left: 12px;
}

/* ---- Site Footer ---- */
.site-footer {
    border-top: 1px solid #e2e8f0;
    margin-top: 64px;
    padding: 48px 24px;
    background: #f7fafc;
}

.footer-inner {
    max-width: 680px;
    margin: 0 auto;
}

.footer-brand {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 1rem;
    color: #1a202c;
    margin-bottom: 8px;
}

.footer-desc {
    font-size: 0.875rem;
    color: #718096;
    line-height: 1.7;
    margin-bottom: 16px;
}

.footer-links {
    font-size: 0.875rem;
}

.footer-links a {
    color: #2b6cb0;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-links .divider {
    color: #cbd5e0;
    margin: 0 6px;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .margin-note {
        float: none;
        width: auto;
        margin: 0 0 16px 0;
        padding: 8px 12px;
        border-left: 2px solid #e2e8f0;
        border-top: none;
        background: #f7fafc;
        border-radius: 0 4px 4px 0;
        font-style: italic;
    }
}

@media (max-width: 720px) {
    .content-column {
        padding: 0 1rem;
    }

    .chapter-num {
        font-size: 2rem;
        min-width: 44px;
    }

    .chapter h2 {
        font-size: 1.25rem;
    }

    .comparison-row {
        grid-template-columns: 1fr;
    }

    .comparison-row span {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding: 8px 14px;
    }

    .comparison-row span:last-child {
        border-bottom: none;
    }

    .comparison-header span:not(:first-child) {
        display: none;
    }

    .toc-nav {
        gap: 4px 8px;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding-top: 40px;
    }

    .chapter {
        margin-bottom: 56px;
    }

    .chapter-heading {
        gap: 12px;
    }

    .chapter-num {
        font-size: 1.75rem;
        min-width: 36px;
    }
}
