/* The account pages on the Hayetek web kit v1.2.0 (`b1df7375`, web conventions §1): every control, card,
   row, notice, tag and table is the kit's (`static/kit/`, a snapshot, see `static/kit/SNAPSHOT.md`); this
   file does LAYOUT ONLY: the page column, the two columns of Account details, how blocks line up, the
   gaps (from `--hk-space-*`). A control the kit lacks is a named stand-in in `kit_standins.css` (none now), never here.
   Logical properties only, so `dir="rtl"` mirrors the page (`8dec70ca`). Light or dark: `THEME` in
   `hayetek/pages/templatetags/pages.py`, as the website's. */

/* Light pinned: the tokens say plain "light" on the root; "only" keeps a browser's own dark mode out. */
html[data-theme="light"] { color-scheme: only light; }

/* ---------- the page column ---------- */
.page { padding-block: var(--hk-space-xl) var(--hk-kit-band); }

/* Text keeps its line length; the page itself takes the kit's full width. */
.page p { max-inline-size: var(--hk-kit-measure); }

/* The page's own answers sit above its content, one step apart. */
.page > .hk-notice,
.page > .errors { margin-block-end: var(--hk-space-md); }
.errors { display: grid; gap: var(--hk-space-xs); }

/* ---------- a single card in the middle (sign-in, the code, welcome, confirm…) ---------- */
.narrow { max-inline-size: 34rem; margin-inline: auto; }
.hk-card > h1,
.hk-card > h2 { margin: 0; }
/* a card's own title sits a step under the page's: the kit's h1/h2 are page sizes */
.hk-card > h1 { font-size: var(--hk-font-size-headline); }
.hk-card > h2 { font-size: var(--hk-font-size-title-md); }
.hk-card { gap: var(--hk-space-sm); }
.hk-card + .hk-card,
.details { margin-block-start: var(--hk-space-md); }
.switch { margin-block-start: var(--hk-space-xs); }

/* ---------- Account details: one page of rows, two columns when there is room ---------- */
.details-head { margin-block-end: var(--hk-space-md); }
.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: var(--hk-space-md);
  align-items: start;
}
.details-column { display: grid; gap: var(--hk-space-md); min-inline-size: 0; }
.details > .hk-card,
.details-column > .hk-card { min-inline-size: 0; margin: 0; }
.leave { margin-block-start: var(--hk-space-xl); }

/* the action word swaps when a row opens ("Edit" → "Close") */
.item-opened { display: none; }
.hk-row[open] > summary .item-closed { display: none; }
.hk-row[open] > summary .item-opened { display: inline; }

/* a row's end (its action word, link or button) keeps the last column even when the value is empty */
.hk-row > summary > .hk-row__action,
.hk-row > .row-end { grid-column: -2; justify-self: end; }
/* on a phone the kit puts a row's value under its label: the end spans both lines, as its action does */
@media (width < 30rem) {
  .hk-row > .row-end { grid-row: 1 / span 2; align-self: center; }
  /* a whole row has no label above its value: both keep the first line */
  .hk-row--whole:not(details) > .hk-row__value,
  .hk-row--whole > .row-end { grid-row: 1; }
}

/* a row that is not a <details> can still hold a form under its three columns (the pending address) */
.row-whole { grid-column: 1 / -1; }
.after-rows { margin-block-start: var(--hk-space-sm); }

/* ---------- forms: how fields and buttons line up ---------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--hk-space-xs) var(--hk-space-md); }
/* a field beside its button (the code): the button lines up with the box, not its label */
.actions:has(> .hk-field) { align-items: end; }
.hk-field { display: grid; gap: var(--hk-space-xs); min-inline-size: 0; }
/* two fields side by side (first + last name, the country code + the number), stacked on a phone */
.pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--hk-space-xs) var(--hk-space-sm);
  align-items: end;
}
.hk-tiles > .tiles-whole { grid-column: 1 / -1; }
/* inside a row, one text box keeps the 28rem a box had: a wide card never stretches it */
.hk-row__body .hk-float:not(.pair > .hk-float) { max-inline-size: 28rem; }
.hk-row__body .hk-date { max-inline-size: 28rem; }
.hk-inline-field { max-inline-size: 36rem; }
.add-passkey[hidden] { display: none; }
