/* Account group: /signup, /login, /forgot, /reset and the email-link pages (/reset#token, /verify).
   Loaded after every shared layer (tokens, components, marketing, site, pages, product), so it only
   refines them. Every colour is a token; the aside is the always-dark ink panel and re-points the
   tokens it uses. Plan numbers never live here; they come from accounts.PLANS through `facts`.
   Classes are prefixed au- so they cannot collide with the shared patterns. */

/* ============================================================ the split */
/* Desktop: form column on paper, ink aside beside it. Below 1024 the aside is hidden, except on
   sign-up where it follows the form as a dark card, so phones get the same reassurance. */
.surface-auth .auth { grid-template-rows: minmax(0, 1fr) auto; }
@media (min-width: 1024px) { .surface-auth .auth { grid-template-rows: none; } }

.surface-auth .auth__form { justify-content: flex-start; gap: var(--space-8); padding: var(--space-4) var(--gutter) var(--space-10); }
@media (min-width: 768px) { .surface-auth .auth__form { padding: var(--space-6) var(--space-10) var(--space-12); } }
@media (min-width: 1024px) { .surface-auth .auth__form { min-height: 100vh; padding: var(--space-8) var(--space-12) var(--space-12); } }

/* The bar: the way home. The aside carries no logo, so this is the only one. */
.au-bar { display: flex; align-items: center; min-height: 2.75rem; }
.au-bar .s-logo { min-height: 2.75rem; }

/* The card sits high on phones (thumb reach, keyboard) and centred on bigger screens. */
.surface-auth .auth__card { max-width: 26rem; display: flex; flex-direction: column; }
@media (min-width: 768px) { .surface-auth .auth__card { margin-block: auto; } }

/* The skip link waits above the viewport; its shadow should not. */
.surface-auth .s-skip:not(:focus) { box-shadow: none; }

/* ============================================================ the card */
.au-badge { display: inline-flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; margin-bottom: var(--space-5);
  border-radius: var(--radius-lg); background: var(--accent-subtle); color: var(--accent-text); }
.au-badge--ok { background: var(--success-subtle); color: var(--success); }
.au-title { font-family: var(--font-display); font-size: clamp(2rem, 1.7rem + 1vw, 2.5rem); font-weight: var(--font-extrabold);
  line-height: 1.05; letter-spacing: -0.035em; color: var(--text-strong); text-wrap: balance; }
.au-sub { margin-top: var(--space-3); font-size: var(--text-base); line-height: 1.55; color: var(--text-muted); text-wrap: pretty; }
.au-sub b { color: var(--text-strong); font-weight: var(--font-semibold); overflow-wrap: anywhere; }
.au-form { display: flex; flex-direction: column; gap: var(--space-5); margin-top: var(--space-8); }
.au-form .s-btn--block { margin-top: var(--space-1); }
.au-fine { font-size: var(--text-xs); line-height: 1.55; color: var(--text-subtle); }
.au-fine .s-link { color: inherit; }
.au-fine .s-link:hover { color: var(--text-strong); }
.au-card-actions { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-8); }

/* A label row with a quiet link on the right ("Forgot password?"). */
.au-labelrow { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.au-labelrow .s-link { font-size: var(--text-sm); }

/* Password with a Show/Hide switch inside the field. Without JavaScript the switch is hidden. */
.au-pw { position: relative; }
.au-pw .s-input { padding-right: 4.75rem; }
.au-pw__toggle { position: absolute; top: 50%; right: var(--space-1); transform: translateY(-50%); min-width: 4rem; height: 2.75rem;
  padding-inline: var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer;
  font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--text-link); }
.au-pw__toggle:hover { background: var(--surface-hover); color: var(--accent-hover); }
html:not(.js) body.surface-auth .au-pw__toggle { display: none; }
html:not(.js) body.surface-auth .au-pw .s-input { padding-right: var(--space-3); }

/* Icons drawn by CSS (the status line's text is rewritten by script, so it cannot hold an <svg>). */
.surface-auth {
  --au-alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1.2 5.5h2.4l-.3 7h-1.8zM12 15.9a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8z'/%3E%3C/svg%3E");
  --au-ok-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1.3 14.3-4.1-4.1 1.4-1.4 2.7 2.7 5.6-5.6 1.4 1.4z'/%3E%3C/svg%3E");
  --au-mail-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3.5 6.5l8.5 6.5 8.5-6.5'/%3E%3C/svg%3E");
}

/* Errors: one line under the field that caused it, or one callout above the form. */
.au-alert { display: flex; gap: var(--space-3); margin-top: var(--space-6); padding: var(--space-3) var(--space-4);
  border: var(--border-w) solid color-mix(in srgb, var(--error) 28%, transparent); border-radius: var(--radius-md);
  background: var(--error-subtle); color: var(--text); font-size: var(--text-sm); line-height: 1.5; }
.au-alert::before, .au-fielderr::before { content: ""; flex: none; width: 1.125rem; height: 1.125rem; margin-top: 0.1rem; background: var(--error);
  -webkit-mask: var(--au-alert-icon) center / contain no-repeat; mask: var(--au-alert-icon) center / contain no-repeat; }
.au-alert b { font-weight: var(--font-semibold); color: var(--text-strong); }
.au-alert .s-link { white-space: nowrap; }
.au-fielderr { display: flex; gap: var(--space-2); font-size: var(--text-sm); line-height: 1.4; color: var(--error); }
.au-fielderr::before { width: 1rem; height: 1rem; margin-top: 0.1rem; }

/* Paid intent carried through sign-up: the plan they picked on pricing. */
.au-next { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-6); padding: var(--space-3) var(--space-4);
  border: var(--border-w) solid var(--accent-border); border-radius: var(--radius-md); background: var(--accent-subtle);
  font-size: var(--text-sm); line-height: 1.45; color: var(--text); }
.au-next svg { flex: none; color: var(--accent-text); }
.au-next b { color: var(--text-strong); font-weight: var(--font-semibold); }

/* The live status line on the email-link pages. email-link.js rewrites its text and, on a bad
   link, sets role=alert, which turns it into the error callout. Waiting reads as a note on a
   tinted ground with a mail mark, so it never looks like a field to type in. */
.au-status { display: flex; gap: var(--space-3); margin-top: var(--space-6); padding: var(--space-3) var(--space-4);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-md); background: var(--bg-subtle);
  font-size: var(--text-base); line-height: 1.5; color: var(--text-strong); font-weight: var(--font-medium); }
.au-status::before { content: ""; flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.1rem; background: var(--accent-text);
  -webkit-mask: var(--au-mail-icon) center / contain no-repeat; mask: var(--au-mail-icon) center / contain no-repeat; }
.au-status[role="alert"] { border-color: color-mix(in srgb, var(--error) 28%, transparent); background: var(--error-subtle); color: var(--text); font-weight: var(--font-normal); }
.au-status[role="alert"]::before { background: var(--error); -webkit-mask-image: var(--au-alert-icon); mask-image: var(--au-alert-icon); }
.au-status--ok { border-color: color-mix(in srgb, var(--success) 30%, transparent); background: var(--success-subtle); }
.au-status--ok::before { background: var(--success); -webkit-mask-image: var(--au-ok-icon); mask-image: var(--au-ok-icon); }
.au-note { margin-top: var(--space-3); }

/* Next steps after "check your email". */
.au-tips { list-style: none; padding: 0; margin-top: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3);
  font-size: var(--text-sm); line-height: 1.5; color: var(--text-muted); }
.au-tips li { display: flex; gap: var(--space-3); }
.au-tips svg { flex: none; margin-top: 0.1rem; color: var(--text-subtle); }

/* The way out under every card: switch account action, or go back. */
.surface-auth .auth__alt { gap: var(--space-3); margin-top: var(--space-8); }
.surface-auth .auth__alt .s-small { line-height: 1.5; }
.surface-auth .auth__alt .s-link, .au-labelrow .s-link { display: inline-flex; align-items: center; min-height: 1.75rem; font-weight: var(--font-medium); }
@media (pointer: coarse) { .surface-auth .auth__alt .s-link, .au-labelrow .s-link { min-height: 2.75rem; } }

/* ============================================================ the aside */
/* One column of proof: what you get, two real frames, why it is safe to try. */
.surface-auth .au-aside { justify-content: center; align-items: center; gap: 0; padding: var(--space-12) var(--space-10);
  --cut: var(--tape-400); --cut-text: var(--tape-300); --accent-text: #8FA8FF; --accent-subtle: var(--brand-900); --text-subtle: var(--ink-400); }
@media (min-width: 1280px) { .surface-auth .au-aside { padding: var(--space-12) var(--space-16); } }
[data-theme="dark"] .surface-auth .au-aside, [data-theme="dark"].surface-auth .au-aside { border-left: var(--border-w) solid var(--ink-800); }
.au-aside__inner { width: 100%; max-width: 34rem; display: flex; flex-direction: column; gap: var(--space-8); }
.au-aside__head { display: flex; flex-direction: column; gap: var(--space-3); }
.au-aside__title { font-size: clamp(1.75rem, 1rem + 1.5vw, 2.5rem); font-weight: var(--font-extrabold); line-height: 1.05; letter-spacing: -0.03em;
  color: #fff; text-wrap: balance; }

/* Two real frames, fanned: the captioned take in front, the number card behind it. */
.au-frames { display: flex; align-items: flex-start; padding: var(--space-2) 0 var(--space-5) var(--space-2); }
.au-frames figure { position: relative; flex: none; width: 10rem; margin: 0; transform: rotate(-3deg); z-index: 2; }
.au-frames figure + figure { width: 9rem; margin: var(--space-10) 0 0 -1.25rem; transform: rotate(4deg); z-index: 1; }
@media (min-width: 1280px) {
  .au-frames figure { width: 11.5rem; }
  .au-frames figure + figure { width: 10.5rem; margin-left: -1.5rem; }
}
/* Short laptop screens (1366x768, 1280x720): smaller frames so the whole aside fits without scrolling. */
@media (min-width: 1024px) and (max-height: 860px) {
  .surface-auth .au-aside { padding-block: var(--space-10); }
  .au-aside__inner { gap: var(--space-6); }
  .au-frames figure { width: 8.75rem; }
  .au-frames figure + figure { width: 8rem; margin: var(--space-8) 0 0 -1.25rem; }
}
.au-frames img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; border-radius: var(--radius-lg);
  background: var(--ink-750); box-shadow: 0 24px 56px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08); }
.au-frames figcaption { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 50%); white-space: nowrap;
  padding: 0.3rem 0.7rem; border-radius: var(--radius-full); background: #fff; color: var(--ink-900);
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.04em; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }

.au-aside .checks { gap: var(--space-4); }
.au-aside .checks li { color: var(--ink-075); line-height: 1.45; text-wrap: pretty; }
.au-aside .checks li::before { background-color: var(--brand-400);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A0E11' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.au-aside__link { display: inline-flex; align-items: center; gap: var(--space-2); align-self: flex-start; min-height: 2.75rem;
  font-weight: var(--font-semibold); color: var(--brand-300); }
.au-aside__link:hover { color: #fff; }
.au-aside__link svg { transition: transform var(--duration-fast) var(--ease-default); }
.au-aside__link:hover svg { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { .au-aside__link svg { transition: none; } }

/* Below 1024: sign-up keeps a compact copy of the aside under the form, frames side by side. */
@media (max-width: 1023px) {
  .surface-auth .au-aside--inline { display: flex; width: min(26rem, calc(100% - 2 * var(--gutter))); margin: 0 auto var(--space-10);
    padding: var(--space-6); border-radius: var(--radius-2xl); align-items: stretch; }
  .au-aside--inline .au-aside__inner { gap: var(--space-6); }
  .au-aside--inline .au-aside__title { font-size: var(--text-2xl); }
  .au-aside--inline .au-frames { gap: var(--space-3); padding: 0 0 var(--space-3); }
  .au-aside--inline .au-frames figure, .au-aside--inline .au-frames figure + figure { width: min(7.5rem, calc(50% - var(--space-3) / 2)); margin: 0; transform: none; }
  .au-aside--inline .au-frames img { box-shadow: 0 0 0 1px rgba(255, 255, 255, .1); }
  .au-aside--inline .checks { gap: var(--space-3); font-size: var(--text-sm); }
  [data-theme="dark"] .surface-auth .au-aside--inline, [data-theme="dark"].surface-auth .au-aside--inline { border: var(--border-w) solid var(--ink-700); }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .surface-auth .au-aside--inline { margin-bottom: var(--space-12); }
}
