/* ===========================================
   KvaTech — style.css (final)
   =========================================== */

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

:root {
    --bg: #0a0a0b;
    --bg2: #111113;
    --bg3: #16161a;
    --bg3h: #1c1c21;
    --border: #222228;
    --borderh: #333340;
    --text: #e8e8ed;
    --muted: #6e6e7a;
    --subtle: #4a4a55;
    --accent: #6c63ff;
    --accentL: #8b83ff;
    --accentDim: rgba(108, 99, 255, 0.15);
    --accentGlow: rgba(108, 99, 255, 0.4);
    --green: #34d399;
    --greenDim: rgba(52, 211, 153, 0.15);
    --yellow: #fbbf24;
    --yellowDim: rgba(251, 191, 36, 0.15);
    --orange: #fb923c;
    --orangeDim: rgba(251, 146, 60, 0.15);
    --r: 16px;
    --rs: 10px;
    --rxs: 6px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: "JetBrains Mono", monospace;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --t: 0.3s var(--ease);
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}
a {
    color: inherit;
    text-decoration: none;
}

/* --- Cursor glow --- */
.cursor-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(108, 99, 255, 0.06) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s;
    opacity: 0;
}
.cursor-glow.active {
    opacity: 1;
}

/* --- Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Nav --- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 0;
    transition: var(--t);
    background: transparent;
}
.nav.scrolled {
    background: rgba(10, 10, 11, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 500;
    transition: var(--t);
}
.bracket {
    color: var(--accent);
}
.nav-logo:hover {
    color: var(--accentL);
}
.nav-links {
    display: flex;
    gap: 32px;
}
.nav-link {
    font-size: 14px;
    color: var(--muted);
    transition: var(--t);
    position: relative;
}
.nav-link::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: var(--t);
}
.nav-link:hover {
    color: var(--text);
}
.nav-link:hover::after {
    width: 100%;
}

/* Burger */
.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--muted);
    transition: var(--t);
    border-radius: 2px;
}
.burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.burger.active span:nth-child(2) {
    opacity: 0;
}
.burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu */
.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(10, 10, 11, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    opacity: 0;
    pointer-events: none;
    transition: var(--t);
}
.mobile-menu.active {
    opacity: 1;
    pointer-events: all;
}
.mobile-link {
    font-size: 24px;
    color: var(--muted);
    transition: var(--t);
}
.mobile-link:hover {
    color: var(--text);
}

/* --- Hero --- */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}
.hero.hero-compact {
    min-height: 70vh;
    padding: 160px 0 80px;
}
.hero-grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(108, 99, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 99, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(
        ellipse 80% 60% at 50% 40%,
        black 30%,
        transparent 100%
    );
    -webkit-mask-image: radial-gradient(
        ellipse 80% 60% at 50% 40%,
        black 30%,
        transparent 100%
    );
}
.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
}
.hero-greeting {
    font-size: 18px;
    color: var(--muted);
    margin-bottom: 16px;
}
.hero-compact .hero-title {
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    font-weight: 700;
}
.accent {
    color: var(--accent);
}
.hero-compact .hero-desc {
    font-size: 16px;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 500px;
}
.hero-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--rs);
    font-size: 14px;
    font-weight: 500;
    transition: var(--t);
    cursor: pointer;
    border: none;
    font-family: var(--font);
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accentL);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accentGlow);
}
.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--borderh);
    background: var(--bg3h);
    transform: translateY(-2px);
}
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    color: var(--text);
    border-color: var(--borderh);
    transform: translateY(-2px);
}
.btn-music {
    background: rgba(255, 0, 0, 0.1);
    color: #ff4444;
    border: 1px solid rgba(255, 0, 0, 0.2);
    margin-top: 16px;
}
.btn-music:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 0, 0, 0.15);
}

/* --- Sections --- */
.section {
    padding: 120px 0;
}
.section-alt {
    background: var(--bg2);
}
.section-head {
    margin-bottom: 64px;
}
.section-num {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--accent);
    display: block;
    margin-bottom: 8px;
}
.section-title {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* --- Project Cards --- */
.projects-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 700px;
}

.card {
    position: relative;
    border-radius: var(--r);
    overflow: hidden;
    background: var(--bg3);
    border: 1px solid var(--border);
    transition: var(--t);
}
a.card {
    cursor: pointer;
}
.card:hover {
    border-color: var(--borderh);
    transform: translateY(-4px);
}
.card:hover .card-glow {
    opacity: 1;
}

.card-glow {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: var(--t);
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(108, 99, 255, 0.06),
        transparent 40%
    );
}
.card-body {
    position: relative;
    z-index: 1;
    padding: 32px;
    display: flex;
    flex-direction: column;
}
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.card-icon {
    font-size: 32px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.status-live {
    background: var(--greenDim);
    color: var(--green);
}
.status-live .status-dot {
    background: var(--green);
    animation: pulseDot 2s ease-in-out infinite;
}
.status-poc {
    background: var(--yellowDim);
    color: var(--yellow);
}
.status-poc .status-dot {
    background: var(--yellow);
}

@keyframes pulseDot {
    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
    }
}

.card-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 12px;
}
.card-desc {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 20px;
}
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.card-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    transition: var(--t);
}
a.card:hover .card-link {
    color: var(--accentL);
}
.card-domain {
    font-size: 12px;
    color: var(--subtle);
    font-family: var(--mono);
}

/* --- Beyond Code --- */
.beyond-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.beyond-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 32px;
    transition: var(--t);
}
.beyond-card:hover {
    border-color: var(--borderh);
}
.beyond-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.beyond-icon {
    font-size: 28px;
}
.beyond-title {
    font-size: 20px;
    font-weight: 600;
}
.beyond-text {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 24px;
}

/* Photo strip */
.photo-strip-wrap {
    position: relative;
    width: 100%;
}

.photo-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
    cursor: grab;
    min-height: 120px;
    scroll-snap-type: x mandatory;
}
.photo-strip::-webkit-scrollbar {
    display: none;
}
.photo-strip:active {
    cursor: grabbing;
}

.photo-item {
    flex: 0 0 auto;
    width: 180px;
    height: 120px;
    border-radius: var(--rs);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border);
    transition: var(--t);
    scroll-snap-align: start;
}
.photo-item:hover {
    border-color: var(--borderh);
    transform: scale(1.03);
}
.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
}
.photo-item:hover img {
    transform: scale(1.1);
}

.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--subtle);
    min-height: 120px;
    font-style: italic;
    font-size: 13px;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.lightbox.active {
    opacity: 1;
    pointer-events: all;
}
.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: var(--rs);
    object-fit: contain;
    transition: transform 0.3s;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 28px;
    cursor: pointer;
    opacity: 0.7;
    transition: var(--t);
    padding: 8px;
}
.lightbox-close:hover {
    opacity: 1;
}
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text);
    font-size: 32px;
    cursor: pointer;
    padding: 12px 16px;
    border-radius: var(--rs);
    opacity: 0.7;
    transition: var(--t);
}
.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}
.lightbox-prev {
    left: 16px;
}
.lightbox-next {
    right: 16px;
}
.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: var(--muted);
    font-family: var(--mono);
}

/* Music */
.music-section {
    display: flex;
    flex-direction: column;
}
.visualizer {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 60px;
    padding: 8px 0;
}
.music-bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(to top, #ff4444, #ff6b6b);
    opacity: 0.6;
    animation: barDance 1.2s ease-in-out infinite alternate;
    animation-delay: calc(var(--i) * 0.08s);
}
@keyframes barDance {
    0% {
        height: 15%;
        opacity: 0.3;
    }
    50% {
        height: 70%;
        opacity: 0.7;
    }
    100% {
        height: 35%;
        opacity: 0.5;
    }
}

/* --- Footer --- */
.footer-full {
    padding: 80px 0 32px;
    border-top: 1px solid var(--border);
}
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 48px;
}
.footer-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.footer-tagline {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
}
.footer-links {
    display: flex;
    gap: 24px;
}
.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--muted);
    transition: var(--t);
    padding: 8px 0;
}
.footer-link:hover {
    color: var(--text);
}
.footer-link svg {
    transition: var(--t);
}
.footer-link:hover svg {
    transform: translate(2px, -2px);
}
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 24px;
}
.footer-copy {
    font-size: 13px;
    color: var(--subtle);
}

/* --- Animations --- */
.anim {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 0.8s var(--ease) forwards;
}
.anim:nth-child(1) {
    animation-delay: 0.1s;
}
.anim:nth-child(2) {
    animation-delay: 0.2s;
}
.anim:nth-child(3) {
    animation-delay: 0.3s;
}
.anim:nth-child(4) {
    animation-delay: 0.4s;
}
.anim:nth-child(5) {
    animation-delay: 0.5s;
}

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

.scroll-anim {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.6s var(--ease),
        transform 0.6s var(--ease);
}
.scroll-anim.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    .burger {
        display: flex;
    }

    .hero.hero-compact {
        padding: 120px 0 60px;
    }
    .hero-buttons {
        flex-direction: column;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }

    .beyond-grid {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 80px 0;
    }

    .footer-content {
        flex-direction: column;
        gap: 32px;
    }
    .footer-links {
        flex-direction: column;
        gap: 8px;
    }
    .footer-inner {
        flex-direction: column;
        gap: 8px;
    }

    .lightbox-prev {
        left: 8px;
        padding: 8px 12px;
        font-size: 24px;
    }
    .lightbox-next {
        right: 8px;
        padding: 8px 12px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    .card-body {
        padding: 24px;
    }
    .beyond-card {
        padding: 24px;
    }
    .photo-item {
        flex: 0 0 140px;
        height: 95px;
    }
}

/* --- Beyond Code --- */
.beyond-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.beyond-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 32px;
    transition: var(--t);
    overflow: hidden; /* ← ключевое */
    min-width: 0; /* ← ключевое */
}
.beyond-card:hover {
    border-color: var(--borderh);
}

.beyond-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.beyond-icon {
    font-size: 28px;
}
.beyond-title {
    font-size: 20px;
    font-weight: 600;
}
.beyond-text {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 24px;
}

/* Photo strip */
.photo-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 8px;
    cursor: grab;
    min-height: 140px;
    margin: 0 -32px; /* ← растянуть до краёв карточки */
    padding-left: 32px;
    padding-right: 32px;
    scroll-snap-type: x mandatory;
}
.photo-strip::-webkit-scrollbar {
    display: none;
}
.photo-strip:active {
    cursor: grabbing;
}

/* Фейд-подсказки по краям */
.photo-strip-wrap {
    position: relative;
}
.photo-strip-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(to left, var(--bg3), transparent);
    pointer-events: none;
    z-index: 2;
    border-radius: 0 var(--r) var(--r) 0;
}

.photo-item {
    flex: 0 0 auto;
    width: 200px;
    height: 140px;
    border-radius: var(--rs);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: var(--t);
    scroll-snap-align: start;
}
.photo-item:hover {
    border-color: var(--borderh);
    transform: scale(1.03);
}
.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
}
.photo-item:hover img {
    transform: scale(1.1);
}

.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--subtle);
    min-height: 140px;
    font-style: italic;
    font-size: 13px;
}
