:root {
  --bg: #050608;
  --bg-soft: #0a0d12;
  --panel: rgba(12, 15, 20, 0.75);
  --panel-strong: rgba(8, 10, 14, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #f8f8f8;
  --muted: #9ca3af;

  --accent: #a78bfa;
  --accent-bright: #c4b5fd;
  --accent-secondary: #22d3ee;
  --accent-warm: #f472b6;
  --accent-gradient: linear-gradient(135deg, #a78bfa 0%, #22d3ee 50%, #f472b6 100%);

  --glow-purple: 0 0 60px rgba(167, 139, 250, 0.4);
  --glow-cyan: 0 0 60px rgba(34, 211, 238, 0.3);
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

  --max-width: 1400px;
  --radius: 24px;
  --radius-sm: 16px;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
}

/* Animated gradient orbs */
.background-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.background-noise::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.12) 0%, transparent 60%);
  filter: blur(80px);
  animation: float-orb 20s ease-in-out infinite;
}

.background-noise::after {
  content: "";
  position: absolute;
  bottom: -20%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.1) 0%, transparent 60%);
  filter: blur(80px);
  animation: float-orb 25s ease-in-out infinite reverse;
}

@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(5%, 10%) scale(1.1); }
  50% { transform: translate(-5%, 5%) scale(0.95); }
  75% { transform: translate(3%, -5%) scale(1.05); }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

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

.page-shell {
  position: relative;
  width: min(calc(100% - 48px), var(--max-width));
  margin: 0 auto;
  padding: 28px 0 60px;
  z-index: 2;
}

.topbar,
.hero,
.section,
.footer {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(10, 13, 18, 0.8);
  position: sticky;
  top: 20px;
  z-index: 100;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.topbar:hover {
  border-color: rgba(167, 139, 250, 0.3);
}

.topbar-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-gradient);
  color: #050608;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.4);
}

.topbar-nav {
  display: flex;
  gap: 8px;
}

.topbar-nav a {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.2s ease;
}

.topbar-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

main {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.hero,
.section,
.footer {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-strong) 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s ease;
}

.hero:hover,
.section:hover {
  border-color: rgba(167, 139, 250, 0.15);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 60px;
  padding: 60px 70px 0;
}

.hero-content {
  max-width: 700px;
  padding-bottom: 60px;
}

.eyebrow,
.section-label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 16px;
  display: inline-block;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(4rem, 8vw, 6rem);
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-bright) 60%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s ease-in-out infinite;
  background-size: 200% 200%;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-headline {
  font-size: 1.35rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 24px 0 0;
  max-width: 500px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 36px;
}

.hero-image {
  position: relative;
  align-self: end;
}

.hero-image img {
  width: 340px;
  height: auto;
  display: block;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
  transition: transform 0.4s ease;
  object-fit: cover;
  object-position: center bottom;
}

.hero:hover .hero-image img {
  transform: scale(1.02);
}

.hero-image::before {
  content: "";
  position: absolute;
  inset: -20px;
  background: var(--accent-gradient);
  opacity: 0.15;
  filter: blur(60px);
  border-radius: 50%;
  z-index: -1;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.button-primary {
  background: var(--accent-gradient);
  border: none;
  color: #050608;
  box-shadow: 0 0 30px rgba(167, 139, 250, 0.3);
}

.button-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 40px rgba(167, 139, 250, 0.5);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.button-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(167, 139, 250, 0.2);
}

.button .external-icon {
  width: 14px;
  height: 14px;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.button:hover .external-icon {
  opacity: 1;
}

/* Sections */
.section {
  padding: 50px 60px;
}

.section-header {
  margin-bottom: 40px;
}

.section h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  color: #ffffff;
}

.section-subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.filter-btn {
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(167, 139, 250, 0.1);
}

.filter-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #050608;
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}

/* Project Grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.project-card.hidden {
  display: none;
}

@keyframes filterIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Show More Button & Extra Projects */
.project-extra {
  display: none;
  opacity: 0;
}

.project-extra.is-visible {
  display: block;
  animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.show-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 32px auto 0;
  padding: 14px 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.show-more-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(167, 139, 250, 0.1);
  transform: translateY(-2px);
}

.show-more-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.show-more-btn:hover svg {
  transform: translateY(3px);
}

.show-more-btn.is-hidden {
  display: none;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), var(--glow-purple);
}

.project-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-soft);
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-card:hover .project-image img {
  transform: scale(1.05);
}

.project-info {
  padding: 28px;
}

.project-info h3 {
  margin: 0 0 12px;
  font-size: 1.4rem;
  font-weight: 600;
  color: #ffffff;
}

.project-info p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.8rem;
  color: var(--accent-bright);
  font-weight: 500;
}

.view-details {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-details svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.view-details:hover {
  color: var(--accent-bright);
}

.view-details:hover svg {
  transform: translateX(4px);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-strong) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s ease;
}

.modal.is-open .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  padding: 48px;
}

.modal-header {
  margin-bottom: 32px;
}

.modal-header h2 {
  margin: 0 0 8px;
  font-size: 2.2rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.modal-section {
  margin-bottom: 32px;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section h3 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.modal-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.modal-section li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-tags span {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.85rem;
  color: var(--accent-bright);
  font-weight: 500;
}

@media (max-width: 768px) {
  .modal-body {
    padding: 32px 24px;
  }

  .modal-header h2 {
    font-size: 1.6rem;
  }
}

/* Skills Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.skill-card {
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.3s ease;
}

.skill-card:hover {
  border-color: rgba(167, 139, 250, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.skill-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  color: var(--accent);
}

.skill-icon svg {
  width: 100%;
  height: 100%;
}

.skill-card h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
}

.skill-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Stats Section */
.stats-section {
  background: var(--accent-gradient);
  border: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 4rem;
  font-weight: 700;
  color: #050608;
  line-height: 1;
}

.stat-label {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(5, 6, 8, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Contact Section */
.contact-section {
  text-align: center;
}

.contact-content {
  max-width: 600px;
  margin: 0 auto;
}

.contact-section h2 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
}

.contact-text {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 16px 0 32px;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 14px;
}

/* Footer */
.footer {
  padding: 24px 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer p {
  margin: 0;
}

/* Reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal.is-visible .project-card,
.reveal.is-visible .skill-card {
  animation: stagger-in 0.6s ease forwards;
  opacity: 0;
}

.reveal.is-visible .project-card:nth-child(1),
.reveal.is-visible .skill-card:nth-child(1) { animation-delay: 0.1s; }
.reveal.is-visible .project-card:nth-child(2),
.reveal.is-visible .skill-card:nth-child(2) { animation-delay: 0.15s; }
.reveal.is-visible .project-card:nth-child(3),
.reveal.is-visible .skill-card:nth-child(3) { animation-delay: 0.2s; }
.reveal.is-visible .project-card:nth-child(4),
.reveal.is-visible .skill-card:nth-child(4) { animation-delay: 0.25s; }
.reveal.is-visible .project-card:nth-child(5),
.reveal.is-visible .skill-card:nth-child(5) { animation-delay: 0.3s; }
.reveal.is-visible .project-card:nth-child(6),
.reveal.is-visible .skill-card:nth-child(6) { animation-delay: 0.35s; }
.reveal.is-visible .project-card:nth-child(7) { animation-delay: 0.4s; }
.reveal.is-visible .project-card:nth-child(8) { animation-delay: 0.45s; }
.reveal.is-visible .project-card:nth-child(9) { animation-delay: 0.5s; }
.reveal.is-visible .project-card:nth-child(10) { animation-delay: 0.55s; }

@keyframes stagger-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
    padding: 50px 50px;
  }

  .hero-content {
    max-width: 100%;
    padding-bottom: 0;
  }

  .hero-headline {
    max-width: 100%;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-image {
    order: -1;
    align-self: center;
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }

  .hero-image img {
    width: 260px;
    height: auto;
    object-fit: cover;
    object-position: center bottom;
  }

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

  .filter-bar {
    justify-content: center;
  }

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

@media (max-width: 768px) {
  .page-shell {
    width: min(calc(100% - 24px), var(--max-width));
    padding-top: 16px;
  }

  .topbar {
    border-radius: var(--radius);
    padding: 12px 16px;
  }

  .topbar-nav a {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .hero {
    padding: 36px 24px 0;
    border-radius: 20px;
  }

  .section {
    padding: 36px 24px;
    border-radius: 20px;
  }

  .hero h1 {
    font-size: clamp(2.8rem, 12vw, 4rem);
  }

  .hero-headline {
    font-size: 1.1rem;
  }

  .hero-image {
    order: unset;
    height: auto;
  }

  .hero-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

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

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

  .stat-value {
    font-size: 3rem;
  }

  .contact-links {
    flex-direction: column;
  }

  .filter-bar {
    gap: 8px;
  }

  .filter-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .footer {
    padding: 20px;
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .reveal.is-visible .project-card,
  .reveal.is-visible .skill-card {
    animation: none;
    opacity: 1;
  }

  .button,
  .project-card,
  .skill-card,
  .topbar,
  .hero-image img {
    transition: none;
  }

  .background-noise::before,
  .background-noise::after,
  .hero h1 {
    animation: none;
  }
}

::selection {
  background: rgba(167, 139, 250, 0.3);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.3);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.5);
}
