/* ===== Design tokens ===== */
:root {
  --navy-dark: #0a192f;
  --navy: #0f2144;
  --navy-light: #16294f;
  --electric: #00b0ff;
  --electric-bright: #40c4ff;
  --electric-dim: rgba(0, 176, 255, 0.15);
  --text-primary: #e6f1ff;
  --text-secondary: #a8b2d1;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
}

/* ===== Reset / base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

::selection {
  background: rgba(0, 176, 255, 0.35);
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid var(--electric);
  outline-offset: 3px;
  border-radius: 4px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--navy-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 25, 47, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.navbar.scrolled {
  background: rgba(10, 25, 47, 0.92);
  border-bottom-color: rgba(0, 176, 255, 0.12);
  box-shadow: 0 10px 30px rgba(2, 12, 27, 0.6);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 72px;
}

.nav-logo {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.25s ease;
}

.nav-logo:hover {
  color: var(--electric-bright);
}

.nav-logo-dot {
  color: var(--electric);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 34px;
  list-style: none;
}

.nav-link {
  position: relative;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 2px;
  transition: color 0.25s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--electric), var(--electric-bright));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

/* Hamburger (hidden on desktop) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--electric);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.navbar.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.navbar.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.navbar.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== Hero section ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Background layers */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.gradient-layer {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(0, 176, 255, 0.14), transparent 60%),
    radial-gradient(ellipse 70% 55% at 80% 70%, rgba(64, 196, 255, 0.1), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(21, 101, 192, 0.18), transparent 65%),
    var(--navy-dark);
  background-size: 160% 160%;
  animation: gradient-drift 18s ease-in-out infinite alternate;
}

@keyframes gradient-drift {
  0% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 60% 40%;
  }
  100% {
    background-position: 100% 100%;
  }
}

#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Content */
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px;
  max-width: 860px;
  animation: fade-up 0.9s ease-out both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-greeting {
  color: var(--electric);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.hero-name {
  font-size: clamp(2.75rem, 8vw, 5.25rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--text-primary) 30%, var(--electric-bright) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 10px;
}

.hero-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}

.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 40px;
  line-height: 1.65;
}

/* CTA buttons */
.hero-cta {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 15px 34px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease,
    background-color 0.25s ease, color 0.25s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--electric), #0077cc);
  color: #04101f;
  box-shadow: 0 8px 24px rgba(0, 176, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 176, 255, 0.45);
}

.btn-outline {
  border: 2px solid var(--electric);
  color: var(--electric);
  background: transparent;
}

.btn-outline:hover {
  background: var(--electric-dim);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 176, 255, 0.18);
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}

.scroll-hint-line {
  display: block;
  width: 2px;
  height: 48px;
  background: linear-gradient(to bottom, var(--electric), transparent);
  animation: scroll-pulse 2s ease-in-out infinite;
}

@keyframes scroll-pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scaleY(0.6);
    transform-origin: top;
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
    transform-origin: top;
  }
}

/* ===== Shared section layout ===== */
.section {
  position: relative;
  padding: 110px 24px;
}

.section-inner {
  max-width: 900px;
  margin: 0 auto;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 36px;
}

.section-accent {
  color: var(--electric);
  font-size: 0.75em;
  font-weight: 600;
}

.section-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, rgba(0, 176, 255, 0.35), transparent);
  margin-left: 8px;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* ===== About section ===== */
.about-bio p {
  color: var(--text-secondary);
  font-size: clamp(1rem, 1.8vw, 1.1rem);
  line-height: 1.75;
  margin-bottom: 22px;
  max-width: 760px;
}

.about-bio p:last-child {
  margin-bottom: 0;
}

/* ===== Skills section ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}

.skill-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 20px;
  background: linear-gradient(160deg, var(--navy), var(--navy-light));
  border: 1px solid rgba(0, 176, 255, 0.16);
  border-radius: 10px;
  transition: transform 0.25s ease, border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.skill-card::before {
  content: "";
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--electric), var(--electric-bright));
  margin-bottom: 6px;
}

.skill-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 176, 255, 0.5);
  box-shadow: 0 10px 28px rgba(0, 176, 255, 0.12);
}

.skill-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.skill-type {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--electric);
  opacity: 0.85;
}

/* ===== Projects section ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
}

.project-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  padding: 28px 26px;
  background: linear-gradient(160deg, var(--navy), var(--navy-light));
  border: 1px solid rgba(0, 176, 255, 0.16);
  border-radius: 12px;
  transition: transform 0.25s ease, border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.project-card::before {
  content: "";
  width: 34px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--electric), var(--electric-bright));
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 176, 255, 0.5);
  box-shadow: 0 14px 34px rgba(0, 176, 255, 0.14);
}

.project-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.project-desc {
  color: var(--text-secondary);
  font-size: 0.97rem;
  line-height: 1.7;
}

.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.project-stack li {
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--electric);
  background: var(--electric-dim);
  border-radius: 999px;
  padding: 5px 12px;
}

.btn-small {
  padding: 11px 24px;
  font-size: 0.92rem;
  align-self: flex-start;
}

/* ===== Contact section ===== */
.contact-lead {
  color: var(--text-secondary);
  font-size: clamp(1rem, 1.8vw, 1.1rem);
  line-height: 1.7;
  max-width: 620px;
  margin-bottom: 40px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 720px;
}

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

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--electric);
}

.form-field input,
.form-field textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--navy);
  border: 1px solid rgba(0, 176, 255, 0.18);
  border-radius: 8px;
  padding: 14px 16px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: rgba(168, 178, 209, 0.45);
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--electric);
  box-shadow: 0 0 0 3px rgba(0, 176, 255, 0.15);
}

.contact-form .btn-primary {
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  align-self: flex-start;
}

.form-status {
  min-height: 1.4em;
  font-size: 0.95rem;
  color: var(--electric-bright);
}

.form-status.error {
  color: #ff6b81;
}

/* ===== Footer ===== */
.footer {
  padding: 36px 24px;
  border-top: 1px solid rgba(0, 176, 255, 0.1);
  text-align: center;
}

.footer-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* ===== Polish: micro-interactions ===== */
.btn:active {
  transform: translateY(-1px) scale(0.98);
}

.skill-card::before,
.project-card::before {
  transition: width 0.3s ease;
}

.skill-card:hover::before {
  width: 40px;
}

.project-card:hover::before {
  width: 52px;
}

.project-card:hover .project-title {
  color: var(--electric-bright);
}

.project-title {
  transition: color 0.25s ease;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-inner {
    height: 64px;
  }

  html {
    scroll-padding-top: 76px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(10, 25, 47, 0.98);
    border-bottom: 1px solid rgba(0, 176, 255, 0.12);
    box-shadow: 0 16px 32px rgba(2, 12, 27, 0.6);
    padding: 8px 0 14px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.28s ease, transform 0.28s ease,
      visibility 0.28s ease;
  }

  .navbar.nav-open .nav-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-menu li {
    text-align: center;
  }

  .nav-link {
    display: block;
    padding: 14px 24px;
    font-size: 1rem;
  }

  .nav-link::after {
    display: none;
  }

  .nav-link.active {
    color: var(--electric);
  }

  .section {
    padding: 84px 20px;
  }

  .section-heading {
    margin-bottom: 28px;
  }

  .hero-content {
    padding: 0 20px;
  }

  .hero-tagline {
    margin-bottom: 34px;
  }

  .skills-grid {
    gap: 14px;
  }

  .projects-grid {
    gap: 18px;
  }
}

@media (max-width: 480px) {
  .hero-cta {
    flex-direction: column;
    align-items: stretch;
    max-width: 320px;
    margin: 0 auto;
  }

  .btn {
    text-align: center;
  }

  .hero-greeting {
    margin-bottom: 14px;
  }

  .section {
    padding: 72px 18px;
  }

  .skill-card {
    padding: 18px 16px;
  }

  .project-card {
    padding: 24px 20px;
  }

  .scroll-hint {
    bottom: 20px;
  }

  .contact-form .btn-primary {
    align-self: stretch;
    text-align: center;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gradient-layer,
  .hero-content,
  .scroll-hint-line {
    animation: none;
  }

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