/* Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: auto;
}

/* Focus Styles */
*:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: var(--radius-2xl);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

[class*="rounded-full"]:focus-visible {
    border-radius: var(--radius-full);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--glass-bg) 80%, transparent);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--accent-color) 60%, transparent);
    background-clip: padding-box;
}

.search-history-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-history-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.search-history-dropdown::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--glass-bg) 80%, transparent);
    border-radius: var(--radius-full);
}

/* Utilities */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Performance Optimizations */
nav:where(.sticky, .fixed),
.sticky,
.fixed {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
}

[class*="grid"]>* {
    content-visibility: auto;
    contain-intrinsic-size: auto 400px;
    contain: layout style paint;
}

[class*="grid"]>a {
    animation: fadeInUp 0.2s ease-out;
}

img {
    content-visibility: auto;
    transform: translateZ(0);
}

body.scrolling * {
    pointer-events: none !important;
}

.group:hover img,
.glass-card,
nav {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

[class*="badge"],
[class*="Badge"] {
    contain: layout style;
}

.search-history-dropdown {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}