/* Soft Grain Texture */
.bg-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 50;
    opacity: 0.3;
}

html.dark .bg-grain {
    opacity: 0.15;
}

/* Disable grain on mobile for performance */
@media (max-width: 768px) {
    .bg-grain {
        display: none;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: #d4d4d4;
    border-radius: 10px;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #404040;
}

::-webkit-scrollbar-thumb:hover {
    background: #a3a3a3;
}

/* Smooth Text Transition */
.text-fade {
    transition: opacity 0.3s ease-in-out;
}

.text-fade.hidden-text {
    opacity: 0;
}

/* Magnetic Button Effect Base */
.magnetic-wrap {
    display: inline-block;
    position: relative;
}

/* Minimal Tilt */
.tilt-card {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-style: preserve-3d;
}

.tilt-card:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(2deg) scale(1.01);
}

/* Focus Glow for Inputs */
.input-group:focus-within label {
    color: #818cf8;
}

.input-group:focus-within .input-underline {
    width: 100%;
    background-color: #818cf8;
}

/* Hero Parallax */
.hero-parallax {
    will-change: transform;
}

/* Nav Underline */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link.active {
    color: #000000;
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

html.dark .nav-link.active {
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Artistic Red Streak */
.red-streak {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg,
            transparent,
            rgba(239, 68, 68, 0.4),
            transparent);
    top: 45%;
    left: 0;
    opacity: 0.6;
}

@layer base {
    /* Override warna text autofill */
    input:-webkit-autofill,
    textarea:-webkit-autofill,
    select:-webkit-autofill {
        -webkit-text-fill-color: inherit !important;
        transition: background-color 5000s ease-in-out 0s;
    }

    /* SOLUSI BLUE BOX (Updated) */
    /* Light Mode */
    input:-webkit-autofill {
        -webkit-box-shadow: 0 0 0px 1000px #fafafa inset !important;
    }

    /* Dark Mode */
    .dark input:-webkit-autofill {
        -webkit-box-shadow: 0 0 0px 1000px #0a0a0a inset !important;
        -webkit-text-fill-color: #fff !important;
    }
}

.input-underline {
    background-color: #ef4444;
}

.dark .input-underline {
    background-color: #f87171;
}

/* Ensure mobile menu button is visible on mobile */
@media (max-width: 767px) {
    #mobile-menu-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

@media (min-width: 768px) {
    #mobile-menu-toggle {
        display: none !important;
    }
}

/* Landscape mode fixes for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #hero {
        min-height: 100vh;
        height: auto;
        padding-top: 4rem;
        padding-bottom: 2rem;
    }
    #hero h1 {
        font-size: 2.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    #hero .mt-6 {
        margin-top: 1rem !important;
    }
}

/* Tech Slider Swipeable */
#tech-slider-container {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

#tech-slider-container::-webkit-scrollbar {
    display: none;
}

#tech-slider {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: pan-x;
}

#tech-slider.active {
    cursor: grabbing;
}

/* Disable tilt effect on mobile for performance */
@media (max-width: 768px) {
    .tilt-card:hover {
        transform: none;
    }
    
    .hero-parallax {
        will-change: auto;
    }
}

/* ============================================
   EDITORIAL MAGAZINE PROJECTS SECTION
   ============================================ */

/* Section base - support light/dark mode */
.editorial-projects {
    background: #ffffff;
}

html.dark .editorial-projects {
    background: #050505;
}

/* Editorial reveal animations - optimized for performance */
.editorial-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease-out,
                transform 0.6s ease-out;
    transition-delay: var(--reveal-delay, 0s);
}

.editorial-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Image cluster container */
.image-cluster {
    perspective: 1000px;
}

/* Cluster image base styles - optimized for performance */
.cluster-img {
    transition: transform 0.4s ease-out,
                box-shadow 0.4s ease-out;
    will-change: transform;
}

.cluster-img img.img-inner,
.cluster-img .img-inner {
    transition: transform 0.4s ease-out,
                filter 0.4s ease-out;
    will-change: transform;
}

/* Hover effects on image cluster - simplified */
.editorial-project:hover .cluster-img img.img-inner,
.editorial-project:hover .cluster-img .img-inner {
    filter: brightness(1.05);
}

.editorial-project:hover .main-img {
    transform: scale(1.01);
}

.editorial-project:hover .support-img-1 {
    transform: scale(1.02) translateY(-5px);
}

.editorial-project:hover .support-img-2 {
    transform: scale(1.02) translateX(3px);
}

/* Individual image hover for subtle movement */
.cluster-img:hover img.img-inner,
.cluster-img:hover .img-inner {
    transform: scale(1.03);
}

/* Editorial CTA link styles */
.editorial-cta {
    position: relative;
}

.editorial-cta::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease-out;
}

.editorial-cta:hover::before {
    width: calc(100% - 80px);
}

/* Remove staggered animation delays - simplified for performance */
.cluster-img {
    transition-delay: 0s;
}

/* Elegant serif typography enhancements */
.font-serif {
    font-feature-settings: 'liga' 1, 'kern' 1;
    text-rendering: optimizeLegibility;
}

/* Project article separator line animation - optimized */
.editorial-project {
    position: relative;
}

.editorial-project::after {
    content: '';
    position: absolute;
    bottom: -4rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(115,115,115,0.3), transparent);
    transition: width 0.8s ease-out;
}

html.dark .editorial-project::after {
    background: linear-gradient(90deg, transparent, #333, transparent);
}

.editorial-project.revealed::after {
    width: 60%;
}

.editorial-project:last-of-type::after {
    display: none;
}

/* Mobile responsive adjustments */
@media (max-width: 1023px) {
    /* Keep asymmetrical positioning for mobile zig-zag */
    .image-cluster {
        height: 350px !important;
    }
    
    /* Project with images on left (Row A) - keep left */
    .editorial-project:nth-child(odd) .cluster-img.support-img-2 {
        left: 0 !important;
        right: auto !important;
    }
    
    .editorial-project:nth-child(odd) .cluster-img.support-img-3 {
        right: 0 !important;
        left: auto !important;
    }
    
    /* Project with images on right (Row B) - keep right */
    .editorial-project:nth-child(even) .cluster-img.support-img-2 {
        right: 0 !important;
        left: auto !important;
    }
    
    .editorial-project:nth-child(even) .cluster-img.support-img-3 {
        left: 0 !important;
        right: auto !important;
    }
}

@media (max-width: 640px) {
    .image-cluster {
        height: 280px !important;
    }
    
    .editorial-project::after {
        bottom: -2rem;
    }
    
    .editorial-project.revealed::after {
        width: 80%;
    }
}

/* Smooth scroll offset for section */
#projects {
    scroll-margin-top: 60px;
}

/* Remove float animations for better performance */

/* Support light/dark mode properly */
html:not(.dark) .editorial-projects {
    background: #ffffff !important;
}

html.dark .editorial-projects {
    background: #050505 !important;
}
