/* The entry pages, /register and /login (feature 035), over account.css.
   The hero is a lab starting on bench black: two machines come up while the
   cockpit's stopwatch runs to the measured 2.5 s, then a terminal opens where
   whoami answers with the visitor's own name and one of five acts plays,
   dealt at random per visit (auth.js). The form is worksheet paper, the
   account pages' fields and buttons at a larger size. Every transition sits on
   an .on state, so a loop restarting snaps back instead of fading backwards. */

/* the hero's terminal draws in the terminal's own colours (brand.css
   --tq-term-*); a machine's dot and "ready" are states, in the signal */
:root {
  --out: cubic-bezier(.16, 1, .3, 1);
}

/* ---- the split: the hero on the left, the form on the right ---------------- */

/* two equal halves (feature 042); the hero's boot keeps its 720px at most and
   the form its 384px column, each centred in its half */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100dvh; }

/* the gutter grows on a wide screen so the boot's 720px sits centred in its
   half, as the form's column does in its own */
.hero {
  --gutter: max(clamp(32px, 4.4vw, 72px), 25vw - 360px);
  position: relative; min-width: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 104px var(--gutter) 48px;
  background: var(--bench); color: var(--chrome-fg);
  --tq-focus: var(--tq-signal-deep); /* ink on the console reads as no ring at all */
}
.hero > .tq-mark { position: absolute; top: 44px; left: var(--gutter); font-size: 22px; }
.headline { margin: 0; font: 600 clamp(40px, 3.8vw, 58px)/1.02 var(--ui); letter-spacing: -0.04em; color: var(--chrome-fg); }
.strap { margin: 20px 0 0; max-width: 46ch; font: 400 16px/1.6 var(--ui); color: var(--chrome-dim); }

/* ---- the machines and the stopwatch ---------------------------------------- */

.boot { max-width: 720px; margin: clamp(36px, 6vh, 64px) 0 0; }
.machines { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.m {
  display: flex; align-items: center; gap: 11px; height: 50px; padding: 0 14px 0 16px; white-space: nowrap;
  font: 600 17px/1 var(--mono); color: var(--chrome-fg);
  background: var(--chrome); border: 1px solid var(--chrome-line); border-radius: 9px;
  opacity: 0; transform: translateY(8px);
}
.m.on { opacity: 1; transform: none; transition: opacity .35s var(--out), transform .5s var(--out); }
/* account.css's starting pulse, a machine on its way up */
.m-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--chrome-strong); animation: starting 1s ease-in-out infinite; }
.m-dot.on {
  background: var(--signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 18%, transparent); animation: none;
  transition: background-color .25s var(--out), box-shadow .45s var(--out);
}
.m-addr { padding: 5px 8px; font: 500 12px/1 var(--mono); color: var(--chrome-dim); background: var(--chrome-chip); border-radius: 5px; }

.watch { display: flex; align-items: baseline; gap: 9px; color: var(--chrome-dim); }
.watch svg { width: 22px; height: 22px; align-self: center; }
.w-time { font: 600 28px/1 var(--ui); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--chrome-fg); }
/* the status beside it: "Provisioning servers" in the dim while the machines
   start, "Ready" in the signal once they are up. Both share one cell, so the
   line keeps its width when it turns and nothing beside it moves. */
.w-state { display: inline-grid; font: 600 15px/1 var(--ui); }
.w-state > * { grid-area: 1 / 1; }
.w-ready { color: var(--signal); opacity: 0; }
.w-state.on .w-prov { opacity: 0; }
.w-state.on .w-ready { opacity: 1; transition: opacity .3s var(--out); }

/* ---- the terminal: it holds its height from the start, so nothing moves ---- */

.term {
  position: relative; height: 312px; margin-top: 16px; padding: 14px 18px;
  font: 13.5px/1.55 var(--mono); color: var(--chrome-fg);
  border: 1px solid var(--chrome-line); border-radius: 10px; overflow: hidden;
  opacity: 0; transform: translateY(6px);
}
.term.on { opacity: 1; transform: none; transition: opacity .3s var(--out), transform .45s var(--out); }
.term pre { margin: 0; font: inherit; }
.ln { display: block; white-space: pre; opacity: 0; }
.ln.on { opacity: 1; transition: opacity .12s linear; }
/* a command types itself, one character per step; auth.js sets --n */
.type { display: inline-block; vertical-align: bottom; clip-path: inset(0 100% 0 0); }
.ln.on .type { clip-path: inset(0 0 0 0); transition: clip-path calc(var(--n) * 42ms) steps(var(--n)); }
.cur { display: inline-block; width: .6em; height: 1.2em; vertical-align: text-bottom; background: var(--chrome-dim); }
.ln.on .cur { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
/* the prompt's colours, as the guest's starship draws them */
.u { font-weight: 600; color: var(--tq-term-green); }
.d { font-weight: 600; color: var(--tq-term-blue); }
.p { color: var(--tq-term-green); }
.dim { color: var(--chrome-mute); }
.music { font-style: normal; color: var(--tq-term-magenta); }

/* a figure drawn frame by frame: the frames share one cell and take turns,
   by opacity, which the compositor animates without the main thread */
.art { display: grid; user-select: none; }
.art .f { grid-area: 1 / 1; opacity: 0; }
.art .f:first-child { opacity: 1; }

/* cat cat.txt: the cat dances, four frames to the beat */
.cat .f { animation: frame4 1.12s step-end infinite; }
.cat .f:nth-child(2) { animation-delay: -.84s; }
.cat .f:nth-child(3) { animation-delay: -.56s; }
.cat .f:nth-child(4) { animation-delay: -.28s; }
@keyframes frame4 { 0% { opacity: 1; } 25%, 100% { opacity: 0; } }

/* sl: the alternate screen. The session hides, a train crosses, it comes back. */
.train { position: absolute; inset: 0; display: none; align-content: center; }
.train .f { animation: frame2 .36s step-end infinite; }
.train .f:nth-child(2) { animation-delay: -.18s; }
@keyframes frame2 { 0% { opacity: 1; } 50%, 100% { opacity: 0; } }
.alt:not(.altdone) .ln { visibility: hidden; }
.alt:not(.altdone) .train { display: grid; animation: chug 4.4s linear forwards; }
/* from just past the right edge until the 38-column smoke line has cleared the left */
@keyframes chug { from { transform: translateX(100%); } to { transform: translateX(-40ch); } }

/* fortune | cowsay: the cow blinks */
.eyes { position: relative; }
.eyes::before { content: "o   o"; animation: open 3.4s step-end infinite; }
.eyes::after { content: "-   -"; position: absolute; left: 0; opacity: 0; animation: shut 3.4s step-end infinite; }
@keyframes open { 0%, 93% { opacity: 1; } 93.5%, 100% { opacity: 0; } }
@keyframes shut { 0%, 93% { opacity: 0; } 93.5%, 100% { opacity: 1; } }

/* sudo rm -rf /: the session glitches, the machine goes down and boots again.
   Only the lines after the reboot (.fresh) survive it. */
.lost { color: var(--coral); }
.down:not(.reboot) .ln.on:not(.lost) {
  animation: glitch .42s steps(3) infinite;
  text-shadow: 2px 0 color-mix(in srgb, var(--tq-term-red) 55%, transparent), -2px 0 color-mix(in srgb, var(--tq-term-cyan) 45%, transparent);
}
@keyframes glitch {
  0% { transform: translateX(0); opacity: 1; }
  33% { transform: translateX(-3px) skewX(-6deg); opacity: .55; }
  66% { transform: translateX(2px); opacity: .85; }
  100% { transform: translateX(0); opacity: .35; }
}
.reboot .ln:not(.fresh) { display: none; }
.down:not(.reboot) .m-dot.on { background: var(--coral); box-shadow: 0 0 0 4px color-mix(in srgb, var(--coral) 16%, transparent); }
.reboot:not(.back) .m-dot.on { background: var(--chrome-strong); box-shadow: none; animation: starting 1s ease-in-out infinite; }
/* the status goes with the machine, and provisions again from the reboot
   until it is back */
.down:not(.reboot) .w-state { opacity: 0; }
.reboot:not(.back) .w-prov { opacity: 1; }
.reboot:not(.back) .w-ready { opacity: 0; }

/* neofetch: the mark as the logo, and the terminal's eight colours */
.neo .logo { font-weight: 700; color: var(--tq-term-green); }
.neo .k { font-weight: 700; color: var(--tq-term-blue); }
.sw { display: inline-flex; vertical-align: middle; }
.sw i { width: 2.4ch; height: 1.1em; }
.sw i:nth-child(1) { background: var(--tq-term-black); }
.sw i:nth-child(2) { background: var(--tq-term-red); }
.sw i:nth-child(3) { background: var(--tq-term-green); }
.sw i:nth-child(4) { background: var(--tq-term-yellow); }
.sw i:nth-child(5) { background: var(--tq-term-blue); }
.sw i:nth-child(6) { background: var(--tq-term-magenta); }
.sw i:nth-child(7) { background: var(--tq-term-cyan); }
.sw i:nth-child(8) { background: var(--tq-term-white); }

/* account.css already drops every transition under reduced motion; the
   hero's animations go too, and auth.js holds the last frame */
@media (prefers-reduced-motion: reduce) {
  .hero *, .hero *::before, .hero *::after { animation: none !important; }
}
/* auth.js settles the loop after one cycle or once the form is used */
.hero.still *, .hero.still *::before, .hero.still *::after { animation: none !important; }

/* ---- the form, on worksheet paper: one column, one gap between whatever is
   showing (GitHub, its divider and the notices come and go) ------------------ */

.form-side {
  display: grid; grid-template-columns: minmax(0, 384px); justify-content: center; align-content: center; gap: 22px;
  padding: 56px clamp(28px, 4vw, 72px);
}
.form-side h1 { font: 600 26px/1.2 var(--ui); letter-spacing: -0.022em; text-wrap: balance; }
.form-side .lede { margin: 8px 0 0; font: 400 14px/1.6 var(--ui); color: var(--mute); }
/* the address an invitation or a signed-in person joins as (feature 042) */
.form-side .lede .bind { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.form-side .notice { margin: 0; }
/* GitHub is account.css's ghost button at the form's size; its mark is a
   filled path, where account.css strokes a button's icons */
.form-side a.provider { gap: 10px; min-height: 44px; padding: 0 16px; margin: 0; font-size: 14px; }
.form-side a.provider:hover { border-color: var(--mute); }
.form-side a.provider svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.or { display: flex; align-items: center; gap: 14px; margin: 0; font: 500 12px/1 var(--ui); color: var(--mute); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
/* the divider is GitHub's: it goes when the link does */
#github[hidden] + .or { display: none; }
/* the GitHub step asks for no email, so no "or with email" even when an
   expired step offers GitHub again, and it is reached by signing in with
   GitHub, so it offers no sign-in */
.form-side:has(#step-github:not([hidden])) :is(.or, .after) { display: none; }
.form-side .field { gap: 6px; margin-bottom: 16px; }
.form-side .field input { min-height: 44px; padding: 0 12px; font-size: 14px; }
.form-side .field input:hover { border-color: var(--mute); }
/* the label is no longer the field's wrapper, so it takes the span's look */
.form-side .field > label { font: 600 .8125rem/1.5 var(--ui); color: var(--ink); }
.field .opt { font-weight: 400; color: var(--mute); margin-left: 4px; }
/* a refused or user-invalid field: a heavier border and a line of text with an
   icon, so the state never rides on colour alone */
.form-side .field input:is(:user-invalid, [aria-invalid="true"]) { border-color: var(--fail); box-shadow: inset 0 0 0 1px var(--fail); }
.field > .field-error { display: flex; align-items: flex-start; gap: 6px; font: 400 .8125rem/1.5 var(--ui); color: var(--fail); }
.field > .field-error:empty { display: none; }
.field > .field-error::before {
  content: ""; flex: none; width: 14px; height: 14px; margin-top: 3px; background: currentColor;
  -webkit-mask: url(/brand/icons/circle-alert.svg) center / contain no-repeat; mask: url(/brand/icons/circle-alert.svg) center / contain no-repeat;
}
/* the password's show toggle sits inside the field's right edge */
.pw { position: relative; display: flex; }
.pw input { padding-right: 48px; }
.reveal {
  position: absolute; top: 0; right: 0; width: 44px; height: 100%; display: grid; place-items: center; padding: 0;
  background: none; border: 0; border-radius: 6px; color: var(--mute); cursor: pointer;
}
.reveal:hover { color: var(--ink); }
.reveal:focus-visible { outline-offset: -4px; }
.reveal svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reveal[aria-pressed="false"] .eye-off, .reveal[aria-pressed="true"] .eye { display: none; }
.form-side #go { min-height: 44px; margin-top: 8px; font-size: 14px; }
.form-side #decline { min-height: 44px; margin-top: 8px; font-size: 14px; }
/* "Forgot password?" under the password, at its right edge (feature 069) */
.forgot { margin: -8px 0 12px; text-align: right; font: 400 13px/1.5 var(--ui); }
.forgot a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
/* the password's rules on one line under its field, each ticked as it is met:
   grey while open, ink with a check once met, so the state never rides on
   colour alone */
.checks { list-style: none; margin: -8px 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks li { display: flex; align-items: center; gap: 6px; white-space: nowrap; font: 400 12px/1.5 var(--ui); color: var(--mute); }
.checks li::before {
  content: ""; flex: none; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: var(--check-icon) center / contain no-repeat; mask: var(--check-icon) center / contain no-repeat;
  --check-icon: url(/brand/icons/circle.svg);
}
.checks li.ok { color: var(--ink); }
.checks li.ok::before { --check-icon: url(/brand/icons/circle-check.svg); }
.after { font: 400 13px/1.6 var(--ui); color: var(--mute); }
.after p { margin: 0; }
.after a, .notice a { font-weight: 500; color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---- narrow: the headline as a band over the form ------------------------- */

/* The machines and the terminal go (auth.js stops their loop at the same
   width): on a phone they would push the form below the fold, and the hero
   must never obscure the form (the surface brief). */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .hero { --gutter: 20px; padding-top: 76px; padding-bottom: 28px; }
  .hero > .tq-mark { top: 24px; }
  .headline { font-size: 34px; }
  .strap { font-size: 15px; }
  .boot { display: none; }
  .form-side { align-content: start; padding: 36px 20px 56px; }
}

/* ---- a phone: 16px input text (iOS Safari zooms on anything smaller) and 44px
   targets for the inline links, laid out as before ---------------------------- */

@media (pointer: coarse), (max-width: 960px) {
  .form-side .field input { font-size: max(16px, 1em); }
}
@media (pointer: coarse) {
  .after a, .forgot a { display: inline-flex; align-items: center; min-height: 44px; margin-block: -12px; }
  .tq-mark { min-height: 44px; }
  .hero > .tq-mark { margin-top: -11px; }
  .single > .tq-mark { margin: -13px 0 5px; }
  .confirm-page .tq-mark { margin: -13px 0 1px; }
}
