:root {
  --bg: #090b14;
  --text: #eef2ff;
  --muted: #c3cbea;
  --glass: rgba(255, 255, 255, 0.11);
  --glass-strong: rgba(255, 255, 255, 0.2);
  --stroke: rgba(255, 255, 255, 0.24);
  --shadow: 0 24px 40px rgba(0, 0, 0, 0.34);
  --accent: #7ae5ff;
  --accent-2: #b28dff;
  --radius: 24px;
}

body.light {
  --bg: #e8ebff;
  --text: #151a2f;
  --muted: #3f4769;
  --glass: rgba(255, 255, 255, 0.46);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --stroke: rgba(255, 255, 255, 0.95);
  --shadow: 0 18px 44px rgba(103, 120, 186, 0.3);
  --accent: #3e71ff;
  --accent-2: #8d53ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  font-family: "Inter", system-ui, sans-serif;
  background: radial-gradient(circle at 15% 20%, #151d35 0%, transparent 35%),
    radial-gradient(circle at 85% 10%, #321d45 0%, transparent 30%),
    radial-gradient(circle at 30% 85%, #10263c 0%, transparent 30%), var(--bg);
  color: var(--text);
  transition: background 0.4s ease, color 0.3s ease;
}

body.light {
  background: radial-gradient(circle at 10% 20%, rgba(191, 217, 255, 0.9) 0%, transparent 42%),
    radial-gradient(circle at 90% 5%, rgba(243, 213, 255, 0.85) 0%, transparent 40%),
    radial-gradient(circle at 30% 90%, rgba(186, 241, 255, 0.8) 0%, transparent 42%),
    linear-gradient(145deg, #f2f6ff 0%, #e3ebff 38%, #ddeeff 100%), var(--bg);
}

.bg-orb {
  position: fixed;
  width: 42vmax;
  height: 42vmax;
  border-radius: 50%;
  filter: blur(44px);
  z-index: -1;
  opacity: 0.45;
  pointer-events: none;
}

.orb-1 {
  background: linear-gradient(135deg, #5fe2ff, #8464ff);
  top: -15vmax;
  left: -10vmax;
  animation: drift 14s ease-in-out infinite;
}

.orb-2 {
  background: linear-gradient(135deg, #69ffd6, #30a5ff);
  right: -14vmax;
  top: 8vmax;
  animation: drift 20s ease-in-out infinite reverse;
}

.orb-3 {
  background: linear-gradient(135deg, #f5a2ff, #7698ff);
  left: 25%;
  bottom: -18vmax;
  animation: drift 18s ease-in-out infinite;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 9.2rem 0 4rem;
}

.topbar {
  position: fixed !important;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  overflow: visible;
  width: min(1100px, 92vw);
  margin: 0;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.logo {
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
}

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

.topbar nav {
  display: flex;
  flex: 1;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
}

.topbar nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.2s ease;
}

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

.lang-select {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 0.32rem 0.62rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
}

.topbar > .lang-select {
  min-height: 38px;
}

.lang-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar .nav-toggle {
  display: none;
}

.glass {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(160deg, var(--glass-strong), var(--glass));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 1px rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(16px) saturate(165%);
  -webkit-backdrop-filter: blur(16px) saturate(165%);
}

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

body.light .glass {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.36)),
    radial-gradient(circle at 8% 10%, rgba(255, 255, 255, 0.72) 0%, transparent 38%);
  border-color: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 20px 46px rgba(112, 128, 190, 0.28),
    0 2px 0 rgba(255, 255, 255, 0.85) inset,
    0 -18px 40px rgba(255, 255, 255, 0.2) inset;
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
}

body.light .glass::before {
  content: "";
  position: absolute;
  inset: -45% -20%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-30%) rotate(12deg);
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 34%,
    rgba(255, 255, 255, 0.18) 44%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.18) 56%,
    rgba(255, 255, 255, 0) 66%
  );
  transition: transform 0.8s ease, opacity 0.35s ease;
}

body.light .hover-lift:hover::before {
  opacity: 0.9;
  transform: translateX(28%) rotate(12deg);
}

body.light .profile-frame {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.3));
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 12px 28px rgba(111, 126, 187, 0.22),
    inset 0 2px 2px rgba(255, 255, 255, 0.82);
}

.hero,
.card,
.project,
.cta {
  padding: clamp(1.1rem, 3vw, 2rem);
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(170px, 260px) 1.3fr;
  gap: 1.2rem;
  align-items: center;
}

.hero-copy {
  min-width: 0;
}

.profile-frame {
  margin: 0;
  aspect-ratio: 1;
  border-radius: 24px;
  border: 1px solid var(--stroke);
  padding: 0.5rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.28);
}

.hero-copy .tag {
  margin-top: 0;
}

.profile-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
}

.hero h1 {
  margin: 0.4rem 0 0.8rem;
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 1.06;
}

.hero h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tag {
  display: inline-flex;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(120deg, rgba(122, 229, 255, 0.25), rgba(178, 141, 255, 0.22));
  box-shadow: 0 10px 24px rgba(89, 109, 196, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.45);
}

body.light .tag {
  border-color: rgba(255, 255, 255, 0.96);
  background: linear-gradient(120deg, rgba(79, 122, 255, 0.2), rgba(141, 83, 255, 0.16));
  box-shadow: 0 10px 22px rgba(98, 118, 191, 0.24), inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

.lead {
  max-width: 62ch;
  color: var(--muted);
}

.hero-actions {
  margin-top: 1.4rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.btn,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--stroke);
  color: var(--text);
  text-decoration: none;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
}

.chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.stats {
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
}

.stats li {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.06);
}

.stats strong {
  font-size: 1.28rem;
}

.stats span {
  color: var(--muted);
  font-size: 0.9rem;
}

.grid {
  margin-top: 1.1rem;
  display: grid;
  gap: 1rem;
}

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

h2 {
  margin-top: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.card p {
  color: var(--muted);
}

.about-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.about-card p {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.65;
}

.about-card .chips {
  margin-top: auto;
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.stack-grid h3 {
  margin: 0 0 0.3rem;
}

.stack-group {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
}

.stack-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stack-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  padding: 0.42rem;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.12);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.stack-logo:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}

body.light .stack-group {
  background: rgba(255, 255, 255, 0.36);
  border-color: rgba(255, 255, 255, 0.95);
}

body.light .stack-logo {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 8px 16px rgba(104, 120, 183, 0.18),
    inset 0 1px 1px rgba(255, 255, 255, 0.85);
}

body.light .stack-logo:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow:
    0 10px 20px rgba(94, 111, 175, 0.24),
    inset 0 1px 1px rgba(255, 255, 255, 0.95);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.3rem;
}

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

.project-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.project p {
  color: var(--muted);
}

.project {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.projects {
  margin-top: 1.5rem;
}

.project ul {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.project .chip {
  margin-top: auto;
  width: fit-content;
}

.cta {
  margin-top: 2rem;
}

.cta p {
  color: var(--muted);
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 1.4rem 1rem 2rem;
}

.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.35s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 44px rgba(0, 0, 0, 0.35);
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(2vmax, -2vmax) scale(1.06);
  }
}

@media (max-width: 920px) {
  .two-cols,
  .project-grid,
  .stack-grid {
    grid-template-columns: 1fr;
  }

  .hero-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
  }

  .profile-frame {
    width: min(180px, 55vw);
    justify-self: center;
    padding: 0.35rem;
  }

  .hero {
    padding: 1rem;
  }

  .hero-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-copy .tag {
    margin: 0 0 0.45rem;
    font-size: 0.84rem;
    padding: 0.35rem 0.72rem;
  }

  .title {
    font-size: clamp(1.4rem, 7vw, 2rem);
    line-height: 1.15;
    margin-top: 0.35rem;
  }

  .lead {
    font-size: 0.98rem;
    line-height: 1.6;
    margin: 0.45rem 0 0;
  }

  .hero-actions {
    width: 100%;
    justify-content: center;
    gap: 0.55rem;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 300px;
  }

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

  .topbar {
    justify-content: flex-start;
    gap: 0.55rem;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .topbar nav {
    display: flex;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.7rem;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: #11182d;
    box-shadow: var(--shadow);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    z-index: 1200;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  body.light .topbar nav {
    background: #f4f7ff;
    border-color: #dbe4ff;
  }

  .topbar nav.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .topbar nav a {
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
  }

  .topbar nav a:hover {
    background: rgba(255, 255, 255, 0.14);
  }

  .topbar .logo {
    order: 1;
  }

  .topbar .nav-toggle {
    order: 2;
    margin-left: auto;
    display: inline-flex;
  }

  .topbar > #themeToggle {
    order: 3;
    display: inline-flex;
  }

  .topbar > .lang-select {
    order: 4;
    display: inline-block;
  }

  .container {
    padding-top: 6.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
