/* Styles for the "how this demo works" explainer pages (src/info/*.html). */

:root {
    --code-bg: #0d1117;
}

.nav .back-link {
    font-size: 0.8125rem;
}

.info-content {
    padding-bottom: 2rem;
}

.info-content h2 {
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--accent);
}

.info-content h2:first-child {
    margin-top: 0;
}

.info-content p,
.info-content li {
    font-size: 0.9375rem;
    color: var(--text);
}

.info-content p {
    margin-bottom: 0.75rem;
}

.info-content ol,
.info-content ul {
    margin: 0 0 1rem 1.25rem;
}

.info-content code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.8125rem;
    background: var(--bg-elevated-2);
    padding: 1px 5px;
    border-radius: 3px;
}

.info-content .file-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-faint);
    margin-bottom: 0.35rem;
}

/* Code blocks — gradient top edge, drop shadow, and a "Copy" button,
   matching the study-notes code style. */

.info-content pre {
    position: relative;
    margin: 1.25rem 0;
    padding: 1.15rem 1.1rem 1rem;
    overflow-x: auto;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.info-content pre::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(90deg, var(--accent), #64b5f6);
}

.info-content pre code {
    display: block;
    background: none;
    padding: 0;
    font-size: 0.8125rem;
    line-height: 1.7;
    color: #dce4ec;
    white-space: pre;
}

.info-content .copy-code {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-elevated-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.info-content .copy-code:hover {
    color: var(--text);
    border-color: var(--accent);
}

.info-content .copy-code.copied {
    color: var(--accent);
    border-color: var(--accent);
}

/* Request-flow diagram — plain boxes + arrows, no external dependency. */

.flow-diagram {
    display: flex;
    align-items: stretch;
    gap: 0.6rem;
    margin: 1rem 0 1.75rem;
}

.flow-diagram.flow-vertical {
    flex-direction: column;
    align-items: center;
}

.flow-diagram.flow-vertical .flow-step {
    width: 100%;
    max-width: 380px;
}

.flow-step {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    background: var(--bg-elevated-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
    text-align: center;
}

.flow-step .flow-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
}

.flow-step .flow-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.flow-arrow,
.flow-arrow-down {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--text-faint);
    font-size: 1.25rem;
}

.flow-branch {
    display: flex;
    flex: 1 1 0;
    width: 100%;
    max-width: 480px;
    gap: 0.6rem;
}

.flow-branch .flow-step {
    }

@media (max-width: 720px) {
    .flow-diagram {
        flex-direction: column;
    }

    .flow-branch {
        flex-direction: column;
    }

    .flow-arrow {
        transform: rotate(90deg);
    }
}

/* Code-flow diagram — a Mermaid flowchart rendered inside a card, showing
   which function calls which and what data passes along each arrow. */

.mermaid-wrap {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0 1.75rem;
    overflow-x: auto;
}

.mermaid-wrap .mermaid {
    display: flex;
    justify-content: center;
}

.mermaid-wrap .mermaid svg {
    min-width: 560px;
    max-width: 100%;
}

.mermaid-wrap .mermaid text,
.mermaid-wrap .mermaid .label,
.mermaid-wrap .mermaid .nodeLabel,
.mermaid-wrap .mermaid .edgeLabel,
.mermaid-wrap .mermaid .label foreignObject div,
.mermaid-wrap .mermaid .nodeLabel p,
.mermaid-wrap .mermaid .edgeLabel p {
    font-size: 12px !important;
    white-space: normal;
}

.mermaid-wrap .mermaid .label foreignObject div {
    line-height: 1.45;
    padding-block: 2px;
}

.mermaid-wrap .mermaid .edgeLabel {
    background-color: #1e1e1e;
}

.mermaid-wrap .mermaid .edgeLabel .label foreignObject div,
.mermaid-wrap .mermaid .edgeLabel p {
    background-color: #1e1e1e;
    padding: 2px 6px;
    border-radius: 4px;
}

@media (max-width: 720px) {
    .mermaid-wrap {
        padding: 0.75rem;
    }

    .mermaid-wrap .mermaid {
        justify-content: flex-start;
    }

    .mermaid-wrap .mermaid svg {
        min-width: 440px;
    }

    .mermaid-wrap .mermaid .label foreignObject div {
        line-height: 1.35;
    }
}