@tailwind base;
@tailwind components;
@tailwind utilities;

/* Custom Utilities */
.hero-bg {
    background: radial-gradient(circle at 50% 0%, #1f3a52 0%, #0b141d 80%);
    position: relative;
}

.hero-bg::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, #f8f9f7, transparent);
    pointer-events: none;
}

.footer-card {
    background-color: #4a3a34;
    border-radius: 2rem;
}

/* Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.stagger-1 {
    transition-delay: 100ms;
}

.stagger-2 {
    transition-delay: 200ms;
}

.stagger-3 {
    transition-delay: 300ms;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Gradient Text */
.text-gradient {
    background: linear-gradient(135deg, #60a5fa 0%, #2dd4bf 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Daily Logo System ── */
#logo { display: inline-block; cursor: default; }

/* Hover: glow */
#logo.logo-hover-glow { transition: text-shadow 0.3s ease; }
#logo.logo-hover-glow:hover {
    text-shadow: 0 0 14px rgba(96,165,250,0.9),
                 0 0 32px rgba(96,165,250,0.5),
                 0 0 60px rgba(96,165,250,0.3);
}

/* Hover: glitch */
#logo.logo-hover-glitch { position: relative; }
#logo.logo-hover-glitch::before,
#logo.logo-hover-glitch::after {
    content: 'PIForge';
    position: absolute;
    left: 0; top: 0;
    font-weight: bold;
    font-size: inherit;
    opacity: 0;
    pointer-events: none;
}
#logo.logo-hover-glitch:hover::before {
    opacity: 1;
    color: #60a5fa;
    animation: glitch-a 0.32s steps(1) infinite;
}
#logo.logo-hover-glitch:hover::after {
    opacity: 1;
    color: #f472b6;
    animation: glitch-b 0.32s steps(1) infinite;
}
@keyframes glitch-a {
    0%   { clip-path: inset(8%  0 72% 0); transform: translateX(-3px); }
    25%  { clip-path: inset(58% 0 12% 0); transform: translateX( 3px); }
    50%  { clip-path: inset(28% 0 42% 0); transform: translateX(-2px); }
    75%  { clip-path: inset(78% 0  6% 0); transform: translateX( 2px); }
    100% { clip-path: inset(8%  0 72% 0); transform: translateX(-3px); }
}
@keyframes glitch-b {
    0%   { clip-path: inset(68% 0 12% 0); transform: translateX( 3px); }
    25%  { clip-path: inset(12% 0 58% 0); transform: translateX(-3px); }
    50%  { clip-path: inset(38% 0 32% 0); transform: translateX( 2px); }
    75%  { clip-path: inset( 4% 0 78% 0); transform: translateX(-2px); }
    100% { clip-path: inset(68% 0 12% 0); transform: translateX( 3px); }
}

/* ── Typewriter cursor ── */
.typewriter-cursor {
    display: inline-block;
    width: 3px;
    height: 0.8em;
    background: #60a5fa;
    margin-left: 4px;
    vertical-align: middle;
    border-radius: 2px;
    animation: blink 0.8s step-end infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ── Particle canvas ── */
#hero-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
}

/* ── Glow card border ── */
@keyframes glow-border {
    0%   { box-shadow: 0 0 0px 0px rgba(96,165,250,0); }
    50%  { box-shadow: 0 0 24px 6px rgba(96,165,250,0.22); }
    100% { box-shadow: 0 0 0px 0px rgba(96,165,250,0); }
}
.glow-card { animation: glow-border 3s ease-in-out infinite; }

/* ── Fade-up hero elements ── */
@keyframes hero-up {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hero-title { animation: hero-up 0.9s cubic-bezier(0.16,1,0.3,1) 0.2s both; }
.hero-sub   { animation: hero-up 0.9s cubic-bezier(0.16,1,0.3,1) 0.4s both; }
.hero-btns  { animation: hero-up 0.9s cubic-bezier(0.16,1,0.3,1) 0.6s both; }

/* ── Scroll mouse dot ── */
@keyframes scroll-dot {
    0%   { transform: translateY(0);   opacity: 1; }
    60%  { transform: translateY(10px); opacity: 0; }
    61%  { transform: translateY(0);   opacity: 0; }
    100% { transform: translateY(0);   opacity: 1; }
}

/* ── Scroll progress bar ── */
#scroll-progress {
    position: fixed;
    top: 0; left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, #60a5fa, #2dd4bf);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ── Nav scroll blur ── */
nav.scrolled, header.scrolled {
    background: rgba(22, 38, 53, 0.85) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.06);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* ── Back to Top ── */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #162635;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}
#back-to-top:hover { background: #0b141d; }


/* ── Page transition ── */
.page-fade {
    animation: pageFadeIn 0.4s ease both;
}
@keyframes pageFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Feature card icon pop ── */
@keyframes icon-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.2) rotate(-5deg); }
    100% { transform: scale(1.1); }
}
.feature-card:hover .feature-icon {
    animation: icon-pop 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

/* ── Gauge animation ── */
@keyframes gauge-fill {
    from { stroke-dashoffset: 351; }
    to   { stroke-dashoffset: 80; }
}
.gauge-arc {
    animation: gauge-fill 2s cubic-bezier(0.16,1,0.3,1) 0.5s both;
}
@keyframes gauge-pulse {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(74,222,128,0.4)); }
    50%       { filter: drop-shadow(0 0 16px rgba(74,222,128,0.8)); }
}
.gauge-arc-glow {
    animation: gauge-fill 2s cubic-bezier(0.16,1,0.3,1) 0.5s both,
               gauge-pulse 2.5s ease-in-out 2.5s infinite;
}

/* ── Marquee ── */
@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee 24s linear infinite;
}
.marquee-wrap {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
}

/* ── Mobile Menu ── */
#mobile-menu.is-open {
    animation: menuFadeIn 0.2s ease both;
}
@keyframes menuFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Mobile fixes ── */
@media (max-width: 767px) {
    /* Hero buttons: stack vertically on small screens */
    .hero-btns {
        flex-direction: column;
        align-items: center;
        gap: 1rem !important;
    }
    .hero-btns a {
        width: 100%;
        max-width: 300px;
        text-align: center;
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    /* Nav touch target: ensure hamburger is easily tappable */
    #mobile-menu-btn {
        padding: 0.5rem;
        margin-right: -0.5rem;
    }

    /* Nav bar height reduction on mobile */
    nav, body > header:not(.hero-bg) {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    /* Mobile menu links: left-aligned */
    #mobile-menu a {
        text-align: left;
    }

    /* Marketplace filter: allow horizontal scroll if needed */
    .filter-scroll-mobile {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .filter-scroll-mobile::-webkit-scrollbar { display: none; }
}