/* Verso variables */

:root {
    --verso-code-font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    --verso-text-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--verso-text-font-family);
    line-height: 1.6;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

/* Layout container */
.layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-content {
    padding: 1rem;
}

/* Mobile-specific sidebar content spacing */
@media (max-width: 768px) {
    .sidebar-content {
        padding-top: 4rem;
        /* Space for hamburger menu */
    }
}

/* Module tree styling */
.module-tree {
    font-family: var(--verso-code-font-family);
    font-size: 0.875rem;
}

.module-tree details {
    margin-left: 1rem;
}

/*
.module-tree details[open]>summary {
  margin-bottom: 0.5rem;
}
*/

.module-tree summary {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    list-style: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.module-tree summary:hover {
    background-color: #e9ecef;
}

.module-tree summary a {
    color: #0066cc;
    text-decoration: none;
}

.module-tree summary a:hover {
    text-decoration: underline;
}

.module-tree summary.current {
    background-color: #0066cc;
    color: white;
}

.module-tree summary.current a {
    color: white;
}

.module-tree summary::before {
    content: "▶";
    position: absolute;
    left: -0.75rem;
    transition: transform 0.2s ease;
    font-size: 0.75rem;
    color: #6c757d;
}

.module-tree details[open] > summary::before {
    transform: rotate(90deg);
}

.module-tree .leaf {
    margin-left: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.module-tree .leaf a {
    color: #0066cc;
    text-decoration: none;
}

.module-tree .leaf a:hover {
    text-decoration: underline;
}

.module-tree .current {
    background-color: #0066cc;
    color: white;
}

.module-tree .current a {
    color: white;
}

/* Main content area */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Title bar */
.title-bar {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
    position: relative;
}

.breadcrumbs {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.9rem;
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
    content: "·";
    margin: 0;
    color: #6c757d;
    font-weight: bold;
}

.breadcrumbs a {
    color: #0066cc;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.breadcrumbs a:hover {
    background-color: #e3f2fd;
    text-decoration: underline;
}

.breadcrumbs .current {
    font-weight: 600;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Code content area */
.code-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: #ffffff;
    color: #24292e;
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    font-size: 1rem;
}

.code-content .verso-text,
.code-content .md-text {
    /* Indent by the width of "O" in the monospace font, times the specified indentation */
    margin-left: calc(var(--indent, 0) * 1ch);
    padding: 0.25rem 0.5rem;
    max-width: 40em;
    border: 1px solid #ddd;
    border-radius: 1rem;
    width: max-content;
}

.code-content .verso-text::before,
.code-content .md-text::before {
    content: "/--";
    display: block;
    width: min-content;
}

.code-content .verso-text.mod-doc::before,
.code-content .md-text.mod-doc::before {
    content: "/-!";
    display: block;
    width: min-content;
}

.code-content .verso-text::after,
.code-content .md-text::after {
    content: "-/";
    display: block;
    width: min-content;
}

.code-content .verso-text > *,
.code-content .md-text > * {
    width: max-content;
    max-width: 100%;
}

.code-content .verso-text > *,
.code-content .md-text > * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin-bottom: 0.5rem;
    display: block;
}

.code-content .verso-text > *:last-child,
.code-content .md-text > *:last-child {
    margin-bottom: 0;
}

.code-content .verso-text ul,
.code-content .md-text ul {
    padding-left: 1.5em;
}

.code-content .verso-text ul > li,
.code-content .md-text ul > li {
    margin-bottom: 0.5rem;
}

.code-content .verso-text ul > li:last-child,
.code-content .md-text ul > li:last-child {
    margin-bottom: 0;
}

.code-content .verso-text dt,
.code-content .md-text dt {
    padding-left: 0.5em;
    font-weight: bold;
}

.code-content .verso-text dd,
.code-content .md-text dd {
    padding-left: 1.5em;
}

.code-content .verso-text dd:not(:last-child),
.code-content .md-text dd:not(:last-child) {
    margin-bottom: 0.5rem;
}

pre,
.code-content .verso-text pre {
    font-family: var(--verso-code-font-family, monospace);
}

/* Hamburger menu (hidden by default) */
.menu-toggle {
    display: none;
}

.hamburger {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #333;
    margin: 4px 0;
    transition: 0.3s;
}

/* Mobile styles */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .menu-toggle:checked + .hamburger + .layout .sidebar {
        left: 0;
    }

    .menu-toggle:checked + .hamburger span:nth-child(1) {
        transform: translate(0px, 6px) rotate(45deg);
    }

    .menu-toggle:checked + .hamburger span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle:checked + .hamburger span:nth-child(3) {
        transform: translate(0px, -6px) rotate(-45deg);
    }

    .main-area {
        width: 100%;
    }

    .title-bar {
        padding-left: 4rem;
        /* Space for hamburger */
    }

    /* Overlay when menu is open */
    .menu-toggle:checked + .hamburger + .layout::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}
