/**
 * Spruce Passkey Registration module — structure only.
 *
 * Colours, fonts and spacing belong to the Divi controls on the module, so this
 * file sets none of them. What is here is the handful of things those controls
 * cannot express and the module cannot work without.
 */

/* -----------------------------------------------------------------------------
 * Steps
 *
 * The identity fields and the six-digit code are both in the DOM from the start
 * so they can be styled in the builder; the script reveals one by clearing its
 * `hidden` attribute. Browsers already hide [hidden] elements, but a theme rule
 * as ordinary as `.spruce-passkey-registration div { display: block }` outranks
 * the UA stylesheet, which would leave both steps stacked on the page. This
 * restates it at author level.
 * -------------------------------------------------------------------------- */

.spruce-passkey-registration [hidden] {
    display: none;
}

/* -----------------------------------------------------------------------------
 * Field labels
 *
 * A <label> is inline by default, which puts it on the same line as its input
 * and leaves nowhere for a gap to go — asking for "more space between the label
 * and the field" has no answer until the label is a block. The size of that gap
 * is then the Field Label Spacing control's business, not this file's.
 * -------------------------------------------------------------------------- */

.spruce-passkey-registration__label {
    display: block;
}

/* The fields are a stack, not a paragraph; without this they inherit the
 * theme's paragraph rhythm and drift apart unevenly. The gap between rows is
 * the Field Row Spacing control — this only zeroes the theme default. */
.spruce-passkey-registration__field {
    margin: 0;
}

/* -----------------------------------------------------------------------------
 * Stay logged in
 *
 * A checkbox drawn as a switch. The native control is clipped so the slider
 * can take the clicks while remaining a real checkbox for assistive tech.
 * -------------------------------------------------------------------------- */

.spruce-passkey-registration__remember {
    margin: 0 0 18px;
}

.spruce-passkey-registration__toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.spruce-passkey-registration__toggle-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.spruce-passkey-registration__toggle-slider {
    flex-shrink: 0;
    position: relative;
    width: 44px;
    height: 24px;
    background-color: var(--gcid-secondary-color, #e5e7eb);
    border-radius: 24px;
    transition: background-color 0.2s ease;
}

.spruce-passkey-registration__toggle-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.spruce-passkey-registration__toggle-input:checked + .spruce-passkey-registration__toggle-slider {
    background-color: var(--gcid-primary-color, #0ea5e9);
}

.spruce-passkey-registration__toggle-input:checked + .spruce-passkey-registration__toggle-slider::before {
    transform: translateX(20px);
}

.spruce-passkey-registration__toggle-input:focus-visible + .spruce-passkey-registration__toggle-slider {
    outline: 2px solid var(--gcid-primary-color, #0ea5e9);
    outline-offset: 2px;
}

.spruce-passkey-registration__toggle-label {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #0f172a;
}

/* -----------------------------------------------------------------------------
 * The six-digit code
 *
 * One input per digit. The fixed width and centred text are what turn six text
 * fields into something a visitor recognises as a code; the Code Boxes size and
 * border controls in the builder override them.
 * -------------------------------------------------------------------------- */

.spruce-passkey-registration__code {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    justify-content: center;
}

.spruce-passkey-registration__code-input {
    width: 2.5em;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* -----------------------------------------------------------------------------
 * Resend / change-email controls
 *
 * These are <button>s because they act on this page rather than navigating.
 * Stripping the button chrome is what makes them read as links.
 * -------------------------------------------------------------------------- */

.spruce-passkey-registration__alt-link {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.spruce-passkey-registration__alt-link:disabled {
    cursor: default;
    text-decoration: none;
    opacity: 0.65;
}
