/* The signed-out gate: sign in, set up, and the four "ask for a login" steps.
   (14-Nov-2026 — supervisor: "too much small. make it big, and animated standard,
   its seems too basic. add animation and all".)

   Bigger, and alive — but still the approved look: navy + brass on a light page, FLAT,
   no gloss, no gradients, light mode only (MIND 10/11-Nov). Everything here moves by
   motion, never by shine: cards rise, the bar fills, the mark breathes, a focused field
   lifts. Every one of them stops dead under `prefers-reduced-motion` (the rule the 3D
   coin set on 07-Nov), and nothing moves that a person has to read while it moves.

   Work screens are untouched: this file is only ever loaded on the gate pages, so the
   counter's 33 px rows stay exactly as dense as they were.

   The step row is `.jsteps`, not `.steps`: app.css already owns `.steps` (the Home
   screen's step list, a 3-column grid per row). Sharing the name put the number beside
   the label and pushed the fourth step outside the card — caught on the first preview. */

/* ---------------------------------------------------------------- the page */

/* The card was 440 px on a 1366 px counter screen, which is what "too small" meant.
   Loaded only here, so this cannot touch a work screen.

   The mark and the name sit BESIDE the card, not above it (supervisor, 14-Nov-2026:
   "keep the logo aside not the above, anyside of it"). page() prints the three as
   siblings — mark, name, card — so the grid puts the first two in a left column and
   lets the card take the right one across both rows. Nothing in the HTML moved, which
   is what keeps the sign-in, set-up and four join screens all doing the same thing. */
main.narrow { max-width: 880px; }

body.gate main {
  padding-top: 34px;
  display: grid;
  grid-template-columns: minmax(170px, 210px) minmax(0, 1fr);
  grid-template-areas: "brand card";
  /* `start`, or the card stretches down the whole page: main is a flex child that takes
     the leftover height, and a stretched grid item would take it with it. */
  align-items: start;
  align-content: start;
  column-gap: 44px;
}
body.gate .logo-hero { grid-area: brand; margin: 0; padding-top: 4px; }
body.gate .gate-name { margin: 14px 0 0; }
body.gate main > .card { grid-area: card; margin-top: 0; }

/* The mark, bigger, with a slow breath so the page is never completely still. */
body.gate .gate-mark {
  width: 148px;
  height: 148px;
  border-radius: 22%;
  animation: gate-breathe 7s ease-in-out infinite;
  transition: opacity 420ms ease;
}

/* The animated 3D mark (src/static/gate.js, src/static/brand3d/README.md). It is drawn
   OVER the flat one, which only then fades — so a page where the 3D never arrives, or
   throws, is exactly the page it always was.

   The canvas is transparent and the TILE is this rule's, not the model's: the same size,
   radius, fill and hairline as the flat mark it replaces, so the swap is invisible instead
   of a shape and a colour changing under the reader.

   WHITE tile, NAVY mark — matching `tileSvg()` in src/ui/brand.ts and the rebuilt app
   icons. The supervisor picked "the app icon's polarity" on 14-Nov-2026, which at that
   moment meant a navy tile; the icons were rebuilt the other way round the same evening,
   so following the words would now break the thing they were chosen for. The mark colour
   is the module's own default, so there is no hex here to drift from the icon. */
body.gate .mark3d {
  width: 148px;
  height: 148px;
  border-radius: 22%;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #dcdce0,            /* tileSvg's stroke */
              0 6px 18px rgba(var(--shade), .18); /* the same lift the flat tile has */
  animation: gate-fade 520ms ease both;
}
body.gate .mark3d canvas { display: block; width: 100%; height: 100%; }
body.gate .logo-hero.is3d .gate-mark {
  opacity: 0;
  position: absolute;
  pointer-events: none;
}
body.gate .logo-hero { position: relative; }
body.gate .gate-name b { font-size: 25px; letter-spacing: .08em; }
/* app.css draws this ornament in --gold, which is now pure white — invisible on the pale
   page the gate actually is. Overridden here rather than in app.css, because the strip and
   the work screens use that token on navy, where white is right. */
body.gate .gate-name .orn { color: var(--gold-d); }
body.gate .gate-name .orn::before,
body.gate .gate-name .orn::after {
  width: 64px;
  background: var(--gold-d);
  animation: gate-rule 900ms ease-out both;
}

@keyframes gate-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.015); }
}
@keyframes gate-rule {
  from { width: 0; opacity: 0; }
  to { width: 64px; opacity: 1; }
}

/* Everything on the gate arrives, rather than being suddenly there. */
body.gate .logo-hero { animation: gate-drop 620ms cubic-bezier(.2, .7, .3, 1) both; }
/* Fade only — the name sits INSIDE the block that is already dropping, and two transforms
   on top of each other make it slide twice as far as the mark. */
body.gate .gate-name { animation: gate-fade 620ms ease 140ms both; }
body.gate .card { animation: gate-rise 620ms cubic-bezier(.2, .7, .3, 1) 120ms both; }

@keyframes gate-drop {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: none; }
}
@keyframes gate-rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes gate-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------------------------------------------------------------- the card itself */

body.gate .card.form {
  padding: 26px 30px 30px;
  border-radius: 8px;
  /* Flat: a soft shadow to lift it off the page, never a gradient or a sheen. */
  box-shadow: 0 10px 30px rgba(var(--shade), .10);
}
body.gate .card > h1,
body.gate .form h1 { font-size: 27px; line-height: 1.2; margin-bottom: 8px; }
body.gate .card > p,
body.gate .card .muted { font-size: 15px; line-height: 1.55; }

/* Fields you can actually hit on a phone at the counter. */
body.gate .form form { gap: 17px; margin-top: 20px; }
body.gate .form label { font-size: 12.5px; gap: 7px; }
body.gate .form input {
  min-height: 52px;
  font-size: 17px;
  padding: 10px 14px;
  border-radius: 5px;
  transition: border-color 140ms ease, box-shadow 180ms ease, transform 140ms ease;
}
/* A focused field lifts a little and takes a brass ring — the one place the page answers
   back while somebody is typing. */
body.gate .form input:focus {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px var(--brown), 0 0 0 4px rgba(var(--shade), .22);
}
body.gate .form button[type=submit] {
  width: 100%;
  min-height: 54px;
  font-size: 16.5px;
  border-radius: 5px;
  margin-top: 3px;
  transition: transform 110ms ease, box-shadow 160ms ease, background 140ms ease;
}
/* --gold is pure white since 14-Nov-2026 ("there is yellow color in wms, change it pure
   white"), and white only works ON navy. These two survive the sweep because the submit
   button IS navy; everywhere brass sat on a light fill, this file now uses navy instead. */
body.gate .form button[type=submit]:hover { box-shadow: inset 0 -3px 0 var(--gold); }
body.gate .form button[type=submit]:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 var(--gold); }
body.gate .card .small,
body.gate .card p.muted.small { font-size: 13.5px; }

/* ---------------------------------------------------------------- the four steps */

/* A bar that fills to where you are. It grows on every page load, so each step is a
   visible step forward rather than four pages that look the same. */
.join .jbar {
  height: 5px;
  border-radius: 3px;
  background: #e8e8eb;
  overflow: hidden;
  margin: 2px 0 18px;
}
.join .jbar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brown);
  border-radius: 3px;
  animation: jbar-fill 900ms cubic-bezier(.2, .7, .3, 1) 220ms both;
}
/* Three steps since 14-Nov-2026 (the PIN moved to after approval), so the bar is in thirds.
   p4 is kept in case a browser is still holding the old page. */
.join .jbar.p1 i { --to: 33%; }
.join .jbar.p2 i { --to: 66%; }
.join .jbar.p3 i { --to: 100%; }
.join .jbar.p4 i { --to: 100%; }
@keyframes jbar-fill { from { width: 0; } to { width: var(--to, 25%); } }

.join .jsteps {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  font-size: 12.5px;
}
.join .jsteps li {
  flex: 1;
  /* Without this a flex item refuses to shrink below its own words, and the fourth step
     pushes itself outside the card on a narrow screen. */
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: #7c7c85;
  line-height: 1.25;
  text-align: center;
}
/* The number in a ring, so a step reads as a place you are at. */
.join .jsteps li b {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid #e4e4e7;
  background: var(--w);
  font: 700 14px var(--mono);
  color: #a1a1aa;
  transition: all 200ms ease;
}
.join .jsteps li.on { color: var(--brown); font-weight: 600; }
.join .jsteps li.on b {
  border-color: var(--brown);
  background: var(--brown);
  color: var(--cream);
  animation: jstep-pop 460ms cubic-bezier(.2, .9, .3, 1.3) 360ms both;
}
/* The step you are on keeps a soft brass halo, breathing, so the eye lands there first. */
.join .jsteps li.on b::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(var(--shade), .3);
  animation: jstep-halo 2.4s ease-out infinite 900ms;
}
.join .jsteps li.done { color: #3f7d53; }
.join .jsteps li.done b {
  border-color: #3f7d53;
  background: #3f7d53;
  color: #fff;
  animation: jstep-tick 420ms cubic-bezier(.2, .9, .3, 1.3) both;
}
@keyframes jstep-pop {
  0% { transform: scale(.78); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
@keyframes jstep-tick {
  0% { transform: scale(.5) rotate(-18deg); opacity: 0; }
  70% { transform: scale(1.12) rotate(0); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes jstep-halo {
  0% { box-shadow: 0 0 0 0 rgba(var(--shade), .28); }
  70% { box-shadow: 0 0 0 12px rgba(var(--shade), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--shade), 0); }
}

/* The rows of a form arrive one after another, left to right, so the eye is led down
   the page instead of meeting all of it at once. */
body.gate .form form > * { animation: gate-rise 480ms cubic-bezier(.2, .7, .3, 1) both; }
body.gate .form form > *:nth-child(1) { animation-delay: 240ms; }
body.gate .form form > *:nth-child(2) { animation-delay: 300ms; }
body.gate .form form > *:nth-child(3) { animation-delay: 360ms; }
body.gate .form form > *:nth-child(4) { animation-delay: 420ms; }
body.gate .form form > *:nth-child(5) { animation-delay: 480ms; }
body.gate .form form > *:nth-child(6) { animation-delay: 540ms; }

.join .hint { display: block; color: #71717a; font-size: 13px; margin-top: 5px; letter-spacing: 0; text-transform: none; font-weight: 400; }

/* ---------------------------------------------------------------- step 2: the word */

.join .howto { margin: 0 0 20px; padding-left: 22px; }
.join .howto li { margin-bottom: 16px; line-height: 1.55; font-size: 15px; }

/* It gets read off this screen and typed into WhatsApp by hand, so it is the biggest
   thing on the page. No O, 0, I or 1 can appear in it (see join.ts). */
.join .word {
  position: relative;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--brown);
  background: var(--cream);
  border: 1px solid #d4d4d8;
  border-radius: 8px;
  padding: 16px 14px;
  margin: 14px 0;
  text-align: center;
  user-select: all;
  overflow: hidden;
}
/* A brass line that travels under the word — the page saying "this is the bit you need". */
.join .word::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 38%;
  background: var(--brown);
  animation: word-sweep 2.8s ease-in-out infinite;
}
@keyframes word-sweep {
  0%, 100% { transform: translateX(-10%); }
  50% { transform: translateX(190%); }
}

.join .btn.wa {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  background: #25d366;
  color: #04301a;
  border: 1px solid #1aa851;
  border-radius: 6px;
  font: 600 16px var(--sans);
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 160ms ease, background 140ms ease;
}
.join .btn.wa:hover { background: #1fc45d; box-shadow: 0 4px 14px rgba(26, 168, 81, .3); transform: translateY(-1px); }
.join .btn.wa:active { transform: translateY(1px); box-shadow: none; }
.join .ok { color: #2f6b45; }
.join .waitline { display: inline-flex; align-items: center; gap: 9px; color: #71717a; }

/* The little spinner beside "Waiting for your message…" */
.join .spin {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid #d4d4d8;
  border-top-color: var(--brown);
  border-radius: 50%;
  animation: join-spin .9s linear infinite;
}
@keyframes join-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- step 3 */

/* A question, not a field label — so it drops the uppercase monospace `.form label` wears. */
.join .tick {
  display: flex;
  align-items: center;
  gap: 11px;
  font: 400 16px var(--sans);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
  padding: 4px 0;
}
.join .tick input { width: 20px; height: 20px; flex: none; }
.join .counter-only { display: grid; gap: 17px; animation: gate-rise 320ms ease both; }
.join .counter-only[hidden] { display: none; }

/* ---------------------------------------------------------------- step 4: waiting */

.join.waiting { text-align: center; padding-bottom: 34px; }
.join.waiting .lead { font-size: 18px; margin: 6px 0 12px; line-height: 1.5; }
.join .hourglass { margin: 10px auto 4px; width: 124px; height: 124px; }
.join .hourglass svg { width: 124px; height: 124px; }
.join .hourglass .ring { stroke: #e4e4e7; }
.join .hourglass .glass { stroke: var(--brown); }
.join .hourglass .sand { fill: rgba(var(--shade), .45); }

/* The icon says "we are still waiting" in three ways at once, because on a phone at the
   counter one of them is always the one you notice: the ring sweeps round, the glass tips
   over every few seconds, and the sand breathes. */
.join .hourglass .ring {
  stroke-dasharray: 44 132;
  transform-origin: 32px 32px;
  animation: join-sweep 1.8s linear infinite;
}
.join .hourglass .glass,
.join .hourglass .sand {
  transform-origin: 32px 32px;
  animation: join-tip 4s ease-in-out infinite;
}
.join .hourglass .sand { animation-name: join-sand; }
@keyframes join-sweep { to { transform: rotate(360deg); } }
@keyframes join-tip {
  0%, 60% { transform: rotate(0deg); }
  75%, 100% { transform: rotate(180deg); }
}
@keyframes join-sand {
  0%, 60% { transform: rotate(0deg); opacity: 1; }
  68% { opacity: .55; }
  75%, 100% { transform: rotate(180deg); opacity: 1; }
}

.join .facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 18px;
  text-align: left;
  margin: 22px auto 12px;
  max-width: 340px;
  font-size: 15px;
  padding: 16px 18px;
  background: var(--cream);
  border-radius: 6px;
}
.join .facts dt { color: #71717a; }
.join .facts dd { margin: 0; font-weight: 600; }

/* ---------------------------------------------------------------- the parts wall */

/* Supervisor, 14-Nov-2026: "add more things to there, as visual but not a highlighted,
   likes the brands we deal, parts icons in faded."

   So: fifteen parts the shop sells - gear, piston, sprocket, brake disc, bearing, chain,
   spark plug, spanner, nut, tyre, oil filter, helmet, bulb - tiled behind the whole gate
   and faded until they are a texture rather than a picture. src/static/brand/parts-wall.svg
   draws them at full strength; the fade is here so it can be tuned, or a phone given its
   own value, without a new file.

   It is a ::before on the BODY, which is what keeps it out of everybody's way:
     * no element, so `main`'s two-column grid ("brand card") never sees a third child;
     * `position: fixed`, so on the join steps it stays put while the card scrolls;
     * `z-index: -1` works because body's own background goes to the page canvas (html sets
       none), so the paper is painted behind this, and every real element above it, without
       a single other rule having to know this exists.

   It does NOT move. The mark breathes, the card rises, the bar fills and the hourglass
   turns - a wall drifting behind a PIN box as well would be motion for its own sake, on
   the one screen where somebody is reading and typing. It arrives with the page and then
   holds still.

   6% of navy on the pale page is about #e4e9f0 against #eef2f7: enough to see the shapes
   when you look, not enough to compete with a word on the card. */
body.gate::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("/static/brand/parts-wall.svg") repeat;
  background-size: 420px 420px;
  /* One number, in one place: the keyframe and the reduced-motion rule both read it, and
     a phone changes the fade by changing this and nothing else. */
  --wall: .06;
  opacity: var(--wall);
  animation: gate-wall 1400ms ease 200ms both;
}
@keyframes gate-wall { from { opacity: 0; } to { opacity: var(--wall); } }

/* The brands line, last thing to arrive (the card and its fields come first - this is the
   quiet note at the bottom, not something anybody is waiting for). Base look is in app.css
   beside the rest of the signed-out frame. */
/* Where the bottom line sits, and why it is not simply "at the bottom":

   app.css gives `main` flex: 1, so on a short page (sign in) it swallows the leftover
   height and pushes everything after it to the foot of the window. That is right there -
   but on a TALL page (the join steps, with four steps and three fields) it meant the
   brands line and the footer were pushed past the "Install WMS" bar, which floats 12 px
   off the bottom of every page in both apps, and the bar sat on top of them.

   So on the gate, main is its own height and the FREE SPACE goes to this line instead
   (margin-top: auto). Short page: it rides at the bottom, exactly as before. Tall page:
   it follows the card, and the page scrolls like any other. The gap above it is padding,
   not margin, because an `auto` margin has no room left to add one.

   The 84 px below the body is the bar's own room (56 px tall, 12 px off the bottom). When
   the app is already installed there is no bar and this is empty page nobody can see. */
body.gate main { flex: none; }
body.gate { padding-bottom: 84px; }
body.gate .gate-brands {
  margin: auto 0 4px;
  padding-top: 30px;
  animation: gate-fade 900ms ease 700ms both;
}
body.gate .gate-brands .lead { font-size: 12.5px; }
body.gate .gate-brands b { font-size: 12.5px; }

/* ---------------------------------------------------------------- holds still on request */

/* A phone that asks for no motion gets none — the project rule since the 3D coin
   (MIND 07-Nov). Every screen still works: the waiting page keeps asking the server in
   the background, and nothing here carries meaning that only the movement conveys. */
@media (prefers-reduced-motion: reduce) {
  body.gate .gate-mark,
  body.gate .logo-hero,
  body.gate .gate-name,
  body.gate .gate-name .orn::before,
  body.gate .gate-name .orn::after,
  body.gate .card,
  body.gate .form form > *,
  .join .jbar i,
  .join .jsteps li b,
  .join .jsteps li.on b::after,
  .join .word::after,
  .join .counter-only,
  body.gate::before,
  body.gate .gate-brands,
  .join .hourglass .ring,
  .join .hourglass .glass,
  .join .hourglass .sand,
  .join .spin {
    animation: none;
  }
  body.gate .form input,
  body.gate .form button[type=submit],
  .join .btn.wa { transition: none; }
  /* These two still have to be THERE - they just arrive without arriving. */
  body.gate::before { opacity: var(--wall); }
  body.gate .gate-brands { opacity: 1; }
  /* The bar still has to SHOW where you are, it just gets there without moving. */
  .join .jbar i { width: var(--to, 25%); }
  .join .word::after { display: none; }
  .join .hourglass .ring { stroke-dasharray: none; }
}

/* ---------------------------------------------------------------- phones */

/* Under this, two columns stop being two columns: the card would be squeezed to nothing.
   The mark and name go back above it, which is where they were before today. */
@media (max-width: 720px) {
  body.gate main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "card";
    justify-items: center;
    row-gap: 0;
  }
  body.gate main > .card { width: 100%; margin-top: 16px; }
  body.gate .gate-name { margin: 8px 0 0; }
}

@media (max-width: 560px) {
  body.gate main { padding-top: 18px; }
  /* One 420 px tile is most of a phone screen - at that size the wall stops being a
     texture and becomes four big parts. Smaller tile, and fainter, because a phone is
     held closer than a counter screen. */
  body.gate::before { background-size: 300px 300px; --wall: .05; }
  /* The phone's install bar is two rows deep, so it needs more room under it. */
  body.gate { padding-bottom: 112px; }
  body.gate .gate-brands { padding-top: 22px; gap: 4px 0; }
  body.gate .gate-brands .lead { font-size: 11.5px; margin-right: 10px; }
  body.gate .gate-brands b { font-size: 11px; letter-spacing: .1em; }
  body.gate .gate-brands b + b::before { margin: 0 7px; }
  body.gate .gate-mark { width: 104px; height: 104px; border-radius: 24px; }
  body.gate .card.form { padding: 20px 18px 22px; }
  body.gate .card > h1, body.gate .form h1 { font-size: 23px; }
  .join .jsteps { font-size: 11px; gap: 2px; }
  .join .jsteps li b { width: 28px; height: 28px; font-size: 13px; }
  .join .word { font-size: 27px; letter-spacing: 2px; padding: 14px 8px; }
  .join .btn.wa { width: 100%; }
  .join .hourglass, .join .hourglass svg { width: 104px; height: 104px; }
}
