/* Nord color palette */
:root {
  --nord0: #2e3440;
  --nord1: #3b4252;
  --nord2: #434c5e;
  --nord3: #4c566a;
  --nord4: #d8dee9;
  --nord5: #e5e9f0;
  --nord6: #eceff4;
  --nord7: #8fbcbb;
  --nord8: #88c0d0;
  --nord9: #81a1c1;
  --nord10: #5e81ac;
  --nord11: #bf616a;
  --nord12: #d08770;
  --nord13: #ebcb8b;
  --nord14: #a3be8c;
  --nord15: #b48ead;
}

/* Lightbox (Cinematic Mode) */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(46, 52, 64, 0.95); /* Nord dark with transparency */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.lightbox.hidden {
  display: none;
}

.lightbox-image {
  max-width: 90%;
  max-height: 85%;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2rem;
  font-weight: bold;
  color: var(--nord6);
  cursor: pointer;
  transition: color 0.3s ease;
}

.lightbox-close:hover {
  color: var(--nord8);
}

/* Lightbox Navigation Arrows */
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  font-weight: bold;
  color: var(--nord6);
  cursor: pointer;
  padding: 0 10px;
  user-select: none;
  transition: color 0.3s ease, transform 0.2s ease;
}

.lightbox-arrow:hover {
  color: var(--nord8);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-arrow.left {
  left: 20px;
}

.lightbox-arrow.right {
  right: 20px;
}

/* General styling */
body {
  font-family: system-ui, sans-serif;
  background-color: var(--nord0);
  color: var(--nord4);
  margin: 0;
  line-height: 1.6;
  scroll-behavior: smooth;
}

h1, h2, h3 {
  color: var(--nord6);
  margin-bottom: 0.5rem;
}

a {
  color: var(--nord8);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--nord7);
}

/* Fade-in animation */
.fade-in {
  opacity: 0;
  transform: translateY(15px);
  animation: fadeInUp 0.8s ease forwards;
}

.fade-in:nth-of-type(1) { animation-delay: 0.2s; }
.fade-in:nth-of-type(2) { animation-delay: 0.4s; }
.fade-in:nth-of-type(3) { animation-delay: 0.6s; }
.fade-in:nth-of-type(4) { animation-delay: 0.8s; }

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

/* Hero Section */
header.hero {
  text-align: center;
  padding: 4rem 1rem;
  background: var(--nord1);
}

header.hero h1 {
  font-size: 2.5rem;
  margin: 0;
}

header.hero .tagline {
  font-size: 1.2rem;
  color: var(--nord9);
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--nord0);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.logo h1 {
  font-size: 1.5rem;
  color: var(--nord6);
  margin: 0;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

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

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

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
}

.bar {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--nord6);
  margin: 5px 0;
  transition: all 0.3s ease;
}

.hero-content {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--nord1);
}

.hero-content h3 {
  font-size: 1.5rem;
  margin: 0.5rem 0;
}

.hero-content .tagline {
  font-size: 1.2rem;
  color: var(--nord9);
}

/* Layout */
main {
  max-width: 900px;
  margin: auto;
  padding: 2rem 1rem;
}

section {
  margin-bottom: 3rem;
}

/* About Section */
.about-content {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  align-items: start;
}

.about-image {
  text-align: center;
}

.profile-img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--nord8);
}

/* Project Cards */
.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--nord1);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

.project-card a {
  display: inline-block;
  margin-top: 0.5rem;
  font-weight: bold;
  transition: transform 0.3s ease;
}

.project-card a:hover {
  transform: translateX(4px);
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* Fixed 3 columns for desktop */
  grid-template-rows: repeat(3, auto); /* 3 rows for 9 images */
  gap: 0.5rem;
  justify-items: center;
  align-items: stretch;
  padding: 0.5rem;
}

.gallery-item {
  overflow: hidden;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  aspect-ratio: 1 / 1; /* Square aspect ratio */
  background-color: var(--nord1);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensure images fill the square without distortion */
  display: block;
  transition: transform 0.3s ease;
  border: 2px solid var(--nord3);
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item img[alt="Image not available"] {
  opacity: 0.5;
}

.lightbox-alt {
  color: var(--nord6);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 1rem;
  max-width: 90%;
  padding: 0 1rem;
}

/* Contact */
.contact ul {
  list-style: none;
  padding: 0;
}

.contact li {
  margin: 0.5rem 0;
}

/* Footer */
footer {
  text-align: center;
  padding: 1rem;
  background: var(--nord1);
  font-size: 0.9rem;
  color: var(--nord3);
}

/* Responsive tweaks */
@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns for 6 images */
    grid-template-rows: repeat(3, auto); /* 3 rows for 6 images */
  }
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: 1fr; /* 1 column for 3 images */
    grid-template-rows: repeat(3, auto); /* 3 rows for 3 images */
  }

  header.hero h1 {
    font-size: 2rem;
  }

  header.hero .tagline {
    font-size: 1rem;
  }

  main {
    padding: 1rem;
  }

  .about-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

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

  .nav-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    background-color: var(--nord0);
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  }

  .nav-menu.active {
    display: flex;
  }

  .hamburger {
    display: block;
  }

  .hero-content h3 {
    font-size: 1.2rem;
  }

  .hero-content .tagline {
    font-size: 1rem;
  }
}

@media (min-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr); /* Ensure 3 columns on wide screens */
  }
}
