/* Main styles for the tutorial site */
:root {
    --primary: #245ea8;
    --primary-dark: #164374;
    --text: #222831;
    --text-light: #616161;
    --bg: #ffffff;
    --bg-soft: #f6f7f9;
    --bg-code: #f3f4f6;
    --border: #d9dee7;
    --accent: #b25c2b;
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    max-width: 980px;
    margin: 0 auto;
    padding: 24px;
}

h1, h2, h3 {
    color: var(--text);
    margin-top: 1.5em;
}

h1 { font-size: 2.1em; margin: 0 0 0.25em; }
h2 { font-size: 1.35em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
h3 { font-size: 1.2em; }

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

a:hover {
    text-decoration: underline;
}

/* Breadcrumb navigation */
.breadcrumb {
    color: var(--text-light);
    font-size: 0.9em;
    margin-bottom: 1.5em;
    display: flex;
    gap: 0.5em;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-light);
}

.page-header {
    margin-bottom: 1em;
}

.chapter-label {
    color: var(--accent);
    font-weight: 700;
    margin: 0 0 0.35em;
    text-transform: uppercase;
    letter-spacing: 0;
    font-size: 0.85em;
}

.subtitle {
    color: var(--text-light);
    margin-top: 0;
}

.chapter-toc {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1em 1.25em;
    margin: 1.5em 0 2em;
}

.chapter-toc h2 {
    margin: 0 0 0.5em;
    border: 0;
    padding: 0;
    font-size: 1.05em;
}

.chapter-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.25em 1em;
}

.chapter-toc li {
    padding: 0.2em 0;
}

.chapter-toc li.current a {
    color: var(--text);
    font-weight: 700;
}

/* Description block */
.description {
    background: var(--bg-soft);
    border-left: 4px solid var(--primary);
    padding: 1em;
    margin: 1em 0;
    border-radius: 0 4px 4px 0;
}

/* Page sections */
.page-section {
    margin: 2em 0;
}

/* Code blocks */
.code-example {
    margin: 1em 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.variant-controls {
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    padding: 0.65em 1em;
    font-size: 0.9em;
}

.variant-controls label {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    color: var(--text-light);
    font-weight: 600;
}

.variant-controls select {
    font: inherit;
    color: var(--text);
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25em 1.8em 0.25em 0.5em;
}

.inline-variant-select {
    font: inherit;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 0 1.4em 0 0.25em;
    min-width: 3.2em;
}

/* Code example tabs */
.code-tabs {
    display: flex;
    align-items: center;
    gap: 0.25em;
    background: var(--bg-code);
    padding: 0.5em 1em;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: 0.4em 0.8em;
    border: 1px solid var(--border);
    border-radius: 4px 4px 0 0;
    background: var(--bg);
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.85em;
    font-family: inherit;
}

.tab-btn:hover {
    background: var(--bg-code);
    color: var(--text);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.code-tabs .filename {
    margin-left: auto;
    font-family: monospace;
    font-size: 0.85em;
    color: var(--text-light);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.source-variant,
.play-variant {
    display: none;
}

.source-variant.active,
.play-variant.active {
    display: block;
}

.tab-content.play iframe.play-variant.active {
    width: 100%;
    height: 400px;
    background: #1e1e1e;
    border: none;
}

.tab-content.play .execvis-embed.play-variant.active {
    display: block;
    width: 100%;
    min-height: 320px;
    background: #1e1e1e;
    overflow-x: auto;
}

pre {
    margin: 0;
    padding: 1em;
    background: var(--bg-code);
    overflow-x: auto;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.9em;
}

/* Help markers - info icon with click-to-toggle tooltip */
.help-marker {
    display: inline-block;
    margin-left: 0.5em;
    color: var(--primary);
    cursor: pointer;
    font-style: normal;
    user-select: none;
}

.help-marker:hover {
    color: var(--primary-dark);
}

.help-tooltip {
    display: none;
    background: #333;
    color: white;
    padding: 0.5em 0.75em;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: system-ui, sans-serif;
    white-space: pre-wrap;
    max-width: 400px;
    margin-top: 0.25em;
    margin-left: 2em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.help-tooltip.show {
    display: block;
}

/* Concepts */
.concept {
    background: #fff3e0;
    border-left: 4px solid #f57c00;
    padding: 0.75em 1em;
    margin: 0.75em 0;
    border-radius: 0 4px 4px 0;
}

.concept-name {
    color: #e65100;
}

/* Exercises */
.exercise {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 1em;
    margin: 1em 0;
    border-radius: 0 4px 4px 0;
}

.exercise h3 {
    margin-top: 0;
    color: #2e7d32;
}

/* Diagrams */
.diagram {
    margin: 1em 0;
    text-align: center;
}

.diagram svg {
    max-width: 100%;
    height: auto;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    gap: 1em;
    margin-top: 3em;
    padding-top: 1em;
    border-top: 1px solid var(--border);
}

.pagination a {
    display: inline-block;
    padding: 0.5em 1em;
    background: var(--bg-code);
    border-radius: 4px;
}

.pagination .toc-link {
    margin-left: auto;
    margin-right: auto;
}

/* Index pages */
.index h1 {
    color: var(--primary);
}

.chapter {
    margin: 2em 0;
}

.chapter h2 {
    color: var(--text);
}

.page-list {
    list-style: none;
    padding: 0;
}

.page-list li {
    padding: 0.5em 0;
    border-bottom: 1px solid var(--border);
}

/* Footer */
footer {
    margin-top: 3em;
    padding-top: 1em;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 0.85em;
    text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 14px;
    }

    h1 { font-size: 1.5em; }
    h2 { font-size: 1.2em; }
    .pagination {
        flex-direction: column;
    }
    .pagination .toc-link {
        margin: 0;
    }
}
