.captcha {
    display: grid;
    gap: 0.5rem;
}

.captcha-label {
    font-weight: 600;
}

.captcha-hint {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--gray-dark);
}

/* Fixed dark backdrop in both themes: the point cloud is drawn in the brand
   colours and needs to sit against something they read against. */
.captcha-stage {
    background: #121316;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 16 / 6.5;
    max-height: 250px;
    /* Lift the panel over the diagonal hatch the contact section paints across
       its whole area, which otherwise reads as dirt on the lens. */
    position: relative;
    z-index: 1;
}

.captcha-stage[hidden] {
    display: none;
}

.captcha-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: pan-y;
}

.captcha-canvas:active {
    cursor: grabbing;
}

.captcha-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

.captcha-input {
    flex: 1 1 8rem;
    min-width: 0;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    letter-spacing: 0.15em;
    background: rgb(from var(--white) r g b / 90%);
    color: var(--gray-dark);
}

.captcha-action {
    padding: 12px 16px;
    border: 1px solid rgb(from var(--gray-dark) r g b / 40%);
    border-radius: 6px;
    background: rgb(from var(--white) r g b / 70%);
    color: var(--gray-dark);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.captcha-action:hover {
    background: var(--gray-dark);
    color: var(--white);
}

.captcha-action[hidden] {
    display: none;
}

.captcha-error:empty {
    display: none;
}

.captcha-error {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--red);
}

/* Honeypot: out of the layout, out of the tab order, hidden from assistive
   technology. Only a script filling every field will reach it. */
.captcha-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .captcha-input {
        flex-basis: 100%;
    }

    .captcha-action {
        flex: 1 1 auto;
    }
}
