/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

@keyframes slideInFromLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(249, 115, 22, 0.3); }
  50%      { box-shadow: 0 0 40px rgba(249, 115, 22, 0.6); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-8px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.8; }
}

@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(249, 115, 22, 0.3); }
  50%      { border-color: rgba(249, 115, 22, 0.8); }
}

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

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

/* --- Gradient Background --- */
.gradient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #0f172a 50%, #1a1a2e 75%, #0f172a 100%);
  background-size: 400% 400%;
  animation: bgShift 20s ease infinite;
}

.gradient-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(249, 115, 22, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
  pointer-events: none;
}

/* --- Scroll Progress Bar --- */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #f97316, #fb923c, #f97316);
  background-size: 200% 100%;
  animation: bgShift 3s linear infinite;
  z-index: 1001;
  width: 0%;
  transition: width 50ms linear;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
}

body {
  font-family: "Poppins", sans-serif;
  background: #0f172a;
  color: #cbd5e1;
  line-height: 1.6;
  scroll-behavior: smooth;
}

/* Header */
header {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 3rem;
  z-index: 1000;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  animation: slideInFromLeft 0.6s ease-out;
}

.header-left h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f97316;
  animation: float 3s ease-in-out infinite;
}

.header-left h1 i {
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

.subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 0.15rem;
  min-height: 1.3em;
}

.cursor {
  color: #f97316;
  animation: cursorBlink 0.7s step-end infinite;
  font-weight: 300;
  margin-left: 1px;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 1002;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #cbd5e1;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

nav {
  display: flex;
  gap: 0;
}

nav a {
  margin-left: 1.5rem;
  text-decoration: none;
  color: #cbd5e1;
  font-weight: 500;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  padding: 0.5rem 0;
}

nav a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #f97316, transparent);
  transition: left 0.4s ease-out;
}

nav a:hover::before {
  left: 100%;
}

nav a:hover,
nav a.active {
  color: #f97316;
  transform: translateY(-2px);
  text-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
}

/* Sections */
.section {
  padding: 8rem 3rem 5rem;
  max-width: 900px;
  margin: 8rem auto 4rem;
  opacity: 0;
  transform: translateY(40px);
  transition: all 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(4px);
  border-radius: 16px;
  border: 1px solid rgba(248, 113, 113, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #f97316;
  animation: fadeInSlideUp 0.8s ease-out 0.2s both;
  position: relative;
  display: inline-block;
}

h2::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #f97316, transparent);
  animation: slideInFromLeft 0.8s ease-out 0.4s forwards;
}

h3 {
  animation: fadeInSlideUp 0.8s ease-out both;
}

a {
  color: #fb923c;
  transition: all 0.4s ease;
  position: relative;
}

a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: #f97316;
  transition: width 0.4s ease;
}

a:hover {
  color: #f97316;
  text-shadow: 0 0 8px rgba(249, 115, 22, 0.4);
}

a:hover::after {
  width: 100%;
}

/* Portfolio Grid */
.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.project-item {
  background: rgba(20, 32, 50, 0.7);
  border-radius: 16px;
  padding: 1.25rem;
  text-align: center;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(148, 163, 184, 0.15);
  opacity: 0;
  animation: fadeInSlideUp 0.8s ease-out forwards;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.project-item:nth-child(1) { animation-delay: 0.1s; }
.project-item:nth-child(2) { animation-delay: 0.2s; }
.project-item:nth-child(3) { animation-delay: 0.3s; }
.project-item:nth-child(4) { animation-delay: 0.4s; }
.project-item:nth-child(5) { animation-delay: 0.5s; }
.project-item:nth-child(6) { animation-delay: 0.6s; }
.project-item:nth-child(7) { animation-delay: 0.7s; }
.project-item:nth-child(8) { animation-delay: 0.8s; }

.project-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent 30%, rgba(249, 115, 22, 0.1) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shimmer 3s infinite;
  opacity: 0;
}

.project-item:hover::before {
  opacity: 1;
}

.project-item:hover {
  box-shadow: 0 25px 50px rgba(249, 115, 22, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-color: rgba(249, 115, 22, 0.5);
}

.project-item img {
  width: 100%;
  border-radius: 14px;
  margin-bottom: 1rem;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
  pointer-events: none;
}

.project-item:hover img {
  transform: scale(1.08) rotate(1deg);
  filter: brightness(1.1);
}

.img-placeholder {
  width: 100%;
  min-height: 180px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 2px dashed rgba(148, 163, 184, 0.4);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  text-align: center;
  margin-bottom: 1rem;
  transition: all 0.4s ease;
  animation: pulse 2s ease-in-out infinite;
}

.project-item:hover .img-placeholder {
  border-color: rgba(249, 115, 22, 0.6);
  animation: borderGlow 2s ease-in-out infinite;
}

.img-placeholder i {
  font-size: 2rem;
  animation: float 3s ease-in-out infinite;
}

.img-placeholder span {
  font-size: 0.8rem;
}

.project-item h3 {
  color: #fb923c;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  transition: all 0.4s ease;
}

.project-item:hover h3 {
  color: #f97316;
  text-shadow: 0 0 20px rgba(249, 115, 22, 0.6);
  transform: scale(1.05);
}

.project-item p {
  font-size: 0.95rem;
  color: #cbd5e1;
  transition: all 0.4s ease;
}

.project-item:hover p {
  color: #e2e8f0;
}

/* Resume Section */
#resume h3 {
  animation: fadeInSlideUp 0.8s ease-out both;
}

#resume h3:nth-of-type(1) { animation-delay: 0s; }
#resume h3:nth-of-type(2) { animation-delay: 0.15s; }
#resume h3:nth-of-type(3) { animation-delay: 0.3s; }
#resume h3:nth-of-type(4) { animation-delay: 0.45s; }
#resume h3:nth-of-type(5) { animation-delay: 0.6s; }
#resume h3:nth-of-type(6) { animation-delay: 0.75s; }

#resume ul {
  list-style: disc inside;
  margin-bottom: 1rem;
  animation: fadeInSlideUp 0.8s ease-out;
}

#resume li {
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
  padding-left: 0.5rem;
}

#resume li:hover {
  color: #f97316;
  transform: translateX(5px);
}

/* Skill Tags */
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.skill-tags span {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 50px;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.25);
  color: #fb923c;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
}

.skill-tags span.visible {
  animation: slideUpFade 0.4s ease-out forwards;
  animation-delay: calc(var(--i) * 0.04s);
}

.skill-tags span:hover {
  background: rgba(249, 115, 22, 0.2);
  border-color: #f97316;
  color: #f97316;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

/* Contact Section */
#contact p {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

#contact p i {
  width: 1.25rem;
  color: #f97316;
  font-size: 1.1rem;
}

#contact p a {
  word-break: break-all;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.9rem;
  background: rgba(15, 23, 42, 0.7);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  margin-top: 2rem;
  color: #94a3b8;
  animation: slideInFromLeft 0.6s ease-out 1s backwards;
}

footer p {
  transition: all 0.4s ease;
}

footer p:hover {
  color: #f97316;
  text-shadow: 0 0 10px rgba(249, 115, 22, 0.4);
}

/* Back to Top */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(249, 115, 22, 0.3);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #f97316;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  pointer-events: none;
  z-index: 999;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#back-to-top:hover {
  background: rgba(249, 115, 22, 0.15);
  border-color: #f97316;
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.3);
  transform: translateY(-3px) scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
  header {
    padding: 0.8rem 1.5rem;
  }

  .hamburger {
    display: flex;
  }

  nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    max-width: 280px;
    height: 100vh;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(16px);
    padding: 5rem 2rem 2rem;
    gap: 0.5rem;
    transition: right 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: -10px 0 40px rgba(0,0,0,0.5);
    border-left: 1px solid rgba(148, 163, 184, 0.1);
  }

  nav.open {
    right: 0;
  }

  nav a {
    margin-left: 0;
    font-size: 1.1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  }

  .section {
    padding: 6rem 1.5rem 4rem;
    margin: 6rem 1rem 3rem;
  }

  .project-item:hover {
    transform: translateY(-8px);
  }

  .project-item {
    transition: all 0.4s ease;
  }

  .project-gallery {
    gap: 1.25rem;
  }

  #back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .skill-tags {
    gap: 0.45rem;
  }

  .skill-tags span {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html { scroll-behavior: auto; }

  .project-item,
  .section {
    opacity: 1;
    transform: none;
  }

  .skill-tags span {
    opacity: 1;
    transform: none;
  }

  #back-to-top {
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
}
