diff --git a/index.html b/index.html index a4aef26..88fccd5 100644 --- a/index.html +++ b/index.html @@ -24,6 +24,15 @@ padding: 0; box-sizing: border-box; } + + /* Otimização de renderização para elementos animados */ + *[class*="icon"], + *[class*="button"], + *[class*="modal"] { + backface-visibility: hidden; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; @@ -39,7 +48,7 @@ contain: layout style; } - /* Background animado com gradiente */ + /* Background animado com gradiente - otimizado */ body::before { content: ''; position: fixed; @@ -47,11 +56,12 @@ left: 0; width: 100%; height: 100%; - background: linear-gradient(45deg, #20337b, #1a2a5e, #2d4a9e, #1e3470, #20337b); - background-size: 400% 400%; - animation: gradientAnimation 15s ease infinite; + background: linear-gradient(45deg, #20337b, #1a2a5e, #2d4a9e); + background-size: 200% 200%; + animation: gradientAnimation 20s ease-in-out infinite; z-index: -2; - will-change: background-position; + will-change: transform; + transform: translate3d(0, 0, 0); contain: strict; } @@ -117,10 +127,11 @@ border-radius: 50px; font-size: 0.95em; font-weight: bold; - transition: all 0.3s ease; + transition: transform 0.2s ease, box-shadow 0.2s ease; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); cursor: pointer; border: none; + transform: translate3d(0, 0, 0); } .save-contact { @@ -129,9 +140,8 @@ } .save-contact:hover { - transform: translateY(-3px); + transform: translate3d(0, -3px, 0); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); - background: linear-gradient(135deg, #2d4a9e, #20337b); } .icons-row { @@ -149,34 +159,35 @@ align-items: center; text-decoration: none; color: white; - transition: transform 0.3s ease; + transition: transform 0.2s ease; position: relative; + transform: translate3d(0, 0, 0); } .icon-item:hover { - transform: scale(1.08); + transform: scale3d(1.08, 1.08, 1); } .icon-box { width: 65px; height: 65px; - background: rgba(255, 255, 255, 0.1); - backdrop-filter: blur(10px); + background: rgba(255, 255, 255, 0.15); border-radius: 12px; display: flex; justify-content: center; align-items: center; margin-bottom: 8px; border: 2px solid rgba(255, 255, 255, 0.2); - transition: all 0.3s ease; + transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; position: relative; z-index: 1; + transform: translate3d(0, 0, 0); } .icon-item:hover .icon-box { - background: rgba(255, 255, 255, 0.2); + background: rgba(255, 255, 255, 0.25); border-color: rgba(255, 255, 255, 0.4); - box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); } .icon-box svg, @@ -215,24 +226,24 @@ width: 0; height: 0; border-radius: 50%; - background: rgba(255, 255, 255, 0.3); - transform: translate(-50%, -50%); - transition: width 0.6s, height 0.6s; + background: rgba(255, 255, 255, 0.2); + transform: translate3d(-50%, -50%, 0); + transition: transform 0.4s ease, opacity 0.4s ease; + opacity: 0; } .pix-button:hover::before { - width: 300px; - height: 300px; + transform: translate3d(-50%, -50%, 0) scale(3); + opacity: 1; } .pix-button:hover { - transform: translateY(-3px); + transform: translate3d(0, -3px, 0); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); - background: linear-gradient(135deg, #00A86B, #32BCAD); } .pix-button:active { - transform: translateY(-1px) scale(0.98); + transform: translate3d(0, -1px, 0) scale(0.98); } .modal { @@ -246,17 +257,17 @@ z-index: 1000; justify-content: center; align-items: center; - transition: background 0.3s ease; + transition: opacity 0.25s ease; + opacity: 0; } .modal.active { display: flex; - animation: fadeIn 0.3s ease forwards; + animation: fadeIn 0.25s ease forwards; } @keyframes fadeIn { - 0% { background: rgba(0, 0, 0, 0); } - 100% { background: rgba(0, 0, 0, 0.8); } + to { background: rgba(0, 0, 0, 0.8); opacity: 1; } } .modal-content { @@ -266,29 +277,26 @@ max-width: 400px; width: 90%; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); - transform: translateY(30px) scale(0.9); + transform: translate3d(0, 30px, 0) scale(0.9); opacity: 0; contain: layout style paint; } .modal.active .modal-content { - animation: slideUpScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; + animation: slideUpScale 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; will-change: transform, opacity; } @keyframes slideUpScale { - 0% { transform: translateY(30px) scale(0.9); opacity: 0; } - 100% { transform: translateY(0) scale(1); opacity: 1; } + to { transform: translate3d(0, 0, 0) scale(1); opacity: 1; } } @keyframes fadeOut { - 0% { background: rgba(0, 0, 0, 0.8); } - 100% { background: rgba(0, 0, 0, 0); } + to { background: rgba(0, 0, 0, 0); opacity: 0; } } @keyframes slideDownScale { - 0% { transform: translateY(0) scale(1); opacity: 1; } - 100% { transform: translateY(30px) scale(0.9); opacity: 0; } + to { transform: translate3d(0, 30px, 0) scale(0.9); opacity: 0; } } .modal-header { @@ -306,14 +314,13 @@ border-radius: 10px; margin-bottom: 20px; text-align: center; - transition: all 0.3s ease; + transition: border-color 0.2s ease, box-shadow 0.2s ease; outline: none; } .modal-input:focus { border-color: #32BCAD; box-shadow: 0 0 0 3px rgba(50, 188, 173, 0.2); - transform: scale(1.02); } .modal-buttons { @@ -329,9 +336,10 @@ font-size: 1em; font-weight: bold; cursor: pointer; - transition: all 0.3s ease; + transition: transform 0.15s ease, box-shadow 0.15s ease; position: relative; overflow: hidden; + transform: translate3d(0, 0, 0); } .modal-button::after { @@ -339,17 +347,18 @@ position: absolute; top: 50%; left: 50%; - width: 0; - height: 0; + width: 100px; + height: 100px; border-radius: 50%; - background: rgba(255, 255, 255, 0.4); - transform: translate(-50%, -50%); - transition: width 0.5s, height 0.5s; + background: rgba(255, 255, 255, 0.3); + transform: translate3d(-50%, -50%, 0) scale(0); + transition: transform 0.4s ease, opacity 0.4s ease; + opacity: 0; } .modal-button:hover::after { - width: 300px; - height: 300px; + transform: translate3d(-50%, -50%, 0) scale(3); + opacity: 1; } .modal-button.generate { @@ -363,12 +372,12 @@ } .modal-button:hover { - transform: translateY(-2px); + transform: translate3d(0, -2px, 0); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); } .modal-button:active { - transform: translateY(0) scale(0.98); + transform: translate3d(0, 0, 0) scale(0.98); } .pix-code-area { @@ -381,10 +390,10 @@ font-family: monospace; font-size: 0.9em; color: #333; - transform: translateY(-10px); + transform: translate3d(0, -10px, 0); opacity: 0; cursor: pointer; - transition: all 0.2s ease; + transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease; border: 2px solid transparent; position: relative; contain: layout style paint; @@ -412,18 +421,17 @@ .pix-code-area:hover { background: #e8f5f3; border-color: #32BCAD; - transform: scale(1.02); + transform: translate3d(0, 0, 0) scale(1.01); } .pix-code-area.active { display: block; - animation: slideInFade 0.4s ease forwards; + animation: slideInFade 0.3s ease forwards; will-change: transform, opacity; } @keyframes slideInFade { - 0% { transform: translateY(-10px); opacity: 0; } - 100% { transform: translateY(0); opacity: 1; } + to { transform: translate3d(0, 0, 0); opacity: 1; } } .copy-notification { @@ -431,18 +439,17 @@ color: #00A86B; font-weight: bold; display: none; - transform: scale(0.8); + transform: scale3d(0.8, 0.8, 1); opacity: 0; } .copy-notification.active { display: block; - animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; + animation: popIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards; } @keyframes popIn { - 0% { transform: scale(0.8); opacity: 0; } - 100% { transform: scale(1); opacity: 1; } + to { transform: scale3d(1, 1, 1); opacity: 1; } } .small-icons { @@ -457,31 +464,70 @@ .small-icon { width: 36px; height: 36px; - background: rgba(255, 255, 255, 0.1); - backdrop-filter: blur(10px); + background: rgba(255, 255, 255, 0.15); border-radius: 8px; display: flex; justify-content: center; align-items: center; border: 1px solid rgba(255, 255, 255, 0.2); - transition: all 0.3s ease; + transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease; text-decoration: none; position: relative; z-index: 1; + transform: translate3d(0, 0, 0); } .small-icon:hover { - background: rgba(255, 255, 255, 0.2); - transform: scale(1.15); - box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); + background: rgba(255, 255, 255, 0.25); + transform: scale3d(1.15, 1.15, 1); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); } + /* Suporte para dispositivos com preferência por movimento reduzido */ + @media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } + + body::before { + animation: none !important; + background: #20337b; + } + } + + /* Otimização para dispositivos touch (geralmente menos potentes) */ + @media (pointer: coarse) { + /* Remove efeitos hover complexos em touch devices */ + .pix-button::before, + .modal-button::after { + display: none; + } + + /* Simplifica sombras */ + .icon-box, + .small-icon, + .save-contact, + .pix-button { + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); + } + } + + /* Otimizações para telas menores e dispositivos menos potentes */ @media (max-width: 600px) { .header h1 { font-size: 1.5em; } .header p { font-size: 0.8em; } .icon-box { width: 60px; height: 60px; } .icon-box svg { width: 28px; height: 28px; } .icon-label { font-size: 0.65em; } + + /* Reduz complexidade de animações em mobile */ + body::before { + animation-duration: 25s; + } } @@ -605,13 +651,19 @@ const openPixModal = () => { pixModal.classList.add('active'); - setTimeout(() => pixValue.focus(), 100); + setTimeout(() => { + pixValue.focus(); + // Remove will-change após animação completar + setTimeout(() => { + modalContent.style.willChange = 'auto'; + }, 300); + }, 100); }; const closePixModal = () => { const animStyle = (elem, anim) => elem.style.animation = anim; - animStyle(modalContent, 'slideDownScale 0.3s ease forwards'); - animStyle(pixModal, 'fadeOut 0.3s ease forwards'); + animStyle(modalContent, 'slideDownScale 0.25s ease forwards'); + animStyle(pixModal, 'fadeOut 0.25s ease forwards'); setTimeout(() => { pixModal.classList.remove('active'); @@ -620,7 +672,9 @@ pixValue.value = ''; pixCodeArea.classList.remove('active'); copyNotification.classList.remove('active'); - }, 300); + // Remove will-change para economizar recursos + modalContent.style.willChange = 'auto'; + }, 250); }; const generatePix = () => {