/* =========================================================
   Theme variables
   ========================================================= */

:root {
    color-scheme: light;

    --background: #FAFAFA;
    --surface: #F1F1F1;
    --surface-hover: #F1F1F1;

    --text: #1F1F1F;
    --text-secondary: #6B6B6B;
    --text-muted: #6B6B6B;

    --accent: #C65D3B;
    --accent-strong: #C65D3B;

    --border: #E0E0E0;
    --link: #C65D3B;
    --link-hover: #E08A6A;

    --palette-yellow: #D99A2B;
    --palette-orange: #C65D3B;


    --math-ruby: #B03A48;
    --math-citrine: #8F6600;
    --math-emerald: #2C7A52;
    --math-turquoise: #237885;
    --math-sapphire: #3A5F9E;
    --math-amethyst: #7A52A0;

    --shadow:
        0 2px 12px rgba(0, 0, 0, 0.04);
        
    --font-serif:
        'Latin Modern Roman',
        Georgia,
        "Times New Roman",
        serif;
    --font-sans:
        "Source Sans 3",
        Inter,
        "Fira Sans",
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

}

:root[data-theme="dark"] {
    --shadow:
        0 2px 16px rgba(0, 0, 0, 0.25);

    --background: #222225;
    --surface: #2A2A2E;
    --surface-hover: #2A2A2E;

    --text: #E8E8EA;
    --text-secondary: #9A9A9F;
    --text-muted: #9A9A9F;

    --accent: #C65D3B;
    --accent-strong: #C65D3B;

    --border: #37373C;
    --link: #E08A6A;
    --link-hover: #F0A585;

    --palette-yellow: #C9942E;
    --palette-orange: #C97F5E;

    --math-ruby: #E87A85;
    --math-citrine: #E5B85C;
    --math-emerald: #5DBF8E;
    --math-turquoise: #5FC5D6;
    --math-sapphire: #6F9AD8;
    --math-amethyst: #BC9BDD;
}




/* =========================================================
   Global
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    margin: 0;

    background: var(--background);
    color: var(--text);

    font-family:var(--font-sans);

    line-height: 1.7;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;

    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-optical-sizing: auto;
}

a {
    color: var(--link);
}

a:hover {
    color: var(--link-hover);
}


.debug {
    display:none !important;
}

/* =========================================================
   Header
   ========================================================= */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-bottom 0.2s ease;
}

.site-header-inner {
    max-width: 1150px;
    margin: 0 auto;

    padding: 1.25rem 1.5rem;

    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 2rem;
}

.site-title {
    color: var(--text);

    font-size: 1.15rem;
    font-weight: 700;

    text-decoration: none;
}

.site-title:hover {
    color: var(--text);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.site-nav > a {
    padding: 0.45rem 0.75rem;

    border-radius: 0.5rem;

    color: var(--text-secondary);

    text-decoration: none;
}

.site-nav > a:hover {
    background: var(--surface-hover);
    color: var(--text);
}


/* =========================================================
   Theme switch
   ========================================================= */

.theme-toggle {
    width: 2.35rem;
    height: 2.35rem;

    margin-left: 0.4rem;

    border: 1px solid var(--border);
    border-radius: 50%;

    background: var(--surface);

    color: var(--text-secondary);

    cursor: pointer;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 1rem;

    box-shadow: var(--shadow);

    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.theme-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.theme-toggle-icon {
    line-height: 1;
}


/* =========================================================
   Main layout
   ========================================================= */

.site-main {
    max-width: 1150px;
    margin: 0 auto;

    padding: 2rem 1.5rem 5rem;
}


/* =========================================================
   Landing page
   ========================================================= */

.landing {
    max-width: 900px;
    margin: 5rem auto;
}

.landing-header {
    margin-bottom: 2.5rem;
}

.landing-header h1 {
    margin: 0 0 0.5rem;

    font-size: 3rem;
    line-height: 1.15;
}

.landing-header p {
    margin: 0;

    color: var(--text-secondary);
    font-size: 1.1rem;
}

.level-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 1.25rem;
}

.level-card {
    display: block;

    padding: 2rem;

    border:
        1px solid var(--border);

    border-radius: 0.9rem;

    background: var(--surface);

    box-shadow: var(--shadow);

    color: var(--text);

    text-decoration: none;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}

.level-card:hover {
    background: var(--surface-hover);

    color: var(--text);

    transform: translateY(-2px);

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.08);
}

.level-card h2 {
    margin-top: 0;
    margin-bottom: 0.4rem;
}

.level-card p {
    margin: 0;
    color: var(--text-secondary);
}


/* =========================================================
   Section pages
   ========================================================= */

.section-page,
.taxonomy-page,
.term-page {
    max-width: 900px;
    margin: 0 auto;
}

.section-header {
    margin-bottom: 2.5rem;
}

.section-header h1 {
    margin-bottom: 0.5rem;

    font-size: 2.4rem;
    line-height: 1.2;
}

.section-description {
    max-width: 700px;

    color: var(--text-secondary);
}










/* =========================================================
   Curriculum
   ========================================================= */

.curriculum {
    margin-top: 3rem;
}

.curriculum-category {
    margin-bottom: 2.5rem;
}

.curriculum-category h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.collection-list {
    margin: 0;
    padding-left: 1.5rem;
}

.collection-list li {
    margin: 0.35rem 0;
}

.collection-list a {
    text-decoration: none;
}

.collection-list a:hover {
    text-decoration: underline;
}

.collection-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}




/* =========================================================
   Collection pages
   ========================================================= */

.collection-header {
    max-width: 800px;
    margin: 0 auto 4rem;
}

.collection-header h1 {
    margin-bottom: 0.75rem;

    font-size: 2.8rem;
    line-height: 1.2;
}

.collection-description {
    margin-top: 0;

    color: var(--text-secondary);

    font-size: 1.15rem;
}

.collection-introduction {
    margin-top: 1.5rem;
}

.collection-authors {
    margin-top: 1.5rem;

    color: var(--text-secondary);

    font-size: 0.95rem;
}

.collection-articles {
    max-width: 820px;
    margin: 0 auto;
}

.collection-article {
    padding-bottom: 4rem;
    margin-bottom: 4rem;

    border-bottom: 1px solid var(--border);
}

.collection-article:last-child {
    border-bottom: none;
}

.collection-article .article-header {
    margin-bottom: 2rem;
}

.collection-article .article-header h2 {
    margin-bottom: 0.75rem;

    font-size: 2rem;
    line-height: 1.25;
}

.collection-article .article-header h2 a {
    color: var(--text);
    text-decoration: none;
}

.collection-article .article-header h2 a:hover {
    color: var(--accent);
}

.collection-article .article-tags {
    margin-bottom: 0.75rem;
}













/* =========================================================
   Featured tags
   ========================================================= */

.featured-tags {
    margin-bottom: 3rem;

    /*padding: 1.5rem;

    border:
        1px solid var(--border);

    border-radius: 0.9rem;

    background: var(--surface);

    box-shadow: var(--shadow);*/
}

.featured-tags h2 {
    margin-top: 0;
}

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

.tag {
    display: inline-block;

    padding: 0.3rem 0.7rem;

    border:
        1px solid var(--border);

    border-radius: 999px;

    background: var(--background);

    color: var(--text-secondary);

    font-size: 0.85rem;

    text-decoration: none;

    background: var(--surface);
}

.tag:hover {
    background: var(--surface-hover);
    color: var(--text);
}


.featured-tags .tag {
    text-transform:capitalize;
    padding:1rem;
    font-size:1.05rem;
    border-radius: 0.9rem;
}

.featured-tags .tag:after {
    content:"\1F862";
    padding-left:0.5rem;
}


/* =========================================================
   Article listing
   ========================================================= */

.article-list h2 {
    margin-bottom: 1rem;
}

.article-cards {
    display: grid;
    gap: 1rem;
}

.article-card {
    padding: 1.4rem 1.5rem;

    border:
        1px solid var(--border);

    border-radius: 0.9rem;

    background: var(--surface);

    box-shadow: var(--shadow);
}

.article-card h3 {
    margin: 0 0 0.4rem;

    font-size: 1.25rem;
}

.article-card h3 a {
    color: var(--text);
    text-decoration: none;
}

.article-card h3 a:hover {
    color: var(--accent);
}

.article-card p {
    color: var(--text-secondary);
}

.article-card-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}




.collection-article-list {
    margin-top: 0.4rem;
    margin-bottom: 1rem;

    padding-left: 1.5rem;

    color: var(--text-secondary);
}

.collection-article-list li {
    margin: 0.2rem 0;
}

.collection-article-list a {
    color: var(--text-secondary);
}

.collection-article-description {
    margin-top: 0.25rem;

    color: var(--text-muted);
    font-size: 0.9rem;
}


.collection-articles {
    max-width: 820px;
    margin: 0 auto;
}

.collection-article-list {
    padding-left: 1.5rem;
}

.collection-article-list li {
    margin: 0.4rem 0;
}



/* =========================================================
   Individual articles
   ========================================================= */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;

    margin-bottom: 1.5rem;

    color: var(--text-muted);
    font-size: 0.85rem;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb span[aria-hidden="true"] {
    color: var(--text-muted);
}



.article {
    max-width: 820px;
    margin: 0 auto;
}

.article-header {
    margin-bottom: 3rem;
}

.article-header h1 {
    margin-bottom: 0.6rem;

    font-size: 2.8rem;
    line-height: 1.15;
}

.article-description {
    margin-top: 0;

    color: var(--text-secondary);

    font-size: 1.1rem;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 1rem;

    margin: 1rem 0;
}

.article-authors {
    color: var(--text-secondary);
}

.article-content {
    font-family:var(--font-serif);

    font-size: 1.08rem;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    margin-top: 2.5rem;

    line-height: 1.3;

    font-family:var(--font-sans);
}

.article-content img {
    max-width: 100%;
    height: auto;

    border-radius: 0.5rem;
}

.article-content code {
    padding: 0.15rem 0.3rem;

    border-radius: 0.25rem;

    background: var(--code-background);

    font-size: 0.9em;
}

.article-content pre {
    overflow-x: auto;

    padding: 1rem;

    border-radius: 0.6rem;

    background: var(--code-background);
}

.article-content pre code {
    padding: 0;

    background: transparent;
}

.article-content blockquote {
    margin-left: 0;
    padding-left: 1.25rem;

    border-left:
        3px solid var(--border);

    color: var(--text-secondary);
}

.article-content table {
    width: 100%;

    border-collapse: collapse;

    margin: 1.5rem 0;
}

.article-content th,
.article-content td {
    padding: 0.55rem 0.75rem;

    border:
        1px solid var(--border);
}

.article-content th {
    background: var(--code-background);
}


/* =========================================================
   Taxonomies
   ========================================================= */

.taxonomy-list {
    display: grid;
    gap: 1rem;
}

.taxonomy-entry {
    padding: 1.25rem 1.5rem;

    border:
        1px solid var(--border);

    border-radius: 0.8rem;

    background: var(--surface);

    box-shadow: var(--shadow);
}

.taxonomy-entry h2 {
    margin: 0;
}

.taxonomy-entry h2 a {
    color: var(--text);
    text-decoration: none;
}

.taxonomy-entry h2 a:hover {
    color: var(--accent);
}

.taxonomy-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}


/* =========================================================
   Footer
   ========================================================= */

.site-footer {
    max-width: 1150px;

    margin: 0 auto;

    padding: 2rem 1.5rem;

    color: var(--text-muted);

    font-size: 0.85rem;
}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 700px) {

    html {
        font-size: 16px;
    }

    .site-header-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-nav {
        width: 100%;

        flex-wrap: wrap;
    }

    .site-main {
        padding-top: 1rem;
    }

    .landing {
        margin: 2rem auto;
    }

    .landing-header h1 {
        font-size: 2.3rem;
    }

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

    .article-header h1 {
        font-size: 2.2rem;
    }

}





/* =========================================================
   SVG
   ========================================================= */



.svg-container {
    display: flex;
    justify-content: center;
}


.svg-container svg {
    /*width:70%;*/
}




.svg-text {
    stroke:var(--text) !important;
}

.svg-stroke-text {
    stroke:var(--text) !important;
}

.svg-fill-text {
    fill:var(--text) !important;
}

.svg-fill-accent {
    fill:var(--accent);
}

.svg-stroke-accent {
    stroke:var(--accent);
}



.katex {
    font-size:1.1em !important;
}