:root {
  --bg: #050505;
  --bg-soft: #0d0d0d;
  --bg-elevated: #141414;
  --text: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --glass: rgba(255, 255, 255, 0.03);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 20px 48px rgba(0, 0, 0, 0.55);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 72px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: clamp(0.95rem, 1.6vw, 1rem);
  -webkit-font-smoothing: antialiased;
}

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

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

.container {
  width: min(1080px, 90vw);
  margin: 0 auto;
}

.section {
  padding: clamp(4rem, 8vw, 6.5rem) 0;
  position: relative;
  z-index: 2;
}

.section-title {
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 clamp(1.25rem, 3vw, 2rem);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(5, 5, 5, 0.82);
  border-bottom: 1px solid var(--border);
}

.nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}

.logo {
  font-weight: 700;
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--text);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 5px auto;
  background: var(--text);
  transition: opacity 0.2s ease;
}

.hero {
  min-height: calc(100dvh - var(--header-h));
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  padding-top: clamp(1rem, 3vw, 2rem);
}

.eyebrow {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(2rem, 6.5vw, 3.75rem);
  margin: 0;
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.hero h2 {
  margin: clamp(0.6rem, 2vw, 1rem) 0 clamp(0.75rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  font-size: clamp(1.05rem, 2.8vw, 1.45rem);
  font-weight: 500;
  line-height: 1.35;
}

.accent {
  color: var(--text);
  border-bottom: 2px solid rgba(255, 255, 255, 0.35);
}

.typing-line {
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  color: var(--text-secondary);
}

#typingText {
  color: var(--text);
  min-height: 1.5em;
  border-right: 2px solid var(--text-muted);
  padding-right: 4px;
}

.hero__bio {
  max-width: 52ch;
  color: var(--text-secondary);
  margin: 0;
  font-size: clamp(0.95rem, 2vw, 1.02rem);
}

.hero__cta {
  margin-top: clamp(1.25rem, 3vw, 2rem);
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.15rem;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

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

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn-primary:hover {
  background: #e5e5e5;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.08);
}

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

.btn-secondary:hover {
  background: #1f1f1f;
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--glass);
}

.btn-demo {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn-demo:hover {
  background: #e5e5e5;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.08);
}

.btn-github {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-github:hover {
  background: var(--bg-elevated);
  border-color: rgba(255, 255, 255, 0.28);
}

.hero__visual {
  position: relative;
  min-height: clamp(240px, 35vw, 320px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.glass-card,
.card,
.project-card,
.timeline-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.glass-card {
  width: 100%;
  max-width: 360px;
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  text-align: center;
}

.glass-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.6;
}

.about-grid,
.skills-grid,
.contact-grid {
  display: grid;
  gap: clamp(0.85rem, 2vw, 1.25rem);
}

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

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

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

.card {
  padding: clamp(1.15rem, 2.5vw, 1.5rem);
  border-radius: var(--radius);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.card h3 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card p {
  margin: 0;
  color: var(--text-secondary);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.chips li {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.38rem 0.82rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--glass);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.chips li:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.skill-card .chips {
  gap: 0.5rem;
}

.timeline {
  margin-top: clamp(0.85rem, 2vw, 1.25rem);
  display: grid;
  gap: clamp(0.75rem, 2vw, 1rem);
}

.timeline-item {
  border-radius: var(--radius);
  padding: clamp(1rem, 2.5vw, 1.25rem);
}

.timeline-item h4 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.timeline-item p {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.timeline-item p:first-of-type {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.filter-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}

.filter-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(0.85rem, 2vw, 1.25rem);
}

.project-card {
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}

.project-card--featured {
  border-color: var(--border-strong);
}

.project-badge {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--text);
}

.project-card img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  filter: grayscale(30%);
  transition: filter 0.3s ease;
}

.project-card:hover img {
  filter: grayscale(0%);
}

.project-body {
  padding: clamp(1rem, 2.5vw, 1.25rem);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-body h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project-body p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.stack {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.project-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 1rem;
}

.contact-form label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--border-strong);
}

.contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-links a {
  display: block;
  margin-bottom: 0.85rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  transition: color 0.2s ease;
}

.contact-links a:hover {
  color: var(--text);
}

.contact-links p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.footer {
  padding: clamp(2rem, 4vw, 3rem) 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: none;
}

#progressBar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 0%;
  height: 2px;
  background: var(--text);
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: grid;
  place-items: center;
  gap: 0.8rem;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader__ring {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loader p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#customCursor {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1099;
  transition: width 0.2s ease, height 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

#customCursorDot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1101;
  background: var(--text);
}

#customCursor.is-active {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  width: 16px;
  height: 16px;
}

#customCursorDot.is-active {
  transform: translate(-50%, -50%) scale(0.9);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-bottom: 1rem;
  }

  .hero__visual {
    order: -1;
    min-height: auto;
  }

  .glass-card {
    max-width: 100%;
  }

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

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

@media (max-width: 720px) {
  .container {
    width: min(1080px, 92vw);
  }

  .nav-toggle {
    display: inline-block;
  }

  .nav-links {
    position: absolute;
    top: calc(var(--header-h) + 4px);
    left: 4vw;
    right: 4vw;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: none;
  }

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

  .nav-links a {
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: var(--glass);
  }

  .hero__cta {
    flex-direction: column;
  }

  .hero__cta .btn {
    width: 100%;
  }

  .project-actions {
    flex-direction: column;
  }

  .project-actions .btn {
    width: 100%;
  }

  .section {
    padding: clamp(3.25rem, 10vw, 4.5rem) 0;
  }
}

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

  html {
    scroll-behavior: auto;
  }

  #customCursor,
  #customCursorDot {
    display: none !important;
  }
}

@media (pointer: fine) {
  body,
  a,
  button,
  input,
  textarea {
    cursor: none;
  }
}
