/* monopole.wiki — Light-academia wiki stylesheet */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #FFFDF8;
    color: #3A3630;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Page Layout */
.page-wrapper {
    display: flex;
    max-width: 1060px;
    margin: 0 auto;
    padding: 60px 40px 80px;
    gap: 60px;
}

.content-column {
    flex: 1;
    max-width: 680px;
    min-width: 0;
}

/* Sidebar */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 40px;
    align-self: flex-start;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    background-color: #F8F4ED;
    padding: 30px 24px;
    border-radius: 2px;
    opacity: 0;
    transform: translateX(20px);
    animation: sidebarFadeIn 500ms ease 300ms forwards;
}

@keyframes sidebarFadeIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Table of Contents */
.toc-title {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7A746A;
    margin-bottom: 16px;
}

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

.toc-list li {
    counter-increment: toc-counter;
    margin-bottom: 4px;
}

.toc-link {
    display: block;
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #3A3630;
    text-decoration: none;
    padding: 6px 12px;
    border-left: 3px solid transparent;
    transition: border-color 200ms ease, background-color 200ms ease, color 200ms ease;
}

.toc-link:hover {
    color: #8B4513;
}

.toc-link.active {
    border-left-color: #8B4513;
    background-color: rgba(196, 154, 108, 0.2);
    color: #2D2A24;
    font-weight: 600;
}

/* Margin Notes */
.margin-notes {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #E8E0D4;
}

.margin-note {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #7A746A;
    margin-bottom: 16px;
    padding: 8px 10px;
    border-radius: 2px;
    transition: background-color 300ms ease;
}

.margin-note.highlighted {
    background-color: rgba(196, 154, 108, 0.15);
}

.note-number {
    font-weight: 600;
    color: #8B4513;
}

/* Article Header */
.article-header {
    margin-bottom: 48px;
}

.article-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 36px;
    font-weight: 600;
    color: #2D2A24;
    line-height: 1.2;
    margin-bottom: 12px;
}

.article-subtitle {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 16px;
    color: #7A746A;
    line-height: 1.5;
    font-style: italic;
}

.title-rule {
    border: none;
    border-top: 1px solid #E8E0D4;
    margin-top: 20px;
}

/* Sections */
section {
    margin-bottom: 24px;
}

.section-heading-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.section-number-watermark {
    position: absolute;
    left: -20px;
    top: -18px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 72px;
    font-weight: 300;
    color: #E8E0D4;
    line-height: 1;
    z-index: 0;
    user-select: none;
    pointer-events: none;
}

.section-heading {
    position: relative;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 24px;
    font-weight: 600;
    color: #2D2A24;
    line-height: 1.3;
    z-index: 1;
}

.subsection-heading {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 20px;
    font-weight: 600;
    color: #2D2A24;
    margin-top: 32px;
    margin-bottom: 12px;
}

/* Body Text */
p {
    margin-bottom: 18px;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

strong {
    font-weight: 600;
    color: #2D2A24;
}

a {
    color: #8B4513;
    text-decoration: none;
    border-bottom: 1px dotted #8B4513;
    transition: border-bottom-style 200ms ease;
}

a:hover {
    border-bottom-style: solid;
}

/* Footnote Markers */
.footnote-marker {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 12px;
    color: #8B4513;
    cursor: pointer;
    font-weight: 600;
    vertical-align: super;
    line-height: 0;
    padding: 0 2px;
    transition: color 200ms ease;
}

.footnote-marker:hover {
    color: #C49A6C;
}

/* Section Divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 36px 0;
}

.ornamental-rule {
    flex: 1;
    border: none;
    border-top: 1px solid #E8E0D4;
}

.diamond-ornament {
    color: #E8E0D4;
    font-size: 10px;
    line-height: 1;
}

/* Illustrations */
.illustration-container {
    margin: 28px 0;
    border: 1px solid #E8E0D4;
    padding: 20px;
}

.illustration {
    display: block;
    width: 100%;
    max-width: 400px;
    height: auto;
}

.illustration-caption {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 13px;
    font-style: italic;
    color: #7A746A;
    margin-top: 12px;
    margin-bottom: 0;
    text-align: left;
}

/* Equations */
.equation-block {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px;
    color: #2D2A24;
    text-align: center;
    padding: 16px 24px;
    margin: 20px 0;
    border-left: 3px solid #E8E0D4;
    background-color: rgba(248, 244, 237, 0.5);
}

.equations-table {
    margin: 20px 0;
    padding: 20px;
    background-color: rgba(248, 244, 237, 0.5);
    border: 1px solid #E8E0D4;
}

.equation-row {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(232, 224, 212, 0.5);
}

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

.equation-label {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #7A746A;
    min-width: 180px;
    flex-shrink: 0;
}

.equation-expr {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 16px;
    color: #2D2A24;
}

/* Article List */
.article-list {
    margin: 16px 0 20px 24px;
    list-style: disc;
}

.article-list li {
    margin-bottom: 8px;
    padding-left: 4px;
}

/* Footer */
.article-footer {
    margin-top: 60px;
}

.footer-text {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 13px;
    color: #7A746A;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 0;
}

/* Mobile TOC */
.mobile-toc-toggle {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: #F8F4ED;
    border: none;
    border-bottom: 1px solid #E8E0D4;
    padding: 12px 20px;
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #2D2A24;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.mobile-toc-dropdown {
    display: none;
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    z-index: 99;
    background-color: #F8F4ED;
    border-bottom: 1px solid #E8E0D4;
    padding: 16px 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease;
}

.mobile-toc-dropdown.open {
    max-height: 400px;
}

.toc-link-mobile {
    display: block;
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #3A3630;
    text-decoration: none;
    padding: 8px 0;
    border-bottom: 1px solid rgba(232, 224, 212, 0.5);
}

.toc-link-mobile:hover {
    color: #8B4513;
}

/* Inline footnotes for mobile */
.inline-footnote {
    font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #7A746A;
    background-color: #F8F4ED;
    padding: 12px 16px;
    margin: 8px 0 16px;
    border-left: 3px solid #C49A6C;
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease, padding 300ms ease;
    padding-top: 0;
    padding-bottom: 0;
}

.inline-footnote.expanded {
    max-height: 200px;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Responsive */
@media (max-width: 860px) {
    .page-wrapper {
        flex-direction: column;
        padding: 60px 20px 40px;
        gap: 0;
    }

    .content-column {
        max-width: 100%;
    }

    .sidebar {
        display: none;
    }

    .mobile-toc-toggle {
        display: block;
    }

    .mobile-toc-dropdown {
        display: block;
    }

    .section-number-watermark {
        left: -10px;
        font-size: 56px;
    }

    .equation-row {
        flex-direction: column;
        gap: 4px;
    }

    .equation-label {
        min-width: auto;
    }
}
