/* ─── DESIGN SYSTEM PREVIEW BLOCKS ─────────────────────────────────────── */
/*
 * tt-ds-block  — framed example card: [label] > [preview] > [note] > [code] > [class pills]
 * tt-ds-grid   — auto-fill grid for laying out multiple ds-blocks
 * tt-ds-section — groups a set of blocks under a labelled heading
 * tt-ds-class  — monospace pill for a single CSS class name
 */

.tt-ds-block {
    display: flex;
    flex-direction: column;
    border: var(--border-thin) solid var(--border-muted);
    border-radius: 0.375rem;
    background: var(--bg-color);
}

.tt-ds-block__label {
    padding: 0.2rem 0.6rem;
    font-size: var(--step--2);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    background: var(--bg-muted);
    border-bottom: var(--border-thin) solid var(--border-muted);
    border-radius: 0.375rem 0.375rem 0 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tt-ds-block__preview {
    flex: 1;
    padding: var(--space-xs) var(--space-s);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2xs);
    min-height: 3rem;
}

.tt-ds-block__preview--column {
    flex-direction: column;
    align-items: flex-start;
}

.tt-ds-block__text {
    padding: var(--space-2xs) var(--space-s);
    border-top: var(--border-thin) solid var(--border-muted);
    font-size: var(--step--1);
    line-height: 1.5;
    color: var(--text-muted);
}

/* ─── CODE SAMPLE ────────────────────────────────────────────────────────── */
/* Markup must be entity-escaped in the template, otherwise it renders. */
.tt-ds-block__code {
    margin: 0;
    padding: var(--space-2xs) var(--space-s);
    border-top: var(--border-thin) solid var(--border-muted);
    background: var(--bg-muted);
    overflow-x: auto;
    font-family: monospace;
    font-size: var(--step--2);
    line-height: 1.7;
    color: var(--text-color);
    tab-size: 4;
}

.tt-ds-block__code code {
    font: inherit;
    color: inherit;
    white-space: pre;
}

.tt-ds-block__classes {
    padding: 0.3rem 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    border-top: var(--border-thin) solid var(--border-muted);
    background: var(--bg-muted);
    border-radius: 0 0 0.375rem 0.375rem;
}

/* ─── CLASS PILL ─────────────────────────────────────────────────────────── */
.tt-ds-class {
    font-family: monospace;
    font-size: var(--step--2);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: var(--bg-color);
    border: var(--border-thin) solid var(--border-muted);
    color: var(--primary-color);
    white-space: nowrap;
    line-height: 1.6;
}

/* Code tone — Bootstrap's inline-code pink. Use on a class name quoted inside prose
   (tt-ds-block__text) so it reads as a code reference, not a repeat of the pills below.
   Bootstrap only flips --bs-code-color under [data-bs-theme=dark], which this app never
   sets, so the dark value is mirrored against the app's own theme switches. */
.tt-ds-class--code {
    --_ds-code-color: var(--bs-code-color, #d63384);
    color: var(--_ds-code-color);
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme-version='light']) .tt-ds-class--code {
        --_ds-code-color: #e685b5;
    }
}

body[data-theme-version='dark'] .tt-ds-class--code {
    --_ds-code-color: #e685b5;
}

/* ─── GRID ───────────────────────────────────────────────────────────────── */
.tt-ds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-xs);
}

.tt-ds-block--full {
    grid-column: 1 / -1;
}

.tt-ds-grid--wide {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ─── SECTION ────────────────────────────────────────────────────────────── */
.tt-ds-section {
    margin-bottom: var(--space-m);
}

.tt-ds-section__title {
    font-family: "PP Valve Plain", sans-serif;
    font-size: var(--step-0);
    font-weight: var(--font-weight-semibold);
    color: var(--heading-color);
    margin-bottom: var(--space-2xs);
    padding-bottom: var(--space-3xs);
    border-bottom: var(--border-md) solid var(--primary-color);
}

.tt-ds-section__desc {
    font-size: var(--step--1);
    color: var(--text-muted);
    margin-bottom: var(--space-2xs);
    max-width: 60ch;
}
