/* Permutation and Combination Calculator (/permutation-combination-calculator): the clickable 2 × 2 grid of counts, the
   formula as a row of terms, the long exact value, the picture (places to fill, the fraction over k!, the orders of
   one selection, stars and bars), the item chips and the numbered list. Tiles, panels and buttons come from the app
   kit (css/app-kit, docs/app-kit.md). Loaded only on this app's page (StylePaths). */

.pc-landing-app .pc-panel { display: flex; flex-direction: column; gap: var(--ak-space-2, 0.6rem); }
.pc-landing-app .pc-note { margin: 0; }

/* The grid: every tile picks its case. */
.pc-landing-app .pc-tile { cursor: pointer; outline: none; transition: background-color 0.15s, border-color 0.15s; }
.pc-landing-app .pc-tile:not(.ak-stat--main):hover { background: var(--ak-hover); }
.pc-landing-app .pc-tile:focus-visible { box-shadow: 0 0 0 2px var(--ak-accent); }

/* The formula: terms joined by "=", wrapping between terms. */
.pc-landing-app .pc-formula-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ak-space-2, 0.5rem); }
.pc-landing-app .pc-symbolic { margin: 0; color: var(--ak-muted); font-size: var(--ak-fs-sm, 0.88rem); font-style: italic; }
.pc-landing-app .pc-formula {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.45rem;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
}
.pc-landing-app .pc-term { white-space: nowrap; }
.pc-landing-app .pc-term--name { font-weight: 700; color: var(--ak-accent); }
.pc-landing-app .pc-term:last-child { font-weight: 700; }
.pc-landing-app .pc-eq { color: var(--ak-muted); }

.pc-landing-app .pc-exact { display: flex; flex-direction: column; gap: 0.35rem; }
.pc-landing-app .pc-exact-digits {
    margin: 0;
    max-height: 12rem;
    overflow-y: auto;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius-sm, 6px);
    background: var(--ak-field);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--ak-fs-sm, 0.88rem);
    line-height: 1.6;
    overflow-wrap: anywhere;
    word-break: break-all;
}
.pc-landing-app .pc-exact-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem; }

/* The picture. */
.pc-landing-app .pc-visual { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; }
.pc-landing-app .pc-visual:empty { display: none; }
.pc-landing-app .pc-slots { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 0.3rem; }
.pc-landing-app .pc-slot { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.pc-landing-app .pc-slot-n {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.6rem;
    height: 2.6rem;
    padding: 0 0.4rem;
    border: 2px solid var(--ak-accent);
    border-radius: var(--ak-radius-sm, 6px);
    background: color-mix(in srgb, var(--ak-accent) 12%, var(--ak-field));
    color: var(--ak-text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.pc-landing-app .pc-slot-cap { min-height: 1em; color: var(--ak-muted); font-size: var(--ak-fs-xs, 0.75rem); line-height: 1; }
.pc-landing-app .pc-times,
.pc-landing-app .pc-dots { display: flex; align-items: center; height: 2.6rem; color: var(--ak-muted); font-weight: 700; }
.pc-landing-app .pc-times:empty { display: none; }
.pc-landing-app .pc-frac { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.pc-landing-app .pc-frac > .pc-slots:last-child .pc-slot-n { border-color: var(--ak-series-2); background: color-mix(in srgb, var(--ak-series-2) 12%, var(--ak-field)); }
.pc-landing-app .pc-frac > .pc-slots:last-child .pc-slot-cap { display: none; }
.pc-landing-app .pc-bar { align-self: stretch; height: 2px; background: var(--ak-text); border-radius: 1px; }

.pc-landing-app .pc-orders { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.pc-landing-app .pc-orders-cap { margin: 0; color: var(--ak-muted); font-size: var(--ak-fs-sm, 0.88rem); text-align: center; }
.pc-landing-app .pc-chips { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.3rem; }
.pc-landing-app .pc-chips:empty { display: none; }
.pc-landing-app .pc-chip {
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--ak-border);
    border-radius: 999px;
    background: var(--ak-field);
    font-size: var(--ak-fs-sm, 0.88rem);
    white-space: nowrap;
}
.pc-landing-app .pc-chip.is-dup { border-color: var(--ak-series-2); background: color-mix(in srgb, var(--ak-series-2) 14%, var(--ak-field)); font-weight: 600; }
.pc-landing-app .pc-chip--set { border: 2px solid var(--ak-accent); background: color-mix(in srgb, var(--ak-accent) 14%, var(--ak-field)); font-weight: 700; }
.pc-landing-app .pc-arrow { color: var(--ak-muted); font-weight: 700; }

.pc-landing-app .pc-stars { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 0.15rem 0.35rem; }
.pc-landing-app .pc-group { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; min-width: 1.2rem; }
.pc-landing-app .pc-group-stars { color: var(--ak-accent); font-size: 1.6rem; line-height: 1.1; letter-spacing: 0.08em; }
.pc-landing-app .pc-group-cap { color: var(--ak-muted); font-size: var(--ak-fs-xs, 0.75rem); white-space: nowrap; }
.pc-landing-app .pc-barsym { color: var(--ak-text); font-size: 1.8rem; font-weight: 300; line-height: 1; }

/* All the items in a row, and the list. */
.pc-landing-app [data-ak-ref~="multi-chips"] { justify-content: flex-start; }
.pc-landing-app .pc-subtitle { margin: 0; font-weight: 600; }
.pc-landing-app .pc-gen-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem; }
.pc-landing-app .pc-gen-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pc-landing-app .pc-gen-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.1rem 0.8rem;
    max-height: 22rem;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    font-variant-numeric: tabular-nums;
}
.pc-landing-app .pc-gen-list:empty { display: none; }
.pc-landing-app .pc-gen-item { display: flex; gap: 0.45rem; align-items: baseline; padding: 0.1rem 0; border-bottom: 1px solid var(--ak-grid); min-width: 0; }
.pc-landing-app .pc-gen-n { min-width: 2.4rem; color: var(--ak-muted); font-size: var(--ak-fs-xs, 0.75rem); text-align: end; }
.pc-landing-app .pc-gen-v { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--ak-fs-sm, 0.88rem); }

.pc-landing-app .pc-nk { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.pc-landing-app .pc-items { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
