:root {
    --bg-color: #0a0a0a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #00f2ff;
    --accent-glow: rgba(0, 242, 255, 0.3);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.05);
    --glass-blur: 10px;
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    --transition-speed: 0.3s;
    --cursor-size: 20px;

    /* FLUID TYPOGRAPHY SCALE */
    --font-size-xs: clamp(0.75rem, 0.714rem + 0.179vw, 0.875rem);
    --font-size-sm: clamp(0.875rem, 0.821rem + 0.268vw, 1rem);
    --font-size-md: clamp(1rem, 0.929rem + 0.357vw, 1.125rem);
    --font-size-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
    --font-size-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.75rem);
    --font-size-2xl: clamp(1.5rem, 1.25rem + 1.25vw, 2.25rem);
    --font-size-3xl: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);

    /* FLUID SPACING SCALE */
    --space-xs: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
    --space-sm: clamp(0.75rem, 0.6rem + 0.75vw, 1.25rem);
    --space-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
    --space-lg: clamp(1.5rem, 1.2rem + 1.5vw, 2.5rem);
    --space-xl: clamp(2rem, 1.5rem + 2.5vw, 4rem);
    --space-2xl: clamp(3rem, 2rem + 5vw, 6rem);

    /* RESPONSIVE LAYOUT */
    --container-padding: clamp(1rem, 0.5rem + 2.5vw, 2rem);
    --grid-min-width: min(100%, 280px);
    --grid-skills-min-width: min(100%, 300px);
    --profile-img-size: clamp(160px, 140px + 10vw, 280px);

    /* TOUCH TARGETS */
    --touch-target-min: 44px;
}

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

* {
    cursor: none;
    /* Hide default cursor */
}

img, video, svg {
    max-width: 100%;
    height: auto;
}

/* Custom Cursor - hidden until JS shows it on mouse move */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    transform: translate(-50%, -50%);
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid var(--accent-color);
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, background-color 0.2s, opacity 0.2s;
}

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

/* Matrix Effect */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    background: black;
}

#matrix-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    color: #0F0;
    font-family: 'Space Grotesk', monospace;
    font-size: 2rem;
    text-align: center;
    text-shadow: 0 0 10px #0F0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.matrix-active #matrix-canvas,
.matrix-active #matrix-message {
    opacity: 1;
    pointer-events: all;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

html {
    scrollbar-gutter: stable;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    min-height: 100vh;
    cursor: default;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #fff, #888);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 3rem;
    position: relative;
    display: inline-block;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
    width: 100%;
}

section {
    padding: var(--space-2xl) 0;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport for mobile address bar */
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: var(--space-2xl) 0 var(--space-xl);
}

.hero-content {
    z-index: 2;
    width: 100%;
    max-width: 1000px;
    opacity: 0;
    transform: translateY(20px);
    display: flex;
    flex-direction: column-reverse; /* Mobile-first: image on top */
    align-items: center;
    text-align: center;
    gap: var(--space-lg);
}

.hero-text {
    flex: 1;
    text-align: center; /* Mobile-first */
}

.profile-img-container {
    width: var(--profile-img-size);
    height: var(--profile-img-size);
    position: relative;
    animation: float 6s ease-in-out infinite;
    flex-shrink: 0;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 1;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    box-shadow: 0 0 40px var(--accent-glow);
    transition: opacity 0.3s ease, transform 0.3s ease, border-radius 0.5s ease;
    animation: morph 8s ease-in-out infinite;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 1;
}

.profile-img.active {
    opacity: 1;
    z-index: 2;
}

.profile-img:hover {
    transform: scale(1.05);
    box-shadow: 0 0 60px var(--accent-glow);
}

@keyframes morph {
    0% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }

    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }

    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }

    100% {
        transform: translateY(0px);
    }
}

.hero-subtitle {
    color: var(--accent-color);
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: var(--space-sm);
    display: block;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hero-title {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    border: none;
    background: none;
    -webkit-text-fill-color: var(--text-secondary);
}

.hero-title::after {
    display: none;
}

.hero-bio {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    max-width: min(600px, 100%);
    margin-bottom: var(--space-lg);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-size-md);
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
    transition: var(--transition-speed);
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-height: var(--touch-target-min);
}

.btn:active {
    transform: scale(0.96);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--accent-color);
    z-index: -1;
    transition: var(--transition-speed);
}

.btn:hover {
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn:hover::before {
    width: 100%;
}

/* Background Animation Elements */
.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
}

/* Cards (Experience, Projects) */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--grid-min-width), 1fr));
    gap: var(--space-lg);
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: var(--space-lg);
    border-radius: clamp(12px, 2vw, 16px);
    backdrop-filter: blur(var(--glass-blur));
    transition: transform 0.1s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(800px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.06), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 3;
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px -20px rgba(0, 242, 255, 0.2);
}

.card h3 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    transform: translateZ(20px);
}

.card-subtitle {
    color: var(--accent-color);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-sm);
    display: block;
    transform: translateZ(15px);
}

.card p {
    color: var(--text-secondary);
    font-size: var(--font-size-md);
    margin-bottom: var(--space-md);
    transform: translateZ(10px);
}

.card i {
    font-size: var(--font-size-2xl);
    color: var(--accent-color);
    margin-bottom: var(--space-md);
    transform: translateZ(25px);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: rgba(255, 255, 255, 0.05);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 20px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.card:hover .tag {
    border-color: rgba(0, 242, 255, 0.2);
    color: var(--text-primary);
}

/* Stats Section */
#stats {
    padding: var(--space-lg) 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    text-align: center;
}

.stat-item {
    padding: var(--space-lg);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: clamp(12px, 2vw, 16px);
    backdrop-filter: blur(var(--glass-blur));
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px -10px var(--accent-glow);
    border-color: rgba(0, 242, 255, 0.3);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1;
    display: inline;
}

.stat-suffix {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    color: var(--accent-color);
}

.stat-label {
    display: block;
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Skills */
.grid-skills {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--grid-skills-min-width), 1fr));
    gap: var(--space-lg);
}

.skill-category {
    height: 100%;
}

.skill-category > i {
    font-size: var(--font-size-2xl);
    color: var(--accent-color);
    margin-bottom: var(--space-md);
    display: block;
}

.skill-groups {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.skill-group h4 {
    color: var(--accent-color);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

/* Experience Slider */
.timeline-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.experience-timeline {
    display: flex;
    gap: var(--space-lg);
    overflow-x: scroll;
    padding: var(--space-sm);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
}

.experience-timeline::-webkit-scrollbar {
    display: none;
}

.timeline-card {
    flex: 0 0 340px;
    scroll-snap-align: start;
}

.timeline-dot {
    display: none;
}

.timeline-nav {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 242, 255, 0.1);
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    cursor: pointer !important;
    pointer-events: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    backdrop-filter: blur(var(--glass-blur));
    z-index: 100;
    position: relative;
}

.timeline-nav i,
.timeline-nav * {
    pointer-events: none !important;
}

.timeline-nav:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--accent-glow);
}

@media (max-width: 768px) {
    .timeline-nav {
        display: none;
    }

    .timeline-card {
        flex: 0 0 280px;
    }
}

/* Education & Certifications Icons */
#education-container .card i,
#certifications-container .card i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

/* Contact */
#contact {
    padding-bottom: var(--space-md);
}

.contact-intro {
    color: var(--text-secondary);
    max-width: min(600px, 100%);
    font-size: var(--font-size-md);
}

.contact-links {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.contact-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-md);
    transition: var(--transition-speed);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    min-height: var(--touch-target-min);
    border-radius: 8px;
}

.contact-link:hover {
    color: var(--accent-color);
    background: rgba(0, 242, 255, 0.05);
}

.contact-link:active {
    transform: scale(0.98);
}

@media (min-width: 480px) {
    .contact-links {
        flex-direction: row;
    }
}

/* Vision 2050 Section */
.vision-section {
    padding: 0;
    margin: var(--space-md) 0 0 0;
}

.video-container {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    overflow: hidden;
    background: transparent;
}

.video-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to bottom,
        var(--bg-color) 0%,
        transparent 100%);
}

@media (min-width: 768px) {
    .video-container::before {
        height: 150px;
        background: linear-gradient(to bottom,
            var(--bg-color) 0%,
            var(--bg-color) 20%,
            transparent 100%);
    }
}

.video-container video {
    width: 100%;
    height: auto;
    display: block;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.vision-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(0.9rem, 3.5vw, 2.5rem);
    font-weight: 600;
    color: #fff;
    text-shadow:
        0 0 10px rgba(0, 242, 255, 0.8),
        0 0 20px rgba(0, 242, 255, 0.6),
        0 0 40px rgba(0, 242, 255, 0.4);
    text-align: center;
    letter-spacing: 1px;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .vision-text {
        gap: 0.5rem;
        letter-spacing: 2px;
        text-shadow:
            0 0 10px rgba(0, 242, 255, 0.8),
            0 0 20px rgba(0, 242, 255, 0.6),
            0 0 40px rgba(0, 242, 255, 0.4),
            0 0 80px rgba(0, 242, 255, 0.2);
    }
}

.vision-text span {
    display: block;
    opacity: 0;
    animation: text-flicker 8s ease-in-out infinite;
}

.vision-text span:nth-child(1) { animation-delay: 0s; }
.vision-text span:nth-child(2) { animation-delay: 0.3s; }
.vision-text span:nth-child(3) { animation-delay: 0.6s; }
.vision-text span:nth-child(4) { animation-delay: 0.9s; }

@keyframes text-flicker {
    0%, 10% { opacity: 0; transform: translateY(10px); }
    15%, 85% { opacity: 1; transform: translateY(0); }
    90%, 100% { opacity: 0; transform: translateY(-10px); }
}

/* Sci-fi scan line effect */
.video-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 242, 255, 0.03) 2px,
        rgba(0, 242, 255, 0.03) 4px
    );
    pointer-events: none;
    animation: scanlines 0.1s linear infinite;
}

@keyframes scanlines {
    0% { background-position: 0 0; }
    100% { background-position: 0 4px; }
}

/* Footer */
footer {
    padding: var(--space-lg) 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    border-top: 1px solid var(--card-border);
    margin-top: var(--space-xl);
}

/* Responsive */

/* Small phones (<375px) */
@media (max-width: 374px) {
    :root {
        --profile-img-size: 160px;
    }

    h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.7rem;
        letter-spacing: 1px;
    }
}

/* Landscape phones */
@media (max-width: 896px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--space-lg) 0;
    }

    .hero-content {
        flex-direction: row;
        gap: var(--space-lg);
    }

    .hero-text {
        text-align: left;
    }

    :root {
        --profile-img-size: 140px;
    }
}

/* Tablets and up (768px+) */
@media (min-width: 768px) {
    .hero {
        padding: 0;
    }

    .hero-content {
        flex-direction: row;
        text-align: left;
        gap: var(--space-xl);
    }

    .hero-text {
        text-align: left;
    }
}

/* Touch device handling - hide custom cursor on mobile/touch */
@media (pointer: coarse) {
    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }

    * {
        cursor: auto !important;
    }
}

/* Also hide cursor on small screens (mobile) */
@media (max-width: 768px) {
    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }

    * {
        cursor: auto !important;
    }
}

/* Hide cursor when touch is available */
@media (hover: none) {
    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }

    * {
        cursor: auto !important;
    }
}

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

    .profile-img-container,
    .profile-img {
        animation: none;
    }

    .profile-img {
        border-radius: 50%;
    }

    #bg-canvas {
        display: none;
    }

    .card {
        transform: none !important;
    }
}