:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --accent-color: #0f172a;
  --text-light: #94a3b8;
  --bg-light: #f8fafc;
  --border-light: #e2e8f0;
  --white: #ffffff;
  --dark-bg: #0f172a;
  --dark-surface: #1e293b;
  --dark-border: #334155;
  --dark-text: #e2e8f0;
  --dark-text-secondary: #94a3b8;
}

[data-theme="dark"] {
  --primary-color: #3b82f6;
  --secondary-color: #94a3b8;
  --accent-color: #e2e8f0;
  --text-light: #64748b;
  --bg-light: #0f172a;
  --border-light: #334155;
  --white: #1e293b;
}

/* NEW MODAL FIX */
/* Always reserve space for the scrollbar, so when the scroll is hide, no jump/glitch. */

html {
  scrollbar-gutter: stable;
}

body.modal-open {
  overflow: hidden;
}

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

body {
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  color: var(--accent-color);
  background-color: var(--bg-light);
  transition: all 0.3s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navigation */
nav {
  background: transparent;
  box-shadow: none;
  position: absolute;
  width: 100%;
  top: 0;
  z-index: 1000;
  transition: all 0.5s ease;
}

nav.sticky {
  position: fixed;

  top: 0;
  left: 0;
  background: rgba(255, 255, 255, 0.6);

  backdrop-filter: blur(12px);

  -webkit-backdrop-filter: blur(12px);

  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] nav.sticky {
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
}

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

/* Mobile Menu Overlay */
.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

.nav-link {
  text-decoration: none;
  color: var(--secondary-color);
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 0;
  background-color: var(--primary-color);
  transition: width 0.3s ease, right 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
  left: 0;
}

/* Active state transitions */
.nav-link.was-active::after {
  width: 0;
  left: 0;
  right: auto;
}

.nav-link.active-from-right::after {
  left: auto;
  right: 0;
  width: 0;
}

.nav-link.active-from-right.active::after {
  left: 0;
  right: auto;
  width: 100%;
}

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

.nav-link.active {
  color: var(--primary-color);
  font-weight: 600;
}

.theme-toggle {
  background: none;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: var(--secondary-color);
}

.theme-toggle:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: rotate(180deg);
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.3s ease;
}

.hamburger.active {
  opacity: 0;
  visibility: hidden;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: var(--accent-color);
  margin: 3px 0;
  transition: 0.3s;
}

[data-theme="dark"] .hamburger span {
  background: var(--dark-text);
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  background: linear-gradient(
    135deg,
    var(--bg-light) 0%,
    rgba(37, 99, 235, 0.05) 100%
  );
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 4rem;
  align-items: center;
}

.hero-text h1 {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(
    135deg,
    var(--accent-color),
    var(--primary-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease;
}

.hero-text .motto {
  font-size: 1.25rem;
  color: var(--secondary-color);
  margin-bottom: 2rem;
  font-style: italic;
  animation: fadeInUp 0.8s ease 0.2s both;
}

.hero-text p {
  font-size: 1.1rem;
  color: var(--secondary-color);
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease 0.4s both;
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  animation: fadeInUp 0.8s ease 0.6s both;
}

.btn {
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

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

.btn-secondary:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

.hero-image {
  text-align: center;
  animation: fadeInRight 0.8s ease 0.4s both;
}

.profile-img {
  width: 250px;
  height: 250px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-color);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.profile-img:hover {
  transform: scale(1.05);
  box-shadow: 0 25px 50px rgba(37, 99, 235, 0.2);
}

/* About Section */
.about {
  padding: 5rem 0;
  background: var(--white);
}

[data-theme="dark"] .about {
  background: var(--dark-surface);
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--accent-color);
  position: relative;
}

.section-title::after {
  content: "";
  width: 60px;
  height: 4px;
  background: var(--primary-color);
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
}

.about-content {
  max-width: 800px;
  margin: 0 auto;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--secondary-color);
  text-align: center;
}

/* Contact Section */
.contact {
  padding: 5rem 0;
  background: var(--bg-light);
}

[data-theme="dark"] .contact {
  background: var(--dark-bg);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 12px 20px;
  background: var(--white);
  border-radius: 12px;
  text-decoration: none;
  color: var(--secondary-color);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .social-link {
  background: var(--dark-surface);
}

.social-link:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  color: var(--primary-color);
}

.social-link i {
  font-size: 1.2rem;
}

/* Bluesky icon matches FA size and inherits color */
/* removed custom PNG-based Bluesky icon (using Font Awesome instead) */

/* Footer */
footer {
  background: var(--accent-color);
  color: white;
  text-align: center;
  padding: 2rem 0;
}

[data-theme="dark"] footer {
  background: var(--dark-surface);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal.show {
  opacity: 1;
}

.modal-content {
  background-color: var(--white);
  margin: 2% auto;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.7) translateZ(-100px);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.modal.show .modal-content {
  transform: scale(1) translateZ(0);
}

.modal-header {
  background: var(--primary-color);
  color: white;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.close {
  background: transparent;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 2rem;
  max-height: calc(90vh - 80px);
  overflow-y: auto;
}

.cv-section {
  margin-bottom: 2rem;
}

.cv-section h3 {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.project-item {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  transition: all 0.3s ease;
  cursor: pointer;
}

.project-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.15);
  border-left-width: 6px;
}

.project-title {
  font-weight: 600;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
}

.project-date {
  color: var(--primary-color);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.project-item ul {
  margin-left: 1rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

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

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

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

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

@keyframes slideIn {
  from {
    transform: scale(0.7) translateZ(-100px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateZ(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
    z-index: 1000;
  }

  .nav-menu {
    position: fixed;
    left: -100%;
    top: 70px;
    flex-direction: column;
    background-color: var(--white);
    width: 100%;
    text-align: center;
    transition: 0.3s;
    box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
    padding: 2rem 0;
    z-index: 999;
  }

  .nav-menu.active {
    left: 0;
  }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }

  .hero-text h1 {
    font-size: 2.5rem;
  }

  .profile-img {
    width: 200px;
    height: 200px;
  }

  .social-links {
    flex-direction: column;
    align-items: center;
  }

  .social-link {
    width: 100%;
    max-width: 300px;
    justify-content: center;
  }

  .cta-buttons {
    justify-content: center;
    flex-wrap: wrap;
  }

  .modal-content {
    margin: 5% auto;
    width: 95%;
    max-height: 85vh;
  }

  .modal-body {
    padding: 1rem;
    max-height: calc(85vh - 80px);
  }
}

@media (max-width: 480px) {
  .hero-text h1 {
    font-size: 2rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .profile-img {
    width: 180px;
    height: 180px;
  }
}

/* Scroll animations */
.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.scroll-animate.active {
  opacity: 1;
  transform: translateY(0);
}
