/*
 * Card verification, styled for a till rather than for a browser.
 *
 * Everything is scoped under .ckm-verification and sets its own surface, type, and controls
 * explicitly. The component is dropped into whichever theme the site runs, so it neither inherits
 * the theme's form styling nor leaks its own outward.
 *
 * No web fonts: a point-of-sale terminal on a slow line should not wait on a font, and the site
 * should not fetch one from a third party. The type personality comes from scale and tracking in
 * system faces instead.
 *
 * Sizes are em against an absolute base on the container, never rem. A theme that sets
 * html { font-size: 62.5% } would otherwise shrink every size here by more than a third, which at a
 * counter is the difference between reading the verdict and squinting at it.
 */

.ckm-verification {
    --ckm-ink: #12213a;
    --ckm-ink-soft: #5a6b85;
    --ckm-rule: #c9d2e0;
    --ckm-field: #f4f6fa;
    --ckm-surface: #ffffff;
    --ckm-valid: #0b6e3f;
    --ckm-invalid: #a5162b;
    --ckm-attention: #8a5a00;

    --ckm-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --ckm-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    box-sizing: border-box;
    /*
     * Containment, not layout. Nothing here is absolutely positioned, but themes position bare
     * elements freely — isicsk pins `form button` to top/right — and without a positioned ancestor
     * the containing block for such a rule becomes some section far up the page, which stretches a
     * width: 100% control across the whole column. Anything that escapes now escapes into the card.
     */
    position: relative;
    max-inline-size: 34rem;
    margin-inline: auto;
    padding: 0;
    background: var(--ckm-surface);
    border: 1px solid var(--ckm-rule);
    border-radius: 10px;
    overflow: hidden;
    font-family: var(--ckm-sans);
    font-size: 17px;
    color: var(--ckm-ink);
    line-height: 1.4;
}

.ckm-verification *,
.ckm-verification *::before,
.ckm-verification *::after {
    box-sizing: inherit;
}

/* ---- Header ------------------------------------------------------------ */

.ckm-verification__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1em;
    padding: 0.9em 1.25em;
    border-block-end: 1px solid var(--ckm-rule);
}

.ckm-verification__eyebrow,
.ckm-verification__partner {
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0;
}

.ckm-verification__eyebrow {
    color: var(--ckm-ink);
}

.ckm-verification__partner {
    color: var(--ckm-ink-soft);
    font-family: var(--ckm-mono);
    letter-spacing: 0.06em;
    text-transform: none;
}

/* ---- Verdict ----------------------------------------------------------- */

/*
 * The signature element. A solid field rather than a tinted strip: the cashier reads this across a
 * counter while a customer waits, and at that distance a pale notice is a guess.
 *
 * Three signals carry the same meaning — the mark, the wording, and the fill — so the answer
 * survives a washed-out monitor and a colour-blind reader.
 */
.ckm-verification__verdict {
    display: flex;
    align-items: stretch;
    min-block-size: 7em;
    color: #fff;
    animation: ckm-verdict-in 140ms ease-out both;
}

.ckm-verification__verdict--valid {
    background: var(--ckm-valid);
}

.ckm-verification__verdict--invalid {
    background: var(--ckm-invalid);
}

.ckm-verification__verdict--problem {
    background: var(--ckm-attention);
}

.ckm-verification__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 3.6em;
    font-size: 2.2em;
    line-height: 1;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.28);
}

.ckm-verification__answer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2em;
    padding: 1.1em 1.25em;
    min-inline-size: 0;
}

.ckm-verification__headline {
    margin: 0;
    font-size: 1.9em;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.1;
    overflow-wrap: break-word;
}

/* The expiry date is the number the cashier actually has to read, so it is set like data. */
.ckm-verification__detail {
    margin: 0;
    font-family: var(--ckm-mono);
    font-size: 1.45em;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.ckm-verification__verdict--problem .ckm-verification__detail {
    font-family: var(--ckm-sans);
    font-size: 0.95em;
    line-height: 1.45;
    max-inline-size: 24em;
}

/*
 * The screen looks identical after every customer, so a new answer needs to announce itself as new.
 * Kept to a single short fade — repeated a few hundred times a day, anything longer becomes noise.
 */
@keyframes ckm-verdict-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ckm-verification__verdict {
        animation: none;
    }
}

/* ---- Form -------------------------------------------------------------- */

.ckm-verification__body {
    padding: 1.25em;
}

/*
 * Spacing lives on the form, not on the fields.
 *
 * The fields are paragraphs, and a theme styling `.entry-content p` outranks a single class here,
 * so any margin set on them is one theme away from vanishing — which is how the submit button ended
 * up flush against the last input. A flex gap is set on the container instead, where no theme rule
 * for a child element can reach it.
 */
.ckm-verification__body form {
    display: flex;
    flex-direction: column;
    gap: 1.15em;
}

/* Same reasoning one level down: the label-to-input gap is owned here, not by the label's margin. */
.ckm-verification .ckm-verification__field {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    margin: 0;
}

.ckm-verification__label {
    display: block;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ckm-ink-soft);
}

.ckm-verification__requirement {
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 400;
}

.ckm-verification .ckm-verification__input {
    -webkit-appearance: none;
    appearance: none;
    inline-size: 100%;
    padding: 0.75em 0.85em;
    background: var(--ckm-field);
    border: 1px solid var(--ckm-rule);
    border-radius: 6px;
    font-family: var(--ckm-sans);
    font-size: 1.1em;
    color: var(--ckm-ink);
    /* Comfortably past the 44px touch minimum: typed into all day, sometimes on a touch terminal. */
    min-block-size: 52px;
}

/* Card numbers are machine data, and mono makes a transposed character visible while typing. */
.ckm-verification__input--code {
    font-family: var(--ckm-mono);
    font-size: 1.2em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ckm-verification__input:focus-visible,
.ckm-verification__button:focus-visible,
.ckm-verification__link:focus-visible {
    outline: 3px solid var(--ckm-ink);
    outline-offset: 2px;
}

/*
 * Doubled selector, here and on the input, purely for specificity. A theme styling `button` or
 * `.entry-content button` otherwise wins on source order and takes back the colour and size.
 */
.ckm-verification .ckm-verification__button {
    -webkit-appearance: none;
    appearance: none;
    /*
     * Declared, not defaulted. `form button { position: absolute; top: 0; right: 0 }` in the isicsk
     * theme loads after this file, and overriding a property means declaring it — winning on the
     * fill and the size while leaving `position` alone let the theme lift the button out of the
     * form, where it covered the header and stretched to the width of its new containing block.
     */
    position: static;
    inline-size: 100%;
    min-block-size: 52px;
    padding: 0.75em 1em;
    background: var(--ckm-ink);
    /* Explicit rather than inherited: white on this navy is the only combination that holds up. */
    color: #fff;
    border: 1px solid var(--ckm-ink);
    border-radius: 6px;
    font-family: var(--ckm-sans);
    font-size: 0.9em;
    font-weight: 700;
    /* Tracking stays modest — wide letter-spacing on short uppercase text reads as grey mush. */
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}

.ckm-verification .ckm-verification__button:hover {
    background: #1c3055;
    color: #fff;
}

/* ---- Footer ------------------------------------------------------------ */

.ckm-verification__footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.75em 1.25em;
    border-block-start: 1px solid var(--ckm-rule);
    background: var(--ckm-field);
}

/*
 * Doubled like the button, and for the same theme rule. This one is a plain `button` in a `form`
 * too, and it declares no width of its own, so it took the theme's 42px as well as the absolute
 * positioning — a logout control the width of a thumbnail, pinned over the verdict.
 */
.ckm-verification .ckm-verification__link {
    position: static;
    inline-size: auto;
    background: none;
    border: 0;
    padding: 0.25em;
    font-family: var(--ckm-sans);
    font-size: 0.8em;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ckm-ink-soft);
    text-decoration: underline;
    cursor: pointer;
}

.ckm-verification__link:hover {
    color: var(--ckm-ink);
}

/* ---- Narrow screens ---------------------------------------------------- */

@media (max-width: 26rem) {
    .ckm-verification__mark {
        flex-basis: 3.25em;
        font-size: 1.75em;
    }

    .ckm-verification__answer,
    .ckm-verification__body {
        padding-inline: 1em;
    }
}
