:root {
  --void: #05070d;
  --surface: #0c1220;
  --surface-2: #101a2e;
  --border: rgba(140, 190, 255, 0.12);
  --border-strong: rgba(140, 190, 255, 0.24);

  --blue-deep: #12306b;
  --blue-mid: #2f6fed;
  --blue-light: #7fb8ff;
  --blue-pale: #bcdcff;

  --text: #e9eefb;
  --text-dim: #a9b7d4;
  --muted: #6f7f9f;

  --grad-1: linear-gradient(135deg, #bcdcff 0%, #4a86f0 45%, #12306b 100%);
  --grad-2: linear-gradient(120deg, #7fb8ff, #2f6fed);
  --grad-radial: radial-gradient(circle at 30% 20%, rgba(47,111,237,0.22), transparent 60%);

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --maxw: 1120px;
  --radius: 14px;
  --radius-sm: 8px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

body {
  background: var(--void);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: var(--blue-mid); color: #fff; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 3px;
  border-radius: 4px;
}

.mono { font-family: var(--font-mono); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--blue-mid);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 999;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 900px 600px at 15% -5%, rgba(47,111,237,0.28), transparent 60%),
    radial-gradient(ellipse 700px 500px at 90% 15%, rgba(127,184,255,0.14), transparent 55%),
    radial-gradient(ellipse 800px 700px at 50% 100%, rgba(18,48,107,0.35), transparent 60%),
    var(--void);
}

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

.grad-text {
  color: var(--blue-light);
  text-shadow: 0 0 30px rgba(47,111,237,0.35);
}

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem clamp(1.25rem, 4vw, 3rem);
  background: rgba(5, 7, 13, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.nav.is-scrolled {
  border-bottom-color: var(--border);
  background: rgba(5, 7, 13, 0.82);
}

.nav__brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.nav__logo {
  border-radius: 6px;
  margin-right: 0.5rem;
}
.nav__prompt { color: var(--blue-light); font-family: var(--font-mono); margin-right: 0.15rem; }
.cursor {
  color: var(--blue-light);
  opacity: 1;
}
.cursor--idle {
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%, 45% { opacity: 1; } 50%, 100% { opacity: 0; } }

.nav__links {
  display: flex;
  gap: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.nav__links a {
  color: var(--text-dim);
  transition: color 0.2s var(--ease);
  position: relative;
}
.nav__links a:hover { color: var(--text); }
.nav__links .idx { color: var(--blue-mid); margin-right: 0.15rem; }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.65rem;
  margin: -0.65rem;
}
.nav__toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}

.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7rem clamp(1.25rem, 5vw, 3rem) 4rem;
  position: relative;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 78% 45%, rgba(47,111,237,0.2), transparent 70%),
    linear-gradient(100deg, var(--void) 0%, rgba(5,7,13,0.75) 32%, rgba(5,7,13,0.4) 60%, rgba(5,7,13,0.15) 100%),
    linear-gradient(0deg, var(--void) 0%, transparent 20%, transparent 80%, var(--void) 100%);
}
.hero__mockup {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 82% 48%;
  opacity: 0.95;
  filter: saturate(0.9) contrast(1.05) brightness(1);
}

.hero__grid {
  position: relative;
  z-index: 1;
  max-width: 700px;
  width: 100%;
  margin: 0 auto 0 0;
}
.hero__grid::before {
  content: "";
  position: absolute;
  inset: -2.5rem -3rem;
  background: radial-gradient(ellipse 100% 100% at 25% 35%, rgba(5,7,13,0.8), rgba(5,7,13,0.45) 55%, transparent 82%);
  z-index: -1;
  pointer-events: none;
  border-radius: 2rem;
}

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; }
  .hero__mockup { object-position: 72% 45%; opacity: 0.55; }
  .hero__bg::after {
    background:
      linear-gradient(180deg, rgba(5,7,13,0.5) 0%, rgba(5,7,13,0.82) 55%, var(--void) 100%);
  }
}

.hero__eyebrow {
  color: var(--blue-light);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
}
.hero__title .line { display: block; }
.hero__handle {
  font-weight: 500;
  font-size: 0.55em;
  color: var(--text-dim);
  margin-top: 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.hero__handle .grad-text {
  font-weight: 700;
  font-size: 1.5em;
  letter-spacing: -0.01em;
  text-shadow: 0 0 34px rgba(47,111,237,0.5);
}

.hero__terminal {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--blue-pale);
  min-height: 1.5em;
  line-height: 1.5em;
  display: block;
  overflow: hidden;
}
.hero__terminal .prompt { color: var(--blue-light); margin-right: 0.5rem; }
.hero__terminal .cursor { margin-left: 0.15em; }

.hero__desc {
  margin-top: 1.5rem;
  max-width: 52ch;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.hero__cta {
  display: flex;
  gap: 1rem;
  margin-top: 2.25rem;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  background-clip: padding-box;
}
.btn--primary {
  background: var(--blue-mid);
  border-color: transparent;
  color: #05070d;
  font-weight: 600;
  box-shadow: 0 0 0 rgba(47,111,237,0);
}
.btn--primary:hover {
  background: var(--blue-light);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -8px rgba(47,111,237,0.55);
}
.btn--ghost {
  border-color: var(--border-strong);
  color: var(--text);
  background: rgba(5,7,13,0.55);
  backdrop-filter: blur(6px);
}
.btn--ghost:hover {
  border-color: var(--blue-light);
  background: rgba(127,184,255,0.1);
  transform: translateY(-2px);
}

.hero__stats {
  display: flex;
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.stat { display: flex; flex-direction: column; gap: 0.2rem; }
.stat__num {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
}
.stat__label {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
  opacity: 1;
  transition: opacity 0.3s var(--ease);
}
.scroll-hint.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.scroll-hint span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blue-light);
  animation: scrollHint 1.8s ease infinite;
}
@keyframes scrollHint {
  0% { opacity: 1; transform: translateY(0); }
  70% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 0; }
}

.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) clamp(1.25rem, 5vw, 3rem);
}

.section__head { max-width: 640px; margin-bottom: 3rem; }

.eyebrow {
  color: var(--blue-light);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.9rem;
  display: block;
}

.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.section__sub {
  margin-top: 0.9rem;
  color: var(--text-dim);
  font-size: 0.98rem;
}
.section__sub a { color: var(--blue-light); border-bottom: 1px solid rgba(127,184,255,0.35); }
.section__sub a:hover { border-color: var(--blue-light); }
.section__sub code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

.about__grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about__text p {
  color: var(--text-dim);
  margin-bottom: 1.1rem;
  font-size: 1.02rem;
}
.about__text strong { color: var(--text); font-weight: 600; }

.about__facts {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.about__facts div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.about__facts div:last-child { border-bottom: none; }
.about__facts dt { color: var(--muted); }
.about__facts dd { color: var(--text); text-align: right; }

.about__side {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.about__animation {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.about__animation-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}
.about__animation-label {
  position: absolute;
  bottom: 0.75rem;
  left: 0.9rem;
  font-size: 0.7rem;
  color: var(--muted);
  background: rgba(5,7,13,0.6);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #00ffff;
  margin-right: 0.6rem;
  box-shadow: 0 0 4px #00ffff;
}

.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 190px;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.project-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.project-card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
}
.project-card__name svg { vertical-align: -2px; margin-left: 0.35rem; opacity: 0.5; width: 14px; height: 14px; }

.project-card__desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  flex: 1;
}

.project-card__meta {
  display: flex;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  align-items: center;
}
.project-card__meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.lang-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue-mid);
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(127,184,255,0.06), transparent);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.projects__error { color: var(--muted); margin-top: 1.5rem; }
.projects__error a { color: var(--blue-light); border-bottom: 1px solid rgba(127,184,255,0.35); }

.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}
.skills__group h3 {
  font-size: 0.78rem;
  color: var(--blue-light);
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.tag-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.84rem;
  color: var(--text-dim);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.tag-list li:hover { border-color: var(--blue-light); color: var(--text); }

.timeline {
  position: relative;
  padding-left: 2.2rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: linear-gradient(var(--blue-mid), transparent);
}
.timeline__item {
  position: relative;
  padding-bottom: 2.6rem;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -2.2rem;
  top: 5px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--void);
  border: 2px solid var(--blue-mid);
}
.timeline__item--now::before {
  background: var(--blue-light);
  box-shadow: 0 0 12px var(--blue-mid);
}
.timeline__date {
  color: var(--blue-light);
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}
.timeline__body h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.timeline__body p { color: var(--text-dim); font-size: 0.92rem; max-width: 60ch; }

.contact__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.contact-card:hover {
  transform: translateY(-4px);
  border-color: var(--blue-light);
  background: var(--surface-2);
}
.contact-card__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(47,111,237,0.14);
  color: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
}
.contact-card__label { font-weight: 600; font-family: var(--font-display); }
.contact-card__value { color: var(--muted); font-size: 0.82rem; word-break: break-word; }

.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem clamp(1.25rem, 5vw, 3rem) 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 1rem;
}
.footer__brand { display: flex; align-items: center; gap: 0.55rem; }
.footer__brand img { border-radius: 4px; opacity: 0.8; }
.footer__top { color: var(--text-dim); transition: color 0.2s var(--ease); }
.footer__top:hover { color: var(--blue-light); }

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 200;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

@media (max-width: 820px) {
  .nav__links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    background: rgba(5,7,13,0.97);
    backdrop-filter: blur(14px);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  }
  .nav__links.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .nav__links a { padding: 0.85rem 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
  .nav__links a:last-child { border-bottom: none; }
  .nav__toggle { display: flex; }

  .hero__stats { gap: 1.75rem; }
}

@media (max-width: 480px) {
  .hero__cta { flex-direction: column; }
  .btn { justify-content: center; width: 100%; }

  .hero { padding: 6rem 1.1rem 3rem; }
  .hero__terminal {
    font-size: 0.82rem;
    min-height: calc(1.4em * 2);
    line-height: 1.4em;
  }
  .hero__desc { font-size: 0.95rem; }
  .hero__stats { gap: 1.25rem; flex-wrap: wrap; }
  .hero__stats .stat__num { font-size: 1.05rem; }

  .section { padding: 3.5rem 1.1rem; }
  .section__head h2 { font-size: 1.5rem; }

  .projects__grid,
  .skills__grid,
  .contact__grid {
    grid-template-columns: 1fr;
  }

  .contact-card { padding: 1.25rem; }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
}
