:root {
    --bg-color: #050505;
    --text-color: #ffffff;
    --accent-color: #7000ff;
    --secondary-accent: #00f3ff;
    --gold: #ffd700;
    --cursor-size: 20px;
    --cursor-outline-size: 40px;

    /* Responsive Typography Variables */
    --fs-h1: clamp(3rem, 8vw, 8rem);
    --fs-h2: clamp(2rem, 5vw, 4rem);
    --fs-h3: clamp(1.5rem, 4vw, 4rem);
    --fs-body: clamp(1rem, 1.5vw, 1.2rem);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: none;
    /* Firefox */
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Space Grotesk', sans-serif;
    overflow-x: hidden;
    -ms-overflow-style: none;
    /* IE/Edge */
    user-select: none;
    -webkit-user-select: none;
    font-size: var(--fs-body);
}

body::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* =========================================
   CURSOR SYSTEM (Progressive Enhancement)
========================================= */
/* Only hide default cursor and show custom cursor on devices with fine pointer (Mouse) */
@media (hover: hover) and (pointer: fine) {
    * {
        cursor: none !important;
    }

    .cursor-dot {
        width: 8px;
        height: 8px;
        background-color: var(--text-color);
        border-radius: 50%;
        position: fixed;
        top: 0;
        left: 0;
        transform: translate(-50%, -50%);
        pointer-events: none;
        z-index: 9999;
        transition: width 0.3s, height 0.3s, background-color 0.3s;
        mix-blend-mode: exclusion;
    }

    .cursor-outline {
        width: var(--cursor-outline-size);
        height: var(--cursor-outline-size);
        border: 1px solid rgba(255, 255, 255, 0.5);
        border-radius: 50%;
        position: fixed;
        top: 0;
        left: 0;
        transform: translate(-50%, -50%);
        pointer-events: none;
        z-index: 9998;
        transition: width 0.2s, height 0.2s, background-color 0.2s;
    }
}

/* On touch devices, ensure default cursor and hide custom elements */
@media (hover: none),
(pointer: coarse) {

    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }

    * {
        cursor: auto !important;
    }
}

/* =========================================
   SCROLL PROGRESS
========================================= */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, var(--accent-color), var(--secondary-accent));
    transform-origin: 0 50%;
    transform: scaleX(0);
    /* Controlled by JS */
    z-index: 10000;
}

/* =========================================
   PAGE TRANSITION & CANVAS
========================================= */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    transform: translateY(100%);
    pointer-events: none;
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.page-transition.active {
    transform: translateY(0);
    pointer-events: all;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.4;
}

/* =========================================
   NAVIGATION
========================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    mix-blend-mode: normal;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.logo {
    font-family: 'Syncopate', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 2px;
    z-index: 1001;
}

.dot {
    color: var(--accent-color);
}

.menu-btn {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
}

.menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: white;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.menu-open .menu-btn span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-open .menu-btn span:nth-child(2) {
    transform: rotate(-45deg) translate(1px, -1px);
    width: 100%;
}

.menu-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background: #000;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: circle(0% at 100% 0%);
    transition: clip-path 0.8s cubic-bezier(0.77, 0, 0.175, 1);
    pointer-events: none;
}

.menu-open .menu-overlay {
    clip-path: circle(150% at 100% 0%);
    pointer-events: all;
}

.menu-links {
    list-style: none;
    text-align: center;
}

.menu-links li {
    margin: 2rem 0;
    overflow: hidden;
}

.menu-links a {
    display: inline-block;
    font-family: 'Syncopate', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.5);
    text-decoration: none;
    position: relative;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.menu-open .menu-links a {
    transform: translateY(0);
}

.menu-open .menu-links li:nth-child(1) a {
    transition-delay: 0.1s;
}

.menu-open .menu-links li:nth-child(2) a {
    transition-delay: 0.2s;
}

.menu-open .menu-links li:nth-child(3) a {
    transition-delay: 0.3s;
}

.menu-open .menu-links li:nth-child(4) a {
    transition-delay: 0.4s;
}

.menu-links a::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    color: white;
    width: 0%;
    overflow: hidden;
    transition: width 0.3s ease-in-out;
    white-space: nowrap;
}

.menu-links a:hover {
    -webkit-text-stroke: 1px white;
}

.menu-links a:hover::before {
    width: 100%;
    color: var(--accent-color);
}

/* =========================================
   HERO SECTION with REAL GLITCH
========================================= */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

.hero-content {
    z-index: 1;
}

/* Glitch Animation Keyframes */
@keyframes glitch-anim {
    0% {
        clip-path: inset(50% 0 30% 0);
        transform: translate(-2px, 2px);
    }

    20% {
        clip-path: inset(10% 0 60% 0);
        transform: translate(2px, -2px);
    }

    40% {
        clip-path: inset(80% 0 5% 0);
        transform: translate(-2px, 2px);
    }

    60% {
        clip-path: inset(15% 0 40% 0);
        transform: translate(2px, -2px);
    }

    80% {
        clip-path: inset(60% 0 10% 0);
        transform: translate(-2px, 2px);
    }

    100% {
        clip-path: inset(40% 0 40% 0);
        transform: translate(0);
    }
}

.glitch-text {
    font-family: 'Syncopate', sans-serif;
    font-size: var(--fs-h1);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: -2px;
    position: relative;
    color: transparent;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.8);
    display: inline-block;

    /* Loading Animation */
    opacity: 0;
    transform: translateY(50px);
    animation: fadeInUp 0.8s ease forwards;
}

/* Stagger delay for 2nd line */
.sub {
    color: white;
    -webkit-text-stroke: 0;
    margin-bottom: 2rem;
    animation-delay: 0.2s;
    /* Stagger */
}

/* Glitch Trigger on Hover */
.glitch-text:hover {
    color: white;
    -webkit-text-stroke: 0;
}

.glitch-text:hover::before,
.glitch-text:hover::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
}

.glitch-text:hover::before {
    left: -2px;
    text-shadow: 2px 0 var(--secondary-accent);
    clip-path: inset(0 0 0 0);
    animation: glitch-anim 0.3s infinite linear alternate-reverse;
}

.glitch-text:hover::after {
    left: 2px;
    text-shadow: -2px 0 red;
    clip-path: inset(0 0 0 0);
    animation: glitch-anim 0.3s infinite linear alternate-reverse;
    animation-delay: 0.1s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-desc {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 3rem;
    line-height: 1.5;
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards 0.5s;
}

.hero-desc span {
    color: var(--secondary-accent);
}

.hero-cta {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards 0.7s;
}

.btn-primary {
    display: inline-block;
    padding: 1rem 3rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    font-family: 'Syncopate', sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.btn-primary:hover {
    background: white;
    color: black;
    transform: scale(1.05);
}

/* =========================================
   WORK SECTION
========================================= */
.work {
    padding: 10vh 5%;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 5rem;
}

.section-header h2 {
    font-family: 'Syncopate', sans-serif;
    font-size: var(--fs-h2);
    color: rgba(255, 255, 255, 0.5);
}

.line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.gallery {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    position: relative;
}

.project-card {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 2rem;
    transition: all 0.5s;
    overflow: hidden;
    /* For bg clip */
    text-decoration: none;
    color: inherit;
    display: block;
    min-height: 300px;
    /* Ensure click area */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* Project Previews - Dynamic Backgrounds */
.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    background-size: cover;
    background-position: center;
    transition: all 0.5s ease;
    z-index: 0;
    filter: grayscale(100%) brightness(0.5);
}

/* Specific Project Backgrounds (Placeholders) */
.project-1-bg {
    background-image: linear-gradient(45deg, #111, #333);
}

.project-2-bg {
    background-image: linear-gradient(45deg, #222, #00f3ff);
}

.project-3-bg {
    background-image: url('../img/cozy_village_pencil_bg.png');
    /* Using existing file */
}

/* Using a placeholder gradient if image missing */
.project-4-bg {
    background-image: url('../img/library_hero.png');
}

.project-card:hover .card-image {
    opacity: 0.2;
    /* Subtle reveal */
    filter: grayscale(0%) blur(5px);
    transform: scale(1.05);
}

.project-card:hover {
    border-bottom-color: var(--accent-color);
    padding-left: 20px;
}

.card-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
    z-index: 2;
    /* In front of bg */
    width: 100%;
}

.card-info h3 {
    font-family: 'Syncopate', sans-serif;
    font-size: var(--fs-h3);
    font-weight: 700;
    text-transform: uppercase;
    transition: color 0.3s;
}

.project-card:hover .card-info h3 {
    color: var(--accent-color);
    text-shadow: 0 0 20px rgba(112, 0, 255, 0.5);
}

.card-info p {
    font-size: 1.2rem;
    color: var(--secondary-accent);
}

.number {
    font-family: 'Syncopate', sans-serif;
    font-size: 1.5rem;
    opacity: 0.3;
}

/* =========================================
   ABOUT SECTION (Ticker Fix)
========================================= */
.about {
    padding: 10vh 5%;
    background: #0a0a0a;
}

.skills-ticker {
    margin-top: 3rem;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    width: 100%;
}

.ticker-content {
    display: inline-block;
    animation: ticker 20s linear infinite;
}

.ticker-content span {
    font-family: 'Syncopate', sans-serif;
    font-size: clamp(2rem, 6vw, 4rem);
    /* Responsive */
    margin-right: clamp(2rem, 4vw, 4rem);
    /* Responsive spacing */
    color: rgba(255, 255, 255, 0.1);
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.3);
}

@keyframes ticker {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* =========================================
   CONTACT SECTION (Revamp)
========================================= */
.contact {
    padding: 15vh 5% 5vh 5%;
    text-align: center;
}

.contact h2 {
    font-family: 'Syncopate', sans-serif;
    font-size: var(--fs-h2);
    margin-bottom: 4rem;
}

/* Grid Layout for CTA Cards */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 5rem auto;
}

.cta-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2.5rem;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border-radius: 4px;
    /* Slight round */
}

.cta-card i {
    font-size: 2.5rem;
    color: var(--secondary-accent);
    margin-bottom: 1rem;
    transition: transform 0.3s;
}

.cta-card h3 {
    font-family: 'Syncopate', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.cta-card p {
    opacity: 0.6;
    font-size: 0.9rem;
}

.cta-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-color);
    transform: translateY(-10px);
}

.cta-card:hover i {
    transform: scale(1.2);
    color: var(--accent-color);
}

/* Hide legacy styles */
.mail-link,
.socials {
    display: none;
}

footer {
    opacity: 0.3;
    font-size: 0.8rem;
    margin-top: 5rem;
}

/* Hover Effects logic via JS classes */
.hover-active .cursor-outline {
    transform: translate(-50%, -50%) scale(1.5);
    background-color: rgba(255, 255, 255, 0.1);
    border-color: transparent;
}

/* =========================================
   BREAKPOINTS MANAGED VIA CLAMP & GRID
   But adding specific tablet tweaks if needed
========================================= */

/* Tablet & Mobile Tweaks */
@media (max-width: 1024px) {
    .card-info {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }

    .card-info p {
        font-size: 1rem;
    }

    .project-card {
        min-height: 250px;
    }

    .gallery {
        gap: 3rem;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1.5rem;
    }

    .hero-content {
        padding-top: 15vh;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }
}