:root {
  --bg: #070b14;
  --bg-soft: #0f172a;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --line: #1e293b;
  --accent: #38bdf8;
  --accent-strong: #22d3ee;
  --accent-violet: #c084fc;
  --accent-violet-soft: #e9d5ff;
  --glass: rgba(15, 23, 42, 0.58);
  --radius: 18px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.16), transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(34, 211, 238, 0.14), transparent 32%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.08) 1px, transparent 1px);
  background-size: 56px 56px;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.bg-blob {
  position: fixed;
  width: 34vw;
  height: 34vw;
  min-width: 240px;
  min-height: 240px;
  border-radius: 50%;
  filter: blur(58px);
  pointer-events: none;
  z-index: -1;
  animation: blob-float 14s ease-in-out infinite;
}

.global-sweep {
  display: none;
}

.global-sweep::after {
  display: none;
}

@keyframes page-sweep {
  0% {
    transform: translateX(-60vw) rotate(18deg);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    transform: translateX(165vw) rotate(18deg);
    opacity: 0;
  }
}

.blob-a {
  top: 6%;
  left: -7%;
  background: radial-gradient(circle, rgba(192, 132, 252, 0.24) 0%, rgba(192, 132, 252, 0) 70%);
}

.blob-b {
  right: -9%;
  bottom: 8%;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.16) 0%, rgba(244, 114, 182, 0) 70%);
  animation-delay: 2.5s;
}

.cursor-glow {
  position: fixed;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(192, 132, 252, 0.18) 0%, rgba(34, 211, 238, 0.08) 35%, rgba(34, 211, 238, 0) 72%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.25s ease;
}

@keyframes blob-float {
  0%,
  100% {
    transform: translateY(0) translateX(0) scale(1);
  }
  33% {
    transform: translateY(-12px) translateX(8px) scale(1.04);
  }
  66% {
    transform: translateY(8px) translateX(-6px) scale(0.97);
  }
}

#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(7, 11, 20, 0.7);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem clamp(1rem, 2.5vw, 2rem);
}

.brand {
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
}

.menu-toggle {
  display: none;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
}

.site-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent-strong);
}

main {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.section {
  margin-top: 2rem;
  padding: clamp(1.1rem, 2.3vw, 1.8rem);
  border-radius: var(--radius);
}

.hero {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}

.profile-avatar {
  width: clamp(86px, 14vw, 128px);
  height: clamp(86px, 14vw, 128px);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(192, 132, 252, 0.6);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.14), 0 8px 26px rgba(0, 0, 0, 0.34);
}

.badge {
  font-size: 0.8rem;
  color: var(--accent-strong);
  border: 1px solid rgba(34, 211, 238, 0.4);
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
}

h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 1.1;
}

.scan-glow {
  position: relative;
  display: inline-block;
  color: #e9faff;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.16);
}

.scan-glow::after {
  display: none;
}

h2,
h3,
.key,
.strong-line {
  display: inline-block;
  background-image: none;
  animation: none;
}

strong {
  display: inline-block;
  color: #ecfeff;
  background-image: none;
  animation: none;
}

@keyframes text-sweep {
  0% {
    background-position: -135% -135%;
  }
  100% {
    background-position: 135% 135%;
  }
}

@keyframes scan-sweep {
  0% {
    background-position: -140% -140%;
    opacity: 0.15;
  }
  18% {
    opacity: 1;
  }
  46% {
    opacity: 0.2;
  }
  100% {
    background-position: 140% 140%;
    opacity: 0;
  }
}

.subtitle {
  color: var(--muted);
}

.subtitle-glow {
  color: #cbd5e1;
  animation: subtitle-pulse 4s ease-in-out infinite;
}

@keyframes subtitle-pulse {
  0%, 100% {
    color: #cbd5e1;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
  }
  50% {
    color: #e0f2fe;
    text-shadow: 0 0 25px rgba(56, 189, 248, 0.8), 0 0 40px rgba(34, 211, 238, 0.6);
  }
}

.hero-intro {
  max-width: 760px;
  color: #cbd5e1;
}

.hero-actions {
  margin-top: 0.4rem;
  display: flex;
  justify-content: center;
  gap: 0.8rem;
}

.btn {
  text-decoration: none;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #051018;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.25);
}

.btn-outline {
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-violet {
  color: #f3e8ff;
  border: 1px solid rgba(192, 132, 252, 0.5);
  background: linear-gradient(120deg, rgba(126, 34, 206, 0.32), rgba(192, 132, 252, 0.26));
}

.glass {
  background: var(--glass);
  border: 1px solid rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(9px);
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

p,
li {
  color: var(--muted);
}

.key {
  color: var(--accent-strong);
  font-weight: 700;
}

.strong-line {
  color: #d7f6ff;
  font-weight: 600;
}

.violet {
  color: var(--accent-violet) !important;
  font-weight: 700;
  text-shadow: 0 0 14px rgba(192, 132, 252, 0.35);
}

ul {
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#projects .grid-3,
#research .grid-2 {
  grid-template-columns: 1fr;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.project-card,
.research-card {
  max-height: 120px;
  transition: max-height 0.675s ease, border-color 0.45s ease, background 0.45s ease, transform 0.45s ease;
}

.project-card > :not(h3):not(.card-summary),
.research-card > :not(h3):not(.card-summary) {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(8px);
  transition: opacity 0.39s ease, max-height 0.675s ease, transform 0.45s ease;
}

.card-summary {
  margin-top: 0.48rem;
  color: var(--muted);
  font-size: 0.92rem;
  opacity: 1;
  max-height: 4rem;
  overflow: hidden;
  transform: translateY(0);
  transition: opacity 0.33s ease, max-height 0.33s ease, transform 0.33s ease;
}

.summary-key {
  color: #7dd3fc;
  font-weight: 700;
}

.project-card:hover,
.project-card:focus-within,
.research-card:hover,
.research-card:focus-within {
  max-height: 620px;
  border-color: rgba(192, 132, 252, 0.45);
  background: rgba(15, 23, 42, 0.74);
  transform: translateY(-2px);
}

.project-card:hover > :not(h3),
.project-card:focus-within > :not(h3),
.research-card:hover > :not(h3),
.research-card:focus-within > :not(h3) {
  opacity: 1;
  max-height: 500px;
  transform: translateY(0);
}

.project-card:hover .card-summary,
.project-card:focus-within .card-summary,
.research-card:hover .card-summary,
.research-card:focus-within .card-summary {
  opacity: 0;
  max-height: 0;
  transform: translateY(-4px);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -130%;
  width: 72%;
  height: 100%;
  background: linear-gradient(115deg, transparent 0%, rgba(192, 132, 252, 0.2) 48%, rgba(34, 211, 238, 0.24) 52%, transparent 100%);
  transform: skewX(-20deg);
  transition: left 0.8s ease;
  pointer-events: none;
  display: none;
}

.card:hover::before {
  left: 180%;
}

.card p + p,
.timeline-item p + p {
  margin-top: 0.4rem;
}

.meta {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: #67e8f9;
}

.repo-link {
  color: var(--accent-violet);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px dashed rgba(192, 132, 252, 0.58);
}

.repo-link:hover {
  color: var(--accent-violet-soft);
}

.tech-stack {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.tech-tag {
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.35rem 0.52rem;
  border-radius: 999px;
  color: #f3e8ff;
  border: 1px solid rgba(192, 132, 252, 0.48);
  background: rgba(76, 29, 149, 0.28);
}

.project-card h3 {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.title-main {
  min-width: 0;
}

.title-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.project-card:hover .title-tags,
.project-card:focus-within .title-tags {
  display: none;
}

.mini-tag {
  font-size: 0.66rem;
  line-height: 1;
  padding: 0.26rem 0.45rem;
  border-radius: 999px;
  color: #f3e8ff;
  border: 1px solid rgba(192, 132, 252, 0.48);
  background: rgba(76, 29, 149, 0.3);
  white-space: nowrap;
  background-image: none !important;
  -webkit-text-fill-color: #f3e8ff;
  animation: none !important;
}

.timeline {
  display: grid;
  gap: 0.9rem;
}

.timeline-item {
  border-left: 2px solid rgba(56, 189, 248, 0.45);
  padding: 0.2rem 0 0.2rem 0.9rem;
}

.time {
  display: inline-block;
  font-size: 0.78rem;
  color: #67e8f9;
  margin-bottom: 0.2rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.7);
}

.photo-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.photo-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.62);
  overflow: hidden;
  max-height: 52px;
  transition: max-height 0.63s ease, border-color 0.45s ease, background 0.45s ease, transform 0.45s ease;
}

.photo-card:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.75);
  outline-offset: 2px;
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  opacity: 0;
  max-height: 0;
  transform: translateY(8px);
  transition: opacity 0.36s ease, max-height 0.63s ease, transform 0.45s ease;
}

.photo-card figcaption {
  position: relative;
  padding: 0.5rem 0.65rem 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.photo-card:hover,
.photo-card:focus {
  max-height: 420px;
  border-color: rgba(192, 132, 252, 0.45);
  background: rgba(15, 23, 42, 0.74);
  transform: translateY(-2px);
}

.photo-card:hover img,
.photo-card:focus img {
  opacity: 1;
  max-height: 340px;
  transform: translateY(0);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  background: rgba(3, 8, 18, 0.82);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.photo-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.photo-lightbox-image {
  max-width: min(92vw, 1400px);
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.photo-lightbox-close {
  position: fixed;
  top: clamp(0.8rem, 2vw, 1.25rem);
  right: clamp(0.8rem, 2vw, 1.25rem);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.75);
  color: #e2e8f0;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.photo-lightbox-close:hover {
  border-color: rgba(192, 132, 252, 0.65);
  transform: translateY(-1px);
}

.photo-lightbox-close:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.75);
  outline-offset: 2px;
}

.connect-section {
  position: relative;
  margin-top: 2.4rem;
  text-align: center;
  overflow: hidden;
}

.connect-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.06) 1px, transparent 1px);
  background-size: 72px 72px;
}

.connect-section > * {
  position: relative;
  z-index: 1;
}

.connect-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.8rem;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.12);
  font-size: 1.2rem;
}

.connect-title {
  font-size: clamp(1.9rem, 4.5vw, 3.05rem);
  margin-bottom: 0.7rem;
  color: #dbeafe;
}

.connect-title span {
  background: linear-gradient(120deg, #60a5fa, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.connect-text {
  max-width: 860px;
  margin: 0 auto;
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  line-height: 1.75;
  color: #cbd5e1;
}

.connect-actions {
  margin-top: 1.4rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.connect-actions-top {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  align-items: stretch;
}

.connect-actions-bottom {
  margin-top: 0.95rem;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.2);
  min-height: 48px;
}

.contact-btn:hover,
.contact-btn:focus-visible {
  color: #e0f2fe;
  border-color: rgba(56, 189, 248, 0.7);
  background: linear-gradient(120deg, rgba(37, 99, 235, 0.88), rgba(14, 165, 233, 0.86));
  box-shadow: 0 10px 24px rgba(56, 189, 248, 0.26);
}

.cv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #e0f2fe;
  border: 1px solid rgba(56, 189, 248, 0.82);
  background: linear-gradient(120deg, rgba(37, 99, 235, 0.92), rgba(14, 165, 233, 0.88));
  box-shadow: 0 10px 24px rgba(56, 189, 248, 0.28);
  min-height: 48px;
  min-width: min(380px, 86vw);
}

.cv-btn:hover,
.cv-btn:focus-visible {
  transform: translateY(-2px);
}

.btn-symbol {
  font-weight: 700;
  font-size: 0.95em;
  opacity: 0.95;
}

.site-footer {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 1rem;
  color: var(--muted);
}

.fade-in {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 860px) {
  .menu-toggle {
    display: block;
  }

  .site-nav {
    position: absolute;
    top: 3.65rem;
    right: 1rem;
    width: min(72vw, 260px);
    background: rgba(7, 11, 20, 0.95);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem;
    display: none;
    flex-direction: column;
  }

  .site-nav.open {
    display: flex;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

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

  .connect-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .connect-actions-top {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .cv-btn {
    min-width: 0;
    width: 100%;
  }

  .connect-actions .btn {
    text-align: center;
  }

  .photo-card {
    max-height: none;
    transform: none;
  }

  .photo-card img {
    opacity: 1;
    max-height: none;
    transform: none;
  }

  .project-card,
  .research-card {
    max-height: none;
  }

  .project-card > :not(h3),
  .research-card > :not(h3) {
    opacity: 1;
    max-height: none;
    transform: none;
  }

  .card-summary {
    display: none;
  }

  .title-tags {
    display: none;
  }
}

@media (max-width: 860px), (prefers-reduced-motion: reduce) {
  .cursor-glow,
  .bg-blob {
    display: none;
  }
}
