/* Theme binding: the root's `data-theme` chooses light or dark, and without
   it the system's preference holds. Values follow through `light-dark()`,
   which reads the `color-scheme` set here, and so do the browser's own
   controls and scroll bars. */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* The bajnok value set: warm paper, ink, felt green and brass,
   with EB Garamond for headings and names and Inter for everything else.
   It gives every name in the README's vocabulary a value; it needs
   theme.css beside it. It applies to a page with no data-look, as
   bajnok's own pages are, or with data-look="bajnok", so a site that
   keeps its own look as another data-look switches with one attribute.

   Fonts: EB Garamond 400, 500 and 400 italic, and Inter's variable weights,
   from Fontsource 5.3.0, Latin and Latin Extended only (Hungarian names
   included); OFL licences in fonts/. */

@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/eb-garamond-latin-ext-400-normal-9a1335bd850842fd.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/eb-garamond-latin-400-normal-912929dba0faab5e.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/eb-garamond-latin-ext-500-normal-6ba629125d8ae9a4.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/eb-garamond-latin-500-normal-7b252686ba2797f0.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "EB Garamond";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/static/eb-garamond-latin-ext-400-italic-a7aad7b598be80ca.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "EB Garamond";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/static/eb-garamond-latin-400-italic-fc5851c4466e73be.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/static/inter-latin-ext-wght-normal-34b9c504cab7a73e.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/static/inter-latin-wght-normal-3100e775e8616cd2.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* Local faces sized to take the space of the two above, so text drawn
   before they arrive barely moves when they do: Arial, or its metric
   twin Liberation Sans, as Inter; Times New Roman, or Liberation Serif, as
   EB Garamond; and DejaVu Sans as Inter on systems with neither (its
   overrides measured on interface text by Quelhas). The overrides are the
   ratio of the faces' advance widths over English text and the web faces'
   ascent and descent, by fontTools. */
@font-face {
  font-family: "Inter fallback";
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("LiberationSans");
  size-adjust: 106.79%;
  ascent-override: 90.72%;
  descent-override: 22.59%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Inter fallback DejaVu";
  src: local("DejaVu Sans"), local("DejaVuSans");
  size-adjust: 93.39%;
  ascent-override: 103.73%;
  descent-override: 25.83%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "EB Garamond fallback";
  font-weight: 400;
  src: local("Times New Roman"), local("TimesNewRomanPSMT"), local("Liberation Serif"), local("LiberationSerif");
  size-adjust: 94.13%;
  ascent-override: 106.98%;
  descent-override: 31.66%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "EB Garamond fallback";
  font-weight: 500;
  src: local("Times New Roman"), local("TimesNewRomanPSMT"), local("Liberation Serif"), local("LiberationSerif");
  size-adjust: 97.29%;
  ascent-override: 103.5%;
  descent-override: 30.63%;
  line-gap-override: 0%;
}

/* In the `bajnok` layer, so that a site's own rule for a name, written
   outside any layer, wins whatever its selector (the README, "Three
   layers of values"). */
@layer bajnok {
:where(:root:not([data-look])),
:root[data-look="bajnok"] {
  --bg: light-dark(#f3ebdd, #17130f);
  --surface: light-dark(#faf5ec, #221c16);
  --surface-2: light-dark(#f1e8d9, #2c241c);
  --inset: light-dark(#fffaf2, #1b1611);
  --selected: light-dark(color-mix(in srgb, #2f4f43 10%, #faf5ec), #29392e);
  --line: light-dark(rgba(30, 26, 22, 0.13), rgba(238, 229, 214, 0.12));
  --line-soft: light-dark(rgba(30, 26, 22, 0.07), rgba(238, 229, 214, 0.07));
  --control: light-dark(#8a7d6d, #8c7e6b);
  --text: light-dark(#1e1a16, #eee5d6);
  --text-2: light-dark(#4d4237, #cbbca7);
  --text-3: light-dark(#6b5f51, #a8977f);
  --accent: light-dark(#2f4f43, #284438);
  --on-accent: light-dark(#f3ebdd, #eee5d6);
  --accent-text: light-dark(#2f4f43, #9cc7b3);
  --primary: light-dark(#2f4f43, #48695a);
  --accent-soft: light-dark(#deded4, #33342c);
  --highlight: light-dark(#a9802f, #d2ac60);
  --on-highlight: #1e1a16;
  --highlight-text: light-dark(#856222, #d2ac60);
  --danger: light-dark(#a2392a, #ec8b7c);
  --focus: light-dark(#1d63d6, #8db6ff);

  --font-body: "Inter Variable", Inter, "Inter fallback", "Inter fallback DejaVu", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "EB Garamond", "EB Garamond fallback", Garamond, "Iowan Old Style", Georgia, serif;
  --type-small: 0.875rem;
  --type-body: 1rem;
  --type-lead: 1.15rem;
  --type-h3: 1.3rem;
  --type-h2: 1.6rem;
  --type-h1: 2.75rem;
  --target: 44px;
  --radius: 6px;
  --radius-lg: 10px;
}
}

/* The family's look, as rules: the header, buttons, fields and cards,
   drawn from Lines of Action's. Every colour, face and radius is a name
   of the vocabulary (the README), so a site that gives the names other
   values keeps these rules and changes its look.

   Nothing here reaches markup that has not asked: a rule applies to an
   element with a `bj-` class, or to what the README says such an
   element holds. Each rule is as weak as a site's own would be (one
   class, and a state), so a site's sheet, included after this one, wins
   every tie. */

/* Buttons ---------------------------------------------------------- */

.bj-button {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.45rem 0.85rem;
  font: inherit;
  color: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.bj-button:hover:where(:not(:disabled)) {
  border-color: var(--accent-text);
  color: var(--text);
}

.bj-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* The page's main action. */
.bj-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-accent);
  font-weight: 600;
}

/* Under the pointer the fill moves a little towards the page, which
   keeps its text as readable as at rest in light and in dark. */
.bj-primary:hover:where(:not(:disabled)) {
  background: color-mix(in srgb, var(--primary) 85%, var(--bg));
  border-color: color-mix(in srgb, var(--primary) 85%, var(--bg));
  color: var(--on-accent);
}

/* Beside a main action, or one of several of equal weight. */
.bj-subtle {
  background: transparent;
}

/* What cannot be undone. */
.bj-danger {
  color: var(--danger);
}

.bj-danger:hover:where(:not(:disabled)) {
  border-color: var(--danger);
  color: var(--danger);
}

/* A drawing alone, such as a gear. */
.bj-icon {
  display: inline-flex;
  align-items: center;
  border: none;
  background: transparent;
  padding: 0.3rem;
  color: var(--text-3);
}

.bj-icon:hover:where(:not(:disabled)) {
  color: var(--text);
}

/* Choices ---------------------------------------------------------- */

/* One of a few, as a row of joined options (from Entropy's): each its own
   box over the rule it shares with its neighbour, so that the chosen one
   draws its edge over both. The page gives the row its height. */
.bj-choice {
  display: inline-flex;
  isolation: isolate;
}

.bj-choice-option {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* None of its own: a site's rule for every `label` must not push the
     words off the middle, the width kept below being a flex item too. */
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--inset);
  padding: 0.4rem 0.8rem;
  font: inherit;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  cursor: pointer;
}

/* The label again at the chosen weight, unseen and unspoken (`data-label`),
   so that an option is as wide as it will be when chosen and choosing one
   moves none of the others. The first `content` is for a browser that does
   not know the second's unspoken form. */
.bj-choice-option[data-label]::after {
  content: attr(data-label);
  content: attr(data-label) / "";
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 600;
  pointer-events: none;
}

.bj-choice-option + .bj-choice-option {
  margin-inline-start: -1px;
}

.bj-choice-option:first-child {
  border-start-start-radius: var(--radius);
  border-end-start-radius: var(--radius);
}

.bj-choice-option:last-child {
  border-start-end-radius: var(--radius);
  border-end-end-radius: var(--radius);
}

/* An option may instead be a label over a native radio or checkbox, unseen
   and as large as the option, which brings the browser's own keys and
   needs no script; it is chosen when its input is checked. */
.bj-choice-option > :where(input[type="radio"], input[type="checkbox"]) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

/* Under the pointer, one not yet chosen. */
.bj-choice-option:hover:where(:not(:disabled, [aria-checked="true"], [aria-pressed="true"], :has(> input:checked))) {
  color: var(--text);
}

.bj-choice-option:where(:disabled, :has(> input:disabled)) {
  opacity: 0.45;
  cursor: not-allowed;
}

/* The chosen one, a radio's or a pressed button's, is the loudest. */
.bj-choice-option:where([aria-checked="true"], [aria-pressed="true"], :has(> input:checked)) {
  z-index: 1;
  border-color: var(--accent-text);
  background: var(--accent-soft);
  font-weight: 600;
  color: var(--accent-text);
}

/* Where the system draws its own colours the wash is lost, so the chosen
   one is marked by a line inside its edge. */
@media (forced-colors: active) {
  .bj-choice-option:where([aria-checked="true"], [aria-pressed="true"], :has(> input:checked)) {
    outline: 2px solid Highlight;
    outline-offset: -4px;
  }
}

/* A focused option rises over its neighbours, so its ring is whole. */
.bj-choice-option:where(:focus-visible, :has(> input:focus-visible)) {
  z-index: 2;
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Options that stand apart and wrap (`bj-apart`): presets beside a typed
   value, or more than one row holds. Each keeps its own corners, and one
   not yet chosen reads as plainly as the text around it. */
.bj-choice:where(.bj-apart) {
  flex-wrap: wrap;
  gap: 0.35rem;
}

.bj-apart > .bj-choice-option,
.bj-who > .bj-choice-option {
  margin-inline-start: 0;
}

.bj-choice:where(.bj-apart, .bj-who) > :where(.bj-choice-option) {
  border-radius: var(--radius);
}

.bj-choice:where(.bj-apart, .bj-who)
  > :where(.bj-choice-option:not([aria-checked="true"], [aria-pressed="true"], :has(> input:checked))) {
  color: var(--text);
}

.bj-choice:where(.bj-apart) > :where(.bj-choice-option) {
  min-width: 3.2rem;
  min-height: 2.25rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* A form's first choice, who to play (`bj-who`): equal options across the
   form and a little larger, which go one under another before any is
   squeezed. */
.bj-choice:where(.bj-who) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(7.5rem, 100%), 1fr));
  gap: 0.35rem;
}

.bj-choice:where(.bj-who) > :where(.bj-choice-option) {
  min-height: 2.6rem;
  font-size: 0.98rem;
  font-weight: 600;
  white-space: normal;
  text-align: center;
}

/* Fields ----------------------------------------------------------- */

.bj-field {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--control);
  border-radius: var(--radius);
  background: var(--inset);
  padding: 0.5rem 0.6rem;
  font: inherit;
  color: inherit;
}

/* The ring below marks focus; the edge marks it too. */
.bj-field:focus {
  border-color: var(--accent-text);
}

.bj-field[aria-invalid="true"] {
  border-color: var(--danger);
}

/* Focus ------------------------------------------------------------ */

.bj-button:focus-visible,
.bj-field:focus-visible,
.bj-header :where(a):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Cards ------------------------------------------------------------ */

/* A sheet on the page. What it holds, and how that is spaced, is the
   page's. */
.bj-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
}

/* A card's heading in the display face. */
.bj-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.2;
}

/* The play page ---------------------------------------------------- */

/* Home's frame (the site standard, "Home is the play page"): what the
   person plays in one column; what the site says about the person beside
   it on a wide screen and under it on a narrow one. What each holds, and
   the page's own width, are the site's. The side column is in the page
   from its first paint or not at all, so the form never changes width. */
.bj-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.bj-home-main,
.bj-home-side {
  display: grid;
  gap: 1rem;
  align-content: start;
  min-width: 0;
}

/* Alone, the column keeps a form's width. */
.bj-home-main {
  max-width: 48rem;
}

@media (min-width: 56rem) {
  .bj-home:where(:has(> .bj-home-side)) {
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
  }

  .bj-home:where(:has(> .bj-home-side)) > :where(.bj-home-main) {
    max-width: none;
  }
}

/* A short list: matches to continue, invitations, open matches. Who and
   how, then what to do, which goes under them where it does not fit. */
.bj-rows {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bj-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  padding: 0.45rem 0.1rem;
  border-bottom: 1px solid var(--line-soft);
}

.bj-row:last-child {
  border-bottom: none;
}

.bj-row-info {
  display: grid;
  flex: 1 1 10rem;
  gap: 0.1rem;
  min-width: 0;
}

.bj-row-note {
  font-size: 0.85rem;
  color: var(--text-3);
}

.bj-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-inline-start: auto;
}

/* The play form: rows of a short label and its controls, laid out by the
   form's own width, so it is the same in a page's column, on a phone and
   in a side panel. The label is over its controls; where the form is wide
   it is beside them, in a column as wide as the longest label. */
.bj-form {
  container: bj-form / inline-size;
  display: grid;
  gap: 0.9rem;
}

.bj-form-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.7rem 0.75rem;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.bj-form-row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  /* On the first line of its controls, where a note wraps under them. */
  align-items: baseline;
  row-gap: 0.3rem;
  min-width: 0;
}

.bj-form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-3);
}

/* A row that needs no label keeps an empty one, for the column's sake. */
.bj-form-label:empty {
  display: none;
}

/* A row's controls side by side, wrapping where they must. */
.bj-form-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  min-width: 0;
}

/* Across the label's column too: a disclosure of further limits, an
   error, a line that belongs to the whole form. */
.bj-form-wide {
  grid-column: 1 / -1;
  min-width: 0;
}

/* A limit or a consequence, said under the controls it is about. */
.bj-form-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-3);
}

.bj-form-line > :where(.bj-form-note) {
  flex-basis: 100%;
}

/* A typed number beside its presets; its width is the page's to change. */
.bj-form-number {
  width: 6rem;
  padding: 0.35rem 0.5rem;
  font-variant-numeric: tabular-nums;
}

/* A field with its unit ("10 min", "5 s a move"), or a box with its words. */
.bj-form-unit,
.bj-form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.bj-form-unit {
  font-size: 0.85rem;
  color: var(--text-3);
}

.bj-form-check {
  font-size: 0.9rem;
  cursor: pointer;
}

/* The form's one main button, at its foot. */
.bj-form-start {
  justify-self: stretch;
  min-height: 2.75rem;
  margin-top: 0.15rem;
  padding-inline: 1.4rem;
  font-size: 1rem;
}

@container bj-form (min-width: 26rem) {
  .bj-form-rows {
    grid-template-columns: fit-content(9rem) minmax(0, 1fr);
  }

  .bj-form-label:empty {
    display: block;
  }

  .bj-form-start {
    justify-self: start;
    min-width: 10rem;
  }
}

/* Under a finger every option, box and field of the form, and a short
   list's action, is a target's height. */
@media (pointer: coarse) {
  .bj-choice:where(.bj-apart, .bj-who) > :where(.bj-choice-option),
  .bj-form-check,
  .bj-form :where(.bj-field),
  .bj-row-actions :where(.bj-button) {
    min-height: var(--target);
  }

  .bj-choice:where(.bj-apart) > :where(.bj-choice-option) {
    min-width: var(--target);
  }
}

/* The header ------------------------------------------------------- */

/* One row at every width, its parts on one baseline: the wordmark,
   the sections, then what belongs to the person. Its width and where
   it sits are the page's. The sections scroll sideways before the row
   would wrap, and the row's height is fixed, whatever face its words
   are in for the moment, so the page below never moves. */
.bj-header {
  box-sizing: border-box;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  height: 3.5625rem;
  padding: 0.85rem 0 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}

/* The ruleset's name, in the display face; a drawing sized in em (the
   package's wordmark.svg) sits on the same line. */
.bj-wordmark {
  flex: none;
  margin-right: 0.6rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.55rem;
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.bj-wordmark svg {
  display: inline-block;
  vertical-align: -0.287em;
}

.bj-wordmark .crown {
  fill: var(--highlight);
  stroke: var(--highlight);
}

.bj-header-nav {
  display: flex;
  align-items: baseline;
}

/* Room inside the scrolling box for a link's focus ring, taken back
   outside it. */
.bj-header-nav {
  flex: 0 1 auto;
  gap: 1.4rem;
  min-width: 0;
  margin: -0.3rem;
  padding: 0.3rem;
  overflow-x: auto;
  scrollbar-width: none;
}

/* To the right. The group draws no box of its own: what it holds takes
   its place in the row, so that a name can give way before the sections
   start to scroll, while the links and buttons keep their size. */
.bj-header-tools {
  display: contents;
}

/* What pushes them to the right, whichever of them a page leaves out;
   it takes back the gap it would add. */
.bj-header-tools::before {
  content: "";
  margin: 0 -1rem 0 auto;
}

/* A link in the row; a link drawn as a button keeps its own shape. Each
   rule counts as one class, so a site's rule for its own link wins. */
.bj-header-nav :where(a),
.bj-header-tools :where(a:not(.bj-button)),
.bj-header-name {
  flex: none;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 120ms ease;
}

.bj-header-nav :where(a):hover,
.bj-header-tools :where(a:not(.bj-button)):hover,
.bj-header :where(a[aria-current="page"]) {
  color: var(--text);
}

.bj-header :where(a[aria-current="page"]) {
  border-bottom-color: var(--accent-text);
}

/* A long name gives way; the row keeps its height. */
.bj-header-name {
  flex: 0 1000 auto;
  min-width: 0;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A button or a drawing in the row sits on its middle, so the row is no
   taller for it. */
.bj-header .bj-button,
.bj-header .bj-icon {
  flex: none;
  align-self: center;
}

/* A phone: a smaller name and tighter sections. */
@media (max-width: 540px) {
  .bj-header {
    gap: 0.6rem;
    height: 2.8125rem;
    padding-top: 0.6rem;
  }

  .bj-wordmark {
    margin-right: 0;
    font-size: 1.15rem;
  }

  .bj-header-nav {
    gap: 0.6rem;
  }

  .bj-header-tools::before {
    margin-right: -0.6rem;
  }

  .bj-header-nav :where(a),
  .bj-header-tools :where(a:not(.bj-button)),
  .bj-header-name {
    font-size: 0.85rem;
  }
}

/* Under a finger, each link, the wordmark among them, is a target's
   height and the row is no taller than they are; a button in it keeps its shape, and is touched
   over a target's size around its middle. */
@media (pointer: coarse) {
  .bj-header {
    height: calc(var(--target) + 1px);
    padding-block: 0;
  }

  .bj-header-nav :where(a),
  .bj-header-tools :where(a:not(.bj-button)) {
    display: inline-flex;
    align-items: center;
    min-height: var(--target);
    padding-block: 0;
  }

  .bj-header :where(.bj-wordmark),
  .bj-header-name {
    padding-block: 0;
    line-height: var(--target);
  }

  .bj-header .bj-button {
    position: relative;
  }

  .bj-header .bj-button::after {
    content: "";
    position: absolute;
    inset: min(0px, (100% - var(--target)) / 2);
  }
}

/* The account pages, in the family's look: @bajnok/tokens' values and its
   rules for the header, buttons, fields and cards are served ahead of
   this file, in the same stylesheet; here is only how these pages are
   laid out. Served under a digest of the whole stylesheet, so cached for
   ever. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--type-body)/1.55 var(--font-body);
}

/* The frame. Signing in and up: the wordmark centred above, leading home,
   then one centred card. The account page: the family's header, as the
   hub's, over a wider column of cards, two columns where there is room. */
body { padding: 0 1.2rem; }
header.centred {
  display: flex;
  justify-content: center;
  padding-top: 2.5rem;
}
header.centred .bj-wordmark { margin: 0; font-size: 2.25rem; }
.bj-header, main.wide { max-width: 67.6rem; margin-inline: auto; }
.bj-header { margin-bottom: 1.4rem; }
/* The family's own name keeps its size where a ruleset's would shrink;
   it is a drawing, and asks for no face of its own. */
.bj-header .bj-wordmark { font-size: 1.55rem; }
.bj-wordmark { font-family: inherit; font-weight: inherit; }
main {
  max-width: 29rem;
  margin: 0 auto;
  padding: 1.75rem 0 4rem;
}
main.wide { padding-top: 0; }

/* A card here holds a form, so it is roomier than the family's. */
.bj-card { padding: 1.5rem; }
.bj-card h1 { margin-top: 0; }

/* The account page: what it is and signing out, then two columns of
   cards on wide screens. */
.intro { margin-bottom: 0.5rem; }
main.wide > .notice { max-width: 36rem; }
.columns { display: grid; gap: 0 1.5rem; }
.columns > div { min-width: 0; }
@media (min-width: 56rem) {
  .columns { grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); align-items: start; }
}
section { margin-top: 1.5rem; }
h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
h1 { font-size: var(--type-h1); line-height: 1.05; margin: 0; overflow-wrap: anywhere; }
h2 { font-size: var(--type-h2); line-height: 1.2; margin: 0 0 0.75rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent-text); text-underline-offset: 0.18em; }

.lead { margin: 0.5rem 0 1.5rem; color: var(--text-2); font-size: var(--type-lead); }
.lead strong { color: var(--text); font-weight: 600; }

.notice {
  background: var(--selected);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}
/* A link within a notice's sentence: a 44 px hit area, the text unmoved. */
.notice a { display: inline-block; padding: 0.7rem 0; margin: -0.7rem 0; }

.field { margin-bottom: 0.25rem; }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; }

/* A password's label shares its row with the "Show" button, or wraps above
   it when narrow. Until the script reveals it, the button keeps its place
   unseen, so revealing it moves nothing. */
.label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 0.5rem;
}
.label-row label { margin: 0; }
.reveal {
  min-height: 1.5rem;
  margin-right: -0.75rem;
  padding: 0 0.75rem;
  border-color: transparent;
  background: transparent;
  color: var(--accent-text);
  font-size: var(--type-small);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.reveal[hidden] { display: inline-flex; visibility: hidden; }
.reveal[aria-pressed="true"] { background: var(--selected); text-decoration: none; }

/* Each note keeps its line whether it holds an error or not, and every
   message is short enough to fit that line from 320 px wide. */
.note {
  min-height: 1.25rem;
  margin: 0.3rem 0 0.6rem;
  font-size: var(--type-small);
  line-height: 1.25rem;
  color: var(--text-3);
}
.note.error { color: var(--danger); font-weight: 600; }
/* A note that is not a field's (a form's own, below its fields, or a
   section's) takes no room until it holds an error, so the button follows
   the last field. */
:not(.field) > .note:empty { min-height: 0; margin: 0; }

/* A form's main button takes its width. These pages are read on phones:
   under a finger every button and field is a target's size. */
.bj-primary { width: 100%; margin-top: 0.5rem; }
@media (pointer: coarse) {
  main .bj-button, main .bj-field { min-width: var(--target); min-height: var(--target); }
  main .bj-button { display: inline-flex; align-items: center; justify-content: center; }
}

.switch { margin: 1.5rem 0 0; color: var(--text-3); text-align: center; }
.back { margin: 0.25rem 0 0; text-align: center; }
.switch a, .back a { display: inline-flex; align-items: center; min-height: var(--target); }
:where(a:not(.bj-button)):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.sessions { list-style: none; margin: 0; padding: 0; }
.sessions li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}
.sessions li:first-child { border-top: 0; padding-top: 0; }
.sessions li.here { border-left: 3px solid var(--highlight); padding-left: 0.75rem; }
.sessions li.here:first-child { padding-top: 0.25rem; }
.sessions form { margin: 0; }
.device { font-weight: 600; margin: 0; }
.meta { color: var(--text-3); font-size: var(--type-small); margin: 0; }
/* A date and its time stay on one line. */
.when time { white-space: nowrap; }
h2 + .meta { margin: -0.25rem 0 1rem; }
.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--highlight);
  color: var(--on-highlight);
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: 0.1em;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; }
.actions form { margin: 0; }
.warning { color: var(--text-2); }
.warning strong { color: var(--danger); }


@media (max-width: 30rem) {
  body { padding: 0 1rem; }
  header.centred { padding-top: 1.75rem; }
  main { padding: 1.25rem 0 3rem; }
  .bj-card { padding: 1.25rem; }
}
/* On a phone a session says how long ago it signed in, not the minute,
   so its row stays two lines beside its button. */
@media (max-width: 30rem) {
  .sessions .when { display: none; }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
