/* Chemical equation balancer (/chemical-equation-balancer): only what is the app's own, the big equation, the atom
   ledger, the method lines, the redox tags and the amount inputs. Panels, tiles, fields, buttons, tables and colours
   come from the app kit (css/app-kit, docs/app-kit.md). Loaded only on this app's page (StylePaths). */

/* The equation: large, wrapping between terms, coefficients in the accent colour. Left to right in every language. */
.ceb-landing-app .ceb-equation {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.35em 0.5em;
    margin: 0.5rem 0 0.75rem;
    font-size: clamp(1.35rem, 3.2vw, 2.1rem);
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}

.ceb-landing-app .ceb-side,
.ceb-landing-app .ceb-term {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.35em 0.45em;
}

.ceb-landing-app .ceb-term {
    gap: 0.2em;
    white-space: nowrap;
}

.ceb-landing-app .ceb-coef {
    color: var(--ak-muted);
    font-variant-numeric: tabular-nums;
}

.ceb-landing-app .ceb-coef.is-balanced {
    color: var(--ak-accent);
    font-weight: 800;
}

.ceb-landing-app .ceb-formula sub,
.ceb-landing-app .ceb-formula sup {
    font-size: 0.62em;
    line-height: 0;
}

.ceb-landing-app .ceb-state {
    color: var(--ak-muted);
    font-size: 0.55em;
    font-weight: 500;
}

.ceb-landing-app .ceb-op {
    color: var(--ak-muted);
    font-weight: 400;
}

.ceb-landing-app .ceb-arrow {
    color: var(--ak-accent);
    font-weight: 400;
    padding: 0 0.15em;
}

.ceb-landing-app .ceb-multiple {
    margin-bottom: 0.5rem;
}

/* The atom ledger: as wide as the panel, its height set by the script (one row per element). */
.ceb-landing-app .ceb-ledger-wrap {
    width: 100%;
}

.ceb-landing-app .ceb-ledger {
    display: block;
    width: 100%;
    height: 120px;
}

/* The system of equations under the ledger. */
.ceb-landing-app .ceb-method {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ak-border);
}

.ceb-landing-app .ceb-method-lines {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    font-size: var(--ak-fs-sm);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.ceb-landing-app .ceb-method-line.is-muted {
    color: var(--ak-muted);
}

.ceb-landing-app .ceb-method-line.is-result {
    color: var(--ak-accent);
    font-weight: 700;
}

.ceb-landing-app .ceb-method-el {
    display: inline-block;
    min-width: 2.2em;
}

/* Redox: a dot in the element colour, and a tag for oxidised (gives electrons) and reduced (takes them). */
.ceb-landing-app .ceb-dot {
    display: inline-block;
    width: 0.7em;
    height: 0.7em;
    margin-inline-end: 0.45em;
    border-radius: 50%;
    background: var(--ceb-dot);
    box-shadow: 0 0 0 1px var(--ak-border);
    vertical-align: -0.05em;
}

.ceb-landing-app .ceb-tag {
    display: inline-block;
    padding: 0.1em 0.55em;
    border-radius: 999px;
    font-size: var(--ak-fs-sm);
    font-weight: 600;
}

.ceb-landing-app .ceb-tag--oxidised {
    color: var(--ak-warning);
    background: color-mix(in srgb, var(--ak-warning) 14%, transparent);
}

.ceb-landing-app .ceb-tag--reduced {
    color: var(--ak-info);
    background: color-mix(in srgb, var(--ak-info) 14%, transparent);
}

.ceb-landing-app .ceb-agents {
    margin: 0.6rem 0 0;
    font-size: var(--ak-fs-sm);
    color: var(--ak-muted);
}

/* Amounts: an input per reactant in the table; the limiting reactant marked, the products set apart. */
/* As specific as the kit's input rule (.ak-app input.ak-field:not(...)), which sets the width to 100%. */
.ceb-landing-app input.ak-field.ceb-amount:not([type="color"]):not([type="range"]):not([type="checkbox"]):not([type="file"]) {
    width: 6.5em;
    min-width: 4.5em;
    padding-block: 0.25rem;
    text-align: end;
}

.ceb-landing-app .ceb-table tr.is-limiting > th {
    color: var(--ak-accent);
    font-weight: 800;
}

.ceb-landing-app .ceb-table tr.is-limiting > th::after {
    content: " ★";
}

.ceb-landing-app .ceb-table tr.ceb-first-product > * {
    border-top: 2px solid var(--ak-border);
}

.ceb-landing-app .ceb-table .ceb-formula sub,
.ceb-landing-app .ceb-table .ceb-formula sup {
    font-size: 0.72em;
    line-height: 0;
}

.ceb-landing-app .ceb-input {
    font-family: var(--ak-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    resize: vertical;
}
