/**
 * Lexikon graphics — inline SVG below the definition (inc/lexikon-graphics.php).
 * The SVGs carry only structure; colours and fonts are set here from theme
 * tokens so every graphic reads as one system with the rest of the site.
 */

.lex-graphic {
    width: 100%;
    margin: 0 0 var(--wp--preset--spacing--48);
    min-width: 0;
}

/* The frame scrolls on narrow screens and must never size its parents. */
.lex-graphic__frame {
    box-sizing: border-box;
    contain: inline-size;
    padding: clamp(var(--wp--preset--spacing--16), 3vw, var(--wp--preset--spacing--32));
    overflow-x: auto;
    background: var(--wp--preset--color--card);
    border: 1px solid color-mix(in srgb, var(--wp--preset--color--text-main) 8%, transparent);
}

.lex-graphic__frame svg {
    display: block;
    width: 100%;
    height: auto;
}

.lex-graphic__caption {
    margin: var(--wp--preset--spacing--12) 0 0;
    font-size: var(--wp--preset--font-size--sm);
    line-height: 1.55;
    color: var(--wp--preset--color--text-muted);
}

/* Narrow screens: keep the labels legible, let the graphic scroll sideways. */
@media (max-width: 640px) {
    .lex-graphic__frame svg {
        min-width: 34rem;
    }
}

/* ── Tokens inside the SVGs ── */

.lxg text {
    font-family: var(--wp--preset--font-family--body);
    font-size: 16px;
    fill: var(--wp--preset--color--text-main);
}

.lxg .lxg-h {
    font-family: var(--wp--preset--font-family--heading);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.lxg .lxg-m {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    letter-spacing: 0.04em;
}

.lxg .lxg-s {
    font-size: 14px;
}

.lxg .lxg-xs {
    font-size: 12px;
}

.lxg .lxg-b {
    font-weight: 600;
}

.lxg .lxg-muted { fill: var(--wp--preset--color--text-muted); }
.lxg .lxg-light { fill: var(--wp--preset--color--text-light); }
.lxg .lxg-accent { fill: var(--wp--preset--color--accent); }
.lxg .lxg-blue { fill: var(--wp--preset--color--hero-blue); }
.lxg .lxg-green { fill: var(--wp--preset--color--status-green); }
.lxg .lxg-white { fill: #fff; }

.lxg .lxg-card {
    fill: var(--wp--preset--color--card);
    stroke: color-mix(in srgb, var(--wp--preset--color--text-main) 14%, transparent);
    stroke-width: 1;
}

.lxg .lxg-card.is-current {
    stroke: var(--wp--preset--color--accent);
    stroke-width: 2;
}

.lxg .lxg-paper { fill: var(--wp--preset--color--bg); }
.lxg .lxg-surface { fill: var(--wp--preset--color--surface); }
.lxg .lxg-chip-green { fill: var(--wp--preset--color--green-100); }
.lxg .lxg-chip-accent { fill: var(--wp--preset--color--accent-100); }
.lxg .lxg-chip-yellow { fill: var(--wp--preset--color--yellow-100); }
.lxg .lxg-chip-blue { fill: var(--wp--preset--color--blue-100); }
.lxg .lxg-fill-accent { fill: var(--wp--preset--color--accent); }
.lxg .lxg-fill-ink { fill: var(--wp--preset--color--text-main); }

.lxg .lxg-line {
    fill: none;
    stroke: var(--wp--preset--color--text-main);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lxg .lxg-line-muted { stroke: var(--wp--preset--color--text-light); }
.lxg .lxg-line-accent { stroke: var(--wp--preset--color--accent); }
.lxg .lxg-line-green { stroke: var(--wp--preset--color--status-green); }
.lxg .lxg-line-thick { stroke-width: 2.5; }
.lxg .lxg-dash { stroke-dasharray: 4 6; }

.lxg .lxg-arrow { fill: var(--wp--preset--color--text-main); }
.lxg .lxg-arrow-muted { fill: var(--wp--preset--color--text-light); }
.lxg .lxg-tri { fill: var(--wp--preset--color--text-light); }

@media (forced-colors: active) {
    .lxg .lxg-card,
    .lxg .lxg-paper,
    .lxg .lxg-surface {
        fill: Canvas;
        stroke: CanvasText;
    }

    .lxg text { fill: CanvasText; }
}
