/* UUID Generator (/uuid-generator): only what is the app's own (the list, the inspector's bit layout and its colours).
   Panels, tiles, fields, buttons, the key / value list and the legend come from the app kit (css/app-kit,
   docs/app-kit.md). Loaded only on this app's page (StylePaths in its demo catalog entry). */

/* On a phone the site's photo-app rule (seo-pages.css) sets align-items: start on every stage, which beats the kit's
   stretch: the panels would shrink to their own width. */
.ug-landing-app > .ak-stage > * {
    align-self: stretch;
}

.ug-landing-app .ug-mono {
    font-family: var(--ak-font-mono);
}

/* The colour of each part of the 128 bits: the bits, the legend swatches (and the same in the saved picture). Set on
   the stage, which carries the app's own Light / Dark theme, so the series colours are the stage's. */
.ug-landing-app .ak-stage {
    --ug-time: var(--ak-series-6);
    --ug-version: var(--ak-series-2);
    --ug-variant: var(--ak-series-4);
    --ug-random: var(--ak-series-3);
    --ug-clock: var(--ak-series-5);
    --ug-node: var(--ak-series-1);
    --ug-hash: var(--ak-series-7);
    --ug-custom: var(--ak-series-8);
    --ug-fixed: var(--ak-muted);
    --ug-other: var(--ak-grid);
}

/* --- The list: Generate, Copy all, Download; then one row per UUID ------------------------------------------------- */

.ug-landing-app .ug-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* On a narrow stage the three buttons share the rows instead of leaving a gap. */
@media (max-width: 640px) {
    .ug-landing-app .ug-actions > .ak-btn {
        flex: 1 1 auto;
    }
}

.ug-landing-app .ug-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 24rem;
    margin: 0;
    padding: 0 0.15rem 0 0;
    overflow-y: auto;
    list-style: none;
    direction: ltr;
}

.ug-landing-app .ug-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    padding: 0.15rem 0.3rem 0.15rem 0.15rem;
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius);
    background: var(--ak-field);
}

.ug-landing-app .ug-item.is-selected {
    border-color: var(--ak-accent);
    background: color-mix(in srgb, var(--ak-accent) 8%, var(--ak-field));
}

.ug-landing-app .ug-uuid {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.35rem 0.5rem;
    overflow: hidden;
    border: 0;
    border-radius: var(--ak-radius-sm);
    background: none;
    color: var(--ak-text);
    font-family: var(--ak-font-mono);
    font-size: 0.95rem;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.ug-landing-app .ug-uuid:hover {
    color: var(--ak-accent);
}

.ug-landing-app .ug-uuid:focus-visible {
    outline: 2px solid var(--ak-accent);
    outline-offset: 1px;
}

/* One UUID: large, as the result. */
.ug-landing-app .ug-list--one .ug-uuid {
    padding: 0.6rem 0.75rem;
    font-size: clamp(0.9rem, 2.6vw, 1.45rem);
    font-weight: 700;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* --- The inspector: the pasted UUID, what it is, its bits ---------------------------------------------------------- */

.ug-landing-app .ug-paste {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ug-landing-app .ug-input {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--ak-font-mono);
    text-align: left;
}

.ug-landing-app .ug-kv > dd.ug-no {
    color: var(--ak-danger);
}

.ug-landing-app .ug-bits-wrap {
    container-type: inline-size;
}

/* Four bytes (32 bits) per row, two on a narrow stage. */
.ug-landing-app .ug-bits {
    --ug-cell: 1.3rem;
    display: grid;
    grid-template-columns: repeat(4, max-content);
    justify-content: center;
    gap: 0.6rem 0.9rem;
    direction: ltr;
}

@container (max-width: 50rem) {
    .ug-landing-app .ug-bits {
        grid-template-columns: repeat(2, max-content);
    }
}

@container (max-width: 25rem) {
    .ug-landing-app .ug-bits {
        --ug-cell: 1.02rem;
        column-gap: 0.6rem;
    }
}

.ug-landing-app .ug-byte,
.ug-landing-app .ug-cells {
    display: flex;
    gap: 2px;
}

.ug-landing-app .ug-byte {
    gap: 0.3rem;
}

.ug-landing-app .ug-nibble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.ug-landing-app .ug-hex {
    color: var(--ak-text);
    font-family: var(--ak-font-mono);
    font-size: 0.85rem;
    font-weight: 700;
}

.ug-landing-app .ug-bit {
    --ug-c: var(--ug-other);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ug-cell);
    height: var(--ug-cell);
    border-radius: 3px;
    background: color-mix(in srgb, var(--ug-c) 22%, transparent);
    color: var(--ak-text);
    font-family: var(--ak-font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.ug-landing-app .ug-bit--time { --ug-c: var(--ug-time); }
.ug-landing-app .ug-bit--version { --ug-c: var(--ug-version); }
.ug-landing-app .ug-bit--variant { --ug-c: var(--ug-variant); }
.ug-landing-app .ug-bit--random { --ug-c: var(--ug-random); }
.ug-landing-app .ug-bit--clock { --ug-c: var(--ug-clock); }
.ug-landing-app .ug-bit--node { --ug-c: var(--ug-node); }
.ug-landing-app .ug-bit--hash { --ug-c: var(--ug-hash); }
.ug-landing-app .ug-bit--custom { --ug-c: var(--ug-custom); }
.ug-landing-app .ug-bit--fixed { --ug-c: var(--ug-fixed); }
.ug-landing-app .ug-bit--other { --ug-c: var(--ug-other); }

/* A 1 bit is filled with its part's colour, a 0 bit only tinted. */
.ug-landing-app .ug-bit.is-one {
    background: var(--ug-c);
    color: var(--ak-bg);
}

.ug-landing-app .ug-legend {
    justify-content: center;
}

.ug-landing-app .ug-swatch--time { --ak-swatch: var(--ug-time); }
.ug-landing-app .ug-swatch--version { --ak-swatch: var(--ug-version); }
.ug-landing-app .ug-swatch--variant { --ak-swatch: var(--ug-variant); }
.ug-landing-app .ug-swatch--random { --ak-swatch: var(--ug-random); }
.ug-landing-app .ug-swatch--clock { --ak-swatch: var(--ug-clock); }
.ug-landing-app .ug-swatch--node { --ak-swatch: var(--ug-node); }
.ug-landing-app .ug-swatch--hash { --ak-swatch: var(--ug-hash); }
.ug-landing-app .ug-swatch--custom { --ak-swatch: var(--ug-custom); }
.ug-landing-app .ug-swatch--fixed { --ak-swatch: var(--ug-fixed); }
.ug-landing-app .ug-swatch--other { --ak-swatch: var(--ug-other); }
