/* ════════════════════════════════════════════════════════════
   profile-glass.css — Liquid Glass profile menu
   The panel grows out of the profile button: a small glass blob
   stretches into the full panel, then the rows fade in quickly
   one after another. Loaded last so it wins over older styles.
   Behaviour lives in js/profile-menu.js.
   ════════════════════════════════════════════════════════════ */

/* ── tokens ── */
html body .profile-dd {
  --ox: 100%; --oy: 0px;            /* grow-from point, set by JS */
  --pdd-r: 28px;                    /* open corner radius */
  --pdd-open: .34s;                 /* open speed */
  --pdd-close: .18s;                /* close speed */
  --pdd-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ── panel: closed state (a small glass blob at the button) ── */
html body .profile-dd {
  display: block !important;
  position: fixed;
  z-index: 250;
  width: min(284px, calc(100vw - 16px));
  max-height: var(--maxh, calc(100dvh - 90px));
  overflow: hidden !important;
  overscroll-behavior: contain;
  isolation: isolate;
  padding: 0 !important;
  border-radius: 999px !important;
  transform-origin: var(--ox) var(--oy);
  transform: scale(.16, .13);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  animation: none !important;       /* the old drop-in keyframes fight the morph */
  background:
    radial-gradient(130% 80% at 0% 0%, rgba(255,255,255,.18), rgba(255,255,255,0) 55%),
    linear-gradient(160deg, rgba(255,255,255,.09), rgba(255,255,255,.02) 60%),
    rgba(22,20,34,.48) !important;
  -webkit-backdrop-filter: blur(32px) saturate(200%) brightness(1.07) !important;
  backdrop-filter: blur(32px) saturate(200%) brightness(1.07) !important;
  border: 1px solid rgba(255,255,255,.06) !important;
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,.22),
    inset 0 -1px 1px rgba(255,255,255,.04),
    inset 0 0 22px rgba(255,255,255,.04),
    0 26px 64px rgba(0,0,0,.52),
    0 3px 10px rgba(0,0,0,.30) !important;
  transition:
    transform var(--pdd-close) cubic-bezier(.4, 0, .9, .4),
    border-radius var(--pdd-close) ease-in,
    opacity .14s ease .04s,
    visibility 0s linear var(--pdd-close);
}

/* ── panel: open state ── */
html body .profile-dd.open {
  border-radius: var(--pdd-r) !important;
  transform: scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  overflow-y: auto !important;
  animation: none !important;
  will-change: transform, opacity;  /* only while visible, saves GPU memory */
  transition:
    transform var(--pdd-open) var(--pdd-ease),
    border-radius .28s var(--pdd-ease),
    opacity .1s ease,
    visibility 0s;
}

/* soft light sweep over the glass */
html body .profile-dd::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,0) 30%, rgba(255,255,255,0) 68%, rgba(255,255,255,.07) 100%);
  opacity: 0; transition: opacity .35s ease;
}
html body .profile-dd.open::before { opacity: 1; transition-delay: .06s; }

/* bright glass rim: light catches the top-left and bottom-right edges */
html body .profile-dd::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(150deg, rgba(255,255,255,.34), rgba(255,255,255,.12) 18%, rgba(255,255,255,.03) 45%, rgba(255,255,255,.04) 70%, rgba(255,255,255,.16));
  opacity: .9;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

/* ── content: sits above the glass effects, fades in with a short stagger ── */
.pdd-in { position: relative; z-index: 1; padding: 8px; }

.pdd-head, .pdd-quick, .pdd-in > .pdd-rule, .pdd-list > * {
  opacity: 0; transform: translateY(-5px) scale(.98);
  transition: opacity .1s ease, transform .1s ease, filter .1s ease;
}
.profile-dd.open .pdd-head,
.profile-dd.open .pdd-quick,
.profile-dd.open .pdd-in > .pdd-rule,
.profile-dd.open .pdd-list > * {
  opacity: 1; transform: none; filter: none;
  transition: opacity .24s ease, transform .3s var(--pdd-ease, ease), filter .24s ease;
  transition-delay: calc(.05s + var(--i, 0) * .028s);
}
/* soft blur-in only where it is cheap (mouse devices) */
@media (hover: hover) and (pointer: fine) {
  .pdd-head, .pdd-quick, .pdd-in > .pdd-rule, .pdd-list > * { filter: blur(4px); }
}

/* ── header ── */
.pdd-head { display: flex; align-items: center; gap: 11px; padding: 10px 10px 12px; }
.pdd-ava {
  position: relative; width: 42px; height: 42px; flex: none; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; font: 800 17px/1 'Syne', sans-serif; color: #fff;
  background: linear-gradient(135deg, var(--accent, #8b5cf6), var(--accent2, #60a5fa));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 0 0 1px rgba(255,255,255,.14), 0 4px 14px rgba(0,0,0,.35);
}
.pdd-ava img, .pdd-ava svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdd-who { min-width: 0; }
.pdd-name > span { display: inline-flex; align-items: center; }
.pdd-name .verified-badge, .pdd-name .premium-badge { margin-left: 0; }
.pdd-name {
  font: 700 15px/1.2 'Syne', sans-serif; color: #fff !important;
  display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pdd-email { margin-top: 2px; font-size: 11.5px; color: rgba(255,255,255,.58); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── icon row ── */
.pdd-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 2px 0 6px; }
.pdd-q {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 4px 9px; border: 0; border-radius: 16px; background: transparent;
  color: rgba(255,255,255,.92); font: 500 11.5px/1 'DM Sans', system-ui, sans-serif; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .16s ease, transform .16s cubic-bezier(.3, 1.5, .5, 1);
}
.pdd-q svg { display: block; }
.pdd-q .dd-badge {
  position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 99px; background: #ff453a; color: #fff; font: 700 10.5px/17px 'DM Sans', sans-serif; text-align: center;
  box-shadow: 0 0 0 2px rgba(30,28,44,.9);
}

/* ── divider ── */
.pdd-rule { height: 1px; margin: 4px 8px 6px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent); }

/* ── list rows ── */
.pdd-row {
  display: flex; align-items: center; gap: 13px; width: 100%; min-height: 46px; padding: 0 12px;
  border: 0; border-radius: 14px; background: transparent; color: rgba(255,255,255,.93);
  font: 500 15px/1 'DM Sans', system-ui, sans-serif; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background .16s ease, transform .16s cubic-bezier(.3, 1.5, .5, 1), box-shadow .16s ease;
}
.pdd-row svg:first-child { flex: none; opacity: .92; }
.pdd-row span { flex: 1; min-width: 0; }
.pdd-chev { flex: none; opacity: .4; }
.pdd-danger { color: #ff6961; }
.pdd-danger svg { opacity: 1; }

html body .pdd-row.dd-premium-btn {
  background: linear-gradient(90deg, rgba(245,200,66,.16), rgba(245,200,66,.05)) !important;
  border: 0 !important; border-radius: 14px !important; margin: 2px 0 4px; padding: 0 12px !important;
  color: #ffd35c !important; font-weight: 600 !important;
}
html body .pdd-row.dd-premium-btn::before { display: none; }   /* old gold edge stripe */
html body .pdd-row.dd-premium-btn:hover { background: linear-gradient(90deg, rgba(245,200,66,.24), rgba(245,200,66,.09)) !important; }

/* ── hover / press / focus: a lit glass pill ── */
@media (hover: hover) {
  .pdd-q:hover, .pdd-row:hover { background: rgba(255,255,255,.11); box-shadow: inset 0 1px 0 rgba(255,255,255,.14); }
  .pdd-danger:hover { background: rgba(255,69,58,.15); }
}
.pdd-q:active, .pdd-row:active { background: rgba(255,255,255,.18); transform: scale(.965); }
.pdd-q:focus-visible, .pdd-row:focus-visible { outline: 2px solid rgba(255,255,255,.6); outline-offset: -2px; background: rgba(255,255,255,.11); }

/* ── avatar button reads as pressed glass while open ── */
.profile-avatar-btn { transition: transform .3s cubic-bezier(.2, 1.4, .3, 1), box-shadow .3s ease, border-color .25s ease, background-color .25s ease; }
.profile-avatar-btn.pdd-open {
  transform: scale(.92);
  border-color: rgba(255,255,255,.45) !important;
  box-shadow: 0 0 0 4px rgba(255,255,255,.10), 0 0 22px rgba(139,92,246,.45);
}

/* ── scrim: catches the outside tap (so it can't hit the page below).
      Dims on phones, invisible on desktop. ── */
.pdd-scrim {
  position: fixed; inset: 0; z-index: 240; opacity: 0; pointer-events: none; touch-action: none;
  background: radial-gradient(120% 70% at 100% 0%, rgba(0,0,0,.26), rgba(0,0,0,.48));
  transition: opacity .2s ease;
}
.pdd-scrim.on { opacity: 1; pointer-events: auto; }
@media (min-width: 900px) { .pdd-scrim { background: transparent; } }

/* ── lite / eco mode: no blur ── */
html.lite-mode .profile-dd, html.eco-mode .profile-dd {
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  background: rgba(24,22,36,.95) !important;
}
html.lite-mode .pdd-head, html.lite-mode .pdd-quick, html.lite-mode .pdd-list > *,
html.eco-mode .pdd-head, html.eco-mode .pdd-quick, html.eco-mode .pdd-list > * { filter: none !important; }

/* ── reduced motion: simple fade ── */
@media (prefers-reduced-motion: reduce) {
  html body .profile-dd,
  html body .profile-dd.open { transform: none; border-radius: var(--pdd-r) !important; will-change: auto; }
  html body .profile-dd { transition: opacity .12s ease, visibility 0s linear .12s; }
  html body .profile-dd.open { transition: opacity .12s ease, visibility 0s; }
  .pdd-head, .pdd-quick, .pdd-in > .pdd-rule, .pdd-list > *,
  .profile-dd.open .pdd-head, .profile-dd.open .pdd-quick, .profile-dd.open .pdd-in > .pdd-rule, .profile-dd.open .pdd-list > * {
    transition: none; transform: none; filter: none;
  }
}

/* ── phones: a bit more compact (desktop unchanged) ── */
@media (max-width: 600px) {
  html body .profile-dd { width: min(244px, calc(100vw - 16px)); --pdd-r: 24px; }
  .pdd-in { padding: 6px; }
  .pdd-head { gap: 9px; padding: 8px 8px 9px; }
  .pdd-ava { width: 36px; height: 36px; font-size: 15px; }
  .pdd-name { font-size: 14px; }
  .pdd-email { font-size: 11px; }
  .pdd-quick { padding: 0 0 4px; }
  .pdd-q { gap: 5px; padding: 8px 2px 7px; font-size: 11px; border-radius: 14px; }
  .pdd-q svg { width: 20px; height: 20px; }
  .pdd-row { min-height: 41px; gap: 11px; padding: 0 10px; font-size: 14px; border-radius: 12px; }
  .pdd-row svg:first-child { width: 18px; height: 18px; }
  .pdd-rule { margin: 3px 8px 4px; }
}
