/* VERIFY — the download checker. Roles only: every colour has to follow both palettes. */

.verify-view {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    background: var(--page);
    color: var(--ink);
    overflow-y: auto;
    overscroll-behavior: auto;
}

.verify-view[hidden],
.verify-view [hidden] {
    display: none !important;
}

.verify-view__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px 12px;
}

.verify-view__eyebrow {
    margin: 0 0 4px;
    color: var(--accent-text);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.verify-view__title {
    margin: 0 0 8px;
    font-size: clamp(1.3rem, 2.6vw, 1.8rem);
    letter-spacing: 0.04em;
}

.verify-view__lede {
    margin: 0;
    max-width: 72ch;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.verify-view__back {
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.verify-view__back:hover,
.verify-view__back:focus-visible {
    border-color: var(--accent);
    color: var(--accent-text);
}

/* ---- the four pickers ---------------------------------------------------------------------- */

.verify-view__form {
    padding: 4px 22px 18px;
    border-bottom: 1px solid var(--rule);
}

.verify-field {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr) minmax(0, 15rem);
    align-items: center;
    gap: 4px 14px;
    padding: 8px 0;
    border-top: 1px solid var(--rule);
}

.verify-field:first-child { border-top: 0; }

.verify-field__label {
    color: var(--ink);
    font-size: 0.82rem;
}

.verify-field__file {
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.78rem;
}

.verify-field__file::file-selector-button {
    margin-right: 10px;
    padding: 5px 10px;
    border: 1px solid var(--rule);
    border-radius: 5px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.76rem;
    cursor: pointer;
}

.verify-field__name {
    color: var(--muted);
    font-size: 0.76rem;
    overflow-wrap: anywhere;
}

.verify-field__name.is-set { color: var(--ink); }

/* the key row: a box to paste or type into, with the file picker beside it as the alternative */
.verify-field--key { align-items: start; }
.verify-field--key .verify-field__paste { grid-column: 2 / -1; }
.verify-field--key .verify-field__file { grid-column: 2 / 3; margin-top: 8px; }
.verify-field--key .verify-field__name { grid-column: 3 / -1; margin-top: 14px; }

/* the two ways in that need no keyserver: pasted text, and a URL the project publishes */
.verify-field__paste,
.verify-field__url {
    min-width: 0;
    padding: 7px 9px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-family: 'Courier New', monospace;
    font-size: 0.74rem;
}

.verify-field__paste { resize: vertical; min-height: 3.6rem; }

.verify-field__paste:focus-visible,
.verify-field__url:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.verify-field--paste { align-items: start; }

.verify-field__note {
    grid-column: 2 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
}

.verify-view__actions {
    display: flex;
    gap: 10px;
    padding: 14px 0 2px;
}

.verify-view__run,
.verify-view__clear {
    padding: 9px 18px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

/* the primary action is a fill, so its label takes the ink role (accent on accent-text is 1:1) */
.verify-view__run {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
}

.verify-view__run:hover,
.verify-view__run:focus-visible {
    box-shadow: 0 0 0 2px var(--accent-text);
}

.verify-view__clear:hover,
.verify-view__clear:focus-visible {
    border-color: var(--accent);
    color: var(--accent-text);
}

/* ---- results ------------------------------------------------------------------------------- */

.verify-view__results {
    padding: 16px 22px 28px;
}

.verify-result {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 14px;
    padding: 9px 0;
    border-top: 1px solid var(--rule);
}

.verify-result__label {
    color: var(--muted);
    font-size: 0.78rem;
}

.verify-result__value {
    color: var(--ink);
    font-size: 0.82rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.verify-result.is-ok .verify-result__value { color: var(--active-text); }
.verify-result.is-bad .verify-result__value { color: var(--accent-text); }

.verify-view__hint,
.verify-view__error {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.verify-view__error { color: var(--accent-text); }

/* ---- the answer, in the middle of the screen ------------------------------------------------- */

.verify-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 1.1rem;
    background: var(--scrim);
}

.verify-modal[hidden] { display: none !important; }

.verify-modal__box {
    position: relative;
    width: min(34rem, 100%);
    max-height: 86vh;
    overflow-y: auto;
    padding: 1.4rem 1.4rem 1.1rem;
    border: 2px solid var(--rule);
    border-radius: 10px;
    background: var(--page);
    color: var(--ink);
    box-shadow: 0 1.2rem 3rem var(--scrim);
}

/* the verdict is the headline: a fill on the outcome, so the colour is read before the words */
.verify-modal__verdict {
    margin: 0 0 1rem;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    font-size: 0.92rem;
    line-height: 1.45;
    background: var(--surface);
    color: var(--ink);
}

.verify-modal__verdict.is-ok {
    background: var(--active);
    color: var(--page);
}

.verify-modal__verdict.is-bad {
    background: var(--accent);
    color: var(--accent-ink);
}

.verify-modal__rows { display: block; }

.verify-modal__rows .verify-result {
    grid-template-columns: 7.5rem minmax(0, 1fr);
}

.verify-modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--page);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.verify-modal__close:hover,
.verify-modal__close:focus-visible {
    border-color: var(--accent);
    color: var(--accent-text);
}

.verify-modal__actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.9rem;
}

.verify-modal__done {
    padding: 8px 18px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.verify-modal__done:hover,
.verify-modal__done:focus-visible {
    box-shadow: 0 0 0 2px var(--accent-text);
}

@media (max-width: 768px) {
    .verify-modal__box { padding: 1.1rem 1rem 1rem; max-height: 90vh; }
    .verify-modal__rows .verify-result { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    /* the BACK button beside a narrow column squeezes the lede into a sliver, so on a phone the head
       stacks and BACK sits under the text */
    .verify-view__head { flex-direction: column-reverse; align-items: flex-start; padding: 14px 14px 10px; }
    .verify-view__form { padding: 4px 14px 14px; }
    .verify-view__results { padding: 12px 14px 22px; }
    .verify-field { grid-template-columns: minmax(0, 1fr); }
    .verify-field__note { grid-column: 1; }
    .verify-field--key .verify-field__paste,
    .verify-field--key .verify-field__file,
    .verify-field--key .verify-field__name { grid-column: 1; margin-top: 6px; }
    .verify-result { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
