/* =========================================================================
   Sign In — page-scoped only, authored from tablet.css tokens.
   Namespace .lg-* ("login").

   No rail and no header: nothing on this page belongs to anybody until the
   password says whose tablet it is. The iPad on its side splits in two: the
   stone and the mark on one half, the step on the other, on white — one
   short line under each heading, everything centred, and every step fits
   the screen. A narrow screen stacks them, the stone becoming a band. What
   only the prototype needs is on the Prototype bar (css/tablet.css), never
   on the page. Written with logical properties, so Arabic and Persian lay
   it out right to left, the stone on the right (TRV-03).
   ========================================================================= */

.lg-page {
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 44fr) minmax(0, 56fr);
  background: var(--color-surface);
  overflow: hidden;
}
.lg-page [hidden] { display: none; }

/* ---- The brand half ------------------------------------------------------- */

.lg-brand {
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
  padding: 40px 40px 36px;
  background: #BFE6DC;
  color: #002040;
}
/* The stone, a touch larger than the half so its cut edges never show. Held
   by its top-left corner, the stone's whitest, under the mark. js/login.js
   picks one of the four stones on every load, and mirrors it on half the
   loads so its veins rise (owner, 2026-10-29). */
.lg-brand::before {
  content: '';
  position: absolute; inset: 0;
  background: left top / cover no-repeat;
  transform: scale(1.08);
}
.lg-brand[data-flip]::before { transform: scale(-1.08, 1.08); }
.lg-brand[data-stone="amazonite"]::before { background-image: url(../../img/login-stone-amazonite.jpg); }
.lg-brand[data-stone="taj-mahal"] { background-color: #EFEADF; }
.lg-brand[data-stone="taj-mahal"]::before { background-image: url(../../img/login-stone-taj-mahal.jpg); }
.lg-brand[data-stone="calacatta-gold"] { background-color: #F3F1EC; }
.lg-brand[data-stone="calacatta-gold"]::before { background-image: url(../../img/login-stone-calacatta-gold.jpg); }
.lg-brand[data-stone="cristallo-petrus"] { background-color: #E8EAE8; }
.lg-brand[data-stone="cristallo-petrus"]::before { background-image: url(../../img/login-stone-cristallo-petrus.jpg); }
/* Paler at the head and the foot, where the mark and the location are read. */
.lg-brand::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .82) 0%, rgba(255, 255, 255, .50) 14%,
                                      rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 70%,
                                      rgba(255, 255, 255, .50) 88%, rgba(255, 255, 255, .80) 100%);
}
/* Mirrored, the whitest corner leaves the mark: a stronger head keeps it on light. */
.lg-brand[data-flip]::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, .92) 0%, rgba(255, 255, 255, .72) 14%,
                                      rgba(255, 255, 255, .30) 26%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 70%,
                                      rgba(255, 255, 255, .50) 88%, rgba(255, 255, 255, .80) 100%);
}
.lg-brand > * { position: relative; z-index: 1; }
.lg-brand-supplier { display: block; width: 196px; height: auto; }
/* The foot: where the tablet lives, and Vava Sales held to the far end. */
.lg-brand-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.lg-brand-by { margin-inline-start: auto; text-align: end; }
.lg-brand-by-label { display: block; margin-bottom: -6px; font: 500 7.5px/1 var(--font-body); color: var(--color-text-muted); }
.lg-brand-logo { display: block; width: 96px; height: auto; }
.lg-brand-tablet { margin: 0; font: 700 32px/1.1 'Caveat', cursive; }

/* ---- The step's half ------------------------------------------------------ */

.lg-main {
  position: relative;
  min-width: 0;
  overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center;
  padding: 76px 40px 40px;
}
.lg-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; }

.lg-card { width: min(400px, 100%); text-align: center; }
.lg-card--wide { width: min(600px, 100%); }

.lg-h1 { margin: 0; font: 700 28px/1.15 var(--font-head); color: var(--color-text); letter-spacing: -.026em; }
.lg-h1:focus { outline: none; }
.lg-sub { margin: 8px 0 0; font: 400 15px/1.5 var(--font-body); color: var(--color-text-muted); }
.lg-sub b { color: var(--color-text); font-weight: 600; overflow-wrap: anywhere; }

/* Waiting on the person: their password is what the tablet needs next. */
.lg-band {
  margin-bottom: 20px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--color-warn-50);
  border: 1px solid var(--color-warn-100);
}
.lg-band b { display: block; font: 700 13.5px/1.3 var(--font-body); color: var(--color-warn-ink); }
.lg-band span { display: block; margin-top: 3px; font: 400 12.5px/1.45 var(--font-body); color: var(--color-text); }

/* ---- The language, in the corner ------------------------------------------ */

.lg-lang { position: absolute; top: 20px; inset-inline-end: 24px; z-index: 20; }
.lg-lang-pick { position: relative; }

/* The button: the language in use, beside its flag, and a chevron. On the
   control ground, since it sits on white (memory.md §13). */
.lg-lang-btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 44px;
  padding-inline: 12px 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--r-md);
  background: var(--color-surface-sunk);
  color: var(--color-text);
  font: 600 14px/1 var(--font-body);
  cursor: pointer;
}
.lg-lang-btn::after {
  content: '';
  width: 7px; height: 7px;
  margin-inline-start: 4px;
  border: solid var(--color-text-muted);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg);
}
.lg-lang-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.lg-lang-btn[aria-expanded="true"] { border-color: var(--color-primary); outline: 2px solid var(--color-primary-100); }
.lg-lang-btn[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }

.lg-flag { width: 22px; height: 15px; flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .10); }

/* The list: every language, each beside its flag; the one in use ticked. */
.lg-lang-menu {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0;
  z-index: 20;
  min-width: max(100%, 210px);
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-modal);
}
.lg-lang-menu[hidden] { display: none; }
.lg-lang-opt {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 44px;
  padding-inline: 10px 12px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  color: var(--color-text);
  font: 500 14px/1.2 var(--font-body);
  text-align: start;
  cursor: pointer;
}
.lg-lang-opt:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.lg-lang-opt[aria-selected="true"] { background: var(--color-primary-50); color: var(--color-primary-700); font-weight: 600; }
.lg-lang-opt[aria-selected="true"]::after {
  content: '';
  width: 5px; height: 10px;
  margin-inline-start: auto;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
}

/* ---- The forms ------------------------------------------------------------ */

.lg-form { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; text-align: start; }
.lg-label { display: block; margin-bottom: 6px; font: 600 13px/1.2 var(--font-body); color: var(--color-text-heading); }

/* A field on white takes the sunk ground, or nobody can see where to type
   (memory.md §13). */
.lg-input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--r-sm);
  background: var(--color-surface-sunk);
  color: var(--color-text);
  font: 400 15px/1 var(--font-body);
}
.lg-input:focus { outline: 2px solid var(--color-primary-100); outline-offset: 0; border-color: var(--color-primary); background: var(--color-surface); }

.lg-pw { position: relative; }
.lg-pw .lg-input { padding-inline-end: 84px; }
.lg-eye {
  position: absolute; top: 2px; bottom: 2px; inset-inline-end: 2px;
  min-width: 72px;
  border: none;
  border-radius: var(--r-xs);
  background: none;
  color: var(--color-primary-700);
  font: 600 13px/1 var(--font-body);
  cursor: pointer;
}

.lg-err {
  margin: 0;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--color-danger-50);
  border: 1px solid var(--color-danger-100);
  color: var(--color-danger-ink);
  font: 500 13px/1.45 var(--font-body);
}

.lg-go { width: 100%; margin-top: 4px; }
.lg-go--alone { margin-top: 26px; }
.lg-go[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* No connection: said only then, plainly. */
.lg-conn { margin: 14px 0 0; font: 500 13px/1.45 var(--font-body); color: var(--color-text); }

/* Every link and note under a step: centred, one after another. */
.lg-link { display: block; min-height: 44px; margin: 10px auto 0; }
.lg-link + .lg-link { margin-top: 0; }
.lg-foot { margin: 8px 0 0; font: 400 13px/1.5 var(--font-body); color: var(--color-text-subtle); }
.lg-foot-a {
  display: inline-flex; align-items: center;
  min-height: 44px;
  font-weight: 600;
  color: var(--color-primary-700);
  text-decoration: none;
}

/* ---- Select Your Name, and their PIN (owner, 2026-10-28) ----------- */

/* Four to a row on an iPad on its side, and a short row sits in the middle
   (owner, 2026-10-29: three are centred). Tiles on the control ground, which
   a thing to pick takes on white (memory.md §13). */
.lg-people {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.lg-people > li { flex: 0 0 calc((100% - 36px) / 4); min-width: 0; }
.lg-person {
  width: 100%;
  min-height: 140px;
  padding: 18px 8px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--color-surface-sunk);
  color: var(--color-text);
  cursor: pointer;
}
.lg-person b { font: 600 14.5px/1.25 var(--font-body); overflow-wrap: anywhere; }
.lg-person span { font: 400 12px/1.3 var(--font-body); color: var(--color-text-muted); }
.lg-person em { margin-top: 2px; font: 600 11.5px/1.3 var(--font-body); font-style: normal; color: var(--color-primary-700); }
.lg-person[disabled] { cursor: not-allowed; opacity: .6; }

/* Initials bold on a full colour, one per tint, so a face is found by its
   colour before its name is read. */
.lg-person .vw-avatar, .lg-pin-who .vw-avatar { border: none; color: #FFFFFF; }
.lg-person .vw-avatar { width: 52px; height: 52px; margin-bottom: 8px; font: 700 17px/1 var(--font-body); }
.lg-page .vw-avatar--grey  { background: #5F6E7E; }
.lg-page .vw-avatar--gold  { background: #9C7A3C; }
.lg-page .vw-avatar--blue  { background: var(--color-primary); }
.lg-page .vw-avatar--green { background: var(--color-success); }
.lg-page .vw-avatar--slate { background: #6F7C8B; }

.lg-pin-who { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 14px; text-align: start; }
.lg-pin-who .vw-avatar { width: 44px; height: 44px; font-size: 15px; }
.lg-pin-who b { display: block; font: 700 28px/1.15 var(--font-head); color: var(--color-text); letter-spacing: -.026em; }
/* The person leads; the ask is the smaller line under them. */
[data-step="pin"] .lg-h1 { font-size: 16px; line-height: 1.25; letter-spacing: 0; }
.lg-pin-who span span { display: block; margin-top: 2px; font: 400 12.5px/1.3 var(--font-body); color: var(--color-text-muted); }
/* The answer is as wide as the keypad it answers. */
[data-step="pin"] .lg-err { width: min(264px, 100%); margin: 16px auto 0; text-align: center; }

/* ---- On the Prototype bar: Sign In As ------------------------------------ */

.lg-proto-accts { display: flex; gap: 2px; }
.lg-proto-accts[hidden] { display: none; }

@media (hover: hover) {
  .lg-eye:hover, .lg-foot-a:hover { color: var(--color-primary); }
  .lg-lang-btn:hover { border-color: var(--color-primary); }
  .lg-lang-opt:not([aria-selected="true"]):hover { background: var(--color-surface-alt); }
  .lg-person:not([disabled]):hover { background: var(--color-surface); border-color: var(--color-primary); box-shadow: var(--shadow-card); }
}

/* Review only: inside the desktop's iPad frame (css/tablet.css) the page is
   the screen, and its own height and width give way to the frame's. */
@media (hover: hover) and (pointer: fine) and (min-width: 760px) {
  .lg-page { width: var(--tab-w); height: var(--tab-h); }
}

/* ---- An iPad on its end, or narrower: the stone becomes a band ------------ */

@media (max-width: 900px) {
  .lg-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .lg-brand { flex-direction: row; align-items: center; padding: 20px 24px; }
  .lg-brand::after, .lg-brand[data-flip]::after { background: rgba(255, 255, 255, .50); }
  .lg-brand-supplier { width: 150px; }
  .lg-brand-logo { width: 84px; }
  .lg-brand-tablet { font-size: 22px; text-align: end; }
  .lg-main { padding-top: 72px; }
  .lg-people > li { flex-basis: calc((100% - 24px) / 3); }
}

@media (max-width: 560px) {
  .lg-people > li { flex-basis: calc((100% - 12px) / 2); }
}

@media (max-width: 480px) {
  .lg-brand { padding: 16px; }
  .lg-brand-supplier { width: 128px; }
  .lg-brand-logo { width: 76px; }
  .lg-main { padding: 68px 16px 24px; }
  .lg-lang { top: 14px; inset-inline-end: 16px; }
  /* Three names and More fit a phone's width only without the tag. */
  .vw-proto > .vw-proto-tag { display: none; }
}
