:root {
  --color-white: rgba(255, 255, 255, 1);
  --color-black: rgba(0, 0, 0, 1);
  --color-blue-50: rgba(239, 246, 255, 1);
  --color-blue-100: rgba(219, 234, 254, 1);
  --color-blue-200: rgba(191, 219, 254, 1);
  --color-blue-300: rgba(147, 197, 253, 1);
  --color-blue-400: rgba(96, 165, 250, 1);
  --color-blue-500: rgba(59, 130, 246, 1);
  --color-blue-600: rgba(37, 99, 235, 1);
  --color-blue-700: rgba(29, 78, 216, 1);
  --color-blue-800: rgba(30, 64, 175, 1);
  --color-gray-50: rgba(249, 250, 251, 1);
  --color-gray-100: rgba(243, 244, 246, 1);
  --color-gray-200: rgba(229, 231, 235, 1);
  --color-gray-300: rgba(209, 213, 219, 1);
  --color-gray-400: rgba(156, 163, 175, 1);
  --color-gray-500: rgba(107, 114, 128, 1);
  --color-gray-600: rgba(75, 85, 99, 1);
  --color-gray-700: rgba(55, 65, 81, 1);
  --color-gray-800: rgba(31, 41, 55, 1);
  --color-blue-500-rgb: 59, 130, 246;
  --color-blue-600-rgb: 37, 99, 235;
  --color-gray-500-rgb: 107, 114, 128;
  --color-gray-400-rgb: 156, 163, 175;

  --color-background: var(--color-blue-50);
  --color-surface: var(--color-white);
  --color-text: var(--color-gray-800);
  --color-text-secondary: var(--color-gray-600);

  --color-primary: #60A5FA;
  --color-primary-hover: #3B82F6;
  --color-primary-active: #1E40AF;

  --color-border: rgba(var(--color-gray-400-rgb), 0.3);
  --color-card-border: rgba(var(--color-gray-400-rgb), 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);

  --radius-base: 8px;
  --radius-lg: 12px;

  --space-8: 8px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;

  --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Global */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  background: var(--color-background);
  color: var(--color-text);
  line-height: 1.6;
}

/* Navigation */
.nav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-16) 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.nav__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-24);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav__logo-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.nav__logo:hover .nav__logo-img {
  transform: scale(1.1);
}

.nav__menu {
  display: flex;
  gap: var(--space-32);
  list-style: none;
  transition: right 0.3s;
  align-items: center;
}

.nav__link {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.3s;
}

.nav__link:hover,
.nav__link--active {
  color: var(--color-primary);
}

/* Icon GitHub inside nav */
.nav__icon-github {
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.2s, fill 0.2s;
}

.nav__link--icon {
  padding: 0 var(--space-8);
  display: flex;
  align-items: center;
}

.nav__link--icon:hover .nav__icon-github {
  fill: var(--color-primary);
  transform: scale(1.1) rotate(-5deg);
}

.nav__link--icon:hover .nav__icon-github path {
  fill: var(--color-primary);
}

.nav__item--github {
  margin-left: 0.3em;
}

/* Burger menu */
.nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 2001;
}

.nav__burger-bar {
  width: 28px;
  height: 4px;
  background: var(--color-primary);
  border-radius: 3px;
  margin: 4px 0;
  transition: all 0.3s;
}

/* Burger open animation */
.nav__burger.open .nav__burger-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav__burger.open .nav__burger-bar:nth-child(2) {
  opacity: 0;
}

.nav__burger.open .nav__burger-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-24);
}

/* Sections */
section {
  padding: 80px 0;
  min-height: 100vh;
  scroll-margin-top: 70px;
  position: relative;
}

section:first-of-type {
  padding-top: 140px;
}

/* Section backgrounds */
section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.10;
  /* Slightly reduced opacity for subtle look */
  z-index: -1;
  /* Fade the top and bottom of the image to blend with background */
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

#home::before {
  background-image: url('https://images.unsplash.com/photo-1517694712202-14dd9538aa97?w=1920&h=1080&fit=crop');
}

#portfolio::before {
  background-image: url('https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=1920&h=1080&fit=crop');
}

#contact::before {
  background-image: url('https://images.unsplash.com/photo-1586281380349-632531db7ed4?w=1920&h=1080&fit=crop');
}

/* Hero */
.hero {
  text-align: center;
  padding: 60px 0;
}

.hero__title {
  font-size: 4rem;
  margin-bottom: var(--space-24);
  color: var(--color-primary);
  background: linear-gradient(135deg, var(--color-blue-600), var(--color-blue-400));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-24);
}

.hero__title::before,
.hero__title::after {
  content: '';
  width: 60px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  flex-shrink: 0;
}

.hero__subtitle {
  font-size: 1.5rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-32);
  font-weight: 500;
}

.hero__intro {
  max-width: 700px;
  margin: 0 auto var(--space-32);
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--color-text-secondary);
}

/* Quote */
.hero__quote {
  max-width: 700px;
  margin: 40px auto 0;
  padding: 24px 32px 120px;
  background: rgba(var(--color-blue-500-rgb), 0.05);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-base);
  position: relative;
}

.hero__quote-text {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--color-text);
  line-height: 1.8;
  margin: 0;
}

.hero__quote-signature {
  position: absolute;
  bottom: -40px;
  right: -40px;
  width: 250px;
  height: auto;
}

.hero__quote-signature-img {
  width: 100%;
  height: auto;
  filter: brightness(0) invert(1);
  opacity: 0.95;
  transition: opacity 0.3s ease;
}

/* Tech Stack */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-24);
  justify-content: center;
  margin-top: 60px;
}

.tech-stack__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  transition: transform 0.3s;
}

.tech-stack__item:hover {
  transform: translateY(-5px);
}

.tech-stack__icon {
  width: 64px;
  height: 64px;
}

.tech-stack__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Portfolio */
.portfolio__header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 60px;
}

.portfolio__title {
  font-size: 3rem;
  text-align: center;
  margin: 0;
  color: var(--color-primary);
  background: linear-gradient(135deg, var(--color-blue-600), var(--color-blue-400));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: var(--space-24);
}

.portfolio__title::before,
.portfolio__title::after {
  content: '';
  width: 60px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
}

#addProjectBtn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.portfolio__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-32);
  margin-bottom: 60px;
}

.project {
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-sm);
  position: relative;
  display: flex;
  flex-direction: column;
}


.project__delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.project:hover .project__delete-btn {
  opacity: 1;
  transform: scale(1);
}

.project__delete-btn:hover {
  background: #dc2626;
  transform: scale(1.1) !important;
}

.project:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: rgba(var(--color-blue-500-rgb), 0.3);
}

/* Animations added */
@keyframes float {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-10px);
  }

  100% {
    transform: translateY(0px);
  }
}

.tech-stack__item {
  animation: float 6s ease-in-out infinite;
}

.tech-stack__item:nth-child(2n) {
  animation-delay: 1s;
}

.tech-stack__item:nth-child(3n) {
  animation-delay: 2s;
}

.project__image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--color-blue-500), var(--color-blue-700));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
}

.project__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project__content {
  padding: var(--space-24);
}

.project__content h3 {
  font-size: 1.3rem;
  margin-bottom: var(--space-8);
  color: var(--color-text);
}

.project__content p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-16);
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}

.project__tag {
  background: rgba(var(--color-blue-500-rgb), 0.1);
  color: var(--color-primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  padding: var(--space-32);
  overflow-y: auto;
}

.modal--active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  max-width: 800px;
  width: 100%;
  padding: var(--space-32);
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal__close {
  position: absolute;
  top: var(--space-16);
  right: var(--space-16);
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--color-text);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s;
}

.modal__close:hover {
  background: rgba(var(--color-blue-600-rgb), 0.1);
}

.modal__image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius-base);
  margin-bottom: var(--space-24);
  background: linear-gradient(135deg, var(--color-blue-500), var(--color-blue-700));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 4rem;
}

.modal__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-base);
}

.modal__title {
  font-size: 2rem;
  margin-bottom: var(--space-16);
  color: var(--color-text);
}

.modal__description {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-24);
  line-height: 1.8;
}

/* Button */
.btn {
  display: inline-block;
  background: var(--color-primary);
  color: white;
  padding: 12px 32px;
  border-radius: var(--radius-base);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.3s;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}


.btn:hover {
  background: var(--color-primary-hover);
}

.btn--full-width {
  width: 100%;
}

.nav__link--btn {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  padding: 6px 16px;
  border-radius: var(--radius-base);
  transition: all 0.3s;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

.nav__link--btn:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

/* Contact */
.contact__title,
.contact__header {
  text-align: center;
  margin-bottom: 60px;
}

.contact__photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto var(--space-24);
  border: 4px solid var(--color-primary);
  box-shadow: var(--shadow-lg);
}

.contact__info {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-24);
  justify-content: center;
  margin-bottom: 60px;
}

.contact__link {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.contact__link:hover {
  text-decoration: underline;
}

.contact__icon {
  width: 24px;
  height: 24px;
}

/* Form */
.form {
  max-width: 600px;
  margin: 0 auto;
  background: var(--color-surface);
  padding: var(--space-32);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-card-border);
  box-shadow: var(--shadow-sm);
}

.form__group {
  margin-bottom: var(--space-24);
}

.form__label {
  display: block;
  margin-bottom: var(--space-8);
  font-weight: 600;
  color: var(--color-text);
}

.form__input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  font-family: var(--font-family-base);
  font-size: 1rem;
  background: var(--color-background);
  color: var(--color-text);
  transition: border-color 0.3s;
}

.form__input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form__input--textarea {
  resize: vertical;
  min-height: 150px;
}

select.form__input {
  height: 150px;
  overflow-y: auto;
}

select.form__input option {
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
}

select.form__input option:checked {
  background-color: var(--color-primary);
  color: white;
}

/* Success Message */
.success-message {
  display: none;
  background: rgba(var(--color-blue-500-rgb), 0.1);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  padding: var(--space-16);
  border-radius: var(--radius-base);
  margin-bottom: var(--space-24);
  text-align: center;
}

.success-message.active {
  display: block;
}

/* Footer */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-32) 0;
  text-align: center;
  color: var(--color-text-secondary);
  margin-top: 60px;
}

.footer__content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-16);
}

.footer__logo-img {
  width: 40px;
  height: 40px;
  color: var(--color-primary);
}

.footer__text {
  font-size: 0.9rem;
}

/* Dark Mode Button */
.nav__link--darkmode-btn {
  background: none;
  border: none;
  padding: 0 var(--space-8);
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  width: 40px;
  height: 40px;
  justify-content: center;
}

/* Dark Mode Icons */
.nav__icon-darkmode {
  width: 24px;
  height: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  color: var(--color-text);
}

.nav__link--darkmode-btn:hover .nav__icon-darkmode {
  color: var(--color-primary);
  transform: rotate(15deg);
}

/* Icon Visibility Logic */
.icon-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
  pointer-events: none;
}

.icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* When Dark Mode is Active */
body.dark-mode .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
  pointer-events: auto;
}

body.dark-mode .icon-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
  pointer-events: none;
}

.nav__item--darkmode {
  margin-left: 0.3em;
}

/* Dark Mode Active Body */
body.dark-mode {
  /* Premium Dark Theme (Slate/Blue-Gray tint instead of pure black) */
  --color-background: #0f172a;
  /* Slate 900 */
  --color-surface: #1e293b;
  /* Slate 800 */
  --color-text: #f1f5f9;
  /* Slate 100 */
  --color-text-secondary: #94a3b8;
  /* Slate 400 */

  --color-border: rgba(148, 163, 184, 0.1);
  --color-card-border: rgba(148, 163, 184, 0.1);

  --color-blue-50: rgba(15, 23, 42, 1);
  --color-blue-500-rgb: 96, 165, 250;
  /* Lighter blue for dark mode visibility */
  --color-primary: #60a5fa;
  /* Blue 400 */
  --color-primary-hover: #93c5fd;
  /* Blue 300 */

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Ensure images in dark mode aren't too bright */
body.dark-mode section::before {
  opacity: 0.05;
  filter: grayscale(100%);
}

/* Fix Hero Title Gradient in Dark Mode to be more vibrant */
body.dark-mode .hero__title,
body.dark-mode .portfolio__title {
  background: linear-gradient(135deg, #60a5fa, #c084fc);
  /* Blue to Purple */
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Dark Mode prefers-color-scheme */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: var(--color-gray-800);
    --color-surface: var(--color-gray-700);
    --color-text: var(--color-gray-100);
    --color-text-secondary: var(--color-gray-300);
    --color-primary: var(--color-blue-400);
    --color-primary-hover: var(--color-blue-500);
    --color-border: rgba(var(--color-gray-400-rgb), 0.3);
    --color-card-border: rgba(var(--color-gray-400-rgb), 0.2);
  }
}

/* Responsive */

/* Nav menu for <=900px */
@media (max-width: 900px) {
  .nav__menu {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: 100px;
    flex-direction: column;
    background: rgba(31, 41, 55, 0.5);
    backdrop-filter: blur(5px);
    box-shadow: var(--shadow-lg);
    justify-content: flex-start;
    align-items: flex-start;
    padding: 80px 24px 24px;
    transition: right 0.3s;
    z-index: 2000;
  }

  .nav__menu.open {
    right: 0;
  }

  .nav__burger {
    display: flex;
  }

  .nav__container {
    justify-content: space-between;
  }
}

/* Small screens <=768px modifications */
@media (max-width: 768px) {
  .nav__menu {
    gap: var(--space-16);
    font-size: 0.9rem;
  }

  .hero__title {
    font-size: 2rem;
  }

  .hero__subtitle {
    font-size: 1.5rem;
    gap: var(--space-16);
  }

  .hero__title::before,
  .hero__title::after {
    width: 40px;
    height: 2px;
  }

  .portfolio__title {
    font-size: 2rem;
  }

  .portfolio__grid {
    grid-template-columns: 1fr;
  }

  .modal__content {
    padding: var(--space-24);
  }

  .hero__quote {
    padding: 20px 20px 120px;
    margin: 30px 20px 0;
  }

  .hero__quote-text {
    font-size: 1rem;
  }

  .hero__quote-signature {
    bottom: 50px;
    right: 0;
    width: 120px;
  }
}

/* Mobile <=600px */
@media (max-width: 600px) {
  .nav__special-icons {
    display: flex;
    flex-direction: row;
    gap: 24px;
    width: 100%;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 20px;
  }

  .nav__menu {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav__item--github,
  .nav__item--darkmode {
    margin: 0;
    width: auto;
    justify-content: flex-start;
    align-items: center;
    display: flex;
    opacity: 1 !important;
    position: static;
    padding-left: 0;
    transition: none;
  }

  @media (min-width: 601px) {
    .nav__special-icons {
      display: none !important;
    }
  }
}