:root {
    /* Light theme defaults */
    --bg: #f7f7f9;
    --bg-elevated: #ffffff;
    --bg-soft: #f0f2f5;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #0f766e;
    --accent-soft: rgba(15, 118, 110, 0.1);
    --border: #e2e8f0;
    --border-soft: #e5e7eb;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
    --hover-bg: #e5f4f3;
}


body[data-theme="dark"] {
    /* Dark graphite base with same turquoise accent as light mode */
    --bg: #1A1A1A;
    --bg-elevated: #000000;
    --bg-soft: #050814;
    --text-primary: #f9fafb;

    --text-secondary: #e5e7eb;

    --text-muted: #64748b;

    --accent: #0f766e;
    --accent-soft: rgba(15, 118, 110, 0.22);
    --border: #1f2937;
    --border-soft: #292929;
    --shadow-soft: 0 24px 70px rgba(0, 0, 0, 0.85);
    --hover-bg: #111827;
}


* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: "Inter", -apple-system, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    line-height: 1.6;
}

body.toast-open {
    overflow: hidden;
}

/* Layout shell */

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 40px 20px 48px;
}

/* Header & Intro */

header {
    margin-bottom: 40px;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Status pill */

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-soft);
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(15, 118, 110, 0.25);
}

body[data-theme="dark"] .status {
    border-color: rgba(26, 26, 26, 0.4);
}

.dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--accent);
}

.status-text {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
}

/* Theme toggle button */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.02);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease-out, border-color 0.15s ease-out,
        box-shadow 0.15s ease-out, color 0.15s ease-out, transform 0.08s ease-out;
}

.theme-toggle-icon {
    font-size: 13px;
    line-height: 1;
}

.theme-toggle-label {
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.theme-toggle:hover {
    background: var(--hover-bg);
    border-color: var(--accent);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
    transform: translateY(-0.5px);
}

body[data-theme="dark"] .theme-toggle {
    background: rgba(15, 23, 42, 0.9);
    border-color: var(--border-soft);
}

/* Intro text */

.bio {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 10px;
    margin-bottom: 24px;
    max-width: 560px;
}

.bio strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Generic sections */

section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.section-title span.section-count {
    font-weight: 500;
}

.list {
    display: flex;
    flex-direction: column;
}

/* List items (legacy) */

.item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px 0;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: all 0.16s ease-out;
}

a.item:hover {
    padding-left: 8px;
    border-bottom-color: var(--text-muted);
}

.item-title {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 400;
}

.item-meta {
    color: var(--text-muted);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.no-link {
    cursor: default;
}

/* Footer */

footer {
    margin-top: 40px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

footer p {
    font-size: 12px;
    color: var(--text-muted);
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    transition: color 0.15s ease-out;
}

footer a:hover {
    color: var(--text-secondary);
}

/* Category filter pills */

#categoryFilters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    padding: 7px 14px;
    background: rgba(15, 23, 42, 0.02);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.16s ease-out;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--accent-soft);
}

.filter-btn.active {
    background: var(--accent);
    color: #ecfeff;
    border-color: var(--accent);
    box-shadow: 0 12px 30px rgba(15, 118, 110, 0.45);
}

/* Search input */

#searchInput {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.16s ease-out, box-shadow 0.16s ease-out,
        background-color 0.16s ease-out;
}

#searchInput::placeholder {
    color: var(--text-muted);
}

#searchInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.2);
}

/* Tree view styles */

.tree-view {
    font-size: 14px;
}

.tree-category {
    margin-bottom: 16px;
}

.tree-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.16s ease-out;
    user-select: none;
}

.tree-category-header:hover {
    background: var(--hover-bg);
    border-color: var(--accent-soft);
}

.tree-subcategory {
    margin-left: 24px;
    margin-top: 8px;
}

.tree-subcategory-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: transparent;
    border-left: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.16s ease-out;
    user-select: none;
}

.tree-subcategory-header:hover {
    background: rgba(15, 23, 42, 0.02);
    border-left-color: var(--accent);
}

.tree-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.16s ease-out;
    width: 12px;
    display: inline-block;
}

.tree-label {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.tree-count {
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.14);
    padding: 2px 8px;
    border-radius: 999px;
}

.tree-children {
    margin-top: 8px;
    margin-left: 8px;
}

.tree-items {
    margin-left: 24px;
    margin-top: 4px;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin: 2px 0;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.16s ease-out;
    border-left: 2px solid transparent;
}

.tree-item:hover {
    background: rgba(15, 23, 42, 0.02);
    color: var(--text-primary);
    border-left-color: var(--accent);
    padding-left: 16px;
}

.tree-file-icon {
    font-size: 14px;
    opacity: 0.75;
}

.tree-item-title {
    font-size: 14px;
    line-height: 1.4;
}

/* Toast modal */

.toast-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: radial-gradient(circle at 50% 0%,
            rgba(15, 118, 110, 0.16),
            transparent 60%),
        rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease-out;
    z-index: 1000;
}

.toast-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.toast-card {
    position: relative;
    width: min(1100px, 96vw);
    max-width: 96vw;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px 24px;
    box-shadow: var(--shadow-soft);
    transform: translateY(24px);
    opacity: 0;
    transition: transform 0.18s ease-out, opacity 0.18s ease-out;
}

.toast-overlay.active .toast-card {
    transform: translateY(0);
    opacity: 1;
}

.toast-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 36px 6px 0;
    color: var(--text-primary);
}

.toast-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 10px;
}

.toast-body {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    max-height: 64vh;
    overflow-y: auto;
}

/* Headings inside toast */

.toast-body h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 16px 0;
    line-height: 1.3;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.toast-body h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 12px 0;
    line-height: 1.3;
}

.toast-body h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 16px 0 10px 0;
    line-height: 1.3;
}

.toast-body h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 14px 0 8px 0;
    line-height: 1.3;
}

.toast-body h5 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 12px 0 6px 0;
    line-height: 1.3;
}

.toast-body h6 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 10px 0 6px 0;
    line-height: 1.3;
}

/* Paragraphs in toast */

.toast-body p {
    margin: 0 0 12px 0;
    line-height: 1.7;
}


/* Code blocks and inline code */

/* Used by inline `code` spans in markdown (e.g., Topic Tags) */


.toast-body code {

    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: "SF Mono", "Menlo", "Monaco", "Consolas", "Liberation Mono",

        "Courier New", monospace;

}

/* Light theme: dark pill with white text for topic tags and inline code */
body[data-theme="light"] .toast-body code {
    background: #f9fafb;
    color: #020617;
}

/* Dark theme: keep a softer dark background with turquoise accent */
body[data-theme="dark"] .toast-body code {
    background: #020617;
    color: #f9fafb;
}


.toast-body pre {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
}

.toast-body pre code {
    background: transparent;
    padding: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    display: block;
}

/* Text formatting */

.toast-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.toast-body em {
    color: var(--accent);
    font-style: italic;
}

/* Lists in toast */

.toast-body ul,
.toast-body ol {
    margin: 12px 0;
    padding-left: 24px;
}

.toast-body ul {
    list-style-type: disc;
}

.toast-body ol {
    list-style-type: decimal;
}

.toast-body li {
    margin: 6px 0;
    line-height: 1.6;
    color: var(--text-secondary);
}

.toast-body li::marker {
    color: var(--accent);
}

/* Links in toast */

.toast-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease-out;
}

.toast-body a:hover {
    border-color: var(--accent);
}

/* Toast close button */

.toast-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease-out, color 0.15s ease-out,
        border-color 0.15s ease-out, transform 0.08s ease-out;
}

.toast-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--accent);
    transform: translateY(-0.5px);
}

/* Responsive tweaks */

@media (max-width: 640px) {
    .container {
        padding: 28px 16px 36px;
    }

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

    footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
