/* Molar mass calculator (/molar-mass-calculator): the tiles in the bar on top (a calculator), the picture (formula, element blocks,
   pie chart, table) and the sum written out under it. Tiles, panels, fields and buttons come from the app kit (css/app-kit,
   docs/app-kit.md). Loaded only on this app's page (StylePaths). */

.mm-landing-app .mm-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ak-space-2, 8px);
}

.mm-landing-app .mm-canvas {
    display: block;
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 16 / 10;
    border-radius: var(--ak-radius, 8px);
    background: #eef3f8;
}

:root[data-theme="dark"] .mm-landing-app .mm-canvas,
.mm-landing-app[data-theme="dark"] .mm-canvas {
    background: #111a2b;
}

/* The sum written out: M = 1 × 63.546 + ... and n = m / M = ... */
.mm-landing-app .mm-calc {
    width: 100%;
    max-width: 1100px;
    font-size: var(--ak-fs-sm, 0.875rem);
    line-height: 1.5;
    color: var(--ak-muted);
    overflow-wrap: anywhere;
}

.mm-landing-app .mm-calc p {
    margin: 0;
}

.mm-landing-app .mm-calc strong {
    color: var(--ak-text);
    font-weight: 700;
}

/* Formulas are typed in a monospaced-looking field that keeps subscripts readable. */
.mm-landing-app .mm-field {
    font-variant-numeric: tabular-nums;
}

/* The error: the message and the formula with the character that is wrong marked. */
.mm-landing-app .mm-error code {
    display: block;
    margin-top: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    direction: ltr;
    unicode-bidi: isolate;
}

.mm-landing-app .mm-error mark {
    background: var(--ak-danger, #dc2626);
    color: #fff;
    border-radius: 3px;
    padding: 0 2px;
}

.mm-landing-app .mm-use {
    justify-self: start;
    align-self: flex-start;
}

.mm-landing-app app-section[hidden] {
    display: none;
}

/* Phones: a taller picture, so the table keeps readable rows. */
@media (max-width: 640px) {
    .mm-landing-app .mm-canvas {
        aspect-ratio: 3 / 4;
    }
}
