:root {
  /* Color system: 1 primary, 2-3 neutrals, 1 accent (max 5 colors) */
  --bg: #0b1220;
  /* deep night */
  --surface: #0f172a;
  /* slate surface */
  --text: #e5e7eb;
  /* near-white text */
  --muted: #94a3b8;
  /* slate-400 */
  --primary: #14b8a6;
  /* teal brand */
  --accent: #f59e0b;
  /* orange accent */
  --success: #10b981;
  /* green for success messages */
  --error: #ef4444;
  /* red for errors */
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Reset + base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  line-height: 1.6;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

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

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

.container {
  width: min(1100px, 92%);
  margin-inline: auto;
}

/* Accessibility helpers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Navbar */
.nav {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.3s ease;
}

.nav.scrolled {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: transform 0.3s ease;
}

.brand:hover {
  transform: scale(1.05);
}

.brand span {
  color: var(--primary);
}

.nav ul {
  display: flex;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav a {
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
}

.nav a::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

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

.nav a:hover::before {
  width: 80%;
}

.nav a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav a.active::before {
  width: 80%;
}

/* Mobile menu */
.menu-btn {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: var(--text);
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.menu-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.menu {
  display: flex;
  transition: all 0.3s ease;
}

@media (max-width: 840px) {
  .menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: rgba(15, 23, 42, 0.95);
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    animation: slideDown 0.3s ease;
  }

  .menu.show {
    display: flex;
  }

  .nav a {
    display: block;
    padding: 0.7rem 0.6rem;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Progress bar on top */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 60;
  transition: width 0.1s ease;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 40;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 1.2rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--accent);
  transform: translateY(-3px);
}

/* Sections */
section {
  scroll-margin-top: 80px;
  padding-block: 4rem;
}

header.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding-top: 5.5rem;
  /* space for sticky nav */
  /*  background: center/cover no-repeat url("https://hebbkx1anhila5yf.public.blob.vercel-storage.com/image-WRpy4J7eniN5QIlHLCMTHI8OL2Xpjm.png");*/
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.hero .card {
  position: relative;
  width: min(950px, 92%);
  margin-inline: auto;
  text-align: center;
  padding: 2.2rem 1.5rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  animation: fadeInUp 1s ease-out;
}

.title {
  font-size: clamp(2rem, 5vw + 0.5rem, 4rem);
  line-height: 1.1;
  margin: 0 0 0.6rem;
}

.lead {
  color: var(--muted);
  font-size: clamp(1rem, 1.2vw + 0.6rem, 1.2rem);
}

.cta-row {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: 1.6px solid rgba(255, 255, 255, 0.22);
  color: var(--text);
  background: transparent;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--text);
  transform: translateY(-2px);
}

.btn.primary {
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent);
  color: var(--bg);
}

.btn .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--accent);
}

.down {
  position: absolute;
  bottom: 18px;
  left: 50%;
  translate: -50% 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: grid;
  place-items: center;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
  animation: bounce 2s infinite;
}

.down:hover {
  background: var(--primary);
  border-color: var(--primary);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  40% {
    transform: translateX(-50%) translateY(-10px);
  }

  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/* Projects */
#projects .grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 980px) {
  #projects .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  #projects .grid {
    grid-template-columns: 1fr;
  }
}

.card-item {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 240px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.card-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.12);
}

.thumb {
  aspect-ratio: 16/9;
  background: #0b132b;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: all 0.3s ease;
}

.card-item:hover .thumb {
  background: #0d1a2d;
}

.thumb span {
  opacity: 0.8;
}

.card-body {
  padding: 1rem;
}

.badge {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.12);
  color: var(--primary);
  border: 1px solid rgba(20, 184, 166, 0.22);
  transition: all 0.3s ease;
}

.badge:hover {
  background: rgba(20, 184, 166, 0.2);
  transform: scale(1.05);
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding: 0 1rem 1rem;
  flex-wrap: wrap;
}

.link {
  color: var(--primary);
  font-weight: 700;
  border-bottom: 1px dashed rgba(20, 184, 166, 0.5);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.link:hover {
  color: #10a198;
  border-bottom-style: solid;
}

/* Skills */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  transition: all 0.3s ease;
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

/* About */
.about-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 360px 1fr;
  align-items: start;
}

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

.avatar {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0e152b;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: all 0.3s ease;
}

.avatar:hover {
  border-color: var(--primary);
}

/* Contact */
form {
  display: grid;
  gap: 1rem;
  max-width: 760px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

label {
  font-weight: 700;
  color: var(--text);
}

input,
textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0a1122;
  color: var(--text);
  transition: all 0.3s ease;
}

input:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.form-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.notice {
  color: var(--muted);
  font-size: 0.95rem;
}

.form-status {
  padding: 0.8rem;
  border-radius: 12px;
  margin: 1rem 0;
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.form-status.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: flex;
}

.form-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
  display: flex;
}

.form-status.loading {
  background: rgba(20, 184, 166, 0.1);
  color: var(--primary);
  border: 1px solid rgba(20, 184, 166, 0.2);
  display: flex;
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Footer */
footer {
  padding: 2.5rem 0;
  color: var(--muted);
  text-align: center;
}

/* Section headings */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: clamp(1.6rem, 1.3vw + 1rem, 2rem);
  margin: 0;
}

.section-sub {
  color: var(--muted);
  margin: 0;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Dark mode toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  padding: 0.5rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: grid;
  place-items: center;
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Typing effect */
.typing-text::after {
  content: "|";
  animation: blink 1s infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }

  .progress {
    transition: none;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
