/* The admin's sign-in screens (login and two-step) laid out like the website's /signin: the form on the left, a
   dark panel with the sunrise pattern on the right. Brand colours come from Wagtail's primary (the site's dark
   colour) and secondary (its primary colour), set from Site settings by core.admin_branding. */
.eyc-auth {
    --eyc-paper: #fff;
    --eyc-surface: #fff;
    --eyc-ink: #12294d;
    --eyc-ink-soft: #3d5070;
    --eyc-muted: #5d6e88;
    --eyc-line: #d5deea;
    --eyc-mist: #eef3f9;
    --eyc-navy: var(--w-color-secondary, #154d95);
    --eyc-ink-bg: var(--w-color-primary, #12294d);
    --eyc-link: var(--eyc-navy);
    --eyc-yellow: #ffc73f;
    --eyc-danger: #b4321f;
    --eyc-success: #1f7a4d;
    --eyc-serif: "Source Serif 4", Georgia, serif;
    --eyc-sans: "Public Sans", system-ui, sans-serif;
    --eyc-pad: clamp(32px, 5vw, 72px);
    --eyc-gutter: clamp(16px, 4vw, 40px);
    --w-color-focus: var(--eyc-navy);  /* Wagtail's focus ring, in the brand */
}
.w-theme-dark .eyc-auth {
    --eyc-paper: hsl(218 50% 9%);
    --eyc-surface: hsl(216 40% 15%);
    --eyc-ink: hsl(213 45% 94%);
    --eyc-ink-soft: hsl(214 28% 78%);
    --eyc-muted: hsl(214 18% 64%);
    --eyc-line: hsl(216 28% 25%);
    --eyc-mist: hsl(217 44% 12%);
    --eyc-ink-bg: hsl(216 55% 16%);
    --eyc-navy: hsl(213 62% 47%);
    --eyc-link: hsl(212 80% 76%);
    --eyc-danger: hsl(8 75% 66%);
    --eyc-success: hsl(150 50% 60%);
}
@media (prefers-color-scheme: dark) {
    .w-theme-system .eyc-auth {
        --eyc-paper: hsl(218 50% 9%);
        --eyc-surface: hsl(216 40% 15%);
        --eyc-ink: hsl(213 45% 94%);
        --eyc-ink-soft: hsl(214 28% 78%);
        --eyc-muted: hsl(214 18% 64%);
        --eyc-line: hsl(216 28% 25%);
        --eyc-mist: hsl(217 44% 12%);
        --eyc-ink-bg: hsl(216 55% 16%);
        --eyc-navy: hsl(213 62% 47%);
        --eyc-link: hsl(212 80% 76%);
        --eyc-danger: hsl(8 75% 66%);
        --eyc-success: hsl(150 50% 60%);
    }
}

/* No sidebar on these screens: drop the space Wagtail keeps for it */
body.eyc-auth-page { background: var(--w-color-surface-page); }
body.eyc-auth-page .wrapper { padding: 0; margin: 0; }
.eyc-auth {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh;
    background: var(--eyc-paper); color: var(--eyc-ink); font-family: var(--eyc-sans); font-size: 1rem; line-height: 1.5;
}
.eyc-auth *, .eyc-auth *::before, .eyc-auth *::after { box-sizing: border-box; }

/* Form column */
.eyc-auth-main { display: flex; flex-direction: column; padding: 28px var(--eyc-gutter) var(--eyc-pad); }
.eyc-auth-brand { display: block; width: min(100%, 460px); margin-inline: auto; }
.eyc-auth-brand img { margin-inline-end: auto; }
.eyc-auth-brand img { display: block; height: 44px; width: auto; max-width: 15rem; object-fit: contain; }
.eyc-auth-brand .eyc-logo-dark { display: none; }
.w-theme-dark .eyc-auth-brand .eyc-logo-light:has(+ .eyc-logo-dark) { display: none; }
.w-theme-dark .eyc-auth-brand .eyc-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
    .w-theme-system .eyc-auth-brand .eyc-logo-light:has(+ .eyc-logo-dark) { display: none; }
    .w-theme-system .eyc-auth-brand .eyc-logo-dark { display: block; }
}
.eyc-auth-card { width: min(100%, 460px); margin: auto; padding-top: var(--eyc-pad); display: grid; gap: 22px; }
.eyc-auth-card h1 {
    margin: 0; font-family: var(--eyc-serif); font-optical-sizing: auto; font-weight: 700;
    font-size: clamp(2rem, 3.4vw, 2.6rem); line-height: 1.04; letter-spacing: -0.02em; color: var(--eyc-ink);
}
.eyc-auth-card .eyc-lede { margin: 10px 0 0; font-size: 1.0625rem; color: var(--eyc-ink-soft); }
.eyc-auth-card p { margin: 0; }
.eyc-auth-card code { font-size: .9375rem; }

/* Which step: password, then code (as the website's sign up steps) */
.eyc-auth-steps { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: .875rem; font-weight: 700; color: var(--eyc-muted); }
.eyc-auth-steps li { flex: 1; padding-top: 8px; border-top: 4px solid var(--eyc-line); }
.eyc-auth-steps li[aria-current] { color: var(--eyc-ink); border-top-color: var(--eyc-navy); }
.eyc-auth-steps li.done { color: var(--eyc-ink-soft); border-top-color: #3592c9; }

/* Messages: a bar at the side, not Wagtail's filled banner */
.eyc-auth .messages:not(:has(li)) { display: none; }
.eyc-auth .messages ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.eyc-auth .messages li {
    position: static; margin: 0; padding: 12px 16px; border-radius: 6px; border-left: 4px solid var(--eyc-navy);
    background: var(--eyc-mist); color: var(--eyc-ink); font-size: .9375rem; font-weight: 600;
}
.eyc-auth .messages li.success { border-left-color: var(--eyc-success); }
.eyc-auth .messages li.error { border-left-color: var(--eyc-danger); }
.eyc-auth .messages li::before { display: none; }

/* Fields (Wagtail's field markup, in the website's look) */
.eyc-auth form { display: grid; gap: 18px; margin: 0; }
.eyc-auth .w-field__wrapper { margin: 0; }
.eyc-auth .w-field__label { display: block; margin: 0 0 6px; font-family: var(--eyc-sans); font-size: .9375rem; font-weight: 700; color: var(--eyc-ink); }
.eyc-auth .w-required-mark { color: var(--eyc-danger); }
.eyc-auth .w-field__input input:is([type="text"], [type="email"], [type="password"]),
.eyc-auth .w-field__input select {
    width: 100%; min-height: 48px; padding: 11px 14px; border: 2px solid var(--eyc-ink); border-radius: 10px;
    background-color: var(--eyc-surface); color: var(--eyc-ink); font: 1rem/1.4 var(--eyc-sans); box-shadow: none;
}
/* Full width with its own chevron, centred whatever the height (Wagtail's is drawn for its shorter fields) */
.eyc-auth .w-field--select { width: 100%; }
.eyc-auth .w-field__input select {
    appearance: none; padding-inline-end: 44px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235d6e88' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 16px 16px;
}
.eyc-auth .w-field--select .w-field__input::after { display: none; }
.w-theme-dark .eyc-auth .w-field__input select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23b4c2d6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) {
    .w-theme-system .eyc-auth .w-field__input select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23b4c2d6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); }
}
.eyc-auth .w-field__input :is(input, select):focus-visible { outline: 3px solid var(--eyc-navy); outline-offset: 2px; border-color: var(--eyc-ink); }
.eyc-auth .w-field__errors, .eyc-auth .error-message { color: var(--eyc-danger); font-weight: 700; font-size: .9375rem; }
.eyc-auth .w-field--error .w-field__input :is(input, select) { border-color: var(--eyc-danger); }
.eyc-auth .w-field__help { color: var(--eyc-muted); font-size: .9375rem; }

/* Remember me and the reset link, on one row as on the website */
.eyc-auth-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.eyc-auth .w-field--boolean_field .w-field__input, .eyc-auth .remember-me { display: flex; align-items: center; gap: 12px; margin: 0; }
.eyc-auth .remember-me { font-weight: 400; color: var(--eyc-ink); cursor: pointer; }
.eyc-auth input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--eyc-navy); flex: none; }
.eyc-auth a, .eyc-auth .eyc-link {
    color: var(--eyc-link); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.eyc-auth a:hover, .eyc-auth .eyc-link:hover { text-decoration-thickness: 3px; }
.eyc-auth a:focus-visible, .eyc-auth button:focus-visible { outline: 3px solid var(--eyc-navy); outline-offset: 3px; border-radius: 2px; }

/* Buttons */
.eyc-auth .form-actions { margin: 4px 0 0; padding: 0; display: grid; gap: 12px; }
.eyc-auth .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: auto; min-height: 52px;
    padding: 14px 24px; border: 2px solid var(--eyc-navy); border-radius: 6px; background: var(--eyc-navy); color: #fff;
    font: 700 1rem/1 var(--eyc-sans); text-decoration: none; white-space: nowrap; cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.eyc-auth .button:hover { background: var(--eyc-ink-bg); border-color: var(--eyc-ink); color: #fff; }
.eyc-auth .button em { font-style: normal; }
.eyc-auth .button.button-secondary { background: transparent; color: var(--eyc-link); border-color: var(--eyc-navy); }
.eyc-auth .button.button-secondary:hover { background: var(--eyc-mist); color: var(--eyc-ink); }
.eyc-auth .eyc-link { padding: 0; border: 0; background: none; font: inherit; font-weight: 700; cursor: pointer; }

/* Under the form: "Not you? Sign out", as the website's "New here?" line */
.eyc-auth-alt { padding-top: 18px; border-top: 1px solid var(--eyc-line); text-align: center; color: var(--eyc-ink-soft); }
.eyc-auth form.eyc-auth-alt { display: block; }

.eyc-qr svg { display: block; width: 100%; max-width: 14rem; height: auto; background: #fff; padding: .5rem; border-radius: .25rem; }
.eyc-backup-codes { columns: 2; list-style: none; padding: 0; margin: 0; }

/* The dark panel */
.eyc-auth-side {
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: var(--eyc-pad) var(--eyc-pad) 0;
    background: var(--eyc-ink-bg); color: #fff; overflow: hidden;
}
.eyc-auth-side h2 {
    margin: 0; max-width: 14ch; font-family: var(--eyc-serif); font-optical-sizing: auto; font-weight: 700;
    font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.1; letter-spacing: -0.015em; color: #fff;
}
.eyc-auth-side ul { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; color: #d6e2f2; font-size: 1.0625rem; }
.eyc-auth-side li { display: flex; gap: 12px; }
.eyc-auth-side li::before { content: ""; width: 10px; height: 10px; margin-top: 9px; border-radius: 50%; background: var(--eyc-yellow); flex: none; }
.eyc-auth-side .eyc-sunrise { margin: 0 calc(-1 * var(--eyc-pad)) 72px; }
.eyc-auth-side .eyc-sunrise svg { display: block; width: 100%; height: 110px; }

@media (max-width: 860px) {
    .eyc-auth { grid-template-columns: 1fr; }
    .eyc-auth-card { padding-top: 40px; margin-top: 0; }
    .eyc-auth-side { padding-top: 40px; }
    .eyc-auth-side .eyc-sunrise { margin-bottom: 24px; }
}
