/*
 * AIE Solicitor Directory: account surface.
 *
 * /join-the-directory/ ([aie_directory_application]) and /solicitor-sign-in/
 * ([aie_solicitor_sign_in]), rebuilt on the Abuse Injury Group (AIG) visual
 * language (docs/DESIGN_SYSTEM.md section 5, "Application and sign-in").
 *
 * - Join: AIG guide composition (membership-apply.html): eyebrow, title and
 *   lead, then the form column (at most 736px, AIG .article) beside a 280px
 *   side column (AIG .side with .toc and .side-help boxes); one column at
 *   860px and below. The confirmation is the AIG welcome card
 *   (.welcome__inner: white, 28px radius, raised shadow, 92px icon circle).
 * - Sign in: a split panel. The plum banner gradient of AIG's page hero
 *   (with its softened peach glow) beside a white form card with a 26px
 *   radius (AIG .help-card); stacked on phones.
 *
 * Depends on tokens.css and ui.css. Buttons, fields, fieldset sections, the
 * statement checkbox, the password control, messages and the on-colour
 * context of the plum panel (.aie-on-colour) are the shared ui.css
 * components; this sheet adds layout and the surface's own components only.
 * Every selector is scoped under .aie-ui; no theme element is styled.
 */

/* ------------------------------------------------------------------ */
/* Shared surface parts                                                */
/* ------------------------------------------------------------------ */

/* Space under the theme header, as on the directory and the portal: 32px
   (20px at 860px and below). Padding rather than margin, so the page root
   still starts where the theme's content area starts. */
.aie-ui.aie-directory-application,
.aie-ui.aie-sign-in {
    padding-top: var(--aie-space-8);
}

/* Numbered steps ("What happens next"): plum numbers in pale circles. The
   list keeps role="list" in the markup because list-style: none removes the
   list semantics in Safari. */
.aie-ui .aie-account__steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: aie-account-step;
}

.aie-ui .aie-account__steps > li {
    position: relative;
    min-height: 1.6em;
    margin: 0;
    padding: 0 0 0 2.35em;
    counter-increment: aie-account-step;
}

.aie-ui .aie-account__steps > li + li {
    margin-top: 0.75em;
}

.aie-ui .aie-account__steps > li::before {
    content: counter(aie-account-step);
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9em;
    height: 1.9em;
    color: var(--aie-plum);
    font-family: var(--aie-font-heading);
    font-size: 0.84em;
    font-weight: 800;
    line-height: 1;
    background: var(--aie-pale);
    border: 1px solid var(--aie-line);
    border-radius: 50%;
}

/* A standalone onward link with a trailing arrow (AIG side-help links). The
   arrow nudges 4px on hover, the only movement on this surface. */
.aie-ui .aie-account__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    font-weight: 600;
}

.aie-ui .aie-account__arrow {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    transition: transform var(--aie-duration) var(--aie-easing);
}

.aie-ui .aie-account__link:hover .aie-account__arrow {
    transform: translateX(4px);
}

/* ------------------------------------------------------------------ */
/* Join the Directory: page layout                                      */
/* ------------------------------------------------------------------ */

/* The page root is the grid, so the form stays a direct child of
   .aie-directory-application: intro across the top, then the form column
   (AIG .article, at most 46rem) and the 280px side column (AIG .side). */
.aie-ui.aie-directory-application {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: start;
    column-gap: 48px;
    row-gap: var(--aie-space-8);
}

.aie-ui .aie-directory-application__intro {
    grid-column: 1 / -1;
    min-width: 0;
}

.aie-ui .aie-directory-application__intro h1 {
    margin: 0 0 0.8rem;
    text-wrap: balance;
}

.aie-ui .aie-directory-application__intro > :last-child {
    margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/* Join the Directory: the form                                         */
/* ------------------------------------------------------------------ */

.aie-ui .aie-directory-application__form {
    grid-column: 1;
    width: 100%;
    max-width: 46rem;
    min-width: 0;
}

/* The error summary is the first thing in the form, on the form's edge. */
.aie-ui .aie-directory-application__form > [data-aie-error-summary] {
    margin-bottom: var(--aie-space-6);
}

.aie-ui .aie-directory-application__form > .aie-directory-form__required {
    margin: 0 0 var(--aie-space-4);
}

/* One field per row inside each fieldset section, 20px apart (AIG
   .mock-form). */
.aie-ui .aie-account__fields {
    display: grid;
    gap: var(--aie-space-5);
}

/* Field widths hint at the expected length. Single-line fields stop at
   30rem, as in AIG's mock form; the phone number and the SRA number (a short
   reference) are narrower; the text area keeps the full width. */
.aie-ui .aie-account__fields :is(input[type="text"], input[type="email"], input[type="url"]) {
    max-width: 30rem;
}

.aie-ui .aie-account__fields input[type="tel"] {
    max-width: 20rem;
}

.aie-ui .aie-account__fields input.aie-account__short-input {
    max-width: 16rem;
}

.aie-ui .aie-directory-application__privacy + .aie-directory-field__error {
    margin-top: var(--aie-space-2);
}

/* ------------------------------------------------------------------ */
/* Join the Directory: side column (AIG .toc and .side-help)            */
/* ------------------------------------------------------------------ */

.aie-ui .aie-directory-application__aside {
    grid-column: 2;
    display: grid;
    gap: var(--aie-space-4);
    min-width: 0;
}

/* Text starts at the shared box inset (border included), so these boxes line
   up with the form's fieldsets when they stack under the form. */
.aie-ui .aie-account__box {
    padding: var(--aie-space-4) calc(var(--aie-inset) - 1px);
    color: var(--aie-ink);
    font-size: 0.95rem;
    line-height: 1.6;
    background: var(--aie-white);
    border: 1px solid var(--aie-line);
    border-radius: var(--aie-radius-box);
}

.aie-ui .aie-account__box--pale {
    background: var(--aie-pale);
}

.aie-ui .aie-account__box p {
    margin: 0 0 0.5rem;
}

.aie-ui .aie-account__box > :last-child {
    margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/* Join the Directory: confirmation (AIG welcome card)                  */
/* ------------------------------------------------------------------ */

.aie-ui .aie-directory-application__result {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: var(--aie-space-8);
    min-width: 0;
    padding: 36px 44px;
    background: var(--aie-white);
    border: 1px solid var(--aie-line-card);
    border-radius: var(--aie-radius-xl);
    box-shadow: var(--aie-shadow-raised);
}

/* AIG .welcome__icon: a 92px peach-to-pink circle with a rose stroke icon
   (the gradient colours have no token). */
.aie-ui .aie-directory-application__result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 92px;
    height: 92px;
    color: var(--aie-rose);
    background: linear-gradient(135deg, #FDE3D3, #F6CFE0);
    border-radius: 50%;
}

.aie-ui .aie-directory-application__result-icon svg {
    display: block;
    width: 52px;
    height: 52px;
}

.aie-ui .aie-directory-application__result-content {
    max-width: 52rem;
    min-width: 0;
}

.aie-ui .aie-directory-application__result h2 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.aie-ui .aie-directory-application__result-text {
    margin: 0;
    font-size: 1.15rem;
}

.aie-ui .aie-directory-application__next-steps {
    margin-top: var(--aie-space-6);
    padding-top: var(--aie-space-5);
    border-top: 1px solid var(--aie-line);
}

.aie-ui .aie-directory-application__next-steps h3 {
    margin: 0 0 var(--aie-space-4);
    font-size: 1.2rem;
}

.aie-ui .aie-directory-application__result-link {
    margin: var(--aie-space-5) 0 0;
}

/* ------------------------------------------------------------------ */
/* Solicitor sign in: split panel                                       */
/* ------------------------------------------------------------------ */

/* The page root holds the two halves; their heights match. */
.aie-ui.aie-sign-in {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: stretch;
    gap: var(--aie-space-6);
}

/* Plum panel: AIG banner gradient with the peach glow at the strength AIG
   uses for narrower banners, so the white text keeps 4.5:1 wherever it
   wraps. The markup marks it .aie-on-colour (ui.css), which makes its text,
   headings and eyebrow white and its focus rings white (teal is 2.39:1 on
   plum); #F3D9E7, fine on flat plum, would drop below 4.5:1 where the
   gradient turns rose. */
.aie-ui .aie-directory-portal__auth-header {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: var(--aie-space-9);
    background:
        radial-gradient(circle at 85% 20%, rgba(242, 196, 168, 0.2) 0, rgba(242, 196, 168, 0) 45%),
        linear-gradient(135deg, var(--aie-plum) 0%, var(--aie-plum-blend) 60%, var(--aie-rose) 100%);
    border-radius: var(--aie-radius-xl);
    box-shadow: 0 16px 36px rgba(81, 44, 89, 0.2);
}

.aie-ui .aie-directory-portal__auth-header .aie-directory-portal__eyebrow {
    margin-bottom: 0.6rem;
}

.aie-ui .aie-directory-portal__auth-header h1 {
    margin: 0 0 0.8rem;
    font-size: clamp(2.1rem, 3.4vw, 2.75rem);
    text-wrap: balance;
}

.aie-ui .aie-directory-portal__auth-lead {
    max-width: 30rem;
    margin: 0 0 var(--aie-space-8);
    font-size: 1.15rem;
}

/* The assurance sits at the foot of the panel, under a faint rule, with a
   drawn tick in a washed circle (AIG member-row icon on colour). */
.aie-ui .aie-directory-portal__auth-assurance {
    display: flex;
    align-items: flex-start;
    gap: var(--aie-space-4);
    margin-top: auto;
    padding-top: var(--aie-space-6);
    border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.aie-ui .aie-directory-portal__auth-tick {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--aie-on-plum-wash);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
}

.aie-ui .aie-directory-portal__auth-tick svg {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
}

.aie-ui .aie-directory-portal__auth-assurance p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
}

.aie-ui .aie-directory-portal__auth-assurance strong {
    display: block;
    font-family: var(--aie-font-heading);
    font-size: 1.05rem;
    font-weight: 700;
}

.aie-ui .aie-directory-portal__auth-assurance small {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.95rem;
}

/* White form card (AIG .help-card: 26px radius, 34px padding). */
.aie-ui .aie-directory-portal__auth-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 34px;
    background: var(--aie-white);
    border: 1px solid var(--aie-line-card);
    border-radius: var(--aie-radius-lg);
    box-shadow: var(--aie-shadow-raised);
}

.aie-ui .aie-directory-portal__auth-content > :last-child {
    margin-bottom: 0;
}

/* Sign-in form: label above each field, 20px apart; the remember row, the
   full-width plum pill and the reset link follow in tab order. */
.aie-ui .aie-directory-sign-in-form {
    display: grid;
    gap: var(--aie-space-5);
}

.aie-ui .aie-directory-sign-in-form__remember {
    display: flex;
    align-items: center;
    justify-self: start;
    gap: var(--aie-space-3);
    min-height: 44px;
    margin: 0;
    color: var(--aie-ink);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.45;
    cursor: pointer;
}

.aie-ui .aie-directory-sign-in-form__remember input[type="checkbox"] {
    margin: 0;
}

.aie-ui .aie-directory-sign-in-form .aie-directory-form__actions {
    margin-top: var(--aie-space-1);
}

.aie-ui .aie-directory-sign-in-form__help {
    margin: 0;
    font-size: 1rem;
    text-align: center;
}

.aie-ui .aie-directory-sign-in-form__help a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.35rem;
    font-weight: 600;
}

/* Route for firms without an account, under a divider at the card foot. */
.aie-ui .aie-directory-portal__auth-join {
    margin: var(--aie-space-5) 0 0;
    padding-top: var(--aie-space-4);
    color: var(--aie-muted);
    font-size: 0.95rem;
    line-height: 2;
    text-align: center;
    border-top: 1px solid var(--aie-line);
}

.aie-ui .aie-directory-portal__auth-join a {
    font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1100px) {
    .aie-ui .aie-directory-portal__auth-header {
        padding: 36px;
    }

    .aie-ui .aie-directory-portal__auth-content {
        padding: 30px;
    }
}

/* AIG's main breakpoint: every two-column layout becomes one column, with
   the side column after the form. */
@media (max-width: 860px) {
    .aie-ui.aie-directory-application,
    .aie-ui.aie-sign-in {
        padding-top: var(--aie-space-5);
    }

    .aie-ui.aie-directory-application {
        grid-template-columns: minmax(0, 1fr);
        row-gap: var(--aie-space-6);
    }

    .aie-ui .aie-directory-application__aside {
        grid-column: 1;
    }

    .aie-ui .aie-directory-application__result {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
        padding: 28px 24px;
    }

    .aie-ui .aie-directory-application__result-icon {
        width: 72px;
        height: 72px;
    }

    .aie-ui .aie-directory-application__result-icon svg {
        width: 40px;
        height: 40px;
    }

    .aie-ui.aie-sign-in {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--aie-space-4);
    }

    .aie-ui .aie-directory-portal__auth-header,
    .aie-ui .aie-directory-portal__auth-content {
        padding: 28px 24px;
    }

    .aie-ui .aie-directory-portal__auth-lead {
        margin-bottom: var(--aie-space-6);
    }
}

@media (max-width: 480px) {
    .aie-ui .aie-directory-application__result,
    .aie-ui .aie-directory-portal__auth-header,
    .aie-ui .aie-directory-portal__auth-content {
        padding: 24px 20px;
    }
}

/* Nothing moves when less motion is requested (ui.css also shortens every
   transition on the surface). */
@media (prefers-reduced-motion: reduce) {
    .aie-ui .aie-account__arrow {
        transition: none;
    }

    .aie-ui .aie-account__link:hover .aie-account__arrow {
        transform: none;
    }
}
