/* ============================================
   COMPONENTS & EFFECTS
   ============================================ */

/* ---- Noise texture overlay (Apple-style grain) ---- */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.018;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---- Custom scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--black);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-600) var(--black);
}

/* ---- Focus styles ---- */
:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---- Smooth image loading ---- */
img {
    opacity: 1;
    transition: opacity 0.4s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded,
img[loading="lazy"][complete] {
    opacity: 1;
}

/* ---- Page transition fade-in ---- */
body {
    animation: pageIn 0.6s ease forwards;
}

@keyframes pageIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- Magnetic hover effect for cards ---- */
.magnetic {
    transition: transform 0.2s ease;
}

/* ---- Skip link (accessibility) ---- */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-sm);
    padding: 0.5rem 1rem;
    background: var(--blue);
    color: white;
    border-radius: var(--border-radius-sm);
    font-size: var(--text-sm);
    z-index: 10000;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: var(--space-sm);
}
