/* ============================
   RESET & VARIABLES
============================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #000000;
  --bg-elev: #0a0a0a;
  --fg: #ffffff;
  --fg-muted: #a1a1aa;
  --fg-dim: #52525b;
  --line: #1f1f23;
  --line-hover: #3f3f46;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --container: 1080px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ============================
   BACKGROUND LAYERS
============================ */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 100%);
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.09) 0%, transparent 65%);
  filter: blur(20px);
}

main, .footer, .nav {
  position: relative;
  z-index: 1;
}

/* ============================
   NAVBAR
============================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.nav.scrolled {
  border-bottom-color: var(--line);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.nav__logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.nav__logo span {
  color: var(--fg-muted);
}

.nav__links {
  display: flex;
  gap: 36px;
}

.nav__links a {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--fg-muted);
  transition: color 0.2s;
}

.nav__links a:hover,
.nav__links a.active {
  color: var(--fg);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--fg);
  transition: transform 0.3s, opacity 0.3s;
}

.nav__toggle.open span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav__toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav__toggle.open span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ============================
   BUTTONS
============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--fg);
  transition: background 0.25s, color 0.25s, transform 0.25s var(--ease);
}

.btn--primary {
  background: var(--fg);
  color: var(--bg);
}

.btn--primary:hover {
  background: transparent;
  color: var(--fg);
  transform: translateY(-2px);
}

.btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line-hover);
}

.btn--ghost:hover {
  border-color: var(--fg);
  transform: translateY(-2px);
}

/* ============================
   HERO
============================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: 120px 0 80px;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 12px;
  border: 1px solid var(--line-hover);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--fg-muted);
  margin-bottom: 32px;
  background: rgba(255, 255, 255, 0.02);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg);
  position: relative;
}

.pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--fg);
  animation: pulseRing 1.8s ease-out infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 10vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  margin-bottom: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__title .dot {
  -webkit-text-fill-color: var(--fg-dim);
}

.hero__subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.rotator {
  color: var(--fg);
  display: inline-block;
  border-bottom: 2px solid var(--fg);
  padding-bottom: 2px;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.rotator.out {
  opacity: 0;
  transform: translateY(8px);
}

.btn__arrow {
  display: inline-block;
  margin-left: 8px;
  transition: transform 0.3s var(--ease);
}

.btn:hover .btn__arrow {
  transform: translateX(4px);
}

/* ============================
   MARQUEE
============================ */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  background: rgba(255, 255, 255, 0.015);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee__track {
  display: flex;
  align-items: center;
  gap: 32px;
  width: max-content;
  animation: marquee 40s linear infinite;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

.marquee__track span {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
}

.marquee__track i {
  font-style: normal;
  color: var(--fg-dim);
  font-size: 0.7rem;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.hero__desc {
  max-width: 560px;
  font-size: 1.05rem;
  color: var(--fg-muted);
  margin-bottom: 40px;
}

.hero__desc em {
  color: var(--fg);
  font-style: normal;
  font-weight: 500;
}

.hero__actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero__scroll {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 40px;
  border: 1px solid var(--line-hover);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.hero__scroll span {
  width: 3px;
  height: 8px;
  background: var(--fg);
  border-radius: 2px;
  animation: scrollDot 1.8s infinite var(--ease);
}

@keyframes scrollDot {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ============================
   HERO GRID + CODE WINDOW
============================ */
.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 64px;
  align-items: center;
}

.hero__visual {
  position: relative;
  transition-delay: 0.35s;
}

.code-window {
  position: relative;
  z-index: 1;
  border: 1px solid var(--line-hover);
  border-radius: 14px;
  background: rgba(8, 8, 8, 0.85);
  backdrop-filter: blur(8px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 30px 60px -20px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  animation: floatY 7s ease-in-out infinite;
}

@keyframes floatY {
  0%, 100% { transform: translateY(0) rotate(0.001deg); }
  50% { transform: translateY(-10px) rotate(0.001deg); }
}

.code-window__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.code-window__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--fg-dim);
  background: rgba(255, 255, 255, 0.06);
}

.code-window__title {
  margin-left: auto;
  margin-right: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.72rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}

.code-window__body {
  margin: 0;
  padding: 20px 20px 16px;
  min-height: 300px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--fg-muted);
  white-space: pre;
  overflow: hidden;
}

.code-window__body .ln {
  display: inline-block;
  width: 22px;
  margin-right: 14px;
  text-align: right;
  color: var(--fg-dim);
  user-select: none;
}

.code-window__body .kw { color: var(--fg); font-weight: 600; }
.code-window__body .key { color: #cfcfcf; }
.code-window__body .str { color: #a8a8a8; font-style: italic; }
.code-window__body .fn { color: var(--fg); }
.code-window__body .cm { color: var(--fg-dim); }
.code-window__body .ok { color: var(--fg); }

.code-cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: var(--fg);
  vertical-align: -0.2em;
  margin-left: 2px;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  to { visibility: hidden; }
}

.code-window__status {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.68rem;
  color: var(--fg-dim);
  background: rgba(255, 255, 255, 0.02);
}

.code-window__status-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pulse--sm {
  width: 6px;
  height: 6px;
  display: inline-block;
}

.code-window__glow {
  position: absolute;
  inset: -20%;
  z-index: 0;
  background: radial-gradient(
    circle at 60% 40%,
    rgba(255, 255, 255, 0.07),
    transparent 60%
  );
  filter: blur(30px);
  pointer-events: none;
}

/* ============================
   SECTIONS
============================ */
.section {
  padding: 120px 0;
  border-top: 1px solid var(--line);
}

#about {
  border-top: none;
}

.section__head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 56px;
}

.section__num {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--fg-dim);
  letter-spacing: 0.1em;
}

.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

/* ============================
   ABOUT
============================ */
.about {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 64px;
  align-items: start;
}

.about__text p {
  color: var(--fg-muted);
  font-size: 1.05rem;
  margin-bottom: 20px;
}

.about__text strong {
  color: var(--fg);
  font-weight: 500;
}

.about__text em {
  color: var(--fg);
  font-style: normal;
}

.about__stats {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.stat {
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}

.stat:last-child {
  border-bottom: none;
}

.stat__num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat__label {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* ============================
   SKILLS
============================ */
.skills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.skill {
  background: var(--bg);
  padding: 32px 28px;
  transition: background 0.3s;
  position: relative;
  overflow: hidden;
}

.skill:hover {
  background: var(--bg-elev);
}

.skill__num {
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
  margin-bottom: 22px;
  transition: color 0.3s;
}

.skill:hover .skill__num {
  color: var(--fg);
}

/* ============================
   SPOTLIGHT (cursor-follow glow)
============================ */
.spotlight {
  --mx: 50%;
  --my: 50%;
}

.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    380px circle at var(--mx) var(--my),
    rgba(255, 255, 255, 0.08),
    transparent 45%
  );
  opacity: 0;
  transition: opacity 0.4s;
  z-index: 0;
}

.spotlight:hover::before {
  opacity: 1;
}

.spotlight > * {
  position: relative;
  z-index: 1;
}

.skill h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.skill p {
  font-size: 0.92rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* ============================
   PROJECTS
============================ */
.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.project {
  display: flex;
  flex-direction: column;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s, transform 0.4s var(--ease), background 0.3s;
}

.project:hover {
  border-color: var(--line-hover);
  background: var(--bg-elev);
  transform: translateY(-6px);
}

.project__num {
  position: absolute !important;
  top: 8px;
  right: 20px;
  font-family: var(--font-display);
  font-size: 5.5rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.04);
  pointer-events: none;
  transition: color 0.4s;
  z-index: 0 !important;
}

.project:hover .project__num {
  color: rgba(255, 255, 255, 0.09);
}

.project__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.project__tag {
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project__arrow {
  font-size: 1.2rem;
  color: var(--fg-dim);
  transition: transform 0.3s var(--ease), color 0.3s;
}

.project:hover .project__arrow {
  color: var(--fg);
  transform: translate(3px, -3px);
}

.project__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.project__desc {
  font-size: 0.95rem;
  color: var(--fg-muted);
  flex: 1;
  margin-bottom: 28px;
}

.project__url {
  font-size: 0.85rem;
  color: var(--fg-dim);
  font-family: var(--font-display);
  transition: color 0.3s;
}

.project:hover .project__url {
  color: var(--fg);
}

/* ============================
   CONTACT
============================ */
.contact {
  max-width: 620px;
}

.contact__title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 18px;
}

.contact__desc {
  color: var(--fg-muted);
  font-size: 1.05rem;
  margin-bottom: 36px;
}

.contact__actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.contact__cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 40px;
}

.contact__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.25s, background 0.25s, transform 0.3s var(--ease);
}

.contact__card:hover {
  border-color: var(--line-hover);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-3px);
}

.contact__card-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
}

.contact__card-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg);
  word-break: break-all;
}

/* ============================
   FOOTER
============================ */
.footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  text-align: center;
}

.footer p {
  font-size: 0.85rem;
  color: var(--fg-dim);
}

/* ============================
   REVEAL ANIMATION
============================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================
   RESPONSIVE
============================ */
@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .hero__visual {
    max-width: 520px;
  }
  .code-window {
    animation: none;
  }
  .skills,
  .projects {
    grid-template-columns: repeat(2, 1fr);
  }
  .about {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

@media (max-width: 640px) {
  .section {
    padding: 80px 0;
  }
  .skills,
  .projects {
    grid-template-columns: 1fr;
  }
  .nav__toggle {
    display: flex;
  }
  .nav__links {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px 20px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s var(--ease);
  }
  .nav__links.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .nav__links a {
    padding: 14px 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--line);
  }
  .nav__links a:last-child {
    border-bottom: none;
  }
  .hero__scroll {
    display: none;
  }
  .code-window__body {
    font-size: 0.72rem;
    min-height: 240px;
    padding: 16px 14px 12px;
  }
  .contact__cards {
    grid-template-columns: 1fr;
  }
}
