/* HOUSE RULES: THE PAGE'S BASE, THE FOOTER AND THE SIGNED-OUT PAGE, the same in every Fifth Ace app. Source: fifthaceapps/house-rules (web/frame.css).
   Apps carry a copy made by `house-rules sync`: never edit the copy. It needs tokens.css, and takes the app's colour through
   --accent, --on-accent and --focus. The portal's pages are the reference; the markup is in menu/render.js (`footer()`,
   `signedOut()`, `authMain()`, `authBackdrop()`, `authHead()`, `authDest()`).

   Skip link:        <a class="skip" href="#main">Skip to content</a> as the first thing in <body> (skipLink() in menu/render.js); the page's <main id="main" tabindex="-1">.
   Signed-out page:  body.auth > authBackdrop(), header.authhead (the Fifth Ace mark and "Need help?"), then
                     main.authmain > .authwrap > .card.authcard > ( [.notice], .authdest, [p.authdest__by], h1, p.authlede, form.authform, p.authlinks, p.authfine ),
                     then the footer. The card's messages (an error, "you are signed out", rate limited) are ONE .notice at the top of the card, never text
                     under the form. In a form (controls.css): div.field, input.input--code (a six-digit code), label.check, button.btn.btn--block,
                     .authsep (the "or" between two ways in); a button that looks like a link is button.authlink. It needs controls.css and components.css too
                     (the card is .card). The page follows the system's light or dark setting: load auth-theme.js in <head> (the one place an app is light, for now). */

/* ---------- the page's base (1.59.0, D-082): html, body and every box, the same in every app and on the website. An app's stylesheet never sets a property on
   html, body or * (no margin, background, colour, font, height, overflow, scroll-behavior or animation): the check fails it. Two rules are deliberate absences:
   NO `scroll-behavior` (the page never scrolls smoothly: on an iPhone a smooth-scrolling root made the fixed tab bar float mid-screen) and NO `overflow` on html
   or body (clipping the root's overflow does the same, and hides the real fault, a box wider than the page). The page's HEIGHT is the frame's: `.shell` is
   min-height 100vh (sidebar.css), the signed-out page's body is min-height 100vh below; never `dvh` on the page, whose value moves with the browser's bars. */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; background: var(--ink); color: var(--text); font: 400 var(--fs-body)/1.65 var(--font-body); -webkit-font-smoothing: antialiased; }
b, strong { font-weight: var(--fw-bold); }
main:focus { outline: none; } /* (main is focused by the skip link; the ring belongs on what a person can act on) */

/* ---------- the footer: the last thing on every page, signed in or out */
.foot { margin-top: auto; border-top: 1px solid var(--line); color: var(--fog); font-size: var(--fs-small); line-height: 1.65; }
.foot__in { width: min(100% - 48px, 1100px); margin-inline: auto; padding: 22px 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.foot p { margin: 0; }
.foot b { font-weight: var(--fw-bold); }
.foot a { color: var(--lilac); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 700px) { .foot__in { width: min(100% - 32px, 1100px); } }
@media (max-width: 640px) { .foot__in { justify-content: center; text-align: center; } }

/* ---------- the signed-out page: a slim bar, one card, the footer */
body.auth { min-height: 100vh; display: flex; flex-direction: column; }
.authmain { flex: 1; width: 100%; max-width: none; margin: 0; padding: 40px 0 72px; } /* explicit: an app's own `main { max-width; margin: 0 auto }` must not shrink the card */
.authwrap { width: min(100% - 48px, 1100px); margin-inline: auto; display: grid; place-items: start center; }
.authcard { max-width: 460px; font-size: var(--fs-body); line-height: 1.65; } /* on top of the shared .card (components.css) */
.authcard h1 { margin: 0; font: var(--fw-bold) var(--fs-title)/1.1 var(--font-display); letter-spacing: -.02em; color: var(--text); text-wrap: balance; text-align: center; }
.authlede { margin: 12px 0 0; max-width: 40rem; color: var(--text-2); text-align: center; }
.authcard .authlede + .btn, .authcard .authlede + form:not(.authform) { margin-top: 24px; }
.authcard .authlede + p:has(> .btn:only-child) { margin: 24px 0 0; } /* the same, when the button sits alone in a <p> */ /* a button or a plain form straight after the intro gets the same room the .authform gets */
.authform { display: grid; gap: 10px; margin-top: 24px; }
.authform label:not(.check) { font-size: var(--fs-body); font-weight: var(--fw-bold); }
.authform .btn { margin-top: 8px; }
.authstatus { margin: 0; min-height: 1.5em; font-size: var(--fs-body); color: var(--text-2); text-align: center; }
.authstatus p { margin: 0; }
.authstatus.is-error { color: var(--text); font-weight: var(--fw-bold); }
.authfine { margin: 18px 0 0; font-size: var(--fs-small); color: var(--fog); text-align: center; }
.authfine a, .authlink { color: var(--lilac); }
.authlink { padding: 0; border: 0; background: none; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.authlink:disabled { color: var(--fog); text-decoration: none; cursor: default; }
form.authfine { display: block; margin-top: 18px; }
@media (max-width: 640px) {
  .authmain { padding: 24px 0 56px; }
  .authwrap { width: min(100% - 32px, 1100px); }
}

/* ---------- the stage behind the card: the website hero's glows and dot grid, and two grayscale Fifth Ace pinwheels in two corners. Names of its own, tuned for each theme. */
:root { --authbg-glow-a: rgba(85, 0, 136, .40); --authbg-glow-b: rgba(51, 0, 79, .60); --authbg-dot: rgba(240, 238, 245, .30); --authbg-card: #24212c; --authbg-edge: #3a3744; --authbg-ink: #6a6577; --authbg-op: .55; }
:root[data-theme="light"] { --authbg-glow-a: rgba(124, 44, 176, .30); --authbg-glow-b: rgba(85, 0, 136, .18); --authbg-dot: rgba(85, 0, 136, .34); --authbg-card: #e9e5f0; --authbg-edge: #b9b1cb; --authbg-ink: #8f87a3; --authbg-op: .8; }
body.auth { position: relative; isolation: isolate; } /* (1.59.0: no overflow-x: clip here any more; .authbg below clips the glows and the pinwheels itself) */
.authbg { position: absolute; z-index: -1; inset: 0; overflow: hidden; pointer-events: none; }
.authbg__dots { position: absolute; inset: 0; opacity: .65; background-image: radial-gradient(var(--authbg-dot) 1.2px, transparent 1.4px); background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 60% 40%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 70% 70% at 60% 40%, #000 20%, transparent 75%); }
.authglow { position: absolute; border-radius: 50%; opacity: .65; }
.authglow--a { width: 1800px; height: 1000px; left: 85%; top: 20%; transform: translate(-50%, -50%); background: radial-gradient(ellipse closest-side, var(--authbg-glow-a), transparent 60%); }
.authglow--b { width: 1400px; height: 800px; left: 5%; top: 90%; transform: translate(-50%, -50%); background: radial-gradient(ellipse closest-side, var(--authbg-glow-b), transparent 60%); }
.authglow--app { width: 900px; height: 600px; left: 50%; top: 38%; transform: translate(-50%, -50%); background: radial-gradient(ellipse closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); opacity: 0; transition: opacity .5s ease; }
body:has(.authdest--app) .authglow--app { opacity: 1; } /* an app's sign-in: its colour glows faintly behind the card */
.authpin { position: absolute; width: 0; height: 0; opacity: var(--authbg-op); }
.authpin--a { right: max(4vw, 24px); top: 34%; }
.authpin--b { left: max(1vw, -20px); bottom: 8%; }
.authpin__sway { animation: authsway 26s ease-in-out infinite alternate; }
.authpin--b .authpin__sway { animation-duration: 32s; animation-direction: alternate-reverse; }
.authbg > svg { position: absolute; }
.authpin svg { position: absolute; left: -150px; top: -150px; width: 300px; height: 300px; max-width: none; overflow: visible; transform: rotate(var(--r, 0deg)); color: var(--authbg-ink); }
.authpin--a svg { --r: 12deg; }
.authpin--b svg { --r: -18deg; left: -180px; top: -180px; width: 360px; height: 360px; }
@keyframes authsway { from { transform: rotate(-2.5deg) translateY(0); } to { transform: rotate(2.5deg) translateY(-14px); } }
@media (max-width: 760px) { .authpin { opacity: calc(var(--authbg-op) * .55); } .authpin--a { right: -60px; top: 22%; } .authpin--b { left: -90px; } }
@media (prefers-reduced-motion: reduce) { .authpin__sway { animation: none; } .authglow--app { transition: none; } }
body.auth .foot { position: relative; z-index: 1; background: var(--ink); } /* the pinwheels end above the footer */

/* ---------- the brand row that replaces the old bar */
.authhead { width: min(100% - 48px, 1100px); margin-inline: auto; padding: 22px 0 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.authbrand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font: var(--fw-bold) 1.1rem/1 var(--font-display); }
.authbrand svg { width: 40px; height: 40px; }
.authhelp { font-size: var(--fs-small); color: var(--text-2); }
.authhelp a { color: var(--lilac); }
@media (max-width: 640px) { .authhead { width: min(100% - 32px, 1100px); flex-wrap: wrap; row-gap: 4px; } .authhelp { flex-basis: 100%; } } /* on a phone the help line goes under the mark, so the top-right corner (the dev ribbon's) is empty and the line never clips */

/* ---------- what the card signs you in to: the app's mark, a short line, the Fifth Ace icon (the icon alone for the portal itself) */
.authdest { display: flex; align-items: center; justify-content: center; gap: 10px; width: min(100%, 220px); margin: 0 auto 20px; }
.authdest--solo { width: auto; }
.authdest--app:has(+ .authdest__by) { margin-bottom: 8px; }
.authdest__by { margin: 0 0 20px; text-align: center; font: 400 var(--fs-small)/1.4 var(--font-body); color: var(--text-2); } /* "by Fifth Ace" under an app's mark: live text, Lexend Regular, the muted text colour (1.65.0) */
.authdest__logo { width: 52px; height: 52px; flex: none; }
.authdest__logo svg, .authdest__logo img { display: block; width: 100%; height: 100%; }
.authdest__link { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--fog); }
.authdest__link::before, .authdest__link::after { content: ""; flex: 1; border-top: 1px dashed var(--line-strong); }
.authdest__link svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* an app's sign-in: the card's top edge wears the app's colour and follows the card's corners */
.authcard { position: relative; }
.authcard:has(.authdest--app)::before { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); border-top: 3px solid var(--accent); pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 0 26px, transparent 26px); mask-image: linear-gradient(#000 0 26px, transparent 26px); }
.authcard > .notice { margin: 0 0 18px; } /* the card's one message sits above everything */
.authlinks { margin: 16px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; font-size: var(--fs-small); }
.authlinks .authlink { color: var(--lilac); }
.authsep { display: flex; align-items: center; gap: 12px; color: var(--fog); font-size: var(--fs-small); }
.authsep::before, .authsep::after { content: ""; flex: 1; border-top: 1px solid var(--line-strong); }
@media (forced-colors: active) { .authcard:has(.authdest--app)::before { border-top-color: Highlight; } }

/* ---------- skip link, focus ring and print: the same in every app */
.skip { position: absolute; left: -999px; top: 0; z-index: 100; padding: .5rem 1rem; background: var(--slate); color: var(--text); }
.skip:focus { left: 0; }
:where(a, button, summary, [tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } /* (:where: any component's own focus style wins) */
@media print { body { background: #fff; } .skip, .noprint, .pagehead__acts, .foot, .dev-banner, .vbar, .authbg { display: none !important; } main { padding: 0; max-width: none; } }
