/* ========================================
   CUSTOM STYLES
   Portfolio - Iqbal Baihaqi Abdullah
   Software Engineer & Frontend Developer Indonesia
   ======================================== */

/* ========================================
   ACCESSIBILITY - Screen Reader Only
   ======================================== */
.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;
}

.sr-only:focus,
.focus\:not-sr-only:focus {
    position: absolute;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus visible styles for better accessibility */
:focus-visible {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

::selection {
    background: #00ff88;
    color: #0a0a0a;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #00ff88;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00cc6a;
}

/* ========================================
   LOADER STYLES
   ======================================== */
.loader-text span {
    display: inline-block;
    transform: translateY(100%);
}

/* ========================================
   GRID BACKGROUND
   ======================================== */
.grid-bg {
    background-image: 
        linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    background-position: center center;
}

/* ========================================
   FLOATING ANIMATION
   ======================================== */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

.floating-element {
    animation: float 6s ease-in-out infinite;
}

/* ========================================
   SCROLL INDICATOR
   ======================================== */
@keyframes scroll-pulse {
    0%, 100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    50% {
        opacity: 0.5;
        transform: translateX(-50%) translateY(10px);
    }
}

.scroll-indicator {
    animation: scroll-pulse 2s ease-in-out infinite;
}

/* ========================================
   NAVBAR STYLES
   ======================================== */
#navbar.scrolled {
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ========================================
   CURSOR FOLLOWER
   ======================================== */
#cursor, #cursor-trail {
    transition: transform 0.1s ease-out, width 0.3s, height 0.3s, opacity 0.3s;
}

#cursor.hover {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 2px solid #00ff88;
}

#cursor-trail.hover {
    width: 60px;
    height: 60px;
}

/* ========================================
   CARD HOVER EFFECTS
   ======================================== */
.skill-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(0, 255, 136, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.5s;
    border-radius: inherit;
}

.skill-card:hover::before {
    opacity: 1;
}

.project-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
    transform: scaleX(0);
    transition: transform 0.5s;
}

.project-card:hover::before {
    transform: scaleX(1);
}

/* ========================================
   TEXT ANIMATIONS
   ======================================== */
.hero-title,
.hero-subtitle,
.hero-desc,
.hero-cta {
    opacity: 0;
}

/* ========================================
   STAT COUNTER ANIMATION
   ======================================== */
.stat-item {
    position: relative;
}

.stat-item::after {
    content: '+';
    position: absolute;
    top: 0;
    right: -0.5em;
    font-size: 0.5em;
    color: #00ff88;
}

/* ========================================
   GLITCH EFFECT (OPTIONAL)
   ======================================== */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

.glitch:hover {
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

/* ========================================
   GRADIENT TEXT ANIMATION
   ======================================== */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

/* ========================================
   BUTTON STYLES
   ======================================== */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

/* ========================================
   FORM STYLES
   ======================================== */
input:focus,
textarea:focus {
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.1);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff;
    -webkit-box-shadow: 0 0 0px 1000px #141414 inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* ========================================
   MOBILE MENU
   ======================================== */
#menu-toggle.active span:first-child {
    transform: translateY(4px) rotate(45deg);
}

#menu-toggle.active span:last-child {
    transform: translateY(-4px) rotate(-45deg);
}

/* ========================================
   REVEAL ANIMATIONS
   ======================================== */
.reveal {
    opacity: 0;
    transform: translateY(50px);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   MAGNETIC BUTTON EFFECT
   ======================================== */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   NOISE TEXTURE (OPTIONAL)
   ======================================== */
.noise::before {
    content: '';
    position: fixed;
    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='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 9999;
}

/* ========================================
   LINE DECORATIONS
   ======================================== */
.line-decoration {
    position: relative;
}

.line-decoration::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background: #00ff88;
    transition: width 0.3s ease;
}

.line-decoration:hover::before {
    width: 100%;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
    .grid-bg {
        background-size: 40px 40px;
    }
    
    .floating-element {
        display: none;
    }
}

/* ========================================
   SMOOTH PAGE TRANSITIONS
   ======================================== */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: 10001;
    transform: translateY(-100%);
}

/* ========================================
   TOOLTIP STYLES
   ======================================== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #00ff88;
    color: #0a0a0a;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* ========================================
   PARALLAX ELEMENTS
   ======================================== */
.parallax {
    will-change: transform;
}

/* ========================================
   STAGGER ANIMATION DELAYS
   ======================================== */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* ========================================
   TECH TAG STYLES
   ======================================== */
.tech-tag {
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.tech-tag:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.3);
    transform: translateY(-2px);
}

.tech-tag i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.tech-tag:hover i {
    transform: scale(1.2);
}

/* ========================================
   TIMELINE STYLES
   ======================================== */
.timeline-item {
    opacity: 0;
    transform: translateY(30px);
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Timeline dot glow effect */
.timeline-item .absolute.w-4 {
    box-shadow: 0 0 20px currentColor;
}

/* Timeline card hover glow */
.timeline-item .group:hover {
    box-shadow: 0 10px 40px -10px rgba(0, 255, 136, 0.2);
}

/* Mobile timeline adjustments */
@media (max-width: 768px) {
    .timeline-item .absolute.w-4 {
        left: -2px;
    }
}

/* ========================================
   PORTFOLIO CARDS STYLES
   ======================================== */
.portfolio-card {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -20px rgba(0, 255, 136, 0.15);
}

.portfolio-card .aspect-video {
    transition: all 0.5s ease;
}

.portfolio-card:hover .aspect-video {
    transform: scale(1.02);
}

/* Line clamp for description */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Portfolio card image shimmer effect */
.portfolio-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.03),
        transparent
    );
    transition: left 0.7s ease;
    pointer-events: none;
}

.portfolio-card:hover::before {
    left: 100%;
}

/* Portfolio Tab Styles */
.portfolio-tab {
    position: relative;
    overflow: hidden;
}

.portfolio-tab.active {
    background: #00ff88 !important;
    color: #0a0a0a !important;
    border-color: #00ff88 !important;
}

.portfolio-tab:not(.active):hover {
    background: rgba(0, 255, 136, 0.1);
}

/* Portfolio card filter animation */
.portfolio-card.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

.portfolio-card.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    position: relative;
    visibility: visible;
}

/* Grid animation */
#portfolio-grid {
    transition: height 0.4s ease;
}
