/* sbom.study - Software Bill of Materials - Textbook Layout */
/* Colors: #FAFBFC, #F6F8FA, #F0F4F8, #E5E7EB, #D0D7DE, #6B7280, #1F2937, #FEF3C7 */

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

body {
    background-color: #FAFBFC;
    color: #1F2937;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    line-height: 1.8;
    overflow-x: hidden;
}

/* Layout */
#layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 2rem 1.5rem;
    border-right: 1px solid #E5E7EB;
    background: #F6F8FA;
}

.sidebar-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #1F2937;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

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

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

.toc-link {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.9rem;
    color: #6B7280;
    text-decoration: none;
    padding: 0.3rem 0.75rem;
    display: block;
    border-left: 3px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.toc-link:hover {
    color: #1F2937;
}

.toc-link.active {
    color: #1F2937;
    font-weight: 600;
    border-left-color: #1F2937;
    background: rgba(31, 41, 55, 0.05);
}

/* Main Content */
#content {
    max-width: 900px;
    padding: 0 3rem;
}

/* Chapters */
.chapter {
    min-height: 80vh;
    padding: 5rem 0;
    border-bottom: 1px solid #E5E7EB;
}

.chapter:last-child {
    border-bottom: none;
}

/* Cover */
.cover-chapter {
    display: flex;
    align-items: center;
    min-height: 100vh;
}

.cover-content {
    max-width: 600px;
}

.cover-edition {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: #6B7280;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.cover-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: #1F2937;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.cover-subtitle {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    color: #6B7280;
    letter-spacing: 0.12em;
    margin-top: 1rem;
}

.cover-line {
    width: 60px;
    height: 2px;
    background: #1F2937;
    margin: 2rem 0;
}

.cover-desc {
    font-size: 1.1rem;
    color: #6B7280;
    line-height: 1.8;
    max-width: 480px;
}

/* Chapter Headers */
.chapter-header {
    margin-bottom: 2.5rem;
}

.chapter-num {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #6B7280;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.chapter-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: #1F2937;
    letter-spacing: 0.01em;
}

/* Chapter Body */
.chapter-body {
    max-width: 680px;
}

.chapter-body p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    color: #1F2937;
}

/* Margin Notes */
.margin-note {
    float: right;
    width: 180px;
    margin-right: -200px;
    font-size: 0.85rem;
    color: #6B7280;
    font-style: italic;
    line-height: 1.5;
    padding-left: 1rem;
    border-left: 2px solid #E5E7EB;
}

.margin-note::before {
    content: attr(data-note);
}

.note-marker {
    display: none;
}

/* Study Cards */
.study-card {
    background: #F6F8FA;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.card-header {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #6B7280;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #E5E7EB;
}

.card-body {
    font-size: 0.95rem;
    color: #1F2937;
    line-height: 1.7;
}

.card-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: #6B7280;
    letter-spacing: 0.08em;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid #E5E7EB;
}

.highlight-card {
    background: #FEF3C7;
    border-color: #D0D7DE;
}

.complete-card {
    background: #F0F4F8;
}

/* Block Diagram */
.block-diagram {
    margin: 2rem 0;
    padding: 1rem;
    background: #FAFBFC;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
}

.diagram-svg {
    width: 100%;
    max-width: 500px;
    display: block;
    margin: 0 auto;
}

/* Data Table */
.data-table {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
    margin: 2rem 0;
}

.table-header, .table-row {
    display: grid;
    grid-template-columns: 160px 1fr 80px;
    gap: 1rem;
    padding: 0.75rem 1rem;
}

.table-header {
    background: #F6F8FA;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #6B7280;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid #E5E7EB;
}

.table-row {
    font-size: 0.9rem;
    border-bottom: 1px solid #F0F4F8;
}

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

.field-name {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #1F2937;
    font-weight: 600;
}

.field-req {
    color: #6B7280;
    font-size: 0.85rem;
}

/* Comparison Cards */
.comparison-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

/* Checklist */
.checklist {
    list-style: none;
    padding: 0;
}

.check-item {
    padding: 0.5rem 0;
    font-size: 0.95rem;
    color: #1F2937;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: color 0.2s ease;
}

.check-item::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #D0D7DE;
    border-radius: 3px;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.check-item.checked::before {
    background: #1F2937;
    border-color: #1F2937;
}

.check-item.checked {
    color: #6B7280;
    text-decoration: line-through;
}

/* Completion Badge */
.completion-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 3rem;
    padding: 1rem;
}

.badge-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1F2937;
    color: #FAFBFC;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.badge-text {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: #1F2937;
}

/* Responsive */
@media (max-width: 900px) {
    #layout {
        grid-template-columns: 1fr;
    }

    #sidebar {
        position: relative;
        top: 0;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #E5E7EB;
        padding: 1.5rem;
    }

    .toc-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .toc-link {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }

    .toc-link.active {
        border-left: none;
        border-bottom-color: #1F2937;
    }

    #content {
        padding: 0 2rem;
    }

    .margin-note {
        float: none;
        width: 100%;
        margin-right: 0;
        margin: 1rem 0;
        padding: 0.75rem 1rem;
        background: #F6F8FA;
        border-left: 3px solid #E5E7EB;
        border-radius: 4px;
    }

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

    .table-header, .table-row {
        grid-template-columns: 1fr 1fr;
    }

    .field-req {
        display: none;
    }
}
