:root {
  --primary: #1e90ff;
  --bg-light: #f8fafa;
  --text-light: #333;
  --bg-dark: #0d1117;
  --text-dark: #e6edf3;
}

html {
  scroll-behavior: smooth;
}

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

body {
  font-family: "Poppins", "Inter", Arial, Helvetica, sans-serif;
  line-height: 1.6;
  color: var(--text-light);
  background: var(--bg-light);
}

@media (prefers-color-scheme: dark) {
  body {
    background: var(--bg-dark);
    color: var(--text-dark);
  }

  header {
    background: var(--primary);
  }

  footer {
    background: #1c1c1c;
  }
}

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1.5rem 1rem;
  background: rgba(13, 17, 23, 0.6);
  backdrop-filter: blur(10px);
  color: #fff;
  text-align: center;
  z-index: 1500;
  transition: padding 0.3s ease, background 0.3s ease;
}

header.shrink {
  padding: 0.75rem 1rem;
  background: rgba(13, 17, 23, 0.8);
}

/* Decorative wave at bottom of header */
header::after {
  content: "";
  display: block;
  height: 60px;
  background: var(--bg-light);
  mask: url('data:image/svg+xml;utf8,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><path d="M0 20 C 30 60, 70 0, 100 40 L100 100 L0 100 Z" fill="white"/></svg>') no-repeat center / cover;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><path d="M0 20 C 30 60, 70 0, 100 40 L100 100 L0 100 Z" fill="white"/></svg>') no-repeat center / cover;
  margin-bottom: -1px; /* overlap next section */
}

/* Mobile nav toggle button */
#navToggle {
  display: none;
  background: transparent;
  border: 2px solid #fff;
  color: #fff;
  font-size: 1.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 1rem;
}

@media (max-width: 600px) {
  header nav {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
  }

  header nav.open {
    display: flex;
  }

  #navToggle {
    display: inline-block;
  }
}

header nav a {
  color: #fff;
  margin: 0 0.5rem;
  text-decoration: none;
  font-weight: bold;
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease-in-out;
}

header nav a:hover {
  text-decoration: none;
  background-color: rgba(255,255,255,0.2);
}

/* Nav active link */
header nav a.active {
  border-bottom: 2px solid #ffe478;
}

section {
  padding: 2rem 1rem;
  max-width: 800px;
  margin: auto;
}

h2 {
  margin-bottom: 1rem;
  color: #1e90ff;
}

ul {
  list-style-type: square;
  margin-left: 1.5rem;
}

footer {
  background: #eee;
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
}

/* Timeline Styles */
.timeline {
  position: relative;
  margin: 2rem 0;
  padding-left: 1.5rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--primary);
}
.timeline li {
  position: relative;
  margin-bottom: 2rem;
  list-style: none;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 1px; /* center on timeline line */
  top: 1rem; /* vertical alignment */
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-light);
  border: 2px solid var(--primary);
  box-shadow: 0 0 6px 2px rgba(30, 144, 255, 0.6);
}
.timeline-content {
  background: #fff;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-left: 1.25rem; /* more space so bullet never overlaps */
}

/* Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(20px);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.6s ease-out;
}

/* Portfolio Grid */
.portfolio-items-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.portfolio-item-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio-item-wrapper:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.portfolio-img-background {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  height: 220px;
  width: 100%;
  transition: filter 0.6s ease;
}

.img-text-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem;
}

.img-text-wrapper .subtitle {
  color: transparent;
  font-weight: 600;
  transition: color 0.6s ease;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.image-blur {
  filter: brightness(0.3) grayscale(20%);
}

.img-text-wrapper:hover .subtitle {
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .portfolio-item-wrapper {
    box-shadow: 0 2px 8px rgba(255,255,255,0.05);
  }

  .portfolio-item-wrapper:hover {
    box-shadow: 0 6px 16px rgba(255,255,255,0.15);
  }
}

#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: var(--primary);
  width: 0%;
  z-index: 2000;
}

.project-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.3s ease, color 0.3s ease;
}

.filter.active,
.filter:hover {
  background: var(--primary);
  color: #fff;
}

/* Glass timeline cards */
.timeline-content {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

@media (prefers-color-scheme: dark) {
  .timeline-content {
    background: rgba(22, 27, 34, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 3000;
}

.modal.show {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  max-width: 90%;
  max-height: 90vh;
  overflow: auto;
  position: relative;
  padding: 1rem;
}

.modal-content img {
  max-width: 100%;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.modal .close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
}

@media (prefers-color-scheme: dark) {
  .modal-content {
    background: #161b22;
  }
  .modal .close {
    color: var(--text-dark);
  }
}

/* Skill pulse */
@keyframes badgePulse {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-3px) scale(1.06);
  }
}

.skill:hover {
  animation: badgePulse 0.6s ease-in-out forwards;
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  text-align: center;
  background: linear-gradient(-45deg, #1e90ff, #6a5acd, #00c9ff, #00d2ff);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

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

.hero-content { position: relative; z-index: 2; }

.hero .highlight { color: #ffe478; }

#stars { position: absolute; inset: 0; z-index: 1; }

.cursor { display: inline-block; animation: blink 0.8s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.btn-cta {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid #fff;
  color: #fff;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s;
}

.btn-cta:hover {
  background: #fff;
  color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Scroll snapping disabled for smoother scrolling */
/* html { scroll-snap-type: y mandatory; } */
/* .snap { scroll-snap-align: start; } */

/* Preloader */
#preloader {
  position: fixed;
  inset: 0;
  background: #0d1117;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 4000;
  transition: opacity 0.4s ease;
}

#preloader.fade-out { opacity: 0; pointer-events: none; }

.spinner {
  width: 64px;
  height: 64px;
  border: 8px solid #1e90ff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Social links */
.social-links {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.5rem;
}
.social-links a {
  color: #fff;
  font-size: 1.2rem;
  transition: color 0.3s ease;
}
.social-links a:hover { color: #ffe478; }

/* Template banner */
.template-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #ffe478;
  color: #000;
  text-align: center;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 2000;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.1);
}