/* ═══════════════════════════════════════════════════════════════════════════
   Block Reference — visual mock & doc card styles
   ───────────────────────────────────────────────────────────────────────────
   Lightweight, dependency-free Blockly-inspired mock. We don't mount Blockly
   in the docs (way too heavy) — instead we render colored bracket-style
   nodes that read like a stack of blocks, with inline value pills and
   indented children for statement slots.
   Each shape gets its own outline so the eye reads container vs statement
   vs value at a glance, in both LTR and RTL.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --bd-radius: 0.6rem;
    --bd-radius-pill: 999px;
    --bd-pad-x: 0.85rem;
    --bd-pad-y: 0.55rem;
    --bd-gap: 0.45rem;
    --bd-indent: 1.1rem;
    --bd-text: #ffffff;
    --bd-shadow: 0 1px 0 rgba(0, 0, 0, 0.18) inset, 0 1px 2px rgba(15, 23, 42, 0.18);
}

/* ───── Card wrapper around a single block doc ───── */
.bd-card {
    border-radius: 1.25rem;
    border: 1px solid var(--color-border, #e2e8f0);
    background-color: var(--color-surface, #ffffff);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bd-card:hover {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.dark .bd-card {
    background-color: rgb(30 41 59);
    border-color: rgb(51 65 85);
}

.bd-card__head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.dark .bd-card__head {
    border-color: rgb(51 65 85);
}

.bd-card__chip {
    flex: 0 0 auto;
    width: 0.45rem;
    align-self: stretch;
    border-radius: var(--bd-radius-pill);
}

.bd-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text, #0f172a);
}

.dark .bd-card__title {
    color: rgb(241 245 249);
}

.bd-card__type {
    margin: 0.15rem 0 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.72rem;
    color: rgb(37 99 235);
    word-break: break-all;
}

.dark .bd-card__type {
    color: rgb(96 165 250);
}

.bd-card__shape-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.55rem;
    border-radius: var(--bd-radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(15, 23, 42, 0.06);
    color: rgb(51 65 85);
    align-self: flex-start;
}

.dark .bd-card__shape-pill {
    background: rgba(255, 255, 255, 0.08);
    color: rgb(203 213 225);
}

.bd-card__body {
    display: grid;
    gap: 1.1rem;
    padding: 1.1rem 1.25rem 1.4rem;
}

.bd-card__summary {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--color-text-secondary, #475569);
}

.dark .bd-card__summary {
    color: rgb(203 213 225);
}

.bd-section {
    display: grid;
    gap: 0.55rem;
}

.bd-section__label {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-muted, #64748b);
}

.dark .bd-section__label {
    color: rgb(148 163 184);
}

.bd-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

@media (min-width: 768px) {
    .bd-meta {
        grid-template-columns: 1fr 1fr;
    }
}

.bd-meta__cell {
    padding: 0.7rem 0.85rem;
    border-radius: 0.85rem;
    background: rgba(15, 23, 42, 0.035);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.dark .bd-meta__cell {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.bd-meta__label {
    margin: 0 0 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text-muted, #64748b);
}

.bd-meta__value {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--color-text, #0f172a);
}

.dark .bd-meta__value {
    color: rgb(226 232 240);
}

/* ───── Parameters table ───── */
.bd-params {
    border-radius: 0.85rem;
    overflow: hidden;
    border: 1px solid var(--color-border, #e2e8f0);
}

.dark .bd-params {
    border-color: rgb(51 65 85);
}

.bd-params__row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 0.75rem 0.95rem;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    background: var(--color-surface, #fff);
}

.bd-params__row:last-child {
    border-bottom: none;
}

@media (min-width: 768px) {
    .bd-params__row {
        grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 2fr) minmax(8rem, 1fr);
        align-items: start;
    }
}

.dark .bd-params__row {
    background: rgb(30 41 59);
    border-color: rgb(51 65 85);
}

.bd-params__name {
    font-weight: 700;
    color: var(--color-text, #0f172a);
}

.dark .bd-params__name {
    color: rgb(241 245 249);
}

.bd-params__desc {
    color: var(--color-text-secondary, #475569);
    line-height: 1.6;
}

.dark .bd-params__desc {
    color: rgb(203 213 225);
}

.bd-params__accepts {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    color: rgb(5 150 105);
}

.dark .bd-params__accepts {
    color: rgb(52 211 153);
}

/* ───── Example container ───── */
.bd-example {
    border-radius: 1rem;
    border: 1px solid var(--color-border, #e2e8f0);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.7), rgba(241, 245, 249, 0.5));
    padding: 1rem 1.1rem;
    display: grid;
    gap: 0.7rem;
}

.dark .bd-example {
    border-color: rgb(51 65 85);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.6), rgba(2, 6, 23, 0.5));
}

.bd-example__title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--color-text, #0f172a);
}

.dark .bd-example__title {
    color: rgb(241 245 249);
}

.bd-example__desc {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--color-text-secondary, #475569);
}

.dark .bd-example__desc {
    color: rgb(203 213 225);
}

.bd-example__stage {
    padding: 0.85rem;
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.03);
    border: 1px dashed rgba(15, 23, 42, 0.12);
    overflow-x: auto;
}

.dark .bd-example__stage {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(255, 255, 255, 0.08);
}

.bd-example__outcome {
    margin: 0;
    padding: 0.6rem 0.8rem;
    border-radius: 0.65rem;
    background: rgba(34, 197, 94, 0.08);
    border-inline-start: 3px solid rgb(22 163 74);
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgb(22 101 52);
}

.dark .bd-example__outcome {
    background: rgba(34, 197, 94, 0.10);
    color: rgb(187 247 208);
}

/* ─── Tip / Warning callouts ─── */
.bd-callout {
    display: grid;
    gap: 0.25rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.6;
    border-inline-start: 3px solid;
}

.bd-callout--tip {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgb(37 99 235);
    color: rgb(30 58 138);
}

.dark .bd-callout--tip {
    color: rgb(191 219 254);
    background: rgba(59, 130, 246, 0.10);
}

.bd-callout--warning {
    background: rgba(234, 179, 8, 0.10);
    border-color: rgb(202 138 4);
    color: rgb(120 53 15);
}

.dark .bd-callout--warning {
    color: rgb(254 240 138);
    background: rgba(234, 179, 8, 0.10);
}

.bd-callout__title {
    margin: 0;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bd-callout__body {
    margin: 0;
}

/* ─── Related blocks chip row ─── */
.bd-related {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.bd-related__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--bd-radius-pill);
    background: rgba(15, 23, 42, 0.05);
    color: var(--color-text-secondary, #475569);
    font-size: 0.78rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.bd-related__chip:hover {
    background: rgba(37, 99, 235, 0.10);
    color: rgb(37 99 235);
}

.dark .bd-related__chip {
    background: rgba(255, 255, 255, 0.06);
    color: rgb(203 213 225);
}

.dark .bd-related__chip:hover {
    background: rgba(96, 165, 250, 0.18);
    color: rgb(147 197 253);
}

/* ═══════════════════════════════════════════════════════════════════════
   Mock block — the visual heart of the example renderer.
   Each .bd-block is a single colored frame. The accent color comes from
   the category and is applied via inline style on a CSS variable
   (--bd-accent), so no per-color class explosion.
   ═══════════════════════════════════════════════════════════════════════ */

.bd-stack {
    display: flex;
    flex-direction: column;
    gap: var(--bd-gap);
    align-items: flex-start;
}

.bd-block {
    --bd-accent: #475569;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: var(--bd-pad-y) var(--bd-pad-x);
    background: var(--bd-accent);
    color: var(--bd-text);
    box-shadow: var(--bd-shadow);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
    direction: ltr;
}

/* Statement: rounded corners, the default flat-stack node */
.bd-block--statement {
    border-radius: var(--bd-radius);
}

/* Container: a hat-style top with an open body slot below */
.bd-block--container {
    border-radius: var(--bd-radius) var(--bd-radius) 0 0;
    margin-bottom: 0;
}

.bd-container {
    width: 100%;
    max-width: 100%;
    border-inline-start: 4px solid var(--bd-accent);
    background: rgba(15, 23, 42, 0.02);
    margin: 0 0 0.4rem;
    padding: 0.5rem 0 0.55rem var(--bd-indent);
    border-radius: 0 0 var(--bd-radius) var(--bd-radius);
}

.dark .bd-container {
    background: rgba(255, 255, 255, 0.03);
}

/* Value: pill-shaped reporter */
.bd-block--value {
    border-radius: var(--bd-radius-pill);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}

/* Boolean: hexagon-leaning shape via clip-path */
.bd-block--boolean {
    border-radius: 0;
    clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0% 50%);
    padding: 0.4rem 1.1rem;
    font-size: 0.78rem;
}

/* Hat: rounded top, flat bottom (event triggers) */
.bd-block--hat {
    border-radius: 1.2rem 1.2rem var(--bd-radius) var(--bd-radius);
}

/* Inline value input "slot" — a thin tinted strip embedded in the parent */
.bd-slot {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.4rem;
    border-radius: var(--bd-radius);
    background: rgba(255, 255, 255, 0.18);
}

/* Statement children stack — indented under the parent block */
.bd-children {
    display: flex;
    flex-direction: column;
    gap: var(--bd-gap);
    margin-inline-start: var(--bd-indent);
    padding-block: 0.25rem;
    align-items: flex-start;
}

.bd-block__field {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    background: rgba(255, 255, 255, 0.95);
    color: rgb(15 23 42);
    border-radius: 0.4rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    font-weight: 500;
}

.bd-block__field-label {
    color: rgb(100 116 139);
    font-weight: 600;
    font-family: inherit;
}

.bd-block__annotation {
    margin-inline-start: auto;
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════
   Category section header
   ═══════════════════════════════════════════════════════════════════════ */
.bd-category {
    display: grid;
    gap: 1.1rem;
}

.bd-category__head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--bd-accent, #2563eb);
}

.bd-category__icon {
    font-size: 1.65rem;
    line-height: 1;
    flex: 0 0 auto;
}

.bd-category__title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-text, #0f172a);
    letter-spacing: -0.01em;
}

.dark .bd-category__title {
    color: rgb(241 245 249);
}

.bd-category__summary {
    margin: 0.25rem 0 0;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--color-text-secondary, #475569);
}

.dark .bd-category__summary {
    color: rgb(203 213 225);
}

.bd-category__count {
    margin-inline-start: auto;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted, #64748b);
    align-self: center;
    background: rgba(15, 23, 42, 0.06);
    padding: 0.25rem 0.65rem;
    border-radius: var(--bd-radius-pill);
}

.dark .bd-category__count {
    background: rgba(255, 255, 255, 0.08);
    color: rgb(203 213 225);
}

.bd-category__blocks {
    display: grid;
    gap: 1rem;
}
