/* The kernel components' styles (app/components; AGENTS.md section 4).

   What belongs here: the rules a ViewComponent needs that the ported
   10-globals.css does not already have. The button, the card and the pill are
   there and are reused by class name, as design-direction.md section 5 says;
   this file adds the page header, the card's parts, the pill's tones and a few
   corrections to the ported rules, each marked where it is. One section for each
   component, in the order the CARE slice builds them.

   Linked after 10-globals.css and 30-mode-switch.css and before 40-native.css,
   so its rules win over the globals by order, and the touch target floor in
   40-native.css still wins over this file's.

   Tokens only (test/styles/tokens_test.rb), so every rule here reads on the light
   shell and on the console, in light and in dark, with nothing written twice. The
   colors a rule uses are pairs that config/contrast_pairs.yml already checks in
   all four token sets: the text and surface pairs, the tone pairs, and the
   accent. There is no spacing token yet (design-direction.md section 3), so
   spacing is rem, on the rhythm the rest of the stylesheet uses. Logical
   properties throughout, so a right-to-left language mirrors
   (test/styles/components_test.rb). Nothing here is pinned to an edge and nothing
   sets a height in vh. */

/* ── Button ───────────────────────────────────────────────────────────────
   The ported `.btn` rules stay. Two corrections for ButtonComponent, both about
   the language rule (AGENTS.md section 11) and the contrast rule.

   `.btn` was `white-space: nowrap`, so a label 40% longer, as a translation can
   be, ran out of a 320px screen. A label wraps now and stays centered.

   The outlined button drew its edge with `--rule-strong`, 1.6 to 1.9:1, and
   WCAG 1.4.11 asks 3:1 of the edge a person has to find. `--control-line` is the
   edge token (it is what the mode switch uses). The hover state keeps it, so the
   edge is not lost at the moment of pointing.

   A disabled button, or a link with no destination, takes no hover look: the hover
   rules above are guarded with `:where(:not(:disabled, [aria-disabled="true"]))`,
   which adds no specificity, so nothing else that answers `.btn:hover` changes. */

.btn {
  max-inline-size: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
.btn-secondary {
  --btn-border: var(--control-line);
}
.btn-secondary:hover:where(:not(:disabled, [aria-disabled="true"])) {
  border-color: var(--control-line);
}

/* An icon-only button is a square target: 36px wide at the least (WCAG 2.5.8 asks
   24), and the 44px floor on touch, like every control (40-native.css gives the
   height, and says an icon-only control sets its own width). */
.btn-icon {
  min-inline-size: 2.25rem;
  padding-inline: 0.62rem;
}
@media (pointer: coarse) {
  .btn-icon {
    min-inline-size: var(--target-min);
  }
}

/* ── Badge ────────────────────────────────────────────────────────────────
   BadgeComponent is the existing `.pill` with a tone. The older `.pill-*` names
   (available, held, taken) are housing's words for these tones and are left for
   the markup that already uses them; a badge says the tone and a person's page
   says what it means. Every pair is a tone pair, checked at 4.5:1.

   `.pill` was `nowrap`, which is the same problem as the button's. A badge that
   must wrap does so inside its own tag.

   A badge is a tag with small corners, not a capsule: the buttons are capsules,
   and a capsule of status beside them read as one more button (22 Oct 2026,
   David Shettler: the "Due today" pill "feels oddly styled"). */

.pill[data-tone] {
  max-inline-size: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: var(--pill-bg);
  color: var(--pill-fg);
  border-color: var(--pill-line);
}
.pill[data-tone="good"] {
  --pill-bg: var(--tone-good-bg);
  --pill-fg: var(--tone-good-fg);
  --pill-line: var(--tone-good-line);
}
.pill[data-tone="warn"] {
  --pill-bg: var(--tone-warn-bg);
  --pill-fg: var(--tone-warn-fg);
  --pill-line: var(--tone-warn-line);
}
.pill[data-tone="bad"] {
  --pill-bg: var(--tone-bad-bg);
  --pill-fg: var(--tone-bad-fg);
  --pill-line: var(--tone-bad-line);
}
.pill[data-tone="info"] {
  --pill-bg: var(--tone-info-bg);
  --pill-fg: var(--tone-info-fg);
  --pill-line: var(--tone-info-line);
}
.pill[data-tone="accent"] {
  --pill-bg: var(--tone-accent-bg);
  --pill-fg: var(--tone-accent-fg);
  --pill-line: var(--tone-accent-line);
}
.pill[data-tone="mute"] {
  --pill-bg: var(--tone-mute-bg);
  --pill-fg: var(--tone-mute-fg);
  --pill-line: var(--tone-mute-line);
}

/* ── Callout ──────────────────────────────────────────────────────────────
   A sentence set apart under the page header: what was just done, or what did not work (CalloutComponent). The tone is
   the tint, the line and the bar at its start, from the same tone pairs a badge uses (checked at 4.5:1 in both modes);
   the sentence is what says it, so it is never color alone. It wraps and never widens the page. */

.callout {
  max-inline-size: 66ch;
  min-inline-size: 0;
  padding: 0.7rem 1rem;
  border: 1px solid var(--callout-line);
  border-inline-start-width: 4px;
  border-radius: var(--radius-md);
  background: var(--callout-bg);
  color: var(--callout-fg);
  overflow-wrap: anywhere;
}
.callout[data-tone="good"] {
  --callout-bg: var(--tone-good-bg);
  --callout-fg: var(--tone-good-fg);
  --callout-line: var(--tone-good-line);
}
.callout[data-tone="info"] {
  --callout-bg: var(--tone-info-bg);
  --callout-fg: var(--tone-info-fg);
  --callout-line: var(--tone-info-line);
}
.callout[data-tone="warn"] {
  --callout-bg: var(--tone-warn-bg);
  --callout-fg: var(--tone-warn-fg);
  --callout-line: var(--tone-warn-line);
}
.callout[data-tone="bad"] {
  --callout-bg: var(--tone-bad-bg);
  --callout-fg: var(--tone-bad-fg);
  --callout-line: var(--tone-bad-line);
}

/* ── Card ─────────────────────────────────────────────────────────────────
   `.card` (raised, a hairline, 6px) and `.card-soft` (the sunken well) are in
   10-globals.css and have no padding, because every card there was a different
   shape. CardComponent gives them one: a header with the heading, a body, and a
   footer that is the actions under a hairline.

   The heading is one size at every level (`--text-md`), so a card's place in the
   page outline never changes how it looks. Elevation in dark is a lighter
   surface and not a shadow; the hairline is what keeps the edge when the two
   surfaces are close. */

.card-panel {
  box-shadow: var(--shadow-soft);
}
.card-header {
  padding: 1rem 1.15rem 0;
}
.card-heading {
  font-size: var(--text-md);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.card-body {
  min-inline-size: 0;
  padding: 1rem 1.15rem;
  overflow-wrap: anywhere;
}
.card-body-flush {
  padding: 0;
}
.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  border-block-start: 1px solid var(--rule);
  border-end-start-radius: inherit;
  border-end-end-radius: inherit;
  background: var(--surface-sunken);
}

/* ── Page header ──────────────────────────────────────────────────────────
   One markup, two products. The light shell: a gold hairline (the brand rule,
   decorative), the eyebrow, the title at full display size, and the sub as an
   italic serif line. The console: no hairline, a smaller title, and the sub as a
   quiet line of working text (design-direction.md sections 2 and 7). The surface
   picks, through `data-surface` on <body>; the mode never does.

   The row is a flex that wraps: the title and sub take the room there is, and the
   actions go under them when there is not enough (a phone, a longer language).
   `min-inline-size: 0` and `overflow-wrap` keep a long unbroken word from
   widening the page. */

.page-header {
  display: grid;
  gap: 0.4rem;
  min-inline-size: 0;
  padding-block: 1.5rem 1.25rem;
}
.page-header::before {
  content: "";
  display: block;
  inline-size: 26px;
  block-size: 2px;
  margin-block-end: 0.4rem;
  border-radius: 2px;
  background: var(--gold);
}
.page-header-eyebrow {
  margin: 0;
}
/* The top row holds the way back in a Hotwire Native shell (NativeBackComponent, drawn by 95-native-shell.css). Anywhere else it is no box, and the two controls are not
   there, so a browser's page is what it always was. */
.page-header-top {
  display: contents;
}
.native-back,
.native-close {
  display: none;
}
.page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}
.page-header-text {
  display: grid;
  flex: 1 1 18rem;
  gap: 0.5rem;
  min-inline-size: 0;
}
.page-header-title {
  overflow-wrap: anywhere;
}
.page-header-sub {
  max-inline-size: 66ch;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.125rem, 1rem + 0.55vw, 1.4rem);
  line-height: 1.5;
  color: var(--fg2);
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

/* A link in the line under a page's title (a request's student and incident) is a 24 px target (WCAG 2.5.8). */
.page-header-sub a {
  display: inline-block;
  min-block-size: 24px;
}
.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-inline-size: 0;
}

/* ── Who is here ──────────────────────────────────────────────────────────
   PagePresenceComponent, beside a page's title (the case page's header, the incident's command bar): the other people who have the page open, as round faces with
   initials (the shared drafts' face and its eight person colors), then "+N". The faces are the summary of a native disclosure that opens the full names in the flow
   under them, so it covers nothing and never widens the page; a join or a leave is a short line beside the faces for a few seconds, which appears and goes without motion. Alone, every box here is empty. */
.page-header-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  min-inline-size: 0;
}
.page-header-heading > .page-header-title {
  min-inline-size: 0;
}
.page-presence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-inline-size: 0;
  font-family: var(--font-sans);
  font-style: normal;
}
.page-presence__faces:empty {
  display: none;
}
.page-presence__all {
  min-inline-size: 0;
}
.page-presence__all[open] {
  flex: 1 1 100%;
}
.page-presence__all:not([open]) > .page-presence__list {
  display: none;
}
.page-presence__summary {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--density-chip);
  padding-inline: var(--space-1);
  border-radius: var(--radius-md);
  list-style: none;
  cursor: pointer;
}
.page-presence__summary::-webkit-details-marker {
  display: none;
}
.page-presence__face {
  --page-presence-person: var(--editing-person-1);
  display: inline-grid;
  place-items: center;
  flex: none;
  inline-size: 1.75rem;
  block-size: 1.75rem;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--page-presence-person);
  color: var(--fg-invert);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}
.page-presence__summary > .page-presence__face + .page-presence__face {
  margin-inline-start: -0.4rem;
}
.page-presence__face[data-color="2"] { --page-presence-person: var(--editing-person-2); }
.page-presence__face[data-color="3"] { --page-presence-person: var(--editing-person-3); }
.page-presence__face[data-color="4"] { --page-presence-person: var(--editing-person-4); }
.page-presence__face[data-color="5"] { --page-presence-person: var(--editing-person-5); }
.page-presence__face[data-color="6"] { --page-presence-person: var(--editing-person-6); }
.page-presence__face[data-color="7"] { --page-presence-person: var(--editing-person-7); }
.page-presence__face[data-color="8"] { --page-presence-person: var(--editing-person-8); }
.page-presence__more {
  margin-inline-start: var(--space-1);
  color: var(--fg2);
  font-size: var(--text-sm);
  font-weight: 600;
}
.page-presence__list {
  display: grid;
  gap: var(--space-2);
  max-inline-size: 24rem;
  margin: var(--space-1) 0 0;
  padding: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  list-style: none;
}
.page-presence__person {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-inline-size: 0;
  color: var(--fg1);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.page-presence__person > bdi {
  flex: 1 1 auto;
  min-inline-size: 0;
}
.page-presence__notice {
  margin: 0;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--fg1);
  font-size: var(--text-sm);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
@media (pointer: coarse) {
  .page-presence__summary {
    min-block-size: var(--target-min);
  }
}

/* The console's header sits `--space-4` below the page's own top padding and `--space-5` above the first thing under it: it was 1.25rem and 1rem, and the title and what it
   headed read as one block. */
[data-surface="console"] .page-header {
  padding-block: var(--space-4) var(--space-5);
}
[data-surface="console"] .page-header::before {
  display: none;
}
[data-surface="console"] .page-header-text {
  gap: 0.25rem;
}
[data-surface="console"] .page-header-title {
  font-size: clamp(1.5rem, 1.25rem + 0.9vw, 1.9rem);
}
[data-surface="console"] .page-header-sub {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: var(--text-sm);
  line-height: 1.45;
}

/* ── Floor plan ───────────────────────────────────────────────────────────
   FloorPlanComponent: a floor's plan with one room marked on it, in words as
   well as on the picture. The component's own comment says what each part is
   for; this says how it is drawn.

   THE SHEET IS WHITE IN LIGHT AND IN DARK. A plan is dark lines on white, and
   it is a document whose colors mean something (Facilities' hatching, a scanned
   page), so it is shown as it is and never inverted: `--plan-paper` is white in
   both modes, and the frame around it (the hairline, the caption, the control)
   follows the mode like everything else. The marker, `--plan-marker`, is 3:1
   against the paper in both (config/contrast_pairs.yml) and has a ring of paper
   around it, so it is also apart from the drawing's lines.

   THE SHEET READS LEFT TO RIGHT, WHATEVER THE LANGUAGE. A drawing is a picture and
   is not mirrored, and a spot's x is measured from the picture's left edge, so the
   sheet sets `direction: ltr`: inside it, `inset-inline-start` is the left edge in
   every language, and the marker is placed with logical properties only. Nothing
   but the picture and the marker is inside it.

   THE LARGER VIEW IS A CHECKBOX. The control is native, works with no hover and no
   script, and says its state to a screen reader. `:has()` widens the sheet inside
   its region, which scrolls (a drawing is two-dimensional content: WCAG 1.4.10) and
   is focusable, so a keyboard pans it. Nothing here stops pinch or page zoom.

   Nothing is pinned to an edge, so there is no safe-area rule: the plan sits inside
   the page's own measure, which already keeps clear of the notch. Nothing is set in
   vh. */

.floor-plan {
  --floor-plan-larger: 90rem; /* the sheet's width when it is shown larger; the region around it scrolls */
  /* The marker's diameter is a share of the sheet's width (a percentage is of the width of the sheet the marker is on), and never under
     1.5rem on a small sheet. There is no top: the marker follows the sheet, so it keeps the same share of the drawing, and of the room
     number it rings, at every size, and does not close in on the digits when the plan is shown larger. The share is the one that holds
     the digits of the previews' drawing (a made-up "204" in a sans-serif face) inside the ring's clear middle at the size the plan is
     first shown and larger (test/system/floor_plan_test.rb measures it); a real drawing's numbers are looked at on the manual-pass card. */
  --floor-plan-marker-share: 0.07;
  --floor-plan-marker: max(1.5rem, calc(var(--floor-plan-marker-share) * 100%));
  /* The mat of paper around the sheet is as wide as the marker's ring is wide from the spot to its outer edge (half of the marker, and
     the paper and the second ring of the "found automatically" shape, 7px), so that the ring is whole at a room on the very edge of the
     plan (a spot may be 0 or 1). A percentage is of the plan's column, and the region is as wide as it, up to 46rem. */
  --floor-plan-mat: clamp(1.25rem, 5%, 2.3rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--density-block);
  min-inline-size: 0;
}
.floor-plan-figure {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--density-gap);
  min-inline-size: 0;
  margin: 0;
}
.floor-plan-viewport {
  box-sizing: border-box;
  max-inline-size: min(100%, 46rem);
  max-block-size: 80dvh;
  /* A mat of paper around the sheet, wide enough that the marker's ring is whole at a room on the very edge of the plan (a spot may be
     0 or 1): at the size the plan is first shown, and (the rule below) when it is larger. */
  padding: var(--floor-plan-mat);
  overflow: auto;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-md);
  background: var(--plan-paper);
}
.floor-plan-viewport:focus-visible {
  outline-offset: -2px;
}
.floor-plan-sheet {
  position: relative;
  direction: ltr;
  inline-size: 100%;
  background: var(--plan-paper);
}
.floor-plan:has(.floor-plan-zoom-input:checked) .floor-plan-sheet {
  inline-size: var(--floor-plan-larger);
}
/* The sheet's width is known when it is larger, so the mat is worked out from it: the marker is as much wider as the sheet is. */
.floor-plan:has(.floor-plan-zoom-input:checked) .floor-plan-viewport {
  padding: calc(var(--floor-plan-larger) * var(--floor-plan-marker-share) / 2 + 0.5rem);
}
.floor-plan-image {
  display: block;
  inline-size: 100%;
  block-size: auto;
}

/* The marker is a ring and not a disc, because a spot is where a room's number is printed and the number has to stay readable inside
   it. It is as wide as a share of the sheet (7%), at least 1.5rem, so it grows when the plan is shown larger, as the number it rings
   does (a cap would let the ring close in on the digits). The marker's
   `--spot-x` and `--spot-y` come from the markup, the one place the number is known; `translate` puts the ring's middle on the spot.

   Its status is in its shape as well as in the words beside the plan: a solid ring (a person placed it), a double ring (found
   automatically), a dashed ring (not verified). A ring of paper on each side of the colored line keeps it apart from the drawing's own
   lines wherever it lies. */
.floor-plan-marker {
  position: absolute;
  inset-inline-start: var(--spot-x, 0%);
  inset-block-start: var(--spot-y, 0%);
  translate: -50% -50%;
  box-sizing: border-box;
  inline-size: var(--floor-plan-marker);
  aspect-ratio: 1;
  border: 3px solid var(--plan-marker);
  border-radius: 50%;
  background: transparent;
  box-shadow:
    0 0 0 2px var(--plan-paper),
    inset 0 0 0 2px var(--plan-paper);
  pointer-events: none;
}
.floor-plan-marker[data-status="auto"] {
  box-shadow:
    0 0 0 2px var(--plan-paper),
    0 0 0 5px var(--plan-marker),
    0 0 0 7px var(--plan-paper),
    inset 0 0 0 2px var(--plan-paper);
}
.floor-plan-marker[data-status="unverified"] {
  border-style: dashed;
}
/* A ring that opens from the marker twice when the plan appears, to find it by, and then is gone. */
.floor-plan-marker::after {
  content: "";
  position: absolute;
  inset: -0.35rem;
  border: 2px solid var(--plan-marker);
  border-radius: 50%;
  opacity: 0;
  animation: floor-plan-find 1.2s ease-out 2;
}
@keyframes floor-plan-find {
  from {
    transform: scale(0.8);
    opacity: 0.8;
  }
  to {
    transform: scale(2.4);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .floor-plan-marker::after {
    animation: none;
  }
}

/* A plan that did not load. The script (floor_plan_controller.js) sets `data-plan-load="failed"` when the picture is broken: the sheet, with
   the marker on it, and the larger-view box have nothing to show or do then, and the words that say so are put into the live region.
   The region is empty, and takes no room, until then. The marker is named in its own rule so that it is gone whatever it is inside. */
.floor-plan[data-plan-load="failed"] .floor-plan-viewport,
.floor-plan[data-plan-load="failed"] .floor-plan-zoom {
  display: none;
}
.floor-plan[data-plan-load="failed"] .floor-plan-marker {
  display: none;
}
.floor-plan-load {
  max-inline-size: min(100%, 46rem); /* as wide as the plan it stands in for */
}
.floor-plan-load:empty {
  position: absolute;
}
.floor-plan-unchecked {
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
  line-height: 1.45;
}

/* The words beside the plan. */
.floor-plan-caption {
  display: grid;
  gap: 0.25rem;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}
.floor-plan-caption > p {
  margin: 0;
}
.floor-plan-room {
  color: var(--fg1);
  font-size: var(--text-md);
  font-weight: 650;
  line-height: 1.3;
}
.floor-plan-floor,
.floor-plan-position,
.floor-plan-status,
.floor-plan-drawn {
  color: var(--fg2);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.floor-plan-empty {
  margin-block-start: 0.4rem;
}
.floor-plan-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: start;
  min-block-size: var(--density-chip);
  color: var(--fg1);
  font-size: var(--text-sm);
  cursor: pointer;
}
.floor-plan-zoom-input {
  flex: none;
  inline-size: 1.5rem;
  block-size: 1.5rem;
  margin: 0;
  accent-color: var(--accent);
}
@media (pointer: coarse) {
  .floor-plan-zoom {
    min-block-size: var(--target-min);
  }
}

/* The building's outline, and the credit its data's licence asks for. The outline is a graphical object in the accent on the page
   (a pair the contrast check already measures), and the building is named in words under it. */
.floor-plan-outline {
  display: grid;
  gap: 0.25rem;
  justify-items: start;
  min-inline-size: 0;
  margin: 0;
}
.floor-plan-outline-shape {
  inline-size: min(100%, 12rem);
  block-size: auto;
  max-block-size: 12rem;
}
.floor-plan-outline-shape path {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 2px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.floor-plan-outline-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  color: var(--fg2);
  font-size: var(--text-sm);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.floor-plan-attribution {
  color: var(--accent-text);
}

/* Forced colors repaint backgrounds and borders in the user's own palette, which would turn the white sheet black and lose the
   drawing's lines: the sheet keeps its paper and the marker its colors, and the outline is drawn in the palette's. */
@media (forced-colors: active) {
  .floor-plan-sheet {
    forced-color-adjust: none;
  }
  .floor-plan-outline-shape path {
    fill: Canvas;
    stroke: CanvasText;
  }
}

/* ── The icon ─────────────────────────────────────────────────────────────
   IconComponent: a drawing in the color of the text beside it. Sized in rem so it grows with the person's text size, and never
   shrunk by a flex row it sits in. `--icon-size` is how a control asks for another size; the default is the 1.5rem a tab and a list
   row both use. */
.icon {
  flex: none;
  inline-size: var(--icon-size, 1.5rem);
  block-size: var(--icon-size, 1.5rem);
  vertical-align: middle;
}

/* ── The help popup ───────────────────────────────────────────────────────
   HelpPopoverComponent: a question in a ring beside a name, and the card it opens. The card is the native popover, in the top layer, so
   nothing on the page covers it and no stacking context clips it. Where the browser can anchor it (anchor positioning), it opens under the
   button and flips to fit the screen; where it cannot, the browser's own place for a popover is the middle of the screen; on a phone it is
   a sheet from the bottom edge, clear of the home indicator. The button is a 24px target and the floor on touch (WCAG 2.5.8), and it keeps
   the accent while its card is open, so a person sees which help is showing. */
.help-pop {
  display: inline-flex;
  align-self: center;
  vertical-align: middle;
}
.help-pop-button,
.help-pop-close {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-inline-size: 1.5rem;
  min-block-size: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg2);
  cursor: pointer;
  --icon-size: 1.125rem;
}
.help-pop-button:hover,
.help-pop-close:hover,
.help-pop:has(.help-pop-card:popover-open) .help-pop-button {
  background: var(--accent-soft);
  color: var(--accent-text);
}
@media (pointer: coarse) {
  .help-pop-button,
  .help-pop-close {
    min-inline-size: var(--target-min);
    min-block-size: var(--target-min);
  }
}
.help-pop-card[popover] {
  inline-size: min(24rem, calc(100% - 2rem));
  max-block-size: min(32rem, calc(100dvh - 2rem));
  overflow: auto;
  padding: var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--fg1);
  box-shadow: var(--shadow-lift);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.5;
  text-align: start;
}
.help-pop-card:popover-open {
  display: grid;
  gap: var(--space-2);
}
@supports (position-area: block-end) {
  .help-pop-card[popover] {
    inset: auto;
    margin-block: var(--space-2);
    margin-inline: 0;
    position-area: block-end span-inline-end;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
}
@media (max-width: 40rem) {
  .help-pop-card[popover] {
    position-area: none;
    inset-block: auto 0;
    inset-inline: 0;
    inline-size: auto;
    max-block-size: min(32rem, calc(100dvh - 4rem));
    margin: 0;
    padding-block-end: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    border-end-start-radius: 0;
    border-end-end-radius: 0;
  }
}
.help-pop-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-2);
  min-inline-size: 0;
}
.help-pop-title {
  min-inline-size: 0;
  padding-block-start: 0.1rem;
  color: var(--fg1);
  font-size: var(--text-md);
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.help-pop-para {
  display: block;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: no-preference) {
  .help-pop-card:popover-open {
    animation: help-pop-in 120ms ease-out;
  }
}
@keyframes help-pop-in {
  from {
    opacity: 0;
  }
}
