/* ===========================================================
   tanso.wiki - documentation clean slate
   Palette:
     #ffffff white
     #1f2937 text
     #2563eb link
     #f9fafb surface
     #d1d5db border
     #ecfdf5 callout
     #10b981 callout border
   Fonts: Inter (display), Noto Sans (body), Source Code Pro (code)
   =========================================================== */

:root {
    --white: #ffffff;
    --text: #1f2937;
    --text-muted: #4b5563;
    --link: #2563eb;
    --link-hover: #1d4ed8;
    --surface: #f9fafb;
    --surface-2: #f3f4f6;
    --border: #d1d5db;
    --border-strong: #9ca3af;
    --callout: #ecfdf5;
    --callout-border: #10b981;
    --callout-deep: #047857;

    --display: "Inter", "Helvetica Neue", Arial, sans-serif;
    --body: "Noto Sans", "Inter", Arial, sans-serif;
    --code: "Source Code Pro", ui-monospace, "SFMono-Regular", Menlo, monospace;

    --shell-max: 1200px;
    --col-side: 220px;
    --gap: 28px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--surface);
    color: var(--text);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.7;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--surface);
    color: var(--text);
}

a {
    color: var(--link);
    text-decoration: none;
}

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

code, pre {
    font-family: var(--code);
    font-size: 0.85rem;
}

pre.codeblock {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 4px solid var(--callout-border);
    padding: 14px 18px;
    overflow-x: auto;
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.55;
    margin: 18px 0;
}

p code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 6px;
}

/* ---------- Header ---------- */

.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 12px 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.15rem;
}

.brand:hover {
    text-decoration: none;
    color: var(--text);
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--callout);
    color: var(--callout-deep);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-weight: 700;
    border: 1px solid var(--callout-border);
}

.brand-text {
    letter-spacing: -0.01em;
}

.brand-dot {
    color: var(--callout-border);
}

.primary-nav {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.primary-nav a {
    color: var(--text);
    font-family: var(--display);
    font-weight: 500;
    font-size: 0.92rem;
    padding: 6px 8px;
    border-bottom: 2px solid transparent;
}

.primary-nav a:hover {
    color: var(--link);
    border-bottom-color: var(--callout-border);
    text-decoration: none;
}

.search {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    min-width: 320px;
}

.search input {
    flex: 1;
    border: 0;
    outline: 0;
    padding: 8px 12px;
    font-family: var(--body);
    font-size: 0.9rem;
    color: var(--text);
    background: transparent;
}

.search button {
    border: 0;
    border-left: 1px solid var(--border);
    background: var(--surface);
    padding: 0 14px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    height: 36px;
}

.search button:hover {
    background: var(--callout);
    color: var(--callout-deep);
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(31, 41, 55, 0.08);
    max-height: 320px;
    overflow-y: auto;
    z-index: 60;
}

.search-suggestions[hidden] {
    display: none;
}

.search-suggestions li {
    padding: 8px 14px;
    font-size: 0.92rem;
    cursor: pointer;
    color: var(--text);
}

.search-suggestions li:hover,
.search-suggestions li.active {
    background: var(--callout);
    color: var(--callout-deep);
}

.search-suggestions li mark {
    background: transparent;
    color: inherit;
    font-weight: 700;
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs {
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.breadcrumbs-inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 8px 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

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

.breadcrumbs .sep {
    color: var(--border-strong);
}

.breadcrumbs .current {
    color: var(--text);
    font-weight: 600;
}

/* ---------- Wiki shell (3-column) ---------- */

.wiki-shell {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 28px 20px 60px;
    display: grid;
    grid-template-columns: var(--col-side) 1fr var(--col-side);
    gap: var(--gap);
    align-items: start;
}

/* ---------- TOC sidebar (left) ---------- */

.toc-sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.toc-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px 18px;
}

.toc-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0 0 10px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.toc-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.55;
}

.toc-list ol {
    padding-left: 16px;
    margin: 4px 0 6px;
}

.toc-list li {
    margin: 3px 0;
}

.toc-list a {
    color: var(--text);
    border-left: 2px solid transparent;
    padding-left: 6px;
    margin-left: -8px;
    display: inline-block;
}

.toc-list a:hover {
    color: var(--link);
    text-decoration: none;
}

.toc-list a.active {
    color: var(--callout-deep);
    border-left-color: var(--callout-border);
    background: var(--callout);
    font-weight: 600;
}

.toc-meta h3 {
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0 0 8px;
}

.page-status {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.page-status li {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dashed var(--border);
}

.page-status li:last-child {
    border-bottom: 0;
}

.page-status strong {
    color: var(--text);
    font-weight: 600;
}

/* ---------- Article (center) ---------- */

.article {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 32px 36px 40px;
    min-width: 0;
}

.article-head {
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
    margin-bottom: 24px;
}

.kicker {
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--callout-deep);
    margin: 0 0 6px;
}

.article-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 2.2rem;
    line-height: 1.2;
    margin: 0 0 14px;
    color: var(--text);
    letter-spacing: -0.01em;
}

.article-lede {
    font-size: 1.02rem;
    margin: 0 0 10px;
    color: var(--text);
}

.article-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.dot-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border-strong);
    display: inline-block;
}

/* Sections */

.article-section {
    margin: 26px 0;
    scroll-margin-top: 90px;
}

.article-subsection {
    margin: 18px 0;
    scroll-margin-top: 90px;
}

.section-heading {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.45rem;
    margin: 0 0 12px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    position: relative;
}

.subsection-heading {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.12rem;
    margin: 16px 0 8px;
    color: var(--text);
    position: relative;
}

.section-anchor {
    color: var(--border-strong);
    margin-left: 8px;
    opacity: 0;
    font-weight: 400;
    font-size: 0.9em;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.section-heading:hover .section-anchor,
.subsection-heading:hover .section-anchor,
.section-anchor:focus {
    opacity: 1;
}

.section-anchor:hover {
    color: var(--link);
    text-decoration: none;
}

.article p {
    margin: 0 0 12px;
}

/* Lists */

.bulleted, .ordered {
    margin: 8px 0 14px;
    padding-left: 22px;
}

.bulleted li, .ordered li {
    margin: 4px 0;
}

/* Callouts */

.callout {
    border-left: 4px solid var(--callout-border);
    background: var(--callout);
    padding: 14px 18px;
    margin: 18px 0;
    border-radius: 0 4px 4px 0;
}

.callout-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 6px;
    color: var(--callout-deep);
}

.callout p {
    margin: 0;
    color: var(--text);
}

/* Data tables */

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.92rem;
    background: var(--white);
}

.data-table caption {
    caption-side: bottom;
    font-size: 0.82rem;
    color: var(--text-muted);
    padding-top: 6px;
    text-align: left;
}

.data-table th, .data-table td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.data-table thead th {
    background: var(--surface);
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.data-table tbody tr:nth-child(even) {
    background: var(--surface);
}

/* Infobox */

.infobox {
    float: right;
    width: 280px;
    margin: 0 0 18px 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 0.86rem;
}

.infobox-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    margin: 0 0 2px;
    color: var(--text);
    background: var(--callout);
    border: 1px solid var(--callout-border);
    border-radius: 4px;
    padding: 6px 8px;
}

.infobox-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin: 4px 0 12px;
    font-size: 0.85rem;
}

.infobox-figure {
    margin: 0 0 12px;
    text-align: center;
}

.molecule-svg {
    width: 100%;
    max-width: 240px;
    height: auto;
}

.infobox-figure figcaption {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.infobox-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.infobox-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    padding: 5px 8px 5px 0;
    vertical-align: top;
    width: 45%;
    border-bottom: 1px solid var(--border);
}

.infobox-table td {
    text-align: right;
    color: var(--text);
    padding: 5px 0 5px 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    vertical-align: top;
}

.infobox-table .infobox-section {
    background: var(--surface);
    color: var(--callout-deep);
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
}

/* References */

.references {
    margin: 8px 0 0;
    padding-left: 22px;
    font-size: 0.88rem;
    color: var(--text);
}

.references li {
    margin: 6px 0;
    line-height: 1.55;
}

.references cite {
    font-style: normal;
    font-weight: 600;
    color: var(--text);
}

/* ---------- Related sidebar (right) ---------- */

.related-sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.related-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
}

.related-card h3 {
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.92rem;
    margin: 0 0 10px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.related-card ul {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.88rem;
}

.related-card ul li {
    padding: 4px 0;
    border-bottom: 1px dashed var(--border);
}

.related-card ul li:last-child {
    border-bottom: 0;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-list li {
    border: 1px solid var(--border) !important;
    border-radius: 999px;
    padding: 3px 10px !important;
    background: var(--surface);
}

.tag-list li a {
    color: var(--text);
    font-size: 0.8rem;
}

.related-stats .stat-list {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.86rem;
}

.related-stats .stat-list > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 6px;
}

.related-stats .stat-list > div:last-child {
    border-bottom: 0;
}

.related-stats dt {
    color: var(--text-muted);
}

.related-stats dd {
    margin: 0;
    font-family: var(--display);
    font-weight: 700;
    color: var(--text);
}

.related-stats dd span {
    color: var(--callout-deep);
}

.stat-source {
    margin: 10px 0 0;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.related-cite .cite-line {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 10px;
    line-height: 1.5;
}

.copy-cite {
    width: 100%;
    border: 1px solid var(--callout-border);
    background: var(--callout);
    color: var(--callout-deep);
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 7px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.copy-cite:hover {
    background: var(--callout-border);
    color: var(--white);
}

.copy-cite.copied {
    background: var(--callout-deep);
    border-color: var(--callout-deep);
    color: var(--white);
}

/* ---------- Footer ---------- */

.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer-inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 32px 20px 18px;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 28px;
}

.footer-col h4 {
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0 0 10px;
    color: var(--text);
}

.footer-col p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.86rem;
}

.footer-col ul li {
    padding: 3px 0;
    color: var(--text-muted);
}

.footer-col ul li a {
    color: var(--link);
}

.footer-meta ul li {
    color: var(--text-muted);
}

.footer-bottom {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 14px 20px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .wiki-shell {
        grid-template-columns: 200px 1fr;
    }
    .related-sidebar {
        grid-column: 1 / -1;
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
    }
}

@media (max-width: 820px) {
    .header-inner {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .primary-nav {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .search {
        min-width: 0;
        width: 100%;
    }
    .wiki-shell {
        grid-template-columns: 1fr;
    }
    .toc-sidebar {
        position: static;
    }
    .related-sidebar {
        grid-template-columns: 1fr;
        position: static;
    }
    .article {
        padding: 22px 18px 28px;
    }
    .infobox {
        float: none;
        width: 100%;
        margin: 0 0 18px;
    }
    .article-title {
        font-size: 1.7rem;
    }
    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 520px) {
    .footer-inner {
        grid-template-columns: 1fr;
    }
}
