/* RSA (/rsa-demo): three panels (the keys with their public/secret tags and the Euclid table, the message table with
   the repeated squaring below it, and the attack). Tiles, panels, tables, callouts and buttons come from the app kit
   (css/app-kit, docs/app-kit.md). Loaded only on this app's page (StylePaths). */

.rsa-landing-app .rsa-panel { display: flex; flex-direction: column; gap: var(--ak-space-2, 0.6rem); }

.rsa-landing-app .rsa-title { margin: 0; font-size: var(--ak-fs-md, 1rem); font-weight: 700; }

.rsa-landing-app .rsa-steps { display: flex; flex-direction: column; gap: 0.4rem; margin: 0; padding: 0; list-style: none; counter-reset: rsa; }

.rsa-landing-app .rsa-step {
    display: grid;
    grid-template-columns: 1.6rem minmax(7rem, 11rem) minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius, 10px);
    background: var(--ak-field);
    counter-increment: rsa;
}

.rsa-landing-app .rsa-step::before {
    content: counter(rsa);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--ak-accent);
    color: var(--ak-on-accent, #fff);
    font-size: var(--ak-fs-xs, 0.75rem);
    font-weight: 700;
}

.rsa-landing-app .rsa-step-label { font-weight: 600; font-size: var(--ak-fs-sm, 0.9rem); }

.rsa-landing-app .rsa-step-formula,
.rsa-landing-app .rsa-output,
.rsa-landing-app .rsa-message .ak-num,
.rsa-landing-app .rsa-euclid .ak-num,
.rsa-landing-app .rsa-trace td {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--ak-fs-sm, 0.88rem);
    overflow-wrap: anywhere;
}

.rsa-landing-app .rsa-tag { justify-self: end; white-space: nowrap; }
.rsa-landing-app .rsa-tag--public { background: color-mix(in srgb, var(--ak-success) 14%, transparent); color: var(--ak-success); }
.rsa-landing-app .rsa-tag--secret { background: color-mix(in srgb, var(--ak-danger) 14%, transparent); color: var(--ak-danger); }

.rsa-landing-app .rsa-details summary { cursor: pointer; font-weight: 600; color: var(--ak-accent); }
.rsa-landing-app .rsa-details[open] summary { margin-bottom: 0.4rem; }
.rsa-landing-app .rsa-details .ak-note { margin: 0 0 0.4rem; }

.rsa-landing-app .rsa-message tbody tr { cursor: pointer; }
.rsa-landing-app .rsa-message .rsa-char,
.rsa-landing-app .rsa-message .rsa-ok { font-weight: 700; text-align: center; }
.rsa-landing-app .rsa-message .rsa-out { color: var(--ak-accent); font-weight: 600; }

.rsa-landing-app .rsa-output-label { margin: 0; font-size: var(--ak-fs-xs, 0.78rem); font-weight: 600; color: var(--ak-muted); }
.rsa-landing-app .rsa-output {
    margin: 0;
    padding: 0.5rem 0.7rem;
    border: 1px dashed var(--ak-border);
    border-radius: var(--ak-radius, 10px);
    background: color-mix(in srgb, var(--ak-danger) 5%, var(--ak-field));
    word-spacing: 0.3em;
}

.rsa-landing-app .rsa-trace-title { margin: 0.3rem 0 0; }

.rsa-landing-app .rsa-actions { display: flex; flex-wrap: wrap; gap: var(--ak-space-2, 0.5rem); }

@media (max-width: 700px) {
    .rsa-landing-app .rsa-step { grid-template-columns: 1.6rem minmax(0, 1fr) auto; }
    .rsa-landing-app .rsa-tag { grid-column: 3; grid-row: 1; }
    .rsa-landing-app .rsa-step-formula { grid-column: 2 / -1; grid-row: 2; }
}
