/* ============================================================
   The account menu (views/partials/user-menu.php, public/js/user-menu.js):
   a component of its own, so a page without the site's layout — the
   scoreboard — can carry it too. A file rather than a <style> in the
   partial, because pages render it inside a Vue root, and Vue drops
   <style> tags it finds there. partials/head.php loads it everywhere else.
   ============================================================ */

/* Signed out: one quiet button that still reads on the dark bar.

   Each state names its own two colours rather than filtering the element,
   because `filter: brightness()` lightens the label along with the plate and
   leaves the pair no further apart than it found them. Measured against the
   gold: 6.98:1 at rest, 9.47:1 on hover, 5.22:1 while pressed — AA at every
   step, and AAA on hover, which is the moment the pointer is on it. */
.um-signin { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 8px 14px; margin-left: 8px;
  font-family: 'Prompt', sans-serif; font-size: 14px; font-weight: 600; color: #0B1B44; background: #C9A24C;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); white-space: nowrap; text-decoration: none;
  transition: background-color .16s, color .16s, transform .16s cubic-bezier(.2,.6,.2,1); }
.um-signin:hover, .um-signin:focus-visible { background: #E2BF66; color: #07122E; transform: translateY(-2px); }
/* Pressed reads as pressed: the plate darkens and the button stops lifting. */
.um-signin:active { background: #B08A3A; color: #0B1B44; transform: none; }
/* The bar behind it is navy, so the ring is white to be seen at all. */
.um-signin:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .um-signin:hover, .um-signin:focus-visible { transform: none; } }
.um-signin-block { display: flex; justify-content: center; width: 100%; margin: 0; }

/* Signed in: avatar + menu. */
.um { position: relative; flex: none; margin-left: 10px; }
.um-btn { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border: 1px solid rgba(201,162,76,.55);
  border-radius: 999px; background: rgba(255,255,255,.10); cursor: pointer; color: #fff; }
.um-btn:hover { background: rgba(255,255,255,.18); border-color: #C9A24C; }
.um-caret { font-size: 10px; opacity: .8; transition: transform .18s; }
.um.open .um-caret { transform: rotate(180deg); }
.um-av { width: 34px; height: 34px; border-radius: 999px; object-fit: cover; flex: none; display: block; background: #10225A; }
.um-av-txt { display: grid; place-items: center; font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 15px; color: #E2BF66; }
.um-av-lg { width: 44px; height: 44px; }

/* The balloon carries the festival identity: a navy head band with a gold
   edge, the same device the modals and page banners use.

   Every rule is written as `.um .um-*` and states its layout explicitly —
   direction, alignment, width, colour. These menus render inside whatever page
   is beneath them, and a bare `.um-item` was losing to page rules that stacked
   the icon above a faded label. Specificity plus explicit values keeps the
   balloon looking the same wherever it opens. */
.um .um-pop { position: absolute; right: 0; top: calc(100% + 12px); z-index: 60; width: 268px; padding: 0 0 6px;
  background: #fff; border: 1px solid #DCE2EF; border-radius: 14px;
  box-shadow: 0 20px 50px rgba(11,27,68,.32), 0 2px 6px rgba(11,27,68,.10);
  text-align: left; font-size: 14px; line-height: 1.5; }
.um .um-pop[hidden] { display: none; }
/* A small nib pointing back at the avatar. */
.um .um-pop::before { content: ''; position: absolute; top: -7px; right: 18px; width: 12px; height: 12px;
  background: #10225A; transform: rotate(45deg); border-radius: 2px; }

.um .um-head { display: flex; flex-direction: row; align-items: center; gap: 11px; padding: 13px 14px;
  background: linear-gradient(120deg, #0B1B44 0%, #1B3A8C 100%); border-bottom: 3px solid #C9A24C;
  border-radius: 13px 13px 0 0; margin: 0; text-align: left; }
.um .um-head .um-av { border: 2px solid rgba(201,162,76,.75); }
.um-head-txt, .um-drawer-txt { min-width: 0; display: block; }
.um .um-head .um-name { color: #fff; }
.um .um-head .um-role { color: #C9A24C; }
.um-name { display: block; font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 14.5px; color: #10225A;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.um-role { display: block; font-size: 12px; color: #6B7280; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-top: 1px; }

.um .um-pop .um-item { display: flex; flex-direction: row; align-items: center; justify-content: flex-start;
  gap: 12px; width: auto; min-height: 46px; margin: 2px 6px; padding: 0 10px; border: 0; border-radius: 9px;
  font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1.4; color: #16213E; text-align: left;
  text-decoration: none; opacity: 1; background: transparent; }
.um .um-pop .um-item + .um-item { margin-top: 0; }
.um .um-pop .um-item i { flex: none; width: 20px; margin: 0; text-align: center; color: #1B3A8C; font-size: 14px; }
.um .um-pop .um-item:hover { background: #EEF1FA; color: #10225A; }
.um .um-pop .um-item:hover i { color: #10225A; }
/* Buttons (page actions, ติดตั้งแอป) look like the links around them. */
.um .um-pop button.um-item { width: calc(100% - 12px); cursor: pointer; }
button.um-drawer-link { width: 100%; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; }
/* The places, then the account. */
.um .um-pop .um-sep { height: 1px; margin: 5px 12px; background: #EEF1F6; }
/* Installing the app is offered only in the browser, not inside the installed app. */
.pwa-standalone .pwa-when-browser { display: none !important; }
/* The page you are on: tinted, with a gold edge, and not a link out. */
.um .um-pop .um-item.is-here { background: #EEF1FA; color: #10225A; font-weight: 600; box-shadow: inset 3px 0 0 #C9A24C; }
.um .um-pop .um-item.is-here i { color: #10225A; }
.um-drawer-link.is-here { background: rgba(255,255,255,.08); box-shadow: inset 3px 0 0 #C9A24C; }
/* Signing out is the one destructive row, and it sits under a hairline. */
.um .um-pop .um-item.um-out { margin-top: 5px; padding-top: 5px; color: #BE123C;
  border-top: 1px solid #EEF1F6; border-radius: 0 0 9px 9px; }
.um .um-pop .um-item.um-out i { color: #BE123C; }
.um .um-pop .um-item.um-out:hover { background: #FEF2F2; color: #9F1239; }
.um .um-pop .um-item.um-out:hover i { color: #9F1239; }

/* Stacked version for the mobile drawers. */
.um-drawer { display: flex; flex-direction: column; gap: 4px; }
.um-drawer-id { display: flex; align-items: center; gap: 10px; padding: 4px 4px 10px; }
.um-drawer-id .um-name { color: #fff; }
.um-drawer-id .um-role { color: #C6CDE6; }
.um-drawer-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 10px;
  color: #E7EAF6; font-size: 15px; font-weight: 600; text-decoration: none; }
.um-drawer-link i { width: 20px; text-align: center; color: #C9A24C; font-size: 14px; }
.um-drawer-link:active { background: rgba(255,255,255,.08); }
.um-drawer-link.um-out { color: #FDA4AF; }
.um-drawer-link.um-out i { color: #FDA4AF; }

/* The bar version is desktop-only; phones get the drawer copy instead —
   except on a page without a drawer ($umAlways), where it stays. */
@media (max-width: 860px) { .um, .um-signin:not(.um-signin-block) { display: none; } .um.um-always { display: block; } }
