:root {
    --bg-color: #050505;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --accent-gradient: linear-gradient(135deg, var(--primary), var(--secondary));
}

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

html {
    scroll-behavior: smooth;
}

/* Scroll Reveal Animations */
.reveal {
    opacity: 0;
    transform: translateY(40px);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.4;
    animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 10%) scale(1.2); }
}

/* Typography */
h1, h2, h3 {
    font-weight: 800;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    margin-bottom: 1rem;
}

.typing-wrapper {
    position: relative;
    display: inline-block;
}

.typing-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.typing-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
}

.typing-text::after {
    content: '|';
    -webkit-text-fill-color: var(--primary);
    color: var(--primary);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

h2.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 3rem;
}

.text-center {
    text-align: center;
}

/* Glassmorphism System */
.glass-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 5%;
    z-index: 100;
    background: rgba(5, 5, 5, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    transition: padding 0.3s ease;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo span {
    color: var(--secondary);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.nav-links a:not(.btn-telegram):not(.btn-primary):hover {
    color: var(--primary);
}

/* Hamburger Menu */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    z-index: 1000;
}

.hamburger span {
    display: block;
    width: 30px;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Buttons */
.btn-primary, .btn-secondary, .tg-button {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-primary.lg, .btn-secondary.lg {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
}

.tg-button {
    background: var(--accent-gradient);
    color: white;
    font-size: 1.2rem;
    padding: 1rem 3rem;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.tg-button:hover {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.5);
}

.btn-telegram {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-telegram:hover {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
    color: white;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
    padding: 8rem 5% 4rem;
}

.hero-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

/* Mockup Animation in Hero */
.mockup-card {
    padding: 1.5rem;
    aspect-ratio: 4/3;
    display: flex;
    flex-direction: column;
    transform: perspective(1000px) rotateY(-15deg) rotateX(5deg);
    transition: transform 0.5s ease;
}

.mockup-card:hover {
    transform: perspective(1000px) rotateY(-5deg) rotateX(2deg);
}

.mockup-header {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.mockup-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mockup-title {
    font-size: 1.4rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.mockup-text {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.mockup-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mockup-box span {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1.1rem;
}

/* Services */
.services {
    max-width: 1600px;
    margin: 0 auto;
    padding: 6rem 5%;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.service-card {
    padding: 2.5rem 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.service-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Portfolio */
.portfolio {
    max-width: 1600px;
    margin: 0 auto;
    padding: 6rem 5%;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.portfolio-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.3s ease;
}

.portfolio-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 24px 48px rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.18);
}

.portfolio-image {
    width: 100%;
    height: 185px;
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    background-color: #0f0f18;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 0.5s ease;
}

.portfolio-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 400%;
    height: 400%;
    transform: scale(0.25);
    transform-origin: 0 0;
    border: none;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.5s ease;
    background: #0f0f18;
}

.portfolio-iframe.fade-out {
    opacity: 0;
}

.portfolio-item:hover .portfolio-image {
    transform: scale(1.05);
}

.portfolio-info {
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
    align-items: center;
}

.portfolio-info h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.portfolio-info p {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0;
}

/* Screenshot backgrounds fallback (local images) */
.ekd-bg {
    background-image: url('ekd.jpg');
    background-size: cover;
    background-position: top center;
    background-color: #0f0f18;
}

.emoji-bg {
    background-image: url('emoji.jpg');
    background-size: cover;
    background-position: top center;
    background-color: #0f0f18;
}

.flamingo-bg {
    background-image: url('flamingo.jpg');
    background-size: cover;
    background-position: top center;
    background-color: #0f0f18;
}

/* Telegram Bot Card Background */

.bots-bg {
    background: linear-gradient(135deg, #0c1a2e 0%, #0a1628 50%, #06101e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bots-bg::before {
    content: 'Telegram Projects';
    font-size: 1.6rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.15);
    position: absolute;
    letter-spacing: 1px;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(99, 102, 241, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2; /* Ensure overlay is above iframe */
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.portfolio-item:hover .overlay {
    opacity: 1;
}

.overlay span {
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.portfolio-item:hover .overlay span {
    transform: translateY(0);
}

.portfolio-info {
    padding: 1.5rem 0.5rem 0.5rem;
}

.portfolio-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

/* Contact */
.contact {
    max-width: 800px;
    margin: 0 auto;
    padding: 6rem 5% 8rem;
    text-align: center;
}

.contact-wrapper {
    padding: 4rem 2rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
}

.contact-info h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.contact-info p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 3rem;
    max-width: 500px;
    margin-inline: auto;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
}

/* Animations */
.animate-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 0.8s forwards ease-out;
}

.animate-in {
    opacity: 0;
    animation: fadeIn 1s forwards ease-out 0.4s;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }

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

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Responsive */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding-top: 10rem;
        gap: 3rem;
    }
    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .hero-content p {
        margin-inline: auto;
    }
    .hero-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin-inline: auto;
        align-items: center;
    }
    .hero-buttons a {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .mockup-card {
        max-width: 500px;
        margin: 0 auto;
        transform: none;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    /* Liquid Glass Mobile Menu */
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(8, 8, 18, 0.82) !important;
        backdrop-filter: blur(30px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
        border: none;
        border-left: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: -4px 0 40px rgba(99, 102, 241, 0.12);
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2.5rem;
        transform: translateX(100%);
        transition: transform 0.45s cubic-bezier(0.77, 0, 0.175, 1);
        z-index: 999;
        display: flex;
    }
    .nav-links.active {
        transform: translateX(0);
    }
    .nav-links li {
        opacity: 0;
        transform: translateX(30px);
        transition: opacity 0.4s ease, transform 0.4s ease;
    }
    .nav-links.active li:nth-child(1) { opacity: 1; transform: translateX(0); transition-delay: 0.15s; }
    .nav-links.active li:nth-child(2) { opacity: 1; transform: translateX(0); transition-delay: 0.25s; }
    .nav-links.active li:nth-child(3) { opacity: 1; transform: translateX(0); transition-delay: 0.35s; }

    .nav-links a:not(.btn-telegram):not(.btn-primary) {
        font-size: 1.6rem;
        letter-spacing: 0.5px;
        padding: 0.5rem 0;
        position: relative;
    }
    .nav-links a:not(.btn-telegram):not(.btn-primary)::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 0;
        height: 2px;
        background: var(--accent-gradient);
        transition: width 0.3s ease;
    }
    .nav-links a:not(.btn-telegram):not(.btn-primary):hover::after {
        width: 100%;
    }
    .nav-links .btn-telegram {
        margin-top: 1rem;
        padding: 1rem 3rem;
        font-size: 1.1rem;
    }

    /* Hamburger Animation to X */
    .hamburger.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .hamburger.active span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    .hamburger.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Prevent body scroll when menu open */
    body.no-scroll {
        overflow: hidden;
    }

    h1 {
        font-size: 2.2rem;
    }
    .contact-info h2 {
        font-size: 1.8rem;
    }
    .services-grid, .portfolio-grid {
        grid-template-columns: 1fr;
    }
    .service-card {
        text-align: center;
    }
    .service-icon {
        text-align: center;
    }
    .portfolio-info {
        text-align: center;
    }
}
