/**
 * Armor Kit page styles.
 *
 * Layout rule that drives the rest of this file: the answer gets the wide
 * column and stays in view while the inputs are adjusted. The controls exist to
 * produce the kit, not the other way round.
 */

.ak-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.ak-layout {
    display: grid;
    gap: var(--space-lg);
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

@media (min-width: 1080px) {
    .ak-layout {
        grid-template-columns: minmax(300px, 1fr) minmax(0, 1.7fr);
    }

    /* The kit stays put while the sliders move, so cause and effect sit side
       by side instead of scrolling past each other. */
    .ak-answer-card {
        position: sticky;
        top: var(--space-md);
        max-height: calc(100vh - var(--space-xl));
        overflow-y: auto;
    }
}

.ak-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.ak-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-xs);
    line-height: 1.55;
}

.ak-note--tight {
    margin-top: calc(var(--space-xs) * -1);
}

/* ------------------------------------------------------------- segmented */

.ak-scope {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.ak-scope__label {
    color: var(--text-secondary);
    font-size: var(--font-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ak-segmented {
    display: flex;
    border: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
}

.ak-segmented__option {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px var(--space-xs);
    border: 0;
    border-right: 1px solid var(--border-primary);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--font-xs);
    line-height: 1.3;
    cursor: pointer;
    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.ak-segmented__option:last-child {
    border-right: 0;
}

.ak-segmented__option:hover {
    color: var(--text-primary);
}

.ak-segmented__option.is-active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: inset 0 -2px 0 var(--accent-primary);
}

.ak-segmented__option:focus-visible,
.ak-chip:focus-visible {
    outline: 1px solid var(--border-focus, var(--accent-primary));
    outline-offset: -1px;
}

.ak-chip {
    padding: 4px 10px;
    border: 1px solid var(--border-primary);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--font-xs);
    cursor: pointer;
}

.ak-chip.is-active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--color-border-accent);
}

/* --------------------------------------------------------------- sliders */

.ak-sliders {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.ak-slider {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ak-slider.is-unreachable {
    opacity: 0.45;
}

.ak-slider__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.ak-slider__label {
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.ak-slider.is-set .ak-slider__label {
    color: var(--text-primary);
}

.ak-slider__entry {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ak-number.ak-number {
    width: 5ch;
    padding: 3px 6px;
    text-align: right;
    font-size: var(--font-xs);
    font-variant-numeric: tabular-nums;
}

.ak-slider__unit {
    width: 1.2ch;
    color: var(--text-muted);
    font-size: var(--font-xs);
}

.ak-slider__ceiling {
    color: var(--text-muted);
    font-size: var(--font-xs);
}

.ak-facts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.ak-facts__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
    font-size: var(--font-xs);
}

.ak-facts__row dt {
    color: var(--text-secondary);
}

.ak-facts__row dd {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- answer */

.ak-answer-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
}

.ak-status {
    color: var(--text-muted);
    font-size: var(--font-xs);
    font-family: var(--font-mono);
}

.ak-placeholder {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    line-height: 1.6;
}

.ak-answer {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.ak-verdict {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--font-sm);
}

/* -------------------------------------------------------------- body map */

.ak-map {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.ak-map__types {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.ak-body {
    width: min(100%, 240px);
    height: auto;
}

.ak-zone rect {
    fill: var(--ak-band-0);
    stroke: var(--border-primary);
    stroke-width: 1;
    transition: fill var(--transition-fast);
}

.ak-zone text {
    fill: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    text-anchor: middle;
    dominant-baseline: middle;
}

.ak-page {
    --ak-band-0: #131513;
    --ak-band-1: #1e241d;
    --ak-band-2: #2a3527;
    --ak-band-3: #384730;
    --ak-band-4: #485c3b;
    --ak-band-5: #5c7449;
}

.ak-zone[data-band="1"] rect {
    fill: var(--ak-band-1);
}
.ak-zone[data-band="2"] rect {
    fill: var(--ak-band-2);
}
.ak-zone[data-band="3"] rect {
    fill: var(--ak-band-3);
}
.ak-zone[data-band="4"] rect {
    fill: var(--ak-band-4);
}
.ak-zone[data-band="5"] rect {
    fill: var(--ak-band-5);
}

.ak-zone[data-band="4"] text,
.ak-zone[data-band="5"] text {
    fill: #cddac2;
}

/* Regions the current requirement does not cover are drawn, but drawn as
   excluded: showing them empty without that mark reads as a failure. */
.ak-zone.is-outside rect {
    fill: transparent;
    stroke-dasharray: 3 3;
}

.ak-zone.is-outside text {
    fill: var(--text-muted);
}

.ak-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ak-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: var(--font-xs);
}

.ak-legend__swatch {
    width: 12px;
    height: 12px;
    border: 1px solid var(--border-primary);
    background: var(--ak-band-0);
}

.ak-legend__swatch[data-band="1"] {
    background: var(--ak-band-1);
}
.ak-legend__swatch[data-band="2"] {
    background: var(--ak-band-2);
}
.ak-legend__swatch[data-band="3"] {
    background: var(--ak-band-3);
}
.ak-legend__swatch[data-band="4"] {
    background: var(--ak-band-4);
}
.ak-legend__swatch[data-band="5"] {
    background: var(--ak-band-5);
}

/* ---------------------------------------------------------------- detail */

.ak-answer__detail {
    display: grid;
    gap: var(--space-lg);
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.ak-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-width: 0;
}

.ak-panel__title {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ak-kit {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ak-kit__item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: var(--space-sm);
    padding: 5px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
}

.ak-kit__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--bg-elevated);
}

.ak-kit__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ak-kit__icon.is-missing::after {
    content: "?";
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--font-xs);
}

.ak-kit__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ak-kit__name {
    color: var(--text-primary);
    font-size: var(--font-sm);
    overflow-wrap: anywhere;
}

.ak-kit__slots {
    color: var(--text-muted);
    font-size: var(--font-xs);
}

.ak-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-xs);
}

.ak-table th,
.ak-table td {
    padding: 4px 6px;
    text-align: right;
    border-bottom: 1px solid var(--border-primary);
}

.ak-table thead th {
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ak-table th[scope="row"] {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 400;
}

.ak-table tbody tr.is-asked th[scope="row"],
.ak-table tbody tr.is-asked .ak-table__value {
    color: var(--text-primary);
}

.ak-table__value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.ak-over {
    color: var(--text-muted);
}

.ak-cost {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ak-cost__item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
    font-size: var(--font-xs);
    color: var(--text-secondary);
}

.ak-cost__amount {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.ak-why summary {
    color: var(--text-secondary);
    font-size: var(--font-xs);
    cursor: pointer;
}

.ak-why[open] summary {
    margin-bottom: var(--space-sm);
}

.ak-why > * + * {
    margin-top: var(--space-sm);
}

@media (prefers-reduced-motion: reduce) {
    .ak-zone rect,
    .ak-segmented__option {
        transition: none;
    }
}
