/* Keep the shared app identity visible without shifting the opening layout. */
html{scroll-padding-top:calc(70px + env(safe-area-inset-top,0px))}
.app>.brand{
 position:sticky;
 top:0;
 z-index:12;
 margin-top:calc(-15px - env(safe-area-inset-top,0px));
 margin-inline:-16px;
 margin-bottom:-8px;
 padding:calc(15px + env(safe-area-inset-top,0px)) 16px 8px;
 background:var(--bg);
}

/* Emphasize the sticky profile without resizing the header or moving the page. */
@media(prefers-reduced-motion:no-preference){
 .app>.brand{
  box-shadow:0 6px 15px rgba(25,52,38,var(--brand-shadow,0));
 }
 .app>.brand>.brand-profile{
  transform:scale(var(--brand-avatar-scale,1));
  transform-origin:center;
  transition:transform .18s cubic-bezier(.2,.75,.25,1);
 }
 .app>.brand>.brand-name{
  min-width:0;
  transform:translateX(var(--brand-title-offset,0px)) scale(var(--brand-title-scale,1));
  transform-origin:left center;
 }
 [dir=rtl] .app>.brand>.brand-name{
  transform:translateX(calc(-1 * var(--brand-title-offset,0px))) scale(var(--brand-title-scale,1));
  transform-origin:right center;
 }
}

/* Only the profile gesture replaces the browser's top overscroll. */
html[data-profile-pull-enabled]{overscroll-behavior-y:none}
.profile-card-flying[popover]{margin:0;padding:0;border:0;right:auto;bottom:auto;background:transparent}
.profile-card-flying{position:fixed;z-index:42;pointer-events:none;border-radius:29%;transform-origin:0 0}
@media(prefers-reduced-motion:no-preference){
 html[data-profile-card-active]::after{
  content:"";position:fixed;inset:0;z-index:39;pointer-events:none;
  background:#11241cc9;opacity:var(--profile-card-shade,0);
 }
 html[data-profile-card-closing]::after{content:none}
 #profile-panel[data-profile-card=reverse]::backdrop{background:#11241cc9;opacity:var(--profile-card-shade,1)}
 html[data-profile-card-settling]::after{pointer-events:auto}
 html[data-profile-card-active]:not([data-profile-card-closing]) #profile-open img,
 html[data-profile-card-closing]:has(#profile-panel[data-profile-card-top-logo]) #profile-open img{visibility:hidden}
 html[data-profile-card-active] .app{
  translate:0 var(--profile-card-page-y,0px);scale:var(--profile-card-page-scale,1);
  transform-origin:50% 0;
 }
 #profile-panel[data-profile-card=measure],#profile-panel[data-profile-card=preview]{
  display:block;position:fixed;inset:0;margin:auto;z-index:40;pointer-events:none;overflow:hidden;
 }
 #profile-panel[data-profile-card=measure]{visibility:hidden}
 #profile-panel[data-profile-card=preview],#profile-panel[data-profile-card=reverse][open]{
  animation:none;translate:0 var(--profile-card-y,100%);border-radius:var(--profile-card-round,24px) var(--profile-card-round,24px) var(--profile-card-bottom,0px) var(--profile-card-bottom,0px);
  box-shadow:0 -12px 44px #10291e26;
 }
 #profile-panel[data-profile-card=preview] #profile-avatar>img,
 #profile-panel[data-profile-card=reverse][data-profile-card-top-logo] #profile-avatar>img{opacity:var(--profile-card-blend,0)}
 #profile-panel[data-profile-card=done][open]{animation:none}
}
/* Shared B icon: the panel has no transform so the flying icon uses viewport coordinates. */
@media(prefers-reduced-motion:no-preference){
 #profile-panel[data-profile-opening=""][open]{animation:profile-surface-in .53s ease-out both}
 #profile-panel[data-profile-opening=done][open]{animation:none}
 html:has(#profile-panel[data-profile-opening=""][open]) #profile-open img{visibility:hidden}
 #profile-panel[data-profile-opening=""]::backdrop{animation:profile-dim-in .42s ease-out both}
 #profile-panel[data-profile-opening=""]>.profile-top,
 #profile-panel[data-profile-opening=""]>.profile-page,
 #profile-panel[data-profile-opening=""]>.profile-meter{animation:profile-reveal .49s cubic-bezier(.19,.76,.22,1) both}
 #profile-panel[data-profile-opening=""] #profile-avatar>img{animation:profile-logo-reveal .53s linear both}
 .profile-opening-logo{
  position:fixed;left:var(--flight-left);top:var(--flight-top);
  width:var(--flight-size);height:var(--flight-size);display:block;
  z-index:8;pointer-events:none;border-radius:29%;transform-origin:0 0;
  animation:profile-logo-flight .53s cubic-bezier(.19,.76,.22,1) both;
 }
 @keyframes profile-surface-in{from{background-color:transparent}55%,to{background-color:#f2f5ee}}
 @keyframes profile-dim-in{from{opacity:0}to{opacity:1}}
 @keyframes profile-reveal{0%,12%{opacity:0}to{opacity:1}}
 @keyframes profile-logo-reveal{0%,70%{opacity:0}to{opacity:1}}
 @keyframes profile-logo-flight{
  from{transform:none;opacity:1}
  76%{opacity:1}
  to{transform:translate(var(--flight-x),var(--flight-y)) scale(var(--flight-scale));opacity:0}
 }
}
