/* fx.css: the IDA portrait, and the pages built around it or in the same voice
   (sign in, register, progress, errors). Loads on every page, after app.css.
   Departure Mono (--pixel) is drawn on an 11px grid: large sizes are multiples of 11. */

:root { --fx-hot: #ffe9c4; }   /* the portrait's scan highlight; scenes.js reads it */

/* ---------- Portrait: the one piece of ASCII art ----------
   <div data-art="ida"><canvas></canvas></div>. Width decides the size; with data-fit="contain" the host box does.
   Stamped on whole device pixels by scenes.js, so never resampled. */
[data-art] { position: relative; display: block; width: 100%; min-width: 0; overflow: hidden; }
[data-art] > canvas { display: block; max-width: none; image-rendering: pixelated; }

/* ---------- Shared small type ---------- */
.fx-kicker {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
  font: 13px/1.2 var(--pixel); color: var(--amber);
}
.fx-kicker::before { content: ""; width: 7px; height: 7px; background: currentColor; flex: none; }
.fx-kicker span { color: var(--dust); }
.fx-kicker.bad { color: var(--rose); }

/* ---------- Sign in, register, progress ---------- */
body.auth ::selection { background: var(--amber); color: #000; }
/* With the portrait on stage the hex field steps back to a texture. */
body.auth .auth-bg { opacity: .2; }
body.auth.is-progress .auth-bg { opacity: .55; }
@media (min-width: 901px) {
  /* Keep the field clear of the form column. */
  body.auth .auth-bg {
    -webkit-mask-image: linear-gradient(to right, transparent 0, transparent 50%, rgba(0,0,0,.5) 66%, #000 86%);
    mask-image: linear-gradient(to right, transparent 0, transparent 50%, rgba(0,0,0,.5) 66%, #000 86%);
  }
}

.auth-art {
  position: fixed; right: 0; bottom: 0; z-index: 0;
  width: min(54vw, 96svh); height: calc(100svh - 76px);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22%);
  mask-image: linear-gradient(to right, transparent 0, #000 22%);
}
@media (max-width: 900px) {
  /* On a phone the portrait is a faint watermark under the form. */
  .auth-art {
    width: 100%; height: 52svh; opacity: .26;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 45%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 45%);
  }
}

/* Top bar in the house voice, here and on the error page. */
body.auth .brand, body.nf .brand { font: 400 16px/1 var(--pixel); letter-spacing: 0; gap: 11px; color: var(--bone); }
body.auth .brand .mark, body.nf .brand .mark { width: 20px; height: 20px; color: var(--amber); }
body.auth .top nav, body.nf .top nav { font-size: 15px; color: var(--bone-2); }
body.auth .top nav .link, body.nf .top nav .link { transition: color .2s; }
body.auth .top nav .link:hover, body.nf .top nav .link:hover { color: var(--bone); }
body.auth .top nav .link::after, body.nf .top nav .link::after { background: var(--amber); }

body.auth .auth-main { max-width: 700px; padding-bottom: 12vh; }
body.auth .auth-main h1 { font-size: clamp(2.5rem, 5.6vw, 4.2rem); color: var(--bone); }
body.auth .auth-sub { color: var(--bone-2); }
body.auth .auth-sub b { color: var(--amber); font-weight: 500; }
body.auth .auth-main form { margin-top: 34px; }
body.auth .auth-main label { font: 13px/1.3 var(--pixel); color: var(--bone-2); margin: 22px 0 10px; }
body.auth .auth-main label small { font: inherit; color: var(--dust); margin-left: 8px; }

body.auth .auth-field { background: #060606; border-color: var(--rule-3); border-radius: 2px; }
body.auth .auth-field::before {
  content: ">"; flex: none; padding-left: 16px; font: 15px/1 var(--pixel); color: var(--amber-dim);
  transition: color .2s;
}
body.auth .auth-field:hover { border-color: var(--amber-dim); }
body.auth .auth-field:focus-within {
  border-color: var(--amber); background: #000;
  box-shadow: 0 0 0 1px var(--amber), 0 0 28px rgba(255, 180, 61, .14);
}
body.auth .auth-field:focus-within::before { color: var(--amber); }
body.auth .auth-field input { padding: 0 16px 0 12px; color: var(--bone); caret-color: var(--amber); }
body.auth .auth-field input::placeholder { color: #4d4a44; }
body.auth .auth-field input:-webkit-autofill,
body.auth .auth-field input:-webkit-autofill:hover,
body.auth .auth-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--bone); caret-color: var(--amber);
  -webkit-box-shadow: 0 0 0 100px #060606 inset; box-shadow: 0 0 0 100px #060606 inset;
}
/* In a column the field must keep its own height. */
@media (max-width: 560px) { body.auth .auth-line .auth-field { flex: none; } }
body.auth .peek { font: 12px/1 var(--pixel); color: var(--dust); }
body.auth .peek:hover { color: var(--amber); }
body.auth .peek:focus-visible { outline: 2px solid var(--amber); outline-offset: -4px; }

body.auth .btn, body.nf .btn { border-radius: 2px; border-color: var(--rule-3); color: var(--bone); }
body.auth .btn::before, body.nf .btn::before { background: var(--bone); }
body.auth .btn:hover, body.nf .btn:hover { color: #000; border-color: var(--bone); }
body.auth .btn-solid, body.nf .btn-solid { background: var(--amber); border-color: var(--amber); color: #000; }
body.auth .btn-solid::before, body.nf .btn-solid::before { background: #000; }
body.auth .btn-solid:hover, body.nf .btn-solid:hover { color: var(--amber); border-color: var(--amber); }
body.auth .btn:focus-visible, body.nf .btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
body.auth .top .link:focus-visible, body.auth .auth-alt .link:focus-visible { outline-color: var(--amber); }

body.auth .auth-hint { color: #807b72; }
body.auth .auth-alt { color: var(--bone-2); }
body.auth .auth-alt .link { color: var(--amber); }

body.auth .flash { border-radius: 2px; font: 13px/1.5 var(--pixel); background: #060606; }
body.auth .flash-error { border-color: var(--rose); color: var(--rose); }
body.auth .flash-success, body.auth .flash-ok { border-color: var(--mint); color: var(--mint); }

/* The token, shown once. */
.token-box { margin-top: 30px; border: 1px solid var(--amber-dim); border-radius: 2px; background: #060402; box-shadow: 0 0 40px rgba(255, 180, 61, .08); }
.token-bar {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--amber-deep); font: 12px/1.2 var(--pixel); color: var(--amber-dim);
}
.token-bar b { font-weight: 400; color: var(--amber); }
body.auth .token-box .keyline {
  border: 0; background: none; padding: 20px 16px 22px;
  font: 500 clamp(.95rem, 1.6vw, 1.15rem)/1.5 var(--mono); color: var(--amber);
  text-shadow: 0 0 14px rgba(255, 180, 61, .35);
}
body.auth .token-box .keyline::selection { background: var(--amber); color: #000; }
body.auth .auth-main .stack { margin-top: 14px; }

.auth-foot {
  position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 0 var(--gutter) 22px; font: 12px/1.2 var(--pixel); color: var(--dust);
}

/* Progress: a big reading, a segmented bar, a state word, then the steps. */
body.auth.is-progress .auth-main { max-width: 760px; }
body.auth .progress { margin-top: 40px; --tone: var(--amber); }
body.auth [data-state="done"] .progress { --tone: var(--mint); }
body.auth [data-state="error"] .progress { --tone: var(--rose); }
.readout { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.readout-pct { display: flex; align-items: flex-start; font: 400 88px/.8 var(--pixel); color: var(--bone); transition: color .3s; }
.readout-pct b { font-weight: 400; font-variant-numeric: tabular-nums; }
.readout-pct i { font-style: normal; font-size: 33px; line-height: 1; margin: -2px 0 0 8px; color: var(--bone-2); }
[data-state="done"] .readout-pct, [data-state="error"] .readout-pct { color: var(--tone); }
.readout-state {
  display: inline-flex; align-items: center; gap: 9px; height: 30px; padding: 0 11px;
  border: 1px solid var(--tone); border-radius: 2px;
  font: 400 11px/1 var(--pixel); letter-spacing: .08em; text-transform: uppercase; color: var(--tone);
  transition: color .3s, border-color .3s;
}
.readout-state::before { content: ""; width: 6px; height: 6px; background: currentColor; animation: fx-blink 1s steps(2) infinite; }
[data-state="done"] .readout-state::before, [data-state="error"] .readout-state::before { animation: none; }

/* The bar: one fill, cut into whole segments by the gaps painted over it. */
body.auth .meter { position: relative; height: 14px; border-radius: 0; background: #1a1a18; }
body.auth .meter i { background: var(--tone); transition: width .6s var(--ease), background .3s; }
body.auth .meter::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, transparent 0, transparent calc(100% - 2px), #000 calc(100% - 2px)) 0 0 / 12px 100% round;
}
body.auth .progress .msg { margin-top: 14px; font: 13px/1.4 var(--pixel); color: var(--amber-dim); transition: color .3s; }
body.auth .progress .msg::before { content: "> "; color: var(--dust); }
body.auth [data-state="done"] .progress .msg { color: var(--mint); }
/* On an error the alert box under the steps carries the message. */
body.auth [data-state="error"] .progress .msg { display: none; }
@media (max-width: 560px) {
  .readout-pct { font-size: 66px; }
  .readout-pct i { font-size: 22px; margin-left: 6px; }
}

body.auth .steps { margin-top: 26px; border-bottom: 1px solid #161616; counter-reset: step; }
body.auth .steps li {
  counter-increment: step; padding: 10px 0; border-top: 1px solid #161616; color: #6b675f; font-size: 15px;
}
body.auth .steps li::after {
  content: counter(step, decimal-leading-zero); margin-left: auto; font: 12px/1 var(--pixel); color: #3d3a35;
}
body.auth .tick { width: 14px; height: 14px; border-radius: 0; border: 1px solid #45423c; font-size: 0; }
body.auth .tick::before { content: ""; width: 6px; height: 6px; background: transparent; }
body.auth .steps li.is-active { color: var(--bone); }
body.auth .steps li.is-active::after { color: var(--amber); }
body.auth .steps li.is-active .tick { border-color: var(--amber); background: none; }
body.auth .steps li.is-active .tick::before { background: var(--amber); animation: fx-blink 1s steps(2) infinite; }
body.auth .steps li.is-done { color: var(--bone-2); }
body.auth .steps li.is-done .tick { background: none; border-color: var(--mint); }
body.auth .steps li.is-done .tick::before { background: var(--mint); }
body.auth [data-state="error"] .steps li.is-active .tick { border-color: var(--rose); }
body.auth [data-state="error"] .steps li.is-active .tick::before { background: var(--rose); animation: none; }
@keyframes fx-blink { 50% { opacity: .15; } }

/* ---------- Error page: the status code, very large ---------- */
body.nf ::selection { background: var(--amber); color: #000; }
body.nf .nf-bg {
  opacity: .22;
  -webkit-mask-image: linear-gradient(to right, transparent 0, transparent 34%, rgba(0,0,0,.5) 58%, #000 84%);
  mask-image: linear-gradient(to right, transparent 0, transparent 34%, rgba(0,0,0,.5) 58%, #000 84%);
}
body.nf .nf-main {
  flex: 1; display: flex; flex-direction: column; flex-wrap: nowrap; justify-content: center;
  align-items: stretch; align-content: normal; gap: 0; padding: 24px var(--gutter) 12vh;
}
.nf-code { margin: 0 0 0 -.04em; font: 400 132px/.8 var(--pixel); color: var(--amber); user-select: none; }
@media (min-width: 600px) { .nf-code { font-size: 220px; } }
@media (min-width: 1100px) and (min-height: 760px) { .nf-code { font-size: 330px; } }
.nf-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 26px 48px;
  margin-top: clamp(28px, 5vh, 52px); padding-top: 26px; border-top: 1px solid var(--rule-2);
}
.nf-row .fx-kicker { margin-bottom: 14px; }
body.nf .nf-main h1 { color: var(--bone); max-width: 36ch; }
body.nf .nf-main h1 span { color: var(--bone-2); }
@media (max-width: 900px) {
  body.nf .nf-bg {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 50%, #000 100%);
    mask-image: linear-gradient(to bottom, transparent 0, transparent 50%, #000 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.auth .steps li.is-active .tick::before, .readout-state::before { animation: none; }
}
