/* pages/account.css — /account, /login, /probe, the home launcher (/), connected.
 *
 * SPEC §5.14. Built on m3.css: the account sections are .panel cards (--xl, 28) with
 * segmented .rows inside, the sign-in card is the dialog shape in the card
 * tone, the launcher tiles are interactive .m3-card cards, and the probe's
 * results are a segmented list with a 3px verdict edge.
 *
 * PAGE-SCOPE RULE (§1.1, test_design check 9): every selector starts with a
 * class this file owns — .login*, .account, .probe*, .grid, .tile*,
 * .connected*. Never [data-page]: these pages share the file with the
 * gallery, and all eleven page files load on every page.
 */

/* ---------------------------------------------------------------- login --
   The bare sign-in page (§4.14 centres it on the canvas). The card is the
   dialog shape (§3.11: 28, level3) in the CONTENT tone #131314 on the
   #1E1F20 canvas — the Gemini inversion, as the auth gate always drew it. */

.login {
  box-sizing: border-box;
  display: grid;
  gap: 16px;
  width: min(400px, 100%);
  margin: 0;
  padding: 32px 24px 24px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface);
  box-shadow: var(--md-sys-elevation-level3);
  color: var(--md-sys-color-on-surface);
  text-align: start;
}
.login[hidden] { display: none; }

.login__title {
  margin: 0 0 8px;
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-ref-typeface-brand);
  font-size: var(--md-sys-typescale-headline-small-size);
  line-height: var(--md-sys-typescale-headline-small-line-height);
  font-weight: var(--md-sys-typescale-emphasized-headline-small-weight);
  font-variation-settings: "ROND" var(--md-sys-typescale-emphasized-rond);
  letter-spacing: 0;
}

/* #signin: the one loud action, filled, size M (56), the full card width, its
   passkey glyph at 24. These are .m3-btn--m's own knobs, so the button is M
   whether the markup says `btn btn--primary` or `m3-btn m3-btn--filled
   m3-btn--m` (the markup is the foundation's, §1.4). */
.login #signin {
  --_h: var(--app-btn-h-m); --_inset: 0px; --_pad: 24px; --_gap: 8px;
  --_r-sq: var(--md-sys-shape-corner-large); --_r-press: var(--md-sys-shape-corner-medium);
  --_icon: var(--app-icon-size-large); --_opsz: 24;
  --_fs: var(--md-sys-typescale-title-medium-size); --_lh: var(--md-sys-typescale-title-medium-line-height);
  --_fw: var(--md-sys-typescale-title-medium-weight); --_fw-em: var(--md-sys-typescale-emphasized-title-medium-weight);
  width: 100%;
  margin-inline: 0;
}

.login__note {
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
  font-weight: var(--md-sys-typescale-body-medium-weight);
}
/* The error banner itself is m3.css's .err family; in the card's grid the
   gap spaces it, not the banner's own bottom margin. */
.login__error { margin: 0; }
.login__error[hidden] { display: none; }

/* -------------------------------------------------------------- account --
   One column of cards, capped at the form measure. Each .panel is a filled
   card (--xl, 28); its .rows are a SEGMENTED list whose tiles are #282A2C inside
   the card (m3.css). The row actions are text buttons in error ink. */

.account {
  display: grid;
  gap: 16px;
  max-inline-size: 720px;
  min-width: 0;
}
.account[hidden] { display: none; }
/* Each section is the EXPRESSIVE card (§3.9 --xl: 28, padding 20/22), the
   shape every other titled section holding a segmented list wears (Health's
   gym log and food log, Sleep, Exercise, Body). At 12 the section was a
   different product beside them, and its 16px segmented tiles were rounder
   than the card that held them. The padding is restated here because
   m3.css's legacy `.panel { padding: 16px 20px }` comes after --xl and wins. */
.account > .panel {
  margin: 0;
  border-radius: var(--md-sys-shape-corner-extra-large);
  padding: 20px 22px;
}
/* A head that carries a button (Passkeys: "Add a passkey") centres its title
   on the button's 48px box instead of sitting on the box's top baseline. */
.account .panel__head { align-items: center; }

/* The Leaving card's sentence is supporting text, not a head figure. */
.account .panel > .panel__note {
  margin: 0 0 16px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
  font-weight: var(--md-sys-typescale-body-medium-weight);
}
/* Sign out sits on the card's padding edge: the button's 48px inset already
   pulls it out by 4px each side, so the visible pill lines up with the text. */
.account form { margin: 0; }

/* The prose note in a passkey row ("the only one — add another before
   removing it") is a sentence, not a trailing figure: supporting type, kept
   narrow so the passkey's own lines keep the row. */
.account .row__note {
  max-inline-size: 24ch;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
  font-weight: var(--md-sys-typescale-body-medium-weight);
}
@media (max-width: 720px) {
  /* A row too narrow for its action wraps it to a second line (m3.css); the
     action then sits at the END of that line, where M3 puts a card's
     actions, not under the leading icon. */
  .account .row > :is(.m3-btn, .btn) { margin-inline-start: auto; }
  /* The text column asks for 22ch before it shares a line with the action:
     at 412 a "Disconnect" beside it squeezed the supporting line to three
     lines in 135px; now the action wraps to the line's end (as at 360).
     Capped at what is left beside the leading icon (20 + the 12px gap), so
     on a 360 phone the icon never wraps onto a line of its own above the
     text (the --xl card's 22px padding left the row 4px short of 22ch). */
  .account .row__main { flex-basis: min(22ch, 100% - var(--app-icon-size-medium) - 12px); }
  /* The prose note takes a line of its own and starts in the item's TEXT
     column (the 20px leading icon + the row's 12px gap), under the headline,
     not under the icon: a segmented item keeps one text column. */
  .account .row__note {
    box-sizing: border-box;
    flex: 1 0 100%;
    max-inline-size: 100%;
    padding-inline-start: calc(var(--app-icon-size-medium) + 12px);
  }
}

/* ----------------------------------------------------- home: the launcher --
   / lists every page from the registry. Each tile is an interactive filled
   card (.m3-card in the markup: state layer, focus ring), 96 tall, the
   page's glyph at 24 above its name in title-medium, the vault folder under
   it in the mono tier. */

.grid {
  display: grid;
  /* 200px tiles; on a phone two to a row rather than one tall column. */
  grid-template-columns: repeat(auto-fill, minmax(min(200px, calc(50% - 8px)), 1fr));
  gap: 16px;
  min-width: 0;
}
.grid[hidden] { display: none; }
.grid + .head__sub { margin: 16px 0 0; }

.tile {
  box-sizing: border-box;
  display: grid;
  align-content: space-between;
  gap: 4px;
  min-height: 96px;
  min-width: 0;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}
.tile[hidden] { display: none; }
.tile b {
  display: grid;
  justify-items: start;
  gap: 12px;
  min-width: 0;
  color: inherit;
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line-height);
  font-weight: var(--md-sys-typescale-title-medium-weight);
}
.tile__ico {
  --_icon: var(--app-icon-size-large);
  --_opsz: 24;
  color: var(--md-sys-color-on-surface-variant);
}
.tile .mono,
.tile em {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--md-sys-color-on-surface-variant);
  font-style: normal;
}
.tile .mono {
  font-family: var(--app-typeface-mono);
  font-size: var(--app-typescale-mono-size);
  line-height: var(--app-typescale-mono-line-height);
}
.tile em {
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: var(--md-sys-typescale-body-small-line-height);
}
/* Not yet ported (a link to server.js): the quiet ink, everything in it. */
.tile--pending,
.tile--pending :is(.tile__ico, .mono, em) { color: var(--app-color-on-surface-low); }

/* ------------------------------------------------------------ connected --
   Where a Google consent round-trip lands: the result, then the way back. */

.connected {
  display: grid;
  gap: 16px;
  justify-items: start;
  max-inline-size: 720px;
  min-width: 0;
}
.connected[hidden] { display: none; }
.connected__msg {
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
}
.connected .err { margin: 0; }

/* ---------------------------------------------------------------- probe --
   A tool page: its head is shown (.head--shown in the markup). The results
   are a SEGMENTED list (§3.10) on the #131314 content, so the tiles are
   #1E1F20, 2px apart, 16 at the ends and 4 between. Each row says its verdict
   with a 3px edge drawn INSIDE the tile (an inset shadow follows the corner):
   positive green for good, the quiet ink for fair, error for slow. The rows
   are built by probe.js. */

.probe {
  display: grid;
  gap: 16px;
  max-inline-size: 640px;
  min-width: 0;
  justify-items: start;
}
.probe[hidden] { display: none; }
.probe__where {
  margin: 0;
  color: var(--app-color-on-surface-low);
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: var(--md-sys-typescale-body-small-line-height);
  overflow-wrap: anywhere;
}
.probe__where:empty { display: none; }
.probe__results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-width: 0;
  container-type: inline-size;
}
.probe__results:empty { display: none; }
.probe__note {
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
}
.probe__err {
  margin: 0;
  color: var(--md-sys-color-error);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
}

.probe__row {
  --_edge: var(--md-sys-color-outline-variant);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  min-height: var(--app-list-h-2);
  min-width: 0;
  padding: 12px 16px 12px 20px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-surface-container);
  box-shadow: inset 3px 0 0 var(--_edge);
  color: var(--md-sys-color-on-surface);
}
.probe__row[hidden] { display: none; }
.probe__row:first-child {
  border-start-start-radius: var(--md-sys-shape-corner-large);
  border-start-end-radius: var(--md-sys-shape-corner-large);
}
.probe__row:last-child {
  border-end-start-radius: var(--md-sys-shape-corner-large);
  border-end-end-radius: var(--md-sys-shape-corner-large);
}
.probe__row--good { --_edge: var(--app-color-positive); }
.probe__row--fair { --_edge: var(--md-sys-color-on-surface-variant); }
.probe__row--slow { --_edge: var(--md-sys-color-error); }

/* The row's name: body-large. Each figure is a caption over a tabular value. */
.probe__row b {
  grid-column: 1 / -1;
  min-width: 0;
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  font-weight: var(--md-sys-typescale-body-large-weight);
}
.probe__row span {
  display: grid;
  gap: 0;
  min-width: 0;
  white-space: nowrap;
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  font-variant-numeric: tabular-nums;
}
.probe__row em {
  color: var(--md-sys-color-on-surface-variant);
  font-style: normal;
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
  font-variant-numeric: tabular-nums;
}
/* The figures sit on a FIXED grid, the same in every row, so p50 / p95 /
   worst / server line up from row to row (a flex-wrap let one row break
   after three figures and the next keep all four). The layout follows the
   LIST's width (a container), not the viewport's, so a narrow split pane
   gets the narrow layout too:
     >= 600  the name in a 144px first column, then five figure columns (the
             fragment's fifth part, "110 rows", in the last);
     < 600   the name on its own line, four figure columns under it; a fifth
             part (it has no caption, only an &nbsp;) joins the NAME's line
             at its end instead of starting a third line of its own;
     < 340   two by two, once a figure like "105.7 ms" no longer fits a
             quarter of the row. */
@container (min-width: 600px) {
  .probe__row { grid-template-columns: 144px repeat(5, minmax(0, 1fr)); column-gap: 16px; }
  .probe__row b { grid-column: auto; }
}
@container (max-width: 599.98px) {
  .probe__row > b:has(~ span:nth-of-type(5)) { grid-row: 1; grid-column: 1 / -2; }   /* the name looks at its own later sibling: test_design check 13 */
  .probe__row > span:nth-of-type(5) { grid-row: 1; grid-column: -2 / -1; justify-self: end; }
  .probe__row > span:nth-of-type(5) > em { display: none; }
}
@container (max-width: 339.98px) {
  .probe__row { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
}
