/* Turing machine (/turing-machine): the tape of cells with the head and its state, the space-time diagram beside the
   rules (stacked on narrow screens), and the rules with the last and next rule marked. Tiles, panels, the editor and
   the buttons come from the app kit (css/app-kit, docs/app-kit.md). Loaded only on this app's page (StylePaths). */

.tm-landing-app .tm-machine { display: flex; flex-direction: column; gap: var(--ak-space-2, 0.5rem); }

.tm-landing-app .tm-head-row { display: flex; justify-content: center; }

.tm-landing-app .tm-state {
    min-width: 2.4rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--ak-accent);
    color: var(--ak-on-accent);
    font-weight: 700;
    text-align: center;
    position: relative;
}

.tm-landing-app .tm-state::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -0.45rem;
    border: 0.3rem solid transparent;
    border-top-color: var(--ak-accent);
    transform: translateX(-50%);
}

.tm-landing-app .tm-tape {
    display: flex;
    justify-content: center;
    overflow: hidden;
    border-top: 2px solid var(--ak-border);
    border-bottom: 2px solid var(--ak-border);
}

.tm-landing-app .tm-cell {
    flex: 0 0 38px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-inline-end: 1px solid var(--ak-grid);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ak-text);
    background: var(--ak-field);
}

.tm-landing-app .tm-cell.sym-1 { background: color-mix(in srgb, var(--ak-series-1) 22%, var(--ak-field)); }
.tm-landing-app .tm-cell.sym-2 { background: color-mix(in srgb, var(--ak-series-2) 22%, var(--ak-field)); }
.tm-landing-app .tm-cell.sym-3 { background: color-mix(in srgb, var(--ak-series-3) 22%, var(--ak-field)); }
.tm-landing-app .tm-cell.sym-4,
.tm-landing-app .tm-cell.sym-5 { background: color-mix(in srgb, var(--ak-series-4) 22%, var(--ak-field)); }

.tm-landing-app .tm-cell.is-head {
    outline: 3px solid var(--ak-accent);
    outline-offset: -3px;
}

.tm-landing-app .tm-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--ak-space-2, 0.5rem);
}

@media (max-width: 560px) {
    .tm-landing-app .tm-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.tm-landing-app .tm-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: var(--ak-space-3, 1rem);
    align-items: start;
}

@media (max-width: 860px) {
    .tm-landing-app .tm-columns { grid-template-columns: minmax(0, 1fr); }
}

.tm-landing-app .tm-diagram { display: block; width: 100%; }
.tm-landing-app .tm-note { margin: 0.25rem 0 0; text-align: center; }

.tm-landing-app .tm-rules-wrap { max-height: 26rem; overflow-y: auto; }
.tm-landing-app .tm-rules td { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tm-landing-app .tm-rules tr.is-last td { background: color-mix(in srgb, var(--ak-series-3) 16%, transparent); }
.tm-landing-app .tm-rules tr.is-next td { background: color-mix(in srgb, var(--ak-accent) 18%, transparent); font-weight: 700; }

.tm-landing-app .tm-program { min-height: 14rem; font-size: var(--ak-fs-sm, 0.875rem); }
