:root {
    --zensical-hero-bg: linear-gradient(
        135deg,
        #0c1220 0%,
        #101b31 45%,
        #17284a 100%
    );
    --zensical-hero-accent: rgba(139, 181, 255, 0.18);
    --zensical-card-border: rgba(120, 147, 200, 0.22);
    --zensical-card-bg: rgba(255, 255, 255, 0.68);
    --zensical-card-bg-hover: rgba(255, 255, 255, 0.82);
    --zensical-card-border-hover: rgba(104, 129, 186, 0.42);
    --zensical-card-shadow: 0 0.75rem 1.5rem rgba(15, 23, 42, 0.08);
    --zensical-card-shadow-hover: 0 0.9rem 1.7rem rgba(15, 23, 42, 0.12);
}

[data-md-color-scheme="slate"] {
    --zensical-card-border: rgba(164, 185, 224, 0.28);
    --zensical-card-bg: rgba(22, 28, 41, 0.92);
    --zensical-card-bg-hover: rgba(28, 35, 50, 0.98);
    --zensical-card-border-hover: rgba(193, 209, 240, 0.44);
    --zensical-card-shadow: 0 0.85rem 1.8rem rgba(0, 0, 0, 0.28);
    --zensical-card-shadow-hover: 0 1rem 2rem rgba(0, 0, 0, 0.34);
}

/* ── Editor tab selector ────────────────────────────────────────────────── */

.zx-editor-radio {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.zensical-editor-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    padding: 0.6rem 0.8rem 0;
    border-bottom: 2px solid var(--md-default-fg-color--lightest);
    margin-bottom: 0;
}

.zensical-editor-selector label {
    padding: 0.3rem 0.75rem;
    border-radius: 0.25rem 0.25rem 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
    cursor: pointer;
    color: var(--md-default-fg-color--light);
    font-size: 0.8rem;
    user-select: none;
    transition:
        color 80ms,
        background 80ms;
}

.zensical-editor-selector label:hover {
    color: var(--md-default-fg-color);
    background: var(--md-default-fg-color--lightest);
}

/* Active tab: driven entirely by which radio is checked — no JS. */
#ed-vscode:checked ~ .zensical-editor-selector label[for="ed-vscode"],
#ed-cursor:checked ~ .zensical-editor-selector label[for="ed-cursor"],
#ed-zed:checked ~ .zensical-editor-selector label[for="ed-zed"] {
    color: var(--md-accent-fg-color);
    font-weight: 700;
    background: var(--md-default-bg-color);
    border-color: var(--md-default-fg-color--lightest);
    border-bottom-color: var(--md-default-bg-color);
}

.zx-env {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3em;
    position: relative;
    padding: 0 0.18em;
    border-radius: 0.2rem;
    background: rgba(82, 108, 254, 0.08);
    box-shadow: inset 0 0 0 1px rgba(82, 108, 254, 0.18);
    text-decoration-style: dotted;
    text-underline-offset: 0.18em;
}

.md-typeset abbr.zx-env {
    cursor: help;
    text-decoration: none;
}

.zx-env:focus-visible {
    outline: 2px solid var(--md-accent-fg-color);
    outline-offset: 2px;
}

.zx-env--output {
    font-weight: 700;
}

.no-js .zx-env::after,
.no-js .zx-env::before {
    position: absolute;
    left: 50%;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 0.15rem);
    transition:
        opacity 120ms ease,
        transform 120ms ease;
}

.no-js .zx-env::after {
    bottom: calc(100% + 0.45rem);
    width: max-content;
    max-width: min(32rem, calc(100vw - 1rem));
    padding: 0.55rem 0.7rem;
    border-radius: 0.25rem;
    background: var(--md-tooltip-bg-color, var(--md-default-fg-color));
    box-shadow: var(--md-shadow-z2);
    color: var(--md-tooltip-fg-color, var(--md-default-bg-color));
    content: attr(data-zx-tooltip-text);
    font-size: 0.64rem;
    line-height: 1.45;
    text-align: left;
    white-space: pre-line;
}

.no-js .zx-env::before {
    bottom: calc(100% + 0.2rem);
    border: 0.25rem solid transparent;
    border-top-color: var(--md-tooltip-bg-color, var(--md-default-fg-color));
    content: "";
}

.no-js .zx-env:hover::after,
.no-js .zx-env:hover::before,
.no-js .zx-env:focus-visible::after,
.no-js .zx-env:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, 0);
}

.zx-tooltip {
    position: fixed;
    z-index: 20;
    max-width: min(32rem, calc(100vw - 1rem));
    padding: 0.55rem 0.7rem;
    border-radius: 0.25rem;
    background: var(--md-tooltip-bg-color, var(--md-default-fg-color));
    box-shadow: var(--md-shadow-z2);
    color: var(--md-tooltip-fg-color, var(--md-default-bg-color));
    font-size: 0.64rem;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transform: translateY(0.15rem);
    transition:
        opacity 120ms ease,
        transform 120ms ease;
}

.zx-tooltip[data-zx-active] {
    opacity: 1;
    transform: translateY(0);
}

.hero {
    width: 100%;
    padding: 2.75rem 2rem;
    border-radius: 1.5rem;
    color: white;
    background:
        radial-gradient(
            circle at top right,
            var(--zensical-hero-accent),
            transparent 34%
        ),
        var(--zensical-hero-bg);
    box-shadow: 0 1.25rem 3rem rgba(10, 18, 37, 0.22);
    margin: 1.5rem auto 2rem;
}

.hero__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 0.8rem;
}

.hero h1 {
    margin: 0;
    max-width: 22ch;
    font-size: clamp(2.3rem, 4vw, 4.6rem);
    line-height: 0.98;
    letter-spacing: -0.05em;
    color: white;
}

.hero p {
    max-width: 68ch;
    margin-top: 1rem;
    margin-bottom: 0;
    font-size: 1.05rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.9);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.hero__actions .md-button {
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 999rem;
    padding: 0.65rem 1.15rem;
}

.hero__actions .md-button--primary {
    border: 1px solid rgba(255, 255, 255, 0.95);
}

/* ── Per-editor inline label variants ──────────────────────────────────── */

/*
 * zx-label--{editor} spans are emitted when a term, action, ui, or output
 * macro has different labels across editors. By default only the vscode
 * (default editor) variant is visible. When a radio is checked the same
 * hide-then-show pattern used for zx-for--{editor} blocks applies.
 */
.zx-label--cursor,
.zx-label--zed,
.zx-label--jetbrains {
    display: none;
}

:is(#ed-vscode, #ed-cursor, #ed-zed):checked
    ~ .md-content__inner
    .zx-label--vscode,
:is(#ed-vscode, #ed-cursor, #ed-zed):checked
    ~ .md-content__inner
    .zx-label--cursor,
:is(#ed-vscode, #ed-cursor, #ed-zed):checked
    ~ .md-content__inner
    .zx-label--zed,
:is(#ed-vscode, #ed-cursor, #ed-zed):checked
    ~ .md-content__inner
    .zx-label--jetbrains {
    display: none;
}

#ed-vscode:checked ~ .md-content__inner .zx-label--vscode {
    display: inline;
}
#ed-cursor:checked ~ .md-content__inner .zx-label--cursor {
    display: inline;
}
#ed-zed:checked ~ .md-content__inner .zx-label--zed {
    display: inline;
}

/* ── Editor-specific content blocks ────────────────────────────────────── */

/*
 * When any editor radio is checked (i.e. the selector is present on the
 * page), hide all editor blocks then show only the matching one.
 * When no radio is checked (no selector on the page), all blocks are visible
 * at their natural display value — no rule applies to hide them.
 */
:is(#ed-vscode, #ed-cursor, #ed-zed):checked
    ~ .md-content__inner
    .zx-for--vscode,
:is(#ed-vscode, #ed-cursor, #ed-zed):checked
    ~ .md-content__inner
    .zx-for--cursor,
:is(#ed-vscode, #ed-cursor, #ed-zed):checked ~ .md-content__inner .zx-for--zed {
    display: none;
}

#ed-vscode:checked ~ .md-content__inner .zx-for--vscode {
    display: block;
}
#ed-cursor:checked ~ .md-content__inner .zx-for--cursor {
    display: block;
}
#ed-zed:checked ~ .md-content__inner .zx-for--zed {
    display: block;
}

/* -------------------------------------------------------------------------
   Inline lookup widget. Uses <span> throughout so it is valid phrasing
   content and stays inside <p> without the browser ejecting it as a block.
   The panel is shown on hover or when focus is within the component.
   ------------------------------------------------------------------------- */

.zx-lookup {
    display: inline-block;
    position: relative;
}

.zx-lookup__trigger {
    display: inline-flex;
    align-items: baseline;
    border-radius: 0.3rem;
    cursor: pointer;
    user-select: none;
    padding-bottom: 0.1em;
    /*margin-bottom: -0.2em;*/
}

.zx-lookup__trigger:focus {
    outline: 2px solid var(--md-accent-fg-color);
    outline-offset: 2px;
}

.zx-lookup kbd {
    background-color: var(--md-default-bg-color);
    transition: all 250ms;
}

.zx-lookup:hover .zx-lookup__trigger kbd,
.zx-lookup:focus-within .zx-lookup__trigger kbd {
    color: var(--md-accent-fg-color);
    box-shadow:
        0 0 0 0.05rem var(--md-accent-fg-color),
        0 0.15rem 0 var(--md-accent-fg-color);
}

/* When there is no hover panel the label and shortcut are siblings rather than
   flex children, so the trigger's gap does not apply. */
.zx-lookup__label + .zx-lookup__shortcut {
    margin-left: 0.3em;
}

/* Panel: hidden by default, shown on hover or focus-within. */
.zx-lookup__panel {
    display: none;
    position: absolute;
    font-size: 0.85em;
    padding-top: 0.4rem;
    top: 100%;
    right: -9px;
    z-index: 100;
}

.zx-lookup:hover .zx-lookup__panel,
.zx-lookup:focus-within .zx-lookup__panel {
    display: block;
}

.zx-lookup__variants {
    display: flex;
    flex-direction: column;
    min-width: max-content;
    background: var(--md-default-bg-color);
    border-radius: 0.4rem;
    box-shadow: var(--md-shadow-z2);
    white-space: nowrap;
    overflow: hidden;
}

.zx-lookup__row {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.35rem 0.55rem;
    justify-content: space-between;
}

.zx-lookup__row + .zx-lookup__row {
    border-top: 1px solid var(--md-default-fg-color--lightest);
}

/* Progressive enhancement: only active when JS has set data-zx-os on the body. */
body[data-zx-os] .zx-lookup__row[data-zx-os] {
    cursor: pointer;
}

body[data-zx-os] .zx-lookup__row[data-zx-os]:hover {
    background: var(--md-default-fg-color--lightest);
}

.zx-lookup__os {
    min-width: 5em;
    color: var(--md-default-fg-color--light);
}

body[data-zx-os="macos"] .zx-lookup__row[data-zx-os="macos"],
body[data-zx-os="windows"] .zx-lookup__row[data-zx-os="windows"],
body[data-zx-os="linux"] .zx-lookup__row[data-zx-os="linux"] {
    background: var(--md-accent-fg-color--transparent);
}

body[data-zx-os="macos"] .zx-lookup__os[data-zx-os="macos"],
body[data-zx-os="windows"] .zx-lookup__os[data-zx-os="windows"],
body[data-zx-os="linux"] .zx-lookup__os[data-zx-os="linux"] {
    color: var(--md-accent-fg-color);
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
    margin: 1.25rem 0 2rem;
}

.page-card {
    display: block;
    padding: 1.1rem 1.1rem 1rem;
    border: 1px solid var(--zensical-card-border);
    border-radius: 1rem;
    background: var(--zensical-card-bg);
    backdrop-filter: blur(10px);
    color: inherit;
    text-decoration: none;
    transition:
        transform 120ms ease,
        box-shadow 120ms ease,
        border-color 120ms ease;
}

.md-typeset .page-card {
    text-decoration: none;
}

.page-card:hover {
    transform: translateY(-2px);
    border-color: var(--zensical-card-border-hover);
    background: var(--zensical-card-bg-hover);
    box-shadow: var(--zensical-card-shadow-hover);
}

.page-card h2 {
    margin: 0 0 0.45rem;
    font-size: 1.05rem;
    color: var(--md-typeset-a-color);
    text-decoration: underline;
}

.page-card p {
    margin: 0;
    line-height: 1.6;
    color: var(--md-default-fg-color);
    text-decoration: none;
}

.md-content .md-content__inner.md-typeset figure.fiftyright {
    display: block;
}

@media screen and (min-width: 960px) {
    .md-content .md-content__inner.md-typeset figure.fiftyright {
        float: right;
        width: 50% !important;
        margin-top: 0 !important;
        margin-right: 0 !important;
        margin-left: 1.25rem !important;
        margin-bottom: 1rem !important;
    }
}
