/* General Body & Typography */
body {
  font-family: "Lora", serif;
  line-height: 1.6;
  margin: 0;
  color: #333;
  background-color: #fdfdfd;
  /* Add these three lines */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Add this new rule for the main element */
main {
  flex-grow: 1;
}

html {
  scroll-behavior: smooth;
}

h1,
h2,
h3 {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
}

.container {
  width: 90%;
  max-width: 1100px;
  margin: 0 auto;
}

section {
  padding: 60px 0;
  /* Prevent sticky header from covering anchor targets */
  scroll-margin-top: 80px;
}

section:nth-of-type(even) {
  background-color: #f4f4f4;
}

/* Header & Navigation */
.main-header {
  background: #fff;
  padding: 1rem 0;
  text-align: center;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.main-header .artist-name {
  margin: 0;
  font-size: 1.8rem;
}

.main-nav ul {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.main-nav li {
  display: inline-block;
  margin: 0 15px;
}

.main-nav a {
  text-decoration: none;
  color: #555;
  font-family: "Montserrat", sans-serif;
  font-weight: 400;
  transition: color 0.3s ease;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: #008b8b; /* A teal color that complements Turkish tiles */
  outline: none;
}

/* About Section */
.about-section .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 800px;
}

.about-section h2 {
  margin-bottom: 20px;
}

.artist-bio p {
  text-align: justify;
}

/* Portfolio Section */
.portfolio-section h2 {
  text-align: center;
  margin-bottom: 40px;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Make portfolio items buttons look like plain tiles */
.portfolio-item {
  cursor: pointer;
  overflow: hidden;
  position: relative;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);

  /* reset default button styles */
  border: none;
  background: none;
  padding: 0;
  display: block;
  width: 100%;
  text-align: inherit;
}

/* Copilot Edit: Restore the circular shape for the artist's portrait button. */
.artist-profile-pic-container {
  width: 150px;
  height: 150px;
  border-radius: 50%; /* This is the key change */
  margin-bottom: 20px;
  border: 5px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.artist-profile-pic-container .artist-profile-pic {
  border-radius: 50%;
}

.portfolio-item:focus-visible {
  outline: 3px solid #008b8b;
  outline-offset: 2px;
}

.portfolio-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.portfolio-item:hover img {
  transform: scale(1.1);
}

/* Footer */
.main-footer {
  background: #333;
  color: #fff;
  text-align: center;
  padding: 20px 0;
}

.main-footer p {
  margin: 0;
  font-size: 0.9rem;
}

/* Lightbox Modal */
.lightbox {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  /* Copilot Edit: Changed to flexbox to better center content */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
}

/* Copilot Edit: Add a spinner for the loading state */
.lightbox::after {
  content: "";
  display: none; /* Hidden by default */
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 2002; /* Ensure spinner is above image */
}

.lightbox.is-loading::after {
  display: block; /* Show spinner when loading */
}

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

/* Copilot Edit: New container for the image and nav buttons */
.lightbox-slide-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  display: block;
  max-width: 100%;
  max-height: 100%;
  transition: opacity 0.2s linear;
  object-fit: contain; /* Ensure image fits without being cropped */
}

/* Dim the low-res image while the high-res one loads */
.lightbox.is-loading .lightbox-content {
  opacity: 0.5;
}

.lightbox-caption {
  margin: 20px auto 0;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
}

#lightbox-title {
  margin-bottom: 5px;
}
#lightbox-details {
  margin-top: 0;
  font-size: 0.9em;
}

.lightbox-close {
  position: absolute;
  top: -40px; /* Positioned above the slide container */
  right: 0;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
  background: transparent;
  border: none;
  line-height: 1;
  z-index: 2001; /* Above other lightbox content */
}

/* Copilot Edit: Styles for Prev/Next navigation buttons */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 5px;
  transition: background-color 0.3s ease;
  z-index: 2001;
  opacity: 0; /* Hidden by default, shown on hover */
  line-height: 1;
}

.lightbox-slide-container:hover .lightbox-nav,
.lightbox-slide-container:focus-within .lightbox-nav {
  opacity: 1; /* Show buttons on hover of the container */
}

.lightbox-nav.lightbox-prev {
  left: 10px;
}

.lightbox-nav.lightbox-next {
  right: 10px;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  background-color: rgba(0, 0, 0, 0.7);
  outline: none;
}

/* Hide nav buttons if there is only one image */
.lightbox-nav[hidden] {
  display: none;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  color: #bbb;
  text-decoration: none;
  outline: none;
}

/* Prevent background scroll when lightbox is open */
body.modal-open {
  overflow: hidden;
}

/* Accessibility focus style fallback */
:focus-visible {
  outline: 3px solid #008b8b;
  outline-offset: 2px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .portfolio-item img {
    transition: none;
  }
  .lightbox::after {
    animation: none; /* Turn off spinner animation if motion is reduced */
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-header {
    position: static;
  }

  .main-header .artist-name {
    font-size: 1.5rem;
  }

  .portfolio-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }

  .lightbox-close {
    top: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    text-align: center;
  }

  .lightbox-slide-container {
    max-height: 70vh;
  }

  .lightbox-nav {
    opacity: 1; /* Always visible on mobile */
    font-size: 1.5rem;
    padding: 8px 12px;
  }
}
