:root {
    /* Base Variables */
    --primary-color: #9b59b6;
    --primary-color-rgb: 155, 89, 182;
    --bg-base: #0f1015;
    --bg-gradient: radial-gradient(circle at top right, rgba(20, 22, 30, 1) 0%, rgba(15, 16, 21, 1) 100%);
    --text-primary: #ffffff;
    --text-secondary: #a0a5b5;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-hover-bg: rgba(255, 255, 255, 0.06);
    --icon-bg: rgba(var(--primary-color-rgb), 0.15);

    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body.light {
    --bg-base: #f4f6f9;
    --bg-gradient: radial-gradient(circle at top right, rgba(255, 255, 255, 1) 0%, rgba(244, 246, 249, 1) 100%);
    --text-primary: #1a1c23;
    --text-secondary: #5a6072;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.05);
    --card-hover-bg: rgba(255, 255, 255, 0.9);
    --icon-bg: rgba(var(--primary-color-rgb), 0.1);
}

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

html,
body {
    overflow-x: hidden;
}

::selection {
    background-color: var(--primary-color);
    color: #fff;
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-base);
    z-index: 99999;
    /* Highest priority */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Terminal Preloader */
.preloader-content.terminal {
    width: 90%;
    max-width: 650px;
    background: #111;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 20px rgba(var(--primary-color-rgb), 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    font-family: 'Courier New', Courier, monospace;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background: #2a2a2a;
    padding: 12px 15px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #000;
}

.terminal-header .btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-header .btn.red {
    background: #ff5f56;
}

.terminal-header .btn.yellow {
    background: #ffbd2e;
}

.terminal-header .btn.green {
    background: #27c93f;
}

.terminal-body {
    padding: 24px;
    color: var(--primary-color);
    font-size: 1.1rem;
    line-height: 1.6;
    min-height: 250px;
    background: rgba(0, 0, 0, 0.5);
}

.terminal-line {
    margin: 8px 0;
    text-shadow: 0 0 8px rgba(var(--primary-color-rgb), 0.6);
}

.terminal-body .cursor {
    display: inline-block;
    width: 10px;
    height: 1.1rem;
    background-color: var(--primary-color);
    animation: blink 1s step-end infinite;
    vertical-align: middle;
    box-shadow: 0 0 10px var(--primary-color);
}

/* Custom Cursor */
body {
    cursor: none;
    /* Hide default cursor */
    font-family: var(--font-body);
    background-color: var(--bg-base);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    transition: color 0.4s ease;
    /* Removed bg transition to let the custom sweep animation run smoothly without ghosting */
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    /* Setup body for clip-path positioning origin if needed */
}

a,
button,
input,
select,
textarea {
    cursor: none;
    /* Hide cursor on interactables too */
}

/* Fallback for touch devices */
@media (pointer: coarse) {

    body,
    a,
    button,
    input,
    select,
    textarea {
        cursor: auto;
    }

    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }
}

.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
}

.cursor-outline {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(var(--primary-color-rgb), 0.5);
    transition: width 0.2s ease, height 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.cursor-outline.hover {
    width: 50px;
    height: 50px;
    background-color: rgba(var(--primary-color-rgb), 0.1);
    border-color: var(--primary-color);
}

/* Scroll Progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--primary-color);
    z-index: 1000;
    box-shadow: 0 0 10px rgba(var(--primary-color-rgb), 0.5);
}

/* Glassmorphism Common Class */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

/* View Transitions API overrides for Theme Sweep */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 2;
}

/* Fallback/Overlay legacy Sweep (if needed) */
.theme-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-base);
    background-image: var(--bg-gradient);
    z-index: -10;
    pointer-events: none;
    clip-path: var(--clip-path-start, circle(0% at 50% 50%));
    transition: clip-path 0.7s ease-out;
}

.theme-transition.active {
    clip-path: var(--clip-path-end, circle(150% at 50% 50%));
    z-index: 99998;
}

/* Parallax Background Shapes */
.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -5;
    pointer-events: none;
    overflow: hidden;
}

.parallax-bg .shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: floatShape 20s infinite alternate ease-in-out;
    mix-blend-mode: screen;
}

.parallax-bg .shape-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* No transition here - JS scroll event updates this at 60fps, transition causes lag/jumping */
}

.parallax-bg .shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.parallax-bg .shape-2 {
    width: 300px;
    height: 300px;
    background: var(--primary-color);
    bottom: 20%;
    right: 10%;
    filter: blur(100px) hue-rotate(45deg);
    /* Slight tone shift but related color! */
    opacity: 0.2;
    animation-delay: -5s;
}

.parallax-bg .shape-3 {
    width: 500px;
    height: 500px;
    background: var(--primary-color);
    top: 60%;
    left: 30%;
    filter: blur(120px) hue-rotate(-30deg);
    /* Slight tone shift */
    opacity: 0.12;
    animation-delay: -10s;
}

@keyframes floatShape {
    0% {
        transform: translateY(0) scale(1) translateX(0);
    }

    33% {
        transform: translateY(-40px) scale(1.05) translateX(30px);
    }

    66% {
        transform: translateY(30px) scale(0.95) translateX(-30px);
    }

    100% {
        transform: translateY(0) scale(1) translateX(0);
    }
}

/* Navigation Controls */
.controls {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    direction: ltr;
    /* Always force LTR for controls to keep layout consistent */
}

.controls select,
.controls button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: color 0.3s ease, transform 0.2s ease;
}

.controls select option {
    background-color: var(--bg-base);
    color: var(--text-primary);
}

.controls button:hover,
.controls select:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.color-picker-wrapper {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--glass-border);
    transition: transform 0.2s ease;
}

.color-picker-wrapper:hover {
    transform: scale(1.1);
}

#color-picker {
    width: 200%;
    height: 200%;
    transform: translate(-25%, -25%);
    border: none;
    padding: 0;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    /* Let clicks pass through to the canvas container but track mouse via parent */
}

.hero-background {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(var(--primary-color-rgb), 0.15) 0%, rgba(var(--primary-color-rgb), 0) 70%);
    border-radius: 50%;
    z-index: -1;
    filter: blur(60px);
    animation: pulse 8s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.5;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

.hero-content {
    max-width: 800px;
    z-index: 1;
}

h1.name {
    font-family: var(--font-heading);
    font-size: clamp(4rem, 8vw, 7rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.typing-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 3rem;
    margin-bottom: 1.5rem;
    animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
    opacity: 0;
}

h2.typing-text {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 500;
    color: var(--primary-color);
}

.typing-cursor {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--primary-color);
    margin-left: 2px;
    animation: blink 1s infinite alternate;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
    opacity: 0;
}

.btn-primary {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border-radius: 50px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
    opacity: 0;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(var(--primary-color-rgb), 0.4);
    background-color: var(--text-primary);
    color: var(--bg-base);
}

/* Scroll Down Indicator */
.scroll-down {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    color: var(--primary-color);
    animation: bounce 2s infinite;
    text-decoration: none;
    z-index: 10;
    transition: color 0.3s ease;
}

.scroll-down:hover {
    color: var(--text-primary);
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0) translateX(-50%);
    }

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

    60% {
        transform: translateY(-10px) translateX(-50%);
    }
}

/* Sections Common */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5rem 2rem;
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.underline {
    width: 60px;
    height: 4px;
    background-color: var(--primary-color);
    margin: 0 auto;
    border-radius: 2px;
}

/* About Section */
.about-content {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    padding: 3rem;
    border-radius: 20px;
    align-items: center;
}

.about-image {
    flex: 1;
    min-width: 250px;
    display: flex;
    justify-content: center;
}

.image-placeholder {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--primary-color-rgb), 0.2) 0%, transparent 70%);
    border: 2px dashed rgba(var(--primary-color-rgb), 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: var(--primary-color);
    position: relative;
    box-shadow: 0 0 40px rgba(var(--primary-color-rgb), 0.2);
    animation: float 6s ease-in-out infinite;
}

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

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

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

.about-text {
    flex: 2;
    min-width: 300px;
}

.about-text p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.about-stats {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.stat-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Skills Section */
.skills-ticker {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 3.5rem 0 1rem 0;
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    direction: ltr;
    /* Force LTR to prevent animation break in Hebrew/Arabic */
}

.skills-track {
    display: flex;
    width: max-content;
    animation: ticker 30s linear infinite;
    cursor: grab;
    user-select: none;
}

.skills-track:active {
    cursor: grabbing;
}

.skills-track:hover {
    animation-play-state: paused;
}

@keyframes ticker {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.skills-track .skill-item {
    width: 150px;
    margin: 0 1rem;
    flex-shrink: 0;
}

.contact-method {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    text-decoration: none;
    transition: transform 0.3s ease, background 0.3s ease;
    position: relative;
    /* Added for copy button positioning */
}

.copy-btn {
    margin-left: auto;
    background: rgba(var(--primary-color-rgb), 0.1);
    border: 1px solid var(--glass-border);
    color: var(--primary-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.copy-btn:hover {
    background: var(--primary-color);
    color: #fff;
    transform: scale(1.1);
}

.copy-btn.copied {
    background: #00c853;
    color: #fff;
    border-color: #00c853;
}

.copy-btn::after {
    content: 'Copied!';
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--primary-color);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.copy-btn.copied::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-width: 140px;
    padding: 1.5rem;
    border-radius: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    position: relative;
}

.skill-item:hover {
    background: var(--glass-hover);
    transform: translateY(-10px) scale(1.05);
    /* User asked for lift on skills too */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

/* Tooltip implementation */
.skill-item::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    margin-bottom: 15px;
    /* Space above the card */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 15, 15, 0.9);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 20;
    pointer-events: none;
}

.skill-item::before {
    content: '';
    position: absolute;
    bottom: 100%;
    margin-bottom: 5px;
    /* Attached to tooltip */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(15, 15, 15, 0.9) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 20;
    pointer-events: none;
}

.skill-item:hover::after,
.skill-item:hover::before,
.skill-item.tooltip-active::after,
.skill-item.tooltip-active::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.skill-item i {
    font-size: 3rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
    transform: translateZ(30px);
    /* 3D depth */
}

.skill-item span {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    transform: translateZ(20px);
}

/* Portfolio Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.project {
    padding: 2rem;
    border-radius: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    /* Removed transform to avoid conflict with JS Tilt */
    position: relative;
    /* overflow: hidden; */
    /* REMOVED for True 3D depth to work */
    display: flex;
    flex-direction: column;
    height: 100%;
    transform-style: preserve-3d;
    /* animation removed per user request for hover-only movement */
    perspective: 1200px;
}

.project:hover {
    transform: translateY(-15px);
    /* Increased lift per user request */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Staggered floating removed per user request */

.project::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    /* Applied here instead of parent overflow for rounding */
    background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(var(--primary-color-rgb), 0.08), transparent 40%);
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.project:hover {
    background: var(--card-hover-bg);
}

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

/* Elevate the content to enhance 3D effect */
.project-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    transform: translateZ(35px);
    /* Real physical pop out */
    transform-style: preserve-3d;
}

.icon-wrapper {
    width: 60px;
    height: 60px;
    background: var(--icon-bg);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
    transform: translateZ(50px);
    /* Even further pop out */
}

.project:hover .icon-wrapper {
    transform: scale(1.08) rotate(5deg) translateZ(60px);
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 10px 25px rgba(var(--primary-color-rgb), 0.3);
}

.project h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    transform: translateZ(80px);
    /* High Z */
    transition: transform 0.3s ease;
}

.years {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 500;
    transform: translateZ(60px);
}

.project p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    /* Pushes the button below it to the bottom */
    transform: translateZ(30px);
}

.view-project-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s ease, transform 0.3s ease;
    position: relative;
    padding-bottom: 2px;
    align-self: flex-start;
    margin-top: auto;
    transform: translateZ(90px);
    /* High Z for button */
}

.view-project-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.project:hover .view-project-btn {
    color: var(--primary-color);
}

.project:hover .view-project-btn::after {
    width: 100%;
}

.view-project-btn i {
    transition: transform 0.3s ease;
}

.view-project-btn:hover i {
    transform: translateX(5px);
}

/* Contact Section */
.contact-wrapper {
    display: flex;
    flex-wrap: wrap-reverse;
    gap: 3rem;
    padding: 3rem;
    border-radius: 20px;
}

.contact-form {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    padding: 1rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.1);
    /* Slightly darker input bg */
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

body.light .form-group input,
body.light .form-group textarea {
    background: rgba(255, 255, 255, 0.3);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
}

.contact-info {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-wrap: break-word;
    word-break: break-word;
}

.contact-info h3 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    overflow-wrap: break-word;
}

.contact-info p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.method {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.2rem;
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.08), transparent 60%);
    border: 1px solid rgba(var(--primary-color-rgb), 0.15);
    border-radius: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.method span {
    position: relative;
    z-index: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.method::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.15), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

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

.method:hover {
    border-color: rgba(var(--primary-color-rgb), 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(var(--primary-color-rgb), 0.1);
}

.method-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
    position: relative;
    z-index: 1;
}



.copy-icon {
    margin-left: auto;
    color: var(--text-secondary);
    opacity: 0.5;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    font-size: 0.9rem;
}

.method:hover .copy-icon {
    opacity: 1;
    color: var(--primary-color);
}

.method.copied .copy-icon {
    color: #00c853;
    opacity: 1;
}

.method.copied {
    border-color: rgba(0, 200, 83, 0.3);
    background: linear-gradient(135deg, rgba(0, 200, 83, 0.1), transparent 60%);
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--glass-border);
    border-bottom: none;
    border-left: none;
    border-right: none;
    border-radius: 40px 40px 0 0;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--glass-bg);
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
}

.social-links a:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 10px 20px rgba(var(--primary-color-rgb), 0.3);
}

.copyright {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-color-rgb), 0.5);
}

/* Back to Top */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(var(--primary-color-rgb), 0.4);
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    background-color: var(--text-primary);
    color: var(--bg-base);
    transform: translateY(-5px);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    border-radius: 20px;
    transform: translateY(50px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-base);
    /* solid bg overriding glass for readability */
    border: 1px solid var(--glass-border);
}

.modal.active .modal-content {
    transform: translateY(0) scale(1);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 2.5rem;
    color: var(--text-secondary);
    transition: color 0.3s ease, transform 0.3s ease;
    z-index: 10;
    cursor: auto;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.close-modal:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.modal-body {
    display: flex;
    flex-direction: column;
}

@media(min-width: 768px) {
    .modal-body {
        flex-direction: row;
    }
}

#modal-img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}

@media(min-width: 768px) {
    #modal-img {
        width: 50%;
        max-height: none;
    }
}

.modal-info {
    padding: 2.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-info h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.modal-info p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
    flex-grow: 1;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.modal-tags span {
    padding: 0.4rem 0.8rem;
    background: rgba(var(--primary-color-rgb), 0.1);
    border: 1px solid rgba(var(--primary-color-rgb), 0.3);
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--primary-color);
}

/* ===== Responsive ===== */

/* Tablet */
@media (max-width: 768px) {
    .controls {
        top: 0.75rem;
        right: 0.75rem;
        gap: 0.5rem;
        padding: 0.4rem 0.75rem;
        border-radius: 12px;
    }

    .controls select,
    .controls button {
        font-size: 0.8rem;
    }

    .hero {
        padding-top: 5rem;
        min-height: 85vh;
    }

    h1.name {
        font-size: 3rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .about-content {
        flex-direction: column;
        padding: 2rem;
        border-radius: 15px;
        gap: 2rem;
    }

    .about-image {
        width: 160px;
        height: 160px;
    }

    .about-stats {
        justify-content: center;
    }

    .stat-num {
        font-size: 2rem;
    }

    .skills-ticker {
        padding: 2rem 0 0.5rem 0;
    }

    .skills-track .skill-item {
        width: 120px;
        min-width: 120px;
        padding: 1rem;
    }

    .skill-item i {
        font-size: 2.2rem;
    }

    .skill-item span {
        font-size: 0.8rem;
    }

    /* Keep tooltips visible on tablet */
    .skill-item::after {
        font-size: 0.65rem;
        white-space: normal;
        max-width: 140px;
        text-align: center;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Reduce 3D depth on tablets to prevent clipping */
    .project-content {
        transform: translateZ(15px);
    }

    .icon-wrapper {
        transform: translateZ(25px);
    }

    .project:hover .icon-wrapper {
        transform: scale(1.05) rotate(3deg) translateZ(35px);
    }

    .project h3 {
        transform: translateZ(25px);
    }

    .years {
        transform: translateZ(20px);
    }

    .project p {
        transform: translateZ(10px);
    }

    .view-project-btn {
        transform: translateZ(30px);
    }

    .contact-wrapper {
        flex-direction: column;
        padding: 1.5rem;
        border-radius: 15px;
    }

    .contact-form {
        order: 2;
    }

    .contact-info {
        order: 1;
        text-align: center;
        min-width: auto;
    }

    .contact-info h3 {
        font-size: 1.3rem;
    }

    .method {
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    footer {
        padding: 2rem 1rem;
    }

    /* Parallax shapes are too large on tablet */
    .parallax-bg .shape-1 {
        width: 250px;
        height: 250px;
    }

    .parallax-bg .shape-2 {
        width: 180px;
        height: 180px;
    }

    .parallax-bg .shape-3 {
        width: 300px;
        height: 300px;
    }
}

/* Phone */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .controls {
        top: 0.5rem;
        right: 0.5rem;
        gap: 0.4rem;
        padding: 0.3rem 0.6rem;
    }

    h1.name {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .section-title h2 {
        font-size: 1.6rem;
    }

    .about-image {
        width: 130px;
        height: 130px;
    }

    .about-text p {
        font-size: 0.95rem;
    }

    .skills-track .skill-item {
        width: 100px;
        min-width: 100px;
        padding: 0.8rem;
        gap: 0.6rem;
    }

    .skill-item i {
        font-size: 1.8rem;
    }

    .skill-item span {
        font-size: 0.7rem;
    }

    /* Tooltips: hidden by default on phone, shown via .tooltip-active from JS */
    .skill-item::after,
    .skill-item::before {
        opacity: 0;
        visibility: hidden;
    }

    .skill-item.tooltip-active::after,
    .skill-item.tooltip-active::before {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    .skill-item::after {
        white-space: normal;
        max-width: 120px;
        text-align: center;
        font-size: 0.65rem;
    }

    .project {
        padding: 1.5rem;
    }

    .project h3 {
        font-size: 1.1rem;
    }

    .project p {
        font-size: 0.85rem;
    }

    /* Further reduce 3D on phone */
    .project-content {
        transform: translateZ(5px);
    }

    .icon-wrapper {
        transform: translateZ(10px);
        width: 50px;
        height: 50px;
    }

    .project:hover .icon-wrapper {
        transform: scale(1.03) translateZ(15px);
    }

    .project h3 {
        transform: translateZ(12px);
    }

    .years {
        transform: translateZ(8px);
    }

    .project p {
        transform: translateZ(5px);
    }

    .view-project-btn {
        transform: translateZ(15px);
    }

    .contact-wrapper {
        padding: 1rem;
    }

    .contact-info {
        min-width: auto;
    }

    .contact-info h3 {
        font-size: 1.2rem;
    }

    .contact-info p {
        font-size: 0.85rem;
    }

    .method {
        padding: 0.8rem;
        gap: 0.5rem;
    }

    .method span {
        font-size: 0.8rem;
    }

    .project {
        overflow: hidden;
    }

    .project h3 {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .project p {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .about-text p {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .form-group input,
    .form-group textarea {
        font-size: 0.9rem;
        padding: 0.7rem;
    }

    .btn-primary {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .social-links a {
        font-size: 1.1rem;
    }

    #back-to-top {
        width: 40px;
        height: 40px;
        bottom: 1rem;
        right: 1rem;
    }

    /* Hide parallax shapes entirely on phone */
    .parallax-bg {
        display: none;
    }

    /* Preloader ensure full coverage */
    .preloader {
        min-height: 100%;
        min-height: -webkit-fill-available;
    }
}