/* ==========================================================================
   static/app/signin.css — the REAL sign-in page, /signin (Wave SG1).
   --------------------------------------------------------------------------
   Loaded after static/app/tokens.css (the owner's palette), mobile/tokens.css
   (phone geometry) and mobile/components.css (the component anatomy). It
   introduces NO hue: every colour here is a var() onto one of those, and the
   two brand buttons keep the colours Apple and Google publish.

   ONE document, THREE compositions:

     PHONE (< 720px)   the welcome design. Navy fills the screen, the water
                       runs along the bottom, the mark floats in the middle,
                       and the ways in sit in the thumb zone. Nothing here is
                       a card: the card IS the lower half of the screen.

     TABLET (>= 720px, touch — iPad, and a narrow desktop window) the phone
                       composition with the column held to 440px (§8).

     DESKTOP (>= 960px, mouse) a split screen: the brand on the water to the
                       left, a white panel with the ways in to the right
                       (§9). A real product's sign-in page, not a phone
                       screen stretched across a monitor.

   The switch is `--bps-ground`: on the phone the card is transparent and the
   controls wear their on-water variants; on the desktop the card is the
   owner's white surface and they wear their ordinary ones. One DOM, one set
   of components, two grounds.

   Older-user floors, inherited and never lowered: 18px body, nothing under
   14px, 56px primary buttons, 48px targets, full-contrast actionable text.
   ========================================================================== */

/* 1 ─ the ground ───────────────────────────────────────────────────────── */

.bps-body {
  /* The owner's four-band navy->teal stripe is the top bar's; the sign-in
     page is a whole screen of it, so it reads as the same product before
     anybody is inside it. --bp-band-4 is the deep end of that same stripe. */
  background: var(--bp-band-4);
  /* The page scrolls vertically when a short window cannot hold the card.
     NEVER sideways (CLAUDE.md §6): nothing on this page is wider than its
     column, and .bps-page clips the axis. */
  overflow: hidden;
}

.bps-page {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overflow-x: clip;               /* clip, never hidden — see CLAUDE.md §6 */
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(120% 80% at 50% 0%,
                    var(--bp-band-2) 0%, transparent 62%),
    var(--bp-band-4);
  color: var(--bpm-bar-ink);
}

/* The sea. Same four layers, same tokens, as the landing page's hero — the
   canvas reads them off itself, so they are declared on the element's own
   ancestor and nothing about the water is decided in JavaScript. */
.bps-waves {
  --bpm-wave-1: var(--bp-band-4);
  --bpm-wave-2: var(--bp-primary);
  --bpm-wave-3: var(--bp-accent-ink);
  --bpm-wave-4: var(--bp-accent);
  position: absolute;
  left: 0; bottom: 0;
  /* WIDTH IS EXPLICIT, and must stay that way: a <canvas> is a replaced
     element, so `left: 0; right: 0` with `width: auto` resolves to its
     INTRINSIC width — and waves.js rewrites that every time it measures,
     which feeds a growth loop. */
  width: 100%;
  height: 58%;
  z-index: 0;
  pointer-events: none;                 /* never eats a tap */
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 46%);
          mask-image: linear-gradient(180deg, transparent 0%, black 46%);
}

/* 2 ─ the column ───────────────────────────────────────────────────────── */

.bps-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: calc(var(--bpm-safe-top) + var(--bpm-space-5))
           calc(var(--bpm-gutter) + var(--bpm-safe-right))
           calc(var(--bpm-safe-bottom) + var(--bpm-space-5))
           calc(var(--bpm-gutter) + var(--bpm-safe-left));
}

/* The mark, in the water's upper field. It is the whole of the phone's top
   half, which is what makes the thumb zone the only place anything happens. */
.bps-brand {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--bpm-space-4);
  padding-bottom: var(--bpm-space-6);
  text-align: center;
}
.bps-brand__mark { width: min(132px, 36vw); height: auto; }
.bps-brand__word {
  font-size: var(--bpm-type-largetitle);
  font-weight: var(--bpm-fw-largetitle);
  letter-spacing: -0.01em;
  color: var(--bpm-bar-ink);
}
.bps-brand__word:focus { outline: none; }

/* THE 56px FLOOR, RESTORED. components.css sets `.bpm-ios .bpm-btn
   { min-height: 50px }` — two classes — and the primary/provider rules that
   raise it to 56 carry only one, so on iOS (and on every desktop, which is
   drawn with the iOS scale) the thumb-zone button quietly came out 50px
   tall. Measured with a real pointer at 393px: 50, not 56. This restores the
   owner's floor for this page at equal specificity, loaded later. The same
   line belongs in components.css when that file next opens — flagged, not
   reached from here. */
.bps-body .bpm-btn--primary,
.bps-body .bpm-btn--apple,
.bps-body .bpm-btn--google,
.bps-body .bpm-btn--onwater-line { min-height: var(--bpm-target-primary); }

/* 3 ─ the card ─────────────────────────────────────────────────────────── */
/* On the phone it is not a card at all: it is the thumb zone, on the water. */

.bps-card {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--bpm-space-4);
  width: 100%;
}
.bps-ways { display: flex; flex-direction: column; gap: var(--bpm-target-gap); }

.bps-step { display: flex; flex-direction: column; gap: var(--bpm-space-3); }
.bps-step__title {
  font-size: var(--bpm-type-title);
  font-weight: var(--bpm-fw-title);
  color: var(--bpm-bar-ink);
}
.bps-step__line { color: var(--bpm-bar-ink-muted); font-size: var(--bpm-type-callout); }
.bps-step__glyph {
  display: inline-grid; place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--bpm-bar-ink);
}

.bps-form { display: flex; flex-direction: column; gap: var(--bpm-space-4); }
.bps-alt { display: flex; justify-content: center; }

/* THE WAY IN FOR SOMEBODY WITH NO ACCOUNT (Wave SG3). A text link under the
   three ways in, never a fourth button: it is a different intent, and the
   thumb zone belongs to signing in. One step of air so the eye reads it as
   its own thing rather than as the last button's caption. */
.bps-alt--new { margin-top: var(--bpm-space-1); }

/* Back. A 48px target with its own visible word — never an icon on its own. */
.bps-back {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 2px;
  min-height: var(--bpm-target);
  margin-left: calc(var(--bpm-space-2) * -1);
  padding: 0 var(--bpm-space-2);
  border: 0;
  background: none;
  color: var(--bpm-bar-ink);
  font: inherit;
  font-size: var(--bpm-type-callout);
  cursor: pointer;
}

/* THE ONE INVERTED BUTTON. On the phone every step stands on the navy
   water, where the owner's navy primary would vanish into it — so it flips to
   the white disc with the navy label that components.css §8 already names for
   exactly this ground. Same two tokens, same contrast, the other way round.
   Inside the desktop card it goes back to navy on white. */
.bps-card .bpm-btn--primary {
  background: var(--bpm-on-primary);
  color: var(--bpm-primary-ink);
}
.bps-card .bpm-btn--primary:active { background: var(--bpm-bar-press); }

/* On the water a field's label and a text link are white; the input itself
   stays the component's white box with dark ink, which is what keeps it
   legible in sunlight. */
.bps-card .bpm-field__label { color: var(--bpm-bar-ink); }
.bps-card .bpm-textlink { color: var(--bpm-bar-ink); text-decoration: underline; text-underline-offset: 3px; }
.bps-card .bpm-field__error { color: var(--bpm-bar-ink); }

/* The refusal line. Full-contrast white on the navy, with its own glyph —
   the status family is told apart by glyph, never by a new hue. */
.bps-alert {
  display: flex; align-items: flex-start; gap: var(--bpm-space-2);
  padding: var(--bpm-space-3);
  border-radius: var(--bpm-radius-field);
  background: rgba(255, 255, 255, 0.14);
  color: var(--bpm-bar-ink);
  font-size: var(--bpm-type-footnote);
}
.bps-alert svg { flex: none; margin-top: 2px; }

/* 4 ─ the terms ────────────────────────────────────────────────────────── */
/* ONE LINE, NOT A CARD (owner, 2026-11-11: "this is all very cluttered. we
   need a more simple, app like format"). It used to be a white list card with
   the switch in it and the two documents repeated as a row of links beneath —
   the heaviest element on the screen, carrying the least important thing on
   it. The sentence now holds its own links, so the row is one quiet line on
   the water with the switch at its end, and the sentence IS the label: the
   words toggle it, the two names open their own tab.

   Nothing about the input changed. It is the same id, the same unticked
   start, and the same 48px switch target an older hand has to find. */

.bps-terms__row {
  display: flex;
  align-items: center;
  gap: var(--bpm-space-3);
  min-height: var(--bpm-target);
  cursor: pointer;
}
.bps-terms__text {
  flex: 1 1 auto;
  color: var(--bpm-bar-ink-muted);
  font-size: var(--bpm-type-subhead);
}
/* The two documents, inside the sentence. Full-contrast white and underlined,
   because they are the only part of the line that does anything. Each name
   stays whole: a title broken across two lines reads as two links, and the
   underline under half of one is how a person misses the other half. */
.bps-terms__doc {
  color: var(--bpm-bar-ink);
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 5 ─ the staff door ───────────────────────────────────────────────────── */
/* A welcome-screen question, so it is drawn with air above it rather than
   stacked tight under the last link — the three-underlined-links-in-a-row
   the owner read as clutter. signin.js hides it on every other step. */

.bps-staff {
  align-self: center;
  margin-top: var(--bpm-space-5);
  color: var(--bpm-bar-ink-muted);
  text-decoration-color: var(--bpm-bar-ink-muted);
}

/* 6 ─ the accounts list ────────────────────────────────────────────────── */
/* Owner, 2026-11-13, of this screen: *"it should just be Employee, Admin, or
   Customer, and more prominent buttons."* They were cells in a white card —
   the quietest thing the component library draws — on a screen where picking
   one is the ONLY thing to do. They are now a stack of full-width primary
   buttons at the thumb-zone height, so the card, its corners and its iOS
   hairlines are all undone here. The row carries a name and the yard; the
   description line it used to carry is gone from the server (see
   `phone_auth.identities_for`). */

.bps-accounts {
  display: flex; flex-direction: column; gap: var(--bpm-space-3);
  background: none;
  border-radius: 0;
  overflow: visible;
}
.bps-accounts > li + li::before { display: none; }   /* the list's hairline */

.bps-accounts .bps-account {
  display: flex; align-items: center; gap: var(--bpm-space-3);
  width: 100%;
  min-height: var(--bpm-target-primary);
  padding: var(--bpm-space-3) var(--bpm-space-4);
  border: 0;
  border-radius: var(--bpm-radius-btn);
  background: var(--bpm-primary);
  font: inherit;
  text-align: left;
  color: var(--bpm-on-primary);
  cursor: pointer;
}
.bps-accounts .bps-account:active { background: var(--bpm-primary-pressed); }
.bps-account__mark {
  flex: none;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  /* On the blue the tint circle used to sit on would be invisible: the mark
     inverts instead of inventing a second colour. */
  background: var(--bpm-on-primary);
  color: var(--bpm-primary);
  font-size: var(--bpm-type-subhead);
  font-weight: var(--bpm-fw-semibold);
}
.bps-account__body { display: flex; flex-direction: column; min-width: 0; }
.bps-account__title { font-size: var(--bpm-type-headline); font-weight: var(--bpm-fw-semibold); }
/* The yard, not a description — same ink as the name, stepped back only in
   weight and size, because there is no grey that reads on the primary blue. */
.bps-account__sub { font-size: var(--bpm-type-footnote); color: inherit; opacity: 0.85; }

/* 7 ─ the busy page ────────────────────────────────────────────────────── */

.bps-page--plain { display: grid; place-items: center; padding: var(--bpm-gutter); }
.bps-card--plain {
  max-width: 420px;
  padding: var(--bpm-space-6);
  border-radius: var(--bpm-radius-card);
  background: var(--bpm-surface);
  color: var(--bpm-ink);
  text-align: center;
}
.bps-card__title { font-size: var(--bpm-type-title); font-weight: var(--bpm-fw-title); }
.bps-card__line { margin-top: var(--bpm-space-2); color: var(--bpm-ink-2); }

/* ==========================================================================
   8 ─ TABLET. The phone design, on a bigger screen (owner, 2026-09-22:
   "mobile also needs to work for ipad").
   --------------------------------------------------------------------------
   Anything 720px or wider that is NOT a desktop (§9) lands here: an iPad in
   either orientation, an Android tablet, the native app on an iPad — and a
   desktop window between 720 and 960 wide. It is the phone's composition —
   water, the mark in the upper field, the ways in low — with the column held
   to a thumb's width so three buttons are never a metre long.
   ========================================================================== */

@media (min-width: 720px) {
  .bps-shell { align-items: center; padding-bottom: calc(var(--bpm-safe-bottom) + var(--bpm-space-8)); }
  .bps-card,
  .bps-staff { width: min(100%, 440px); }
  .bps-staff { text-align: center; }
  .bps-brand__mark { width: min(168px, 24vw); }
}

/* ==========================================================================
   9 ─ DESKTOP. A real product's sign-in page (owner, 2026-09-22: "redo
   desktop view to make more sense for desktop").
   --------------------------------------------------------------------------
   Decided by the POINTER, not the width alone: a desktop is wide AND has a
   mouse. An iPad is wide and has a finger, so it stays on §8 — which is also
   why narrowing a desktop window below 960 gives the phone design back.

   Split screen: the brand on the water to the left, a white panel to the
   right holding a heading, the ways in, the terms as an ordinary checkbox,
   and the staff door at its foot. Nothing changes in the DOM the script
   drives — every step, hook and id is where §1-§7 left it; this is layout.
   ========================================================================== */

.bps-home, .bps-desk-title { display: none; }

@media (min-width: 960px) and (hover: hover) and (pointer: fine) {
  .bps-body { --bps-panel: clamp(460px, 38vw, 560px); }

  /* The water fills only the brand side. Height up so the crests pass
     behind the mark's lower half. */
  .bps-waves { width: calc(100% - var(--bps-panel)); height: 62%; }

  .bps-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--bps-panel);
    grid-template-rows: auto 1fr auto;
    align-items: stretch;
    padding: 0;
    /* The panel's white, painted by the shell so no wrapper is needed. */
    background: linear-gradient(90deg,
                transparent calc(100% - var(--bps-panel)),
                var(--bpm-surface) calc(100% - var(--bps-panel)));
  }

  .bps-brand {
    grid-column: 1; grid-row: 1 / -1;
    flex-direction: column;
    gap: var(--bpm-space-4);
    padding: var(--bpm-space-8);
  }
  .bps-brand__mark { width: clamp(96px, 11vw, 150px); }
  .bps-brand__word { font-size: clamp(34px, 3.4vw, 46px); }

  /* Back to the site: a desktop visitor came from the landing page. */
  .bps-home {
    grid-column: 2; grid-row: 1;
    justify-self: start;
    display: inline-flex; align-items: center; gap: 4px;
    margin: var(--bpm-space-6) var(--bpm-space-8) 0;
    min-height: 40px;
    color: var(--bpm-ink-2);
    font-size: var(--bpm-type-callout);
    text-decoration: none;
  }
  .bps-home:hover { color: var(--bpm-primary-ink); }

  .bps-card {
    grid-column: 2; grid-row: 2;
    align-self: center; justify-self: center;
    width: min(calc(100% - 2 * var(--bpm-space-8)), 400px);
    padding: var(--bpm-space-6) 0;
    background: none;
    color: var(--bpm-ink);
  }
  .bps-desk-title {
    display: block;
    margin-bottom: var(--bpm-space-2);
    font-size: 30px;
  }

  .bps-staff {
    grid-column: 2; grid-row: 3;
    justify-self: center;
    width: auto;
    margin: 0 0 var(--bpm-space-7);
    color: var(--bpm-ink-2);
    text-decoration-color: var(--bpm-hairline-strong);
  }
  .bps-staff:hover { color: var(--bpm-primary-ink); }

  /* On white, everything goes back to its ordinary ground. */
  .bps-card .bps-step__title,
  .bps-card .bps-back { color: var(--bpm-ink-strong); }
  .bps-card .bps-step__line { color: var(--bpm-ink-2); }
  .bps-card .bpm-field__label { color: var(--bpm-ink); }
  .bps-card .bpm-textlink { color: var(--bpm-primary-ink); }
  .bps-card .bpm-field__error { color: var(--bpm-destructive); }
  .bps-card .bps-step__glyph { background: var(--bpm-primary-tint); color: var(--bpm-primary-ink); }
  .bps-card .bps-alert {
    background: var(--bpm-surface-sunken);
    color: var(--bpm-ink);
    box-shadow: inset 0 0 0 1px var(--bpm-hairline-strong);
  }

  /* Email is OURS: the owner's primary blue on white, where the eye lands. */
  .bps-card .bpm-btn--onwater-line {
    background: var(--bpm-primary);
    color: var(--bpm-on-primary);
    box-shadow: none;
  }
  .bps-card .bpm-btn--onwater-line:hover,
  .bps-card .bpm-btn--primary:hover { background: var(--bpm-primary-pressed); }
  .bps-card .bpm-btn--google:hover { background: var(--bpm-surface-2); }
  .bps-card .bpm-btn--primary {
    background: var(--bpm-primary);
    color: var(--bpm-on-primary);
  }
  .bps-card .bpm-btn--primary:active { background: var(--bpm-primary-pressed); }

  /* THE TERMS, AS A DESKTOP CHECKBOX. Same <input>, same id, same unticked
     start — only its drawing changes: a box before the sentence instead of
     a phone switch after it. The label stays clickable, so the small box is
     never the only target. */
  .bps-terms__text { color: var(--bpm-ink); font-size: var(--bpm-type-callout); }
  .bps-terms__doc { color: var(--bpm-primary-ink); }
  .bps-terms .bpm-switch { order: -1; min-width: 24px; min-height: 24px; }
  .bps-terms .bpm-switch__track,
  .bps-body.bps-body .bps-terms .bpm-switch__track {
    width: 22px; height: 22px;
    border-radius: 6px;
    background: var(--bpm-surface);
    box-shadow: inset 0 0 0 1.5px var(--bpm-ink-3);
  }
  .bps-terms .bpm-switch__track::after,
  .bps-body.bps-body .bps-terms .bpm-switch__track::after {
    top: 5px; left: 8px;
    width: 6px; height: 11px;
    border-radius: 0;
    background: none;
    box-shadow: none;
    border: solid var(--bpm-on-primary);
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    transition: transform var(--bp-dur) var(--bpm-ease-standard);
  }
  .bps-terms .bpm-switch input:checked + .bpm-switch__track,
  .bps-body.bps-body .bps-terms .bpm-switch input:checked + .bpm-switch__track {
    background: var(--bpm-primary);
    box-shadow: none;
  }
  .bps-terms .bpm-switch input:checked + .bpm-switch__track::after,
  .bps-body.bps-body .bps-terms .bpm-switch input:checked + .bpm-switch__track::after {
    top: 5px; left: 8px; width: 6px; height: 11px;
    background: none;
    transform: rotate(45deg) scale(1);
  }
}

/* A window too short to hold the column: let it grow and the page scroll,
   rather than squeezing anything. */
@media (min-width: 960px) and (max-height: 640px) and (hover: hover) and (pointer: fine) {
  .bps-card { align-self: start; }
}

/* The sea is decoration. Somebody who has asked for less motion gets one
   still frame from waves.js itself; nothing here needs to move either. */
@media (prefers-reduced-motion: reduce) {
  .bps-body * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
