/*
 * Funnel step: Create your account + terms modal (spec 012 — Figma 1:1234 / 1:1334).
 * Every selector is scoped under .cu-step-account (the modal lives inside it;
 * its ::backdrop is addressed via the #cu-terms-modal id, unique to this step).
 */

.cu-step-account {
    --cu-acct-maroon: var(--bs-heading-color, #751144);
    --cu-acct-brand: var(--purple, #750444);
    --cu-acct-brown: var(--text-body-color, #4f2a10);
    --cu-acct-border: #d8c9b2;
    --cu-acct-field-bg: #fffdf7;
    --cu-acct-serif: "Palatino", "Palatino Linotype", "Book Antiqua", serif;
    --cu-acct-sans: "Proza Libre", sans-serif;

    max-width: 1160px;
    margin: 0 auto;
    padding: 40px 24px 96px;
    font-family: var(--cu-acct-serif);
    color: var(--cu-acct-brown);
}

.cu-step-account__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
}

/* No enrollment summary (free account) — one centered column, no hairline. */
.cu-step-account__layout--solo {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
}

.cu-step-account__main {
    max-width: 760px;
    padding-right: 56px;
}

.cu-step-account__layout--solo .cu-step-account__main {
    padding-right: 0;
}

.cu-step-account__aside {
    border-left: 1px solid rgba(79, 42, 16, 0.18);
    padding-left: 36px;
}

/* ---------- header ---------- */

.cu-step-account__back {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 15px;
    color: var(--cu-acct-brown);
    text-decoration: none;
}

.cu-step-account__back:hover,
.cu-step-account__back:focus {
    color: var(--cu-acct-maroon);
    text-decoration: underline;
}

.cu-step-account__title {
    margin: 0 0 10px;
    font-family: var(--cu-acct-serif);
    font-size: clamp(28px, 3.2vw, 36px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--cu-acct-maroon);
}

.cu-step-account__subtitle {
    margin: 0 0 28px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--cu-acct-brown);
}

.cu-step-account__login-toggle {
    color: var(--cu-acct-brown);
    font-weight: 600;
    text-decoration: underline;
}

.cu-step-account__login-toggle:hover,
.cu-step-account__login-toggle:focus {
    color: var(--cu-acct-maroon);
}

/* ---------- errors ---------- */

.cu-step-account__error,
.cu-step-account__form-error {
    margin: 0 0 20px;
    padding: 12px 16px;
    background: #fbe9e2;
    border: 1px solid #e0a58e;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.45;
    color: #8a3b1e;
}

.cu-step-account__form-error[hidden] {
    display: none;
}

/* ---------- inline login ---------- */

.cu-step-account__login {
    margin: 0 0 32px;
    padding: 22px 24px;
    background: var(--light-beige, #fcf5df);
    border: 1px solid var(--cu-acct-border);
    border-radius: 10px;
}

.cu-step-account__login[hidden] {
    display: none;
}

.cu-step-account__login-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 18px;
}

.cu-step-account__submit--login {
    width: auto;
    margin-top: 0;
    padding: 12px 32px;
}

.cu-step-account__lost {
    font-size: 14px;
    color: var(--cu-acct-brown);
    text-decoration: underline;
}

.cu-step-account__lost:hover,
.cu-step-account__lost:focus {
    color: var(--cu-acct-maroon);
}

/* ---------- logged-in identity card (gift step) ---------- */

.cu-step-account__identity {
    margin: 0 0 24px;
    padding: 18px 24px;
    background: var(--light-beige, #fcf5df);
    border: 1px solid var(--cu-acct-maroon);
    border-radius: 10px;
}

.cu-step-account__identity-eyebrow {
    margin: 0 0 4px;
    font-size: 0.8125rem;
    color: rgba(79, 42, 16, 0.65);
}

.cu-step-account__identity-name {
    margin: 0 0 2px;
    font-size: 17px;
    font-weight: 700;
    color: var(--cu-acct-maroon);
}

.cu-step-account__identity-email {
    margin: 0;
    font-size: 14.5px;
    color: var(--cu-acct-brown);
}

/* ---------- form grid + fields ---------- */

.cu-step-account__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 26px;
}

.cu-step-account__field--c1 {
    grid-column: 1;
}

.cu-step-account__field--c2 {
    grid-column: 2;
}

.cu-step-account__field {
    margin: 0;
}

.cu-step-account__field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.3;
    color: var(--cu-acct-brown);
}

/* Requirement hint under a field (password rules), quieter than the label. */
.cu-step-account__field-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(90, 74, 58, 0.75);
}

.cu-step-account__input {
    width: 100%;
    padding: 12px 14px;
    background: var(--cu-acct-field-bg);
    border: 1px solid var(--cu-acct-border);
    border-radius: 6px;
    font-family: var(--cu-acct-serif);
    font-size: 16px;
    line-height: 1.3;
    color: var(--cu-acct-brown);
    box-sizing: border-box;
}

.cu-step-account__input::placeholder {
    color: #b3a893;
    opacity: 1;
}

.cu-step-account__input:focus {
    outline: none;
    border-color: var(--cu-acct-maroon);
    box-shadow: 0 0 0 3px rgba(117, 17, 68, 0.12);
}

/* ---------- terms row ---------- */

.cu-step-account__terms {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 24px;
}

.cu-step-account__terms input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 3px;
    accent-color: var(--cu-acct-brand);
}

.cu-step-account__terms label {
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--cu-acct-brown);
}

.cu-step-account__terms .cu-terms-open {
    color: var(--cu-acct-brown);
    font-weight: 600;
    text-decoration: underline;
}

.cu-step-account__terms .cu-terms-open:hover,
.cu-step-account__terms .cu-terms-open:focus {
    color: var(--cu-acct-maroon);
}

/* ---------- submit ---------- */

.cu-step-account__submit {
    display: block;
    width: 100%;
    margin-top: 28px;
    padding: 15px 24px;
    background: var(--cu-acct-brand);
    border: none;
    border-radius: 6px;
    font-family: var(--cu-acct-serif);
    font-size: 17px;
    font-weight: 700;
    color: #f9f1d7;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.cu-step-account__submit:hover,
.cu-step-account__submit:focus {
    background: #5c0334;
}

.cu-step-account__submit:focus-visible {
    outline: 2px solid var(--cu-acct-maroon);
    outline-offset: 2px;
}

/* ---------- terms modal (Figma 1:1334) ---------- */

.cu-step-account .cu-terms-modal {
    width: min(680px, calc(100vw - 32px));
    padding: 0;
    background: var(--beige, #f9f1d7);
    border: none;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(26, 8, 16, 0.35);
    color: var(--cu-acct-brown);
    font-family: var(--cu-acct-serif);
}

#cu-terms-modal::backdrop {
    background: rgba(26, 8, 16, 0.6);
}

.cu-step-account .cu-terms-modal__inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: min(640px, calc(100vh - 64px));
    padding: 32px 40px 28px;
    box-sizing: border-box;
}

.cu-step-account .cu-terms-modal__title {
    margin: 0;
    font-family: var(--cu-acct-serif);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--cu-acct-maroon);
}

.cu-step-account .cu-terms-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 10px;
    font-size: 15px;
    line-height: 1.55;
    overscroll-behavior: contain;
}

.cu-step-account .cu-terms-modal__body p {
    margin: 0 0 1em;
}

.cu-step-account .cu-terms-modal__body h1,
.cu-step-account .cu-terms-modal__body h2,
.cu-step-account .cu-terms-modal__body h3,
.cu-step-account .cu-terms-modal__body h4 {
    margin: 1.2em 0 0.5em;
    font-family: var(--cu-acct-serif);
    color: var(--cu-acct-maroon);
}

/* The terms content is authored elsewhere and may use any heading level —
   cap every level below the 26px modal title so pasted headings never
   outrank it. */
.cu-step-account .cu-terms-modal__body h1 {
    font-size: 20px;
}

.cu-step-account .cu-terms-modal__body h2 {
    font-size: 20px;
}

.cu-step-account .cu-terms-modal__body h3 {
    font-size: 18px;
}

.cu-step-account .cu-terms-modal__body h4,
.cu-step-account .cu-terms-modal__body h5,
.cu-step-account .cu-terms-modal__body h6 {
    font-size: 16px;
}

.cu-step-account .cu-terms-modal__footer {
    flex: 0 0 auto;
    padding-top: 4px;
}

.cu-step-account .cu-terms-modal__agree {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: var(--cu-acct-brand);
    border: none;
    border-radius: 8px;
    font-family: var(--cu-acct-serif);
    font-size: 16px;
    font-weight: 600;
    color: #fdf8ec;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.cu-step-account .cu-terms-modal__agree:hover,
.cu-step-account .cu-terms-modal__agree:focus {
    background: #5c0336;
}

.cu-step-account .cu-terms-modal__agree[disabled] {
    background: #e3cdd6;
    color: #a98a97;
    cursor: not-allowed;
}

/* Creating-the-account state: stays brand-colored (it is progress, not a
   locked control) with a spinner appended to the label. */
.cu-step-account .cu-terms-modal__agree.is-loading,
.cu-step-account .cu-terms-modal__agree.is-loading[disabled] {
    background: var(--cu-acct-brand);
    color: #fdf8ec;
    cursor: wait;
}

.cu-step-account .cu-terms-modal__agree.is-loading::after {
    content: '';
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-left: 10px;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: cu-agree-spin 0.7s linear infinite;
}

@keyframes cu-agree-spin {
    to { transform: rotate(360deg); }
}

/* Scroll hint under the agree button. Fades by opacity only — the element
   keeps its box, so enabling the button never shifts the layout. */
.cu-step-account .cu-terms-modal__hint {
    margin: 10px 0 0;
    font-size: 13px;
    text-align: center;
    color: #8c6f5a;
    opacity: 1;
    transition: opacity 0.4s ease-in-out;
}

.cu-step-account .cu-terms-modal__hint.is-faded {
    opacity: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 960px) {
    .cu-step-account__layout {
        grid-template-columns: 1fr;
    }

    .cu-step-account__main {
        max-width: none;
        padding-right: 0;
    }

    .cu-step-account__aside {
        order: -1;
        margin-bottom: 32px;
        padding-left: 0;
        padding-bottom: 24px;
        border-left: none;
        border-bottom: 1px solid rgba(79, 42, 16, 0.18);
    }
}

@media (max-width: 640px) {
    .cu-step-account {
        padding: 28px 18px 64px;
    }

    .cu-step-account__grid {
        grid-template-columns: 1fr;
    }

    .cu-step-account__field--c1,
    .cu-step-account__field--c2 {
        grid-column: 1;
    }

    .cu-step-account__login-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        text-align: center;
    }

    .cu-step-account__submit--login {
        width: 100%;
    }

    .cu-step-account .cu-terms-modal__inner {
        padding: 24px 20px 20px;
    }
}
