/* =============================================================================================
   Fields of light (draft "Tropfen 3", 2026-10-23): the forms of the subpages (contact,
   newsletter) in the room of the home page. A form with the class .lightform: its fields are dark
   glass with a fine rim of light, the rim lights up in the colour of the page (--c: the world of
   the room) while the field is in use; check boxes are round lights; the file field is a ring
   with a round button. State changes are instant (no animated borders or shadows): the motion of
   the page is the light being, which marks the field in use (welcome/js/companion.js).
   ============================================================================================= */

/* --c comes from the page (the world of the room), pearl without one. */
.lightform {
    --field-c: var(--c, var(--w-pearl));
    --field-line: color-mix(in oklab, var(--field-c) 16%, rgba(214, 224, 240, 0.16));
    --field-lit: color-mix(in oklab, var(--field-c) 72%, white);
}

/* Labels of fields: quiet, above their field (low specificity: a page may shape its own labels). */
.lightform :where(.form-group, .lf-field) > label {
    display: block;
    margin-bottom: 8px;
    color: var(--fg-2);
    font-size: 0.88rem;
    font-weight: 500;
}

/* Text, mail, select and long text: dark glass, a fine rim, round ends. */
.lightform :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"], [type="submit"], [type="button"]), select, textarea) {
    width: 100%;
    min-height: 50px;
    padding: 13px 18px;
    border: 1px solid var(--field-line);
    border-radius: 16px;
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in oklab, var(--field-c) 6%, transparent), transparent 60%),
        rgba(9, 12, 17, 0.72);
    color: var(--fg);
    font: inherit;
    font-size: 1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.lightform textarea {
    min-height: 168px;
    line-height: 1.55;
    resize: vertical;
}

.lightform :is(input, textarea)::placeholder {
    color: var(--fg-3);
    opacity: 1;
}

/* The select draws its own chevron in the light of the page. */
.lightform select {
    padding-right: 48px;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c8d2e2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E"),
        radial-gradient(120% 140% at 0% 0%, color-mix(in oklab, var(--field-c) 6%, transparent), transparent 60%);
    background-color: rgba(9, 12, 17, 0.72);
    background-repeat: no-repeat;
    background-position: right 18px center, 0 0;
    background-size: 14px 14px, auto;
    appearance: none;
    cursor: pointer;
}

.lightform select option {
    background: #0b0f15;
    color: var(--fg);
}

/* In use: the rim takes the light of the page. */
.lightform :is(input, select, textarea):focus {
    border-color: var(--field-lit);
    outline: none;
    box-shadow: 0 0 0 1px var(--field-lit), 0 0 22px -6px color-mix(in oklab, var(--field-c) 70%, transparent);
}

.lightform :is(input, select, textarea):focus-visible {
    outline: 2px solid var(--field-lit);
    outline-offset: 3px;
}

/* Wrong after the visitor's own input (never before). */
.lightform :is(input, select, textarea):user-invalid,
.lightform [aria-invalid="true"] {
    border-color: color-mix(in oklab, var(--signal, #ff6b6b) 70%, white);
}

/* Round check boxes: a ring that fills with the light of the page. */
.lightform input[type="checkbox"] {
    flex: none;
    width: 24px;
    height: 24px;
    margin: 1px 0 0;
    border: 1.5px solid var(--field-line);
    border-radius: 50%;
    background: rgba(9, 12, 17, 0.72);
    appearance: none;
    cursor: pointer;
}

.lightform input[type="checkbox"]:checked {
    border-color: var(--field-lit);
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2307090d' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 12.5 3.4 3.4L17.5 8.8'/%3E%3C/svg%3E") center / 15px 15px no-repeat,
        radial-gradient(circle at 38% 34%, #fff 0 12%, var(--field-lit) 55%, var(--field-c));
    box-shadow: 0 0 14px color-mix(in oklab, var(--field-c) 55%, transparent);
}

.lightform input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--field-lit);
    outline-offset: 3px;
}

/* The file field: a round button in a ring of light, the chosen files as pills below. */
.lightform input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px dashed color-mix(in oklab, var(--field-c) 30%, rgba(214, 224, 240, 0.22));
    border-radius: 999px;
    background: rgba(9, 12, 17, 0.5);
    color: var(--fg-3);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.lightform input[type="file"]::file-selector-button {
    min-height: 40px;
    margin-right: 14px;
    padding: 0 18px;
    border: 1px solid var(--field-lit);
    border-radius: 999px;
    background: color-mix(in oklab, var(--field-c) 14%, rgba(7, 9, 13, 0.9));
    color: var(--fg);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.lightform input[type="file"]:focus-visible {
    outline: 2px solid var(--field-lit);
    outline-offset: 3px;
}

/* Messages of a field and of the form: quiet text with a small light, no boxes. */
.lightform .error-message {
    margin-top: 8px;
    color: color-mix(in oklab, var(--signal, #ff6b6b) 82%, white);
    font-size: 0.86rem;
}

/* Without consent to the form protection (reCAPTCHA) this note stands in place of the send button:
   a title with a light of its own, the reason, the consent, the other way (email). No box. */
.captcha-consent {
    display: grid;
    gap: 10px;
    justify-items: start;
    color: var(--fg-2);
    font-size: 0.93rem;
    line-height: 1.55;
}

.captcha-consent[hidden] {
    display: none;
}

.captcha-consent-title {
    display: flex;
    gap: 12px;
    align-items: baseline;
    color: var(--fg);
    font-family: var(--font-display);
    font-size: var(--step-1);
    line-height: 1.2;
}

.captcha-consent-title::before {
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 34%, #fff 0 10%, var(--w-care) 50%, transparent);
    box-shadow: 0 0 12px color-mix(in oklab, var(--w-care) 60%, transparent);
    translate: 0 -2px;
}

.captcha-consent-text,
.captcha-consent-mail {
    max-width: 54ch;
}

.captcha-consent-mail a {
    color: var(--fg);
    text-decoration: underline;
    text-decoration-color: color-mix(in oklab, var(--c, var(--w-pearl)) 60%, transparent);
    text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .lightform * {
        transition: none;
    }
}
