/* AST Explorer page: the code with X-Ray on the left, the pinned node on the right. Colors are the tokens of app.css. */

.ast {
    flex: 1;
    min-height: 0;
    display: grid;
    padding: 12px 16px 16px;
    /* the middle track holds the drag handle, see splitters.js */
    grid-template-columns: minmax(0, 0.56fr) var(--gutter) minmax(0, 0.44fr);
}

.ast-side {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 16px;
    display: grid;
    gap: 18px;
    align-content: start;
}

.ast-intro {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--fg-2);
}

.ast-intro b {
    color: var(--fg);
    font-weight: 600;
}

.ast-intro code {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--sunken);
    color: var(--fg);
}

.credit {
    font-size: 12px;
    color: var(--muted);
}

.credit a {
    color: var(--fg-2);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.xray-box.xray-box-pinned {
    background-image: none;
    border: 2px solid var(--focus);
    border-radius: 3px;
    background-color: color-mix(in oklab, var(--focus) 12%, transparent);
}

.xray-box-block.xray-box-pinned {
    border-radius: 5px;
    background-color: color-mix(in oklab, var(--focus) 5%, transparent);
}

.ast-details {
    display: grid;
    gap: 14px;
    color: var(--fg);
}

.ast-details:empty {
    display: none;
}

.ast-details-hint {
    margin: 0;
    color: var(--fg-2);
    font-size: 13px;
}

.ast-details-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--muted);
}

.ast-details-path .ast-node-link {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--sunken);
    color: var(--fg-2);
}

.ast-details-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.ast-details-kind {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.01em;
    overflow-wrap: anywhere;
}

.ast-details-unpin {
    font-size: 12px;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ast-details-unpin:hover {
    color: var(--fg);
}

.ast-details-target {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid color-mix(in oklab, var(--brand) 40%, transparent);
    background: color-mix(in oklab, var(--brand) 7%, transparent);
}

.ast-details-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
}

.ast-details-target-class {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--brand);
    user-select: all;
    overflow-wrap: anywhere;
}

.ast-dump {
    margin: 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--fg-2);
    overflow-x: auto;
}

.ast-dump-name {
    color: var(--muted);
}

.ast-dump-scalar {
    color: var(--uncovered);
}

.ast-node-link {
    color: var(--focus);
}

.ast-node-link:hover {
    text-decoration: underline;
}

.ast-node-link-active,
.ast-details-path .ast-node-link-active {
    color: var(--brand);
    font-weight: 700;
}

@media (max-width: 900px) {
    .ast {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px;
    }

    .ast .ed {
        height: 55vh;
        min-height: 300px;
        flex: none;
    }
}
