/* ========================================
   Design System — ivan.semkin.ru
   ======================================== */

:root {
  /* Backgrounds */
  --bg-base: #08080c;
  --bg-surface: #111118;
  --bg-elevated: #1a1a24;
  --bg-hover: #222230;

  /* Text */
  --text-primary: #eeeef3;
  --text-secondary: #7c7c96;
  --text-muted: #4c4c62;

  /* Accents */
  --violet: #7C3AED;
  --violet-light: #a78bfa;
  --cyan: #06B6D4;
  --cyan-light: #22d3ee;

  /* Gradient */
  --gradient: linear-gradient(135deg, var(--violet), var(--cyan));
  --gradient-text: linear-gradient(135deg, var(--violet-light), var(--cyan-light));

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 9999px;

  /* Fonts */
  --f-display: 'Unbounded', sans-serif;
  --f-body: 'Manrope', sans-serif;
  --f-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --max-w: 1100px;
  --nav-h: 64px;
}


/* ========================================
   Reset & Base
   ======================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-base);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

::selection {
  background: rgba(124, 58, 237, 0.3);
  color: var(--text-primary);
}


/* ========================================
   Noise Overlay
   ======================================== */

.noise {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.03;
  z-index: 9999;
}


/* ========================================
   Container
   ======================================== */

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}


/* ========================================
   Navigation
   ======================================== */

#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 1000;
  transition: background 0.3s, backdrop-filter 0.3s, box-shadow 0.3s;
}

#navbar.scrolled {
  background: rgba(8, 8, 12, 0.8);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 1px 0 var(--border);
}

.nav-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  transition: opacity 0.2s;
}

.nav-logo:hover { opacity: 0.7; }

.logo-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gradient);
  display: inline-block;
}

/* Nav Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  transition: color 0.2s;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient);
  border-radius: 1px;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Nav Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Language Toggle */
.lang-toggle {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 4px;
  gap: 0;
  overflow: hidden;
}

.lang-option {
  position: relative;
  z-index: 1;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  color: var(--text-muted);
  transition: color 0.3s;
  border-radius: var(--r-full);
  user-select: none;
}

.lang-option.active {
  color: var(--text-primary);
}

.lang-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--bg-hover);
  border-radius: var(--r-full);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.lang-toggle[data-lang="en"] .lang-slider {
  transform: translateX(100%);
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
  transform-origin: center;
}

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

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

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


/* ========================================
   Mobile Menu Overlay
   ======================================== */

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(8, 8, 12, 0.95);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mobile-link {
  font-family: var(--f-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 12px 24px;
  transition: color 0.2s, transform 0.2s;
  opacity: 0;
  transform: translateY(20px);
}

.mobile-menu.open .mobile-link {
  opacity: 1;
  transform: translateY(0);
}

.mobile-link:hover {
  color: var(--text-primary);
}


/* ========================================
   Hero Section
   ======================================== */

#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 120px 24px 80px;
}

/* Hero Background */
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
}

.hero-orb-1 {
  width: 600px;
  height: 600px;
  background: var(--violet);
  top: -20%;
  left: -10%;
  animation: orbFloat1 20s ease-in-out infinite;
}

.hero-orb-2 {
  width: 500px;
  height: 500px;
  background: var(--cyan);
  bottom: -20%;
  right: -10%;
  animation: orbFloat2 25s ease-in-out infinite;
}

.hero-orb-3 {
  width: 300px;
  height: 300px;
  background: var(--violet-light);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat3 18s ease-in-out infinite;
}

/* Perspective Grid */
.hero-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 20%, transparent 70%);
}

/* Hero Content */
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Avatar */
.avatar-wrapper {
  margin-bottom: 8px;
}

.avatar-ring {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  padding: 4px;
  background: var(--gradient);
  animation: ringRotate 6s linear infinite;
  background-size: 200% 200%;
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-base);
}

/* Hero Typography */
.hero-name {
  font-family: var(--f-display);
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-title {
  font-family: var(--f-mono);
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

.hero-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

.hero-location svg {
  flex-shrink: 0;
}

/* Hero CTA */
.hero-cta {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: var(--r-full);
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 24px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.4);
}

.btn-ghost {
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.btn-ghost:hover {
  border-color: var(--violet-light);
  background: rgba(124, 58, 237, 0.08);
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1;
}

.scroll-text {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: var(--gradient);
  animation: scrollPulse 2s ease-in-out infinite;
  transform-origin: top;
}


/* ========================================
   Sections (shared)
   ======================================== */

.section {
  padding: 100px 0;
  position: relative;
}

.section-header {
  margin-bottom: 56px;
}

.section-tag {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan-light);
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--f-display);
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}


/* ========================================
   Skills Section
   ======================================== */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.skill-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.skill-group:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.skill-group-title {
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.chip:hover {
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.1);
}

.chip-accent {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.25);
  color: var(--violet-light);
}

.chip-accent:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.15);
}


/* ========================================
   Experience Timeline
   ======================================== */

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 24px;
  position: relative;
}

.timeline-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding-top: 6px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--text-muted);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.timeline-dot.active {
  border-color: var(--violet);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
  background: var(--violet);
}

.timeline-line {
  width: 2px;
  flex-grow: 1;
  background: var(--border);
  margin-top: 4px;
}

.timeline-card {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 24px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.timeline-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.timeline-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.timeline-card-title h3 {
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.timeline-role {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.timeline-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.badge {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: var(--r-full);
}

.badge-date {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.badge-type {
  color: var(--cyan-light);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.15);
}

.timeline-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-card-body li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
}

.timeline-card-body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--violet);
}


/* ========================================
   Projects Section
   ======================================== */

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

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.project-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  transform: translateY(-4px);
}

.project-img-wrap {
  position: relative;
  aspect-ratio: 512 / 250;
  overflow: hidden;
}

.project-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-card:hover .project-img-wrap img {
  transform: scale(1.05);
}

.project-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-surface) 0%, transparent 50%);
  pointer-events: none;
}

/* Placeholder projects */
.project-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.woofz-bg {
  background: linear-gradient(135deg, #d97706, #f59e0b, #fbbf24);
}

.github-bg {
  background: linear-gradient(135deg, #1a1a2e, #2d2d44);
}

.placeholder-label {
  font-family: var(--f-display);
  font-size: 24px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.placeholder-label-sm {
  font-size: 18px;
}

.placeholder-gh-icon {
  position: absolute;
}

.project-body {
  padding: 20px 24px 24px;
}

.project-name {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.project-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

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

.plink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}

.plink:hover {
  color: var(--text-primary);
  border-color: var(--violet);
  background: rgba(124, 58, 237, 0.1);
  transform: translateY(-2px);
}


/* ========================================
   Education
   ======================================== */

.edu-card {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  transition: border-color 0.3s;
}

.edu-card:hover {
  border-color: var(--border-hover);
}

.edu-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: rgba(124, 58, 237, 0.1);
  color: var(--violet-light);
  flex-shrink: 0;
}

.edu-name {
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.edu-details {
  font-size: 14px;
  color: var(--text-secondary);
}


/* ========================================
   Open Source
   ======================================== */

.oss-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.oss-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.oss-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.oss-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
}

.oss-name {
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.oss-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}


/* ========================================
   Contacts
   ======================================== */

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 28px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.contact-card:hover {
  border-color: var(--violet);
  box-shadow: 0 0 24px rgba(124, 58, 237, 0.12);
  transform: translateY(-4px);
}

.contact-card svg {
  color: var(--text-secondary);
  transition: color 0.2s;
}

.contact-card:hover svg {
  color: var(--violet-light);
}

.contact-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.contact-val {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--text-secondary);
}


/* ========================================
   Footer
   ======================================== */

.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.footer p {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}


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

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

  .menu-toggle {
    display: flex;
  }
}

@media (max-width: 767px) {
  .section {
    padding: 72px 0;
  }

  .section-header {
    margin-bottom: 40px;
  }

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

  /* Timeline */
  .timeline-card-header {
    flex-direction: column;
  }

  .timeline-card-meta {
    align-items: flex-start;
  }

  .timeline-card {
    padding: 20px;
  }

  /* OSS */
  .oss-grid {
    grid-template-columns: 1fr;
  }

  /* Contacts */
  .contacts-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Education */
  .edu-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
  }

  /* Hero */
  .hero-cta {
    flex-direction: column;
    width: 100%;
    max-width: 280px;
  }
}

@media (max-width: 480px) {
  .contacts-grid {
    grid-template-columns: 1fr;
  }

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