Optimize CSS for mobile and desktop: implement smooth scrolling for desktop only, enhance card and glass component styles for better performance on mobile, and ensure backdrop-blur effects are applied conditionally based on screen size.

This commit is contained in:
PEDZEO
2026-01-20 01:39:20 +03:00
parent 13f6380763
commit d77d3ffd24

View File

@@ -102,19 +102,34 @@
html {
overflow-x: hidden;
}
/* Smooth scroll only on desktop - mobile uses native */
@media (min-width: 1024px) {
html {
scroll-behavior: smooth;
}
}
/* Dark theme (default) */
body, .dark body {
@apply bg-dark-950 text-dark-100 font-sans antialiased;
overscroll-behavior-y: contain;
/* iOS smooth scrolling */
-webkit-overflow-scrolling: touch;
}
/* Optimize main scrollable content */
main {
/* Prevent layout shifts during scroll */
contain: layout style;
}
/* Light theme - Champagne */
.light body {
@apply bg-champagne-200 text-champagne-900 font-sans antialiased;
overscroll-behavior-y: contain;
-webkit-overflow-scrolling: touch;
}
/* Light theme text color overrides - convert dark-* text colors to readable colors */
@@ -310,10 +325,19 @@
@layer components {
/* ========== DARK THEME COMPONENTS (default) ========== */
/* Cards - Dark */
/* Cards - Dark (optimized for mobile) */
.card {
@apply bg-dark-900/50 backdrop-blur-sm rounded-2xl border border-dark-800/50 p-5 sm:p-6
@apply bg-dark-900/70 rounded-2xl border border-dark-800/50 p-5 sm:p-6
transition-all duration-300 ease-smooth;
/* GPU acceleration for smooth scroll */
transform: translateZ(0);
}
/* Enable backdrop-blur only on desktop */
@media (min-width: 1024px) {
.card {
@apply bg-dark-900/50 backdrop-blur-sm;
}
}
.card-hover {
@@ -329,9 +353,19 @@
@apply card animate-slide-up;
}
/* Glass effect - Dark */
/* Glass effect - Dark (optimized for mobile) */
.glass {
@apply bg-dark-900/30 backdrop-blur-xl border border-dark-700/30;
@apply bg-dark-900/80 border border-dark-700/30;
/* GPU acceleration */
transform: translateZ(0);
will-change: transform;
}
/* Enable backdrop-blur only on desktop where it's performant */
@media (min-width: 1024px) {
.glass {
@apply bg-dark-900/30 backdrop-blur-xl;
}
}
/* Buttons - Dark */