/* ==========================================================================
   WILLIAM CANDRA PORTFOLIO - CUSTOM STYLES
   Grunge & Edgy Aesthetic
   ========================================================================== */

/* ==========================================================================
   ROOT & RESET
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* ==========================================================================
   GRUNGE TEXTURES & OVERLAYS
   ========================================================================== */

/* Grain/Noise Overlay */
.grain-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='2.5' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    z-index: 1;
}

/* Grunge Border Effect */
.border-grunge {
    position: relative;
    border: 8px solid #FFFFFF;
    box-shadow: 0 0 0 2px #000000;
}

.border-grunge::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

/* ==========================================================================
   LOADING SCREEN
   ========================================================================== */

#loading-screen {
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

#navbar {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#navbar.scrolled {
    background: rgba(0, 0, 0, 0.95);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.nav-link,
.mobile-nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #FFFFFF;
    transition: width 0.3s ease;
}

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

/* Mobile Menu Animation */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#mobile-menu.active {
    max-height: 500px;
}

/* Hamburger Animation */
#mobile-menu-btn.active .hamburger-top {
    transform: rotate(45deg) translate(5px, 5px);
}

#mobile-menu-btn.active .hamburger-middle {
    opacity: 0;
}

#mobile-menu-btn.active .hamburger-bottom {
    transform: rotate(-45deg) translate(7px, -6px);
}

.hamburger-top,
.hamburger-middle,
.hamburger-bottom {
    transition: all 0.3s ease;
    transform-origin: center;
}

/* ==========================================================================
   TYPOGRAPHY & TEXT EFFECTS
   ========================================================================== */

/* Glitch Text Effect (Subtle) */
.glitch-text {
    position: relative;
    animation: glitch-skew 5s infinite linear alternate-reverse;
}

@keyframes glitch-skew {
    0% {
        transform: skew(0deg);
    }
    10% {
        transform: skew(0deg);
    }
    10.1% {
        transform: skew(-1deg);
    }
    10.2% {
        transform: skew(0deg);
    }
    20% {
        transform: skew(0deg);
    }
    20.1% {
        transform: skew(1deg);
    }
    20.2% {
        transform: skew(0deg);
    }
    100% {
        transform: skew(0deg);
    }
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */

#home {
    position: relative;
    background: linear-gradient(135deg, #000000 0%, #0A0A0A 100%);
}

/* Snake Animation */
.snake-animation {
    animation: snake-float 8s ease-in-out infinite;
}

@keyframes snake-float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-20px) translateX(10px);
    }
}

/* Scroll Indicator */
#home .animate-bounce {
    animation: bounce 2s infinite;
}

/* ==========================================================================
   ABOUT SECTION
   ========================================================================== */

.profile-photo {
    transition: all 0.5s ease;
    filter: grayscale(50%);
}

.profile-photo:hover {
    filter: grayscale(0%);
    transform: scale(1.05);
}

/* Show More Button */
#show-more-btn {
    position: relative;
    overflow: hidden;
}

#show-more-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    transition: left 0.3s ease;
    z-index: -1;
}

#show-more-btn:hover::before {
    left: 0;
}

/* ==========================================================================
   PORTFOLIO SECTION
   ========================================================================== */

/* Filter Buttons */
.filter-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.filter-btn.active {
    background: #FFFFFF;
    color: #000000;
}

.filter-btn:not(.active)::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    transition: left 0.3s ease;
    z-index: -1;
}

.filter-btn:not(.active):hover::before {
    left: 0;
}

/* Portfolio Grid Animation */
.portfolio-item {
    opacity: 1;
    transform: scale(1);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-item.hide {
    opacity: 0;
    transform: scale(0.8);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Portfolio Cards */
.portfolio-card {
    position: relative;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.portfolio-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.portfolio-card img {
    transition: all 0.5s ease;
}

.portfolio-card:hover img {
    transform: scale(1.1);
}

/* Portfolio Overlay with Grunge Effect */
.portfolio-overlay {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(10, 10, 10, 0.95) 100%);
}

.portfolio-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.1;
    pointer-events: none;
}

/* View Project Button */
.view-project-btn {
    position: relative;
    overflow: hidden;
    z-index: 10;
}

.view-project-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    transition: left 0.3s ease;
    z-index: -1;
}

.view-project-btn:hover::before {
    left: 0;
}

/* ==========================================================================
   PORTFOLIO MODAL
   ========================================================================== */

#portfolio-modal {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

#portfolio-modal.hidden {
    animation: fadeOut 0.3s ease-out;
}

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

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

#close-modal {
    background: rgba(0, 0, 0, 0.8);
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

#modal-image {
    border: 4px solid #FFFFFF;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   CONTACT SECTION
   ========================================================================== */

.social-link {
    position: relative;
    overflow: hidden;
}

.social-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    transition: left 0.3s ease;
    z-index: -1;
}

.social-link:hover::before {
    left: 0;
}

/* ==========================================================================
   BUTTONS & INTERACTIVE ELEMENTS
   ========================================================================== */

.btn-primary,
.btn-secondary {
    position: relative;
    overflow: hidden;
    display: inline-block;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5);
}

.btn-primary::after,
.btn-secondary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    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;
}

.btn-primary:hover::after,
.btn-secondary:hover::after {
    width: 300px;
    height: 300px;
}

/* ==========================================================================
   SCROLL REVEAL ANIMATIONS
   ========================================================================== */

.reveal-element {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Stagger Animation */
.reveal-element:nth-child(1) {
    transition-delay: 0.1s;
}

.reveal-element:nth-child(2) {
    transition-delay: 0.2s;
}

.reveal-element:nth-child(3) {
    transition-delay: 0.3s;
}

.reveal-element:nth-child(4) {
    transition-delay: 0.4s;
}

/* ==========================================================================
   PARALLAX EFFECTS
   ========================================================================== */

.parallax-section {
    transform: translateY(var(--parallax-offset, 0));
    transition: transform 0.1s linear;
}

/* ==========================================================================
   RESPONSIVE UTILITIES
   ========================================================================== */

@media (max-width: 768px) {
    .border-grunge {
        border-width: 4px;
    }

    .glitch-text {
        animation: none;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Focus Styles */
a:focus,
button:focus {
    outline: 2px solid #FFFFFF;
    outline-offset: 4px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ==========================================================================
   SELECTION STYLES
   ========================================================================== */

::selection {
    background: #FFFFFF;
    color: #000000;
}

::-moz-selection {
    background: #FFFFFF;
    color: #000000;
}

/* ==========================================================================
   SCROLLBAR STYLING
   ========================================================================== */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #000000;
}

::-webkit-scrollbar-thumb {
    background: #666666;
    border: 2px solid #000000;
}

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

/* ==========================================================================
   PERFORMANCE OPTIMIZATIONS
   ========================================================================== */

/* GPU Acceleration */
.portfolio-card,
.btn-primary,
.btn-secondary,
.filter-btn,
.nav-link {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Image Optimization */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    #loading-screen,
    #navbar,
    .grain-overlay,
    footer {
        display: none;
    }

    body {
        background: #FFFFFF;
        color: #000000;
    }
}

/* ==========================================================================
   CUSTOM UTILITIES
   ========================================================================== */

.text-shadow-grunge {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.box-shadow-grunge {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Border Animations */
.border-animate {
    position: relative;
}

.border-animate::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid #FFFFFF;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.border-animate:hover::before {
    opacity: 1;
}

/* ==========================================================================
   END OF STYLESHEET
   ========================================================================== */
