@tailwind base;
@tailwind components;
@tailwind utilities;

/* Global Focus Reset */
*:focus {
    outline: none !important;
}

body {
    background-color: #0a0a0a;
    color: #f5f5f5;
    cursor: none;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Show default cursor on touch devices */
@media (pointer: coarse) {
    body {
        cursor: auto;
    }
    a, button, input, textarea, select, .hover-trigger {
        cursor: pointer !important;
    }
}

/* FORCE CURSOR HIDDEN ON INTERACTIVE ELEMENTS (desktop only) */
@media (pointer: fine) {
    a, button, input, textarea, select,
    [type="button"], [type="submit"],
    .hover-trigger {
        cursor: none !important;
    }
}

/* Custom Cursor Base Styles */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    transition: width 0.2s, height 0.2s, background-color 0.2s, border-color 0.2s;
}

/* White Mode */
.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: white;
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Hover State on Dark Background */
body:hover .cursor-outline.hovered {
    width: 80px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: transparent;
}

/* Dark Mode (For White Backgrounds) */
.cursor-dot.dark {
    background-color: #0a0a0a !important;
}

.cursor-outline.dark {
    border-color: rgba(0, 0, 0, 0.5) !important;
}

/* Hover State on Light Background */
body:hover .cursor-outline.dark.hovered {
    width: 80px;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.05) !important;
    border-color: transparent !important;
}

/* Hide cursor on touch devices */
@media (pointer: coarse) {
    .cursor-dot, .cursor-outline {
        display: none !important;
    }
}

/* Precise Hamburger Animation */
.hamburger {
    width: 30px;
    height: 20px;
    position: relative;
    transform: rotate(0deg);
    transition: .5s ease-in-out;
    cursor: pointer;
}

.hamburger span {
    display: block;
    position: absolute;
    height: 2px;
    width: 100%;
    background: white;
    border-radius: 9px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: .25s ease-in-out;
}

.hamburger span:nth-child(1) { top: 0px; }
.hamburger span:nth-child(2) { top: 9px; }
.hamburger span:nth-child(3) { top: 18px; }

.hamburger.active span:nth-child(1) {
    top: 9px;
    transform: rotate(135deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
    left: -60px;
}
.hamburger.active span:nth-child(3) {
    top: 9px;
    transform: rotate(-135deg);
}

/* Hero Styles */
.hero-text-stroke {
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.15);
    color: transparent;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.blend-difference {
    mix-blend-mode: difference;
}

/* Animated Grain Background */
.bg-grain {
    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");
}

/* Image Hover Effects */
.portfolio-item,
.portfolio-card {
    position: relative;
    overflow: hidden;
}

.portfolio-item img,
.portfolio-card img {
    transition: transform 0.7s cubic-bezier(0.2, 1, 0.3, 1), filter 0.5s;
}

.portfolio-item:hover img,
.portfolio-card:hover img {
    transform: scale(1.1);
    filter: grayscale(100%) contrast(120%);
}

.portfolio-overlay {
    background: linear-gradient(to top, black, transparent);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #0a0a0a;
}
::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.outlined-text {
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.3);
    color: transparent;
    transition: all 0.3s ease;
}
.outlined-text:hover {
    -webkit-text-stroke: 0px;
    color: #FF3B30;
}

/* Footer */
.footer-link {
    position: relative;
    display: inline-block;
}
.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0%;
    height: 2px;
    background: #FF3B30;
    transition: width 0.4s ease;
}
.footer-link:hover::after {
    width: 100%;
}

/* Mobile Menu Styles */
.mobile-link {
    position: relative;
    display: inline-block;
}
.mobile-link::before {
    content: attr(data-index);
    position: absolute;
    top: 0;
    left: -30px;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    color: #FF3B30;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
}
.mobile-link:hover::before {
    opacity: 1;
    transform: translateX(0);
}

/* Page Loader */
#page-loader {
    transition: opacity 0.6s ease;
}
#page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}
.loader-bar {
    width: 0%;
}

/* Portfolio Filter Active State */
.portfolio-filter.active {
    color: #FF3B30;
}

/* Select styling for dark theme */
select option {
    background-color: #121212;
    color: #f5f5f5;
}

/* FAQ hover states */
.faq-answer {
    transition: all 0.3s ease;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .hero-text-stroke {
        font-size: 20vw;
    }
    .mobile-link::before {
        left: -20px;
        font-size: 0.7rem;
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background-color: #FF3B30;
    color: white;
}
::-moz-selection {
    background-color: #FF3B30;
    color: white;
}

/* Input autofill fix for dark theme */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: #f5f5f5;
    -webkit-box-shadow: 0 0 0px 1000px #0a0a0a inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Prevent text selection on decorative elements */
.hero-text-stroke,
.vertical-text {
    user-select: none;
    -webkit-user-select: none;
}

/* Better focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #FF3B30 !important;
    outline-offset: 2px;
}

/* Loading state for buttons */
button:disabled {
    opacity: 0.7;
    cursor: not-allowed !important;
}

/* Image loading placeholder */
img {
    background-color: #1a1a1a;
}

/* Prevent layout shift */
img[src] {
    background-color: transparent;
}

/* Ensure hero animations work even without GSAP */
.hero-anim {
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.2s ease;
}
#hero-card {
    transition: transform 1.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.5s ease;
}