/* ============================================================
   FORMS
   ============================================================ */

.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.field__error {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--danger);
}

.input,
.select {
    width: 100%;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: var(--border-width) solid var(--border-strong);
    border-radius: var(--radius-md);
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus,
.select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--glow-accent);
}

/* --- Search ------------------------------------------------- */

.search {
    display: flex;
    gap: var(--space-2);
}

.search__field {
    position: relative;
    flex: 1;
}

.search__field .input {
    /* Room for the leading icon. */
    padding-left: calc(var(--space-4) + 1.25rem);
}

.search__icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1.1rem;
}

/* ============================================================
   LANGUAGE SWITCH
   Two positions with a sliding pill, rather than a dropdown:
   with only two languages, a menu costs an extra click and
   hides the alternative.
   ============================================================ */

.lang-switch {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    /* Matches the height of the icon buttons beside it. */
    height: 40px;
    padding: 3px;
    background: color-mix(in srgb, var(--nav-text, var(--text-primary)) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--nav-text, var(--text-primary)) 24%, transparent);
    border-radius: var(--radius-pill);
}

/* The pill that travels between the two options. */
.lang-switch__slider {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    box-shadow: 0 0 12px color-mix(in srgb, var(--secondary) 45%, transparent);
    transition: transform var(--duration-base) var(--ease-out);
}

/* Spanish is first, English second: the pill sits left or right. */
.lang-switch--en .lang-switch__slider {
    transform: translateX(100%);
}

/* Each option is its own form; the form is the grid cell. */
.lang-switch__form {
    display: flex;
}

.lang-switch__option {
    position: relative;
    z-index: 1;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding-inline: var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    color: var(--nav-text-muted, var(--text-muted));
    background: none;
    border: 0;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-out);
}

.lang-switch__option:hover {
    color: var(--nav-text-strong, var(--text-primary));
}

.lang-switch__option[aria-current="true"] {
    color: var(--text-on-accent);
    cursor: default;
}

.lang-switch__option:focus-visible {
    outline: var(--border-width-thick) solid var(--gold);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .lang-switch__slider {
        transition: none;
    }
}
