/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --accent-tertiary: #c4b5fd;
    --accent-glow: rgba(139, 92, 246, 0.3);
    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    --gradient-secondary: linear-gradient(135deg, #1a1a25 0%, #0a0a0f 100%);
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

::selection {
    background: var(--accent-primary);
    color: white;
}

/* ===== Custom Cursor ===== */
.cursor {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    transition: transform 0.1s ease;
}

.cursor-follower {
    width: 40px;
    height: 40px;
    border: 1px solid var(--accent-secondary);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .cursor, .cursor-follower {
        display: none;
    }
}

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

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 20px 0;
    transition: all var(--transition-medium);
    backdrop-filter: blur(10px);
    background: rgba(10, 10, 15, 0.8);
}

.header.scrolled {
    padding: 12px 0;
    background: rgba(10, 10, 15, 0.95);
    border-bottom: 1px solid var(--border-color);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap:  2px;
}

.logo-bracket {
    color: var(--accent-primary);
}

.logo-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display:  flex;
    gap: 40px;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition:  color var(--transition-fast);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left:  0;
    width: 0;
    height:  2px;
    background: var(--gradient-primary);
    transition: width var(--transition-medium);
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a:hover::after {
    width:  100%;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.menu-toggle span {
    width:  25px;
    height: 2px;
    background: var(--text-primary);
    transition: all var(--transition-fast);
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top:  0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 30px;
        transition: right var(--transition-medium);
    }

    .nav-links.active {
        right:  0;
    }

    .menu-toggle {
        display: flex;
        z-index: 1001;
    }

    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}

/* ===== Hero Section ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

.hero-bg {
    position:  absolute;
    inset: 0;
    z-index: 0;
}

.grid-lines {
    position:  absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(139, 92, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 80% 50% at 50% 50%, black 40%, transparent 100%);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-greeting {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary);
    font-size: 1rem;
    margin-bottom: 12px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4. 5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 16px;
}

.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width:  100%;
    height: 100%;
    opacity: 0;
}

.glitch:hover::before {
    animation: glitch-1 0.3s linear infinite;
    color: #ff00ff;
    opacity: 0.8;
}

.glitch:hover::after {
    animation: glitch-2 0.3s linear infinite;
    color: #00ffff;
    opacity: 0.8;
}

@keyframes glitch-1 {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform:  translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-2 {
    0% { transform:  translate(0); }
    20% { transform: translate(2px, -2px); }
    40% { transform: translate(2px, 2px); }
    60% { transform: translate(-2px, -2px); }
    80% { transform: translate(-2px, 2px); }
    100% { transform: translate(0); }
}

.hero-subtitle {
    font-size:  1.25rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.typing::after {
    content:  '|';
    animation: blink 1s step-end infinite;
    color: var(--accent-primary);
}

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

.hero-stats {
    display:  flex;
    gap: 40px;
    margin-bottom: 40px;
}

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

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color:  transparent;
    background-clip: text;
}

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

.hero-cta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding:  14px 28px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-medium);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background:  var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

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

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.avatar-wrapper {
    position:  relative;
    width: 320px;
    height: 320px;
}

.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    position: relative;
    z-index: 2;
}

.avatar-ring {
    position:  absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid transparent;
    background:  var(--gradient-primary) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite:  exclude;
    animation: rotate 8s linear infinite;
}

.avatar-glow {
    position: absolute;
    inset: -40px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    z-index: 0;
    filter: blur(40px);
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform:  rotate(360deg); }
}

.scroll-indicator {
    position:  absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size:  0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.scroll-line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, var(--accent-primary), transparent);
    animation: scroll-pulse 2s ease-in-out infinite;
}

@keyframes scroll-pulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.2); }
}

@media (max-width: 968px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

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

    .hero-cta {
        justify-content: center;
    }

    .hero-image {
        order: -1;
    }

    .avatar-wrapper {
        width: 220px;
        height: 220px;
    }
}

/* ===== Section Base ===== */
.section {
    padding: 120px 0;
    position: relative;
}

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight:  700;
    margin-bottom: 60px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.section-title::after {
    content: '';
    flex:  1;
    max-width: 300px;
    height: 1px;
    background: var(--border-color);
}

.title-number {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary);
    font-size: 1rem;
}

/* ===== About Section ===== */
.about-content {
    display:  grid;
    grid-template-columns:  1fr 1fr;
    gap: 60px;
    align-items: start;
}

.about-text p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.about-text strong {
    color:  var(--text-primary);
}

.tech-stack {
    margin-top: 32px;
}

.tech-stack h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tech-tags {
    display:  flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tech-tag {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border:  1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--accent-secondary);
    font-family: 'JetBrains Mono', monospace;
    transition: all var(--transition-fast);
}

.tech-tag:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Terminal */
.terminal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.terminal-header {
    display:  flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.terminal-buttons {
    display:  flex;
    gap: 8px;
}

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

.terminal-btn.close { background: #ff5f56; }
.terminal-btn.minimize { background: #ffbd2e; }
.terminal-btn.maximize { background: #27c93f; }

.terminal-title {
    font-family: 'JetBrains Mono', monospace;
    font-size:  0.8rem;
    color: var(--text-muted);
}

.terminal-body {
    padding: 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size:  0.9rem;
    line-height: 1.8;
}

.terminal-body p {
    margin-bottom: 8px;
}

.prompt {
    color: var(--accent-primary);
    margin-right: 8px;
}

.output {
    color: var(--text-secondary);
    padding-left: 20px;
}

.cursor-blink {
    animation: blink 1s step-end infinite;
}

@media (max-width:  968px) {
    .about-content {
        grid-template-columns: 1fr;
    }

    .about-terminal {
        order: -1;
    }
}

/* ===== Projects Section ===== */
.projects {
    background: var(--bg-secondary);
}

.projects-grid {
    display:  grid;
    grid-template-columns:  repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-medium);
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-primary);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15);
}

.project-card:hover::before {
    transform: scaleX(1);
}

.project-card.featured {
    border-color: var(--accent-primary);
}

.featured-badge {
    position: absolute;
    bottom: 16px;              /* снизу */
    right: 16px;               /* справа */
    padding: 6px 12px;
    background: var(--gradient-primary);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.12);
    z-index: 1;                /* ниже интерактивных элементов внутри карточки */
    pointer-events: none;      /* клики проходят к ссылкам под бейджем */
    transform: translateZ(0);
}

.project-card .project-header,
.project-card .project-links,
.project-card .project-title {
    position: relative;
    z-index: 2;
}

/* На мобильных скрываем бейдж (чтобы не занимал место) и даём дополнительный padding */
@media (max-width: 768px) {
    .featured-badge {
        display: none;
    }

    .project-card {
        padding-bottom: 56px; /* при необходимости подкорректируй */
    }
}

.project-header {
    display:  flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.project-icon {
    width:  60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius:  var(--radius-md);
    color: var(--accent-primary);
}

.project-links {
    display:  flex;
    gap: 12px;
}

.project-link {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.project-link:hover {
    color: var(--accent-primary);
}

.project-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.7;
}

.project-meta {
    display:  flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.project-lang {
    display: flex;
    align-items: center;
    gap:  6px;
}

.lang-dot {
    width:  12px;
    height: 12px;
    border-radius: 50%;
}

.lang-dot.kotlin { background: #A97BFF; }
.lang-dot.go { background: #00ADD8; }
.lang-dot.html { background: #E34C26; }

.project-stats {
    display:  flex;
    align-items: center;
    gap: 4px;
}

.project-tags {
    display:  flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-tags span {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* ===== Contact Section ===== */
.contact-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-text {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.contact-links {
    display:  flex;
    justify-content: center;
    gap: 20px;
}

.contact-link {
    display:  inline-flex;
    align-items:  center;
    gap: 10px;
    padding: 16px 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-medium);
}

.contact-link:hover {
    background:  var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-4px);
}

/* ===== Footer ===== */
.footer {
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer p {
    color:  var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer-year {
    font-family: 'JetBrains Mono', monospace;
}

/* ===== Animations ===== */
[data-aos="fade-up"] {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

[data-aos="fade-up"].aos-animate {
    opacity:  1;
    transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .container {
        padding:  0 16px;
    }

    .section {
        padding: 80px 0;
    }

    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }

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

    .project-card {
        padding: 24px;
    }
}

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

@media (max-width: 968px) {
  .hero {
    padding-top: 120px; /* было 80px — увеличиваем, чтобы аватар не наезжал */
  }

  /* немного уменьшим размер аватара на очень узких экранах, если нужно */
  @media (max-width: 480px) {
    .avatar-wrapper {
      width: 200px;
      height: 200px;
      margin-top: 8px;
    }
  }
}
