/* > **CLAUDE-AUTHORED** — written or edited by Claude (`profile-rehost`), 2026-09-14. */
/* ============================================================
   THE PROFILE MENU - the popover that opens off the rail's third mark.

   WHAT IT IS
   SureDash's own `.portal-avatar-menu`, opened by SureDash's own handler.
   No JavaScript is added anywhere; the platform toggles `.active` on
   `.portal-user-profiles-wrap` and the platform's own
   `.portal-user-profiles-wrap.active .portal-avatar-menu{ display:block }`
   is what shows it. This sheet never touches `display` on the menu.

   WHERE THE VALUES COME FROM
   Every value below is a face token's value, taken from portal-home.css's
   DESKTOP token block (`body.ag-face`, inside its >=1026px gate - the
   same width as every rule here) and written into a component property
   as a LITERAL. Nothing is declared on `:root`.
   ⛔ Not `var(--agf-*)`, re-hosted 2026-09-14. Those tokens exist only
   where portal-home.css loads AND `body.ag-face` is stamped; an element
   sheet that reads them paints its fallbacks, or nothing, the moment
   either narrows. The literals were checked character for character
   against that block on the day: if the face moves a token, this sheet
   does not follow it, and that is the price of standing alone.

     plane      --agf-raised   #14171C  depth-2
     hover      --agf-hover    #1C2027  depth-3
     lip        --agf-lip      #2A2E36  brand hairline, the lit top edge
     edge       --agf-lit      rgba(238,244,245,.07)  flanks + interior rule
     ink        --agf-ink      #EEF4F5  Oracle Silver
     ink-70     --agf-ink-70   #A8ADAE
     ink-55     --agf-ink-55   #86898B
     gold       --agf-gold     #FFC000  focus ring only - see THE GOLD below

   THE PLANE, argued
   The rail is the deepest plane on this screen (#030406, below the ground).
   A menu that opens off it must read as lifted OFF that plane, and the only
   currency this design allows for that is an edge, a shadow and a step in
   the ladder - not a lighter invented fill. depth-2 is the step: it is one
   tier ABOVE the cards (#0C0E12), which is what a floating object should
   be, and it is four tiers above the rail it springs from.

   ⚠️ MEASURE PLANE SEPARATION IN L*, NOT IN WCAG CONTRAST. Measured on the
   render, the popover's fill is 1.14:1 against the rail and 1.12:1 against
   the ground - and those numbers say nothing, because down here the +0.05
   flare term in the WCAG formula swamps both luminances. The same three
   surfaces in L*: rail 1.1, ground 1.9, card 3.9, popover 7.6. That is a
   ΔL* of 6.5 off the rail and 3.7 above the cards, which is what the eye
   is actually reading. WCAG ratios are kept below for the TEXT, where they
   are the right instrument.

   THE SHADOW, and its honest limit
   A popover floats, so unlike the recessed rail it may carry one, and it
   does: the card's two-layer shadow, one step deeper. ⚠️ On this ground it
   earns very little and it is not what separates the object - the ground is
   #060709 and the rail beneath the menu is #030406, so there is almost no
   room left to darken. The plane step and the lit top edge do the work; the
   shadow only closes the contact edge. Said plainly rather than pretended.

   THE GOLD
   None at rest. None on hover. The one gold in the component is the 1px
   focus-visible ring, which is not a decision made here - it is verbatim
   the rail's own rule for its nav rows (face.css:242-244,
   `outline: 1px solid var(--agf-gold); outline-offset: -1px`). These rows
   are the same kind of object as those rows and they focus the same way.
   A gold at rest would also outrank the register's ONE conditional gold -
   the unread-notification mark - which is the only thing in the rail
   allowed to be loud, and only when it has something to say.

   RADIUS
   0, and not restated. post 22 already carries
   `body:has(.portal-home-grid) *{ border-radius:0 !important }` at (0,1,0)
   and it computes 0 on every box here. ADR-017 holds without help.

   THE TWO PLATFORM RULES THAT SHAPE EVERY DECLARATION BELOW
   1. `.wp-block-suredash-profile *{ font-size|font-weight|line-height|color:
      inherit !important }` - blocks-rtl.min.css. At (0,1,0)+important it
      beats the platform's OWN `.portal-avatar-menu a{ font-size:14px }`,
      which is why the menu has never had a size of its own. Anything this
      sheet says about type or ink must therefore be `!important` AND above
      (0,1,0). Every selector here is at least (0,5,1).
   2. `body:has(.portal-home-grid) .portal-content *{ font-family:
      var(--ph-sans) !important }` - post 22, (0,2,1). Same answer.

   SCOPE
   `.portal-sidebar .portal-tools-register`, and gated to >=1026px, exactly
   as the face is. The page renders THREE copies of this block; the other
   two live outside `.portal-application-content-part` where the `--agf-*`
   properties are declared, and every tokenised declaration would die
   silently on them. Mobile is out of this brief's scope and is left as it
   renders today.

   HOST - re-hosted 2026-09-14, off `body.ag-face`
   Every selector used to open with `body.ag-face`, a class
   `portal-home.php` stamps on portal routes: this sheet painted only
   because that plugin happened to load on every route. The host is now the
   component's own anchor, `.portal-sidebar .portal-tools-register`, and
   nothing else. `body` and the repeated `.portal-sidebar` are WEIGHT, not
   scope: together they are (0,1,1), exactly what `body.ag-face` weighed,
   so every selector keeps its old specificity to the digit and every
   cascade contest resolves as it did, whichever sheet the competitor is
   in, and between this sheet's own rules. `body` is an ancestor of
   everything this sheet can reach and a repeated class matches exactly
   what the single class matches, so neither narrows anything.
   ⛔ Do not tidy `.portal-sidebar.portal-sidebar` down to one class, or
   drop `body`: either one lowers every rule below its old weight.
   ============================================================ */

@media (min-width: 1026px) {

/* ---------- 1. WHERE IT HANGS ----------
   The popover is moved off the 32px mark and onto the MARKS ROW.

   Measured reason, not preference. `.portal-sidebar` is `position: sticky`
   with `overflow: hidden auto`, and anchored to the mark the menu was
   180px wide ending at the mark's right edge - which put its left 40px
   OUTSIDE the rail's padding box. That strip was clipped away by the
   sidebar's overflow, and a hit test at (1202,102) returned
   `.portal-content-section`, not the menu: a portal card was painting over
   the overhang. Anchored to the register instead, the menu spans the rail's
   inner width (199px measured) and is contained by construction - there is
   no overhang left to clip and no card can reach it. See § STACKING at the
   foot of this file for why raising a z-index could not have fixed it.

   `position: static` on the wrap hands the containing block up to the
   register. The wrap keeps `.sd-relative` - a utility class names a
   property, not a place - and only this one instance is overridden. */
body .portal-sidebar.portal-sidebar .portal-tools-register{
  position: relative !important;
}
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-user-profiles-wrap{
  position: static !important;
}

/* ---------- 2. THE SURFACE ---------- */
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu{
  /* component properties, scoped to the component, never :root. Literals,
     not `var(--agf-*)`: see WHERE THE VALUES COME FROM. */
  --apu-plane:  #14171C;                          /* --agf-raised */
  --apu-hover:  #1C2027;                          /* --agf-hover */
  --apu-lip:    #2A2E36;                          /* --agf-lip */
  --apu-edge:   rgba(238, 244, 245, .07);         /* --agf-lit */
  --apu-ink:    #EEF4F5;                          /* --agf-ink */
  --apu-ink-70: #A8ADAE;                          /* --agf-ink-70 */
  --apu-ink-55: #86898B;                          /* --agf-ink-55 */
  --apu-gold:   #FFC000;                          /* --agf-gold */
  --apu-ease:   cubic-bezier(0.22, 0.61, 0.36, 1); /* --agf-ease */
  --apu-t:      160ms;                            /* --agf-pointer */
  /* 38px rows: one step under the rail's own nav rows, because a popover is
     a shorter list read in one glance and a 44px row here would make the
     menu taller than the three cards it hangs beside. */
  --apu-row:    38px;
  --apu-pad:    14px;

  /* `inset: unset` is what blocks-rtl.min.css leaves on this element at
     desktop, and the platform sets `right:0` INLINE. Author !important
     beats a normal inline declaration, so all four are restated here. */
  position: absolute !important;
  inset-block-start: calc(100% + 10px) !important;   /* clear of the register's rule */
  inset-block-end: auto !important;
  inset-inline: 0 !important;                        /* the rail's inner width */
  width: auto !important;
  min-width: 0 !important;       /* platform: 180px */
  max-width: none !important;    /* platform: 200px */

  padding: 0 !important;
  background: var(--apu-plane) !important;
  /* the card grammar: a lit TOP edge, flanks stepping down. Composited over
     depth-2 the flanks land at L* ~15 against the lip's L* 18.9. */
  border: 1px solid var(--apu-edge) !important;
  border-top-color: var(--apu-lip) !important;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .60),
    0 18px 40px -14px rgba(0, 0, 0, .85) !important;
  overflow: hidden !important;

  font-family: 'Assistant', 'Arial Hebrew', system-ui, sans-serif !important; /* --agf-sans */
  color: var(--apu-ink) !important;
  /* the platform animates `transition: .25s` on ALL properties, which makes
     a synchronous read of this element return pre-toggle colours. Narrowed
     to the two things that actually move. */
  transition:
    opacity var(--apu-t) var(--apu-ease),
    box-shadow var(--apu-t) var(--apu-ease) !important;

  /* above everything else inside the rail's stacking context. The platform
     ships 99; 99 was never the problem (see § STACKING) and a number that
     large invites a bidding war, so it is stated at the scale the rail
     actually uses. */
  z-index: 40 !important;
}

/* ---------- 3. THE TWO GROUPS ----------
   Three profile actions, then a rule, then logout. The rule is the face's
   interior-divider token in exactly its named role: it separates two blocks
   on ONE plane, not two planes. */
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu .portal-user-menu-links{
  display: block !important;
  padding: 6px 0 !important;                            /* platform: 8px all round */
  border-bottom: 1px solid var(--apu-edge) !important;
}
/* logout is a direct child of the menu, not of the group above it, so its
   breathing room is a margin rather than the group's padding. Same 6px, so
   the two blocks keep one rhythm. */
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu > .portal-logout-url{
  margin: 6px 0 !important;
}

/* ---------- 4. THE ROW ----------
   Full-bleed: the hover fill runs edge to edge. With radius pinned at 0 an
   inset pill would be the only rounded-adjacent shape on the screen, and a
   full-width band is also the larger target. */
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu .portal-user-menu-link{
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  height: var(--apu-row) !important;
  padding: 0 var(--apu-pad) !important;
  background: transparent !important;                   /* platform: its own fill */
  color: var(--apu-ink) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  letter-spacing: normal !important;                    /* never positive on Hebrew */
  text-decoration: none !important;
  transition:
    background-color var(--apu-t) var(--apu-ease),
    color var(--apu-t) var(--apu-ease) !important;
}

/* the label. Size and weight are inherited from the row THROUGH the
   platform's own weld, which is the one place that rule is useful; what is
   named here is only what the weld cannot give: the box behaviour. */
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu .portal-user-menu-link-title{
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  letter-spacing: normal !important;
}

/* THE TYPE LADDER, two ranks.
   The three profile actions are the reason the menu opens, and they carry
   full ink. Logout is not one of them - it is the exit, wanted rarely and
   never wanted by mistake - so it sits at ink-70, below the rule, one rank
   down. Same size, same weight: the ladder is built in lightness, which is
   the same instrument the greeting's two values use. */
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu > .portal-logout-url{
  color: var(--apu-ink-70) !important;
}

/* ---------- 5. THE GLYPH ----------
   16px, up from the platform's 12px `.portal-icon-xs`, and drawn at
   stroke-width 1.5 - the weight the three marks in the register above are
   drawn at, so the menu reads as the same hand. At rest it sits at ink-55,
   one rank under its own label; on hover it comes up to full ink. That is
   the state change: the plane steps one tier and the glyph lights. */
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu .portal-svg-icon{
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  width: 16px !important;
  height: 16px !important;
  color: var(--apu-ink-55) !important;
  transition: color var(--apu-t) var(--apu-ease) !important;
}
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu .portal-svg-icon svg{
  width: 16px !important;
  height: 16px !important;
  stroke-width: 1.5 !important;                         /* platform: 2 */
}

/* ---------- 6. HOVER ----------
   depth-2 -> depth-3, and the glyph to full ink. No gold, no movement, no
   inset shape: the light changes, the object does not - the same premise
   the cards were re-founded on. */
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu .portal-user-menu-link:hover{
  background: var(--apu-hover) !important;
  color: var(--apu-ink) !important;
}
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu .portal-user-menu-link:hover .portal-svg-icon{
  color: var(--apu-ink) !important;
}

/* ---------- 7. FOCUS ----------
   The rail's own ring, verbatim. `outline-offset: -1px` rather than the
   card's +2px: the rows are full-bleed inside an `overflow: hidden` box, so
   an outset ring would be clipped on three sides. */
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu .portal-user-menu-link:focus-visible{
  background: var(--apu-hover) !important;
  color: var(--apu-ink) !important;
  outline: 1px solid var(--apu-gold) !important;
  outline-offset: -1px !important;
}
body .portal-sidebar.portal-sidebar .portal-tools-register .portal-avatar-menu .portal-user-menu-link:focus-visible .portal-svg-icon{
  color: var(--apu-ink) !important;
}

} /* end @media (min-width: 1026px) */

/* ============================================================
   § STACKING - the answer, and why a z-index was never the fix

   `.portal-sidebar` is `position: sticky`. A stickily positioned element
   creates a stacking context UNCONDITIONALLY - z-index: auto does not
   exempt it - so the menu's z-index, whatever it is, is sealed inside the
   rail and is compared only against the rail's other children. The rail as
   a whole then paints at `z-index: auto`, and the portal cards
   (`position: relative`, `z-index: auto`, in a column that comes AFTER the
   rail in document order) paint in the same layer, later. Later wins.

   So: the platform's 99 was already meaningless against a card, and 9999
   would have been meaningless in exactly the same way. Verified before the
   change - a hit test inside the open menu's own rectangle returned
   `.portal-content-section` and a card's `.sd-flex-col`, not the menu.

   What this component needs: z-index 40, inside the rail, and NO overlap
   with the cards at all - the popover now lives entirely within the rail's
   199px inner width, and the cards stop 17px short of the rail's left edge.
   Nothing to fight.

   ⚠️ For the sibling complaint (a card overriding the notifications
   drawer): that drawer hangs outside the sidebar, so it cannot be solved
   this way. The fix would have to be on the SIDEBAR, not on the drawer -
   giving `.portal-sidebar` a `z-index` of 1, via the sheet's own
   `body.ag-face` + `.wp-block-columns:has(> .portal-sidebar)` selector,
   which lifts the sticky element's whole stacking context above the cards.
   It is NOT applied here: this popover does not need it, and the drawer is
   another owner's surface.

   ⛔ WRITTEN AS PROSE ON PURPOSE - 2026-09-11. It used to sit here as a
   paste-ready, `!important`-carrying declaration inside this comment. It
   was inert (verified: one occurrence in the file, zero after stripping
   comments) and it was a loaded gun, because CODE IN A COMMENT GETS
   RE-ENABLED by readers who assume a previous author left it for them -
   and it arrives carrying whatever specificity it had when it was written,
   which is usually HIGHER than what is live, because it was written to
   win. ⛔ A commented-out rule is not documentation. It is a rule with its
   safety off. Prose cannot be un-commented by accident.

   ⚠️ TWO SILENT FAILURES WOULD HAVE FOLLOWED ONE PASTE, and the original
   author could not have known the second:
     1. it outranks the notices stacking fix at (0,4,1) and pins the
        sidebar at z-index 1, killing it with NO error. A stacking fix that
        stops working shows a panel behind a card - which reads as a bug in
        the panel, sending the next person to the wrong file entirely.
     2. that selector is CHARACTER-FOR-CHARACTER the one `face.css` uses
        for the sidebar's width and ground. So it would not add a
        declaration - it would land as a same-specificity sibling of the
        sidebar's own base rule, in a different plugin, with the winner
        decided by STYLESHEET LOAD ORDER rather than by anything written
        down anywhere.

   ⚠️ AND THE REASONING ABOVE WAS RIGHT - it is the SAFETY ARGUMENT that
   was scoped too narrowly, which is the part worth keeping. The original
   read: "visually inert: the rail's box (x 1235.5-1467.5) and the content
   column (x 185.5-1235.5) do not overlap, so nothing changes on screen
   except that things hanging out of the rail can finally win." ✅ That was
   true when written AND IT IS ABOUT A DIFFERENT PROPERTY. It is a
   correctness argument about PIXELS, and the change it accompanies is
   about STACKING. A reader finding only a deletion here would assume the
   proposal was wrong; it was not. ⛔ The species, and it is the reason
   this note is long: A SAFETY ARGUMENT SURVIVES LONGER THAN THE
   CONDITIONS IT WAS MADE UNDER, AND IT DOES NOT SAY WHICH PROPERTY IT WAS
   ABOUT.
   → `elements/sidebar/TRAPS.md` § 6.
   ============================================================ */
