/**
 * Profile Image Carousel Styles
 * 
 * These styles create a circular profile image carousel with navigation
 * buttons positioned outside the circular frame.
 * 
 * The layout is responsive and adapts to different screen sizes.
 * 
 * For detailed documentation, see: documentation/profile-carousel.js.md
 */

/* Container for the pfp section */
.pfp {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  /* Ensure container has padding to accommodate the buttons */
  padding: 0;
  box-sizing: border-box;
  gap: 1rem; /* Space between buttons and image */
}

/* Image container with circular frame */
.pfp-image-container {
  position: relative;
  width: 15rem;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  margin: 0;
  flex-shrink: 1; /* Allow image to shrink */
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);

  /* Fallback for browsers that don't support aspect-ratio */
  @supports not (aspect-ratio: 1 / 1) {
    height: 15rem; /* Fixed height fallback */
  }
}

/* Images within the container */
.pfp-image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transition: opacity 0.3s ease-in-out;
}

/* Navigation buttons */
.pfp-nav-btn {
  position: relative; /* Changed from absolute to relative/static flow */
  top: auto;
  transform: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
  opacity: 0.7;
  transition: opacity 0.2s, background-color 0.2s;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  touch-action: manipulation;
  flex-shrink: 0; /* Prevent buttons from squishing */
}

/* SVG icon styling */
.pfp-nav-btn svg,
.pfp-nav-btn img {
  width: 24px;
  height: 24px;
}

.pfp-nav-btn .chevron-icon {
  stroke: currentColor;
  stroke-width: 2px;
}

/* Button hover state */
.pfp-nav-btn:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.8);
}

/* Position buttons closer to the circular frame */
/* Removed absolute positioning offsets */
.pfp-prev {
  /* left: 10px; - Removed */
  order: 1;
}

.pfp-image-container {
  order: 2;
}

.pfp-next {
  /* right: 10px; - Removed */
  order: 3;
}

/* Responsive styles for desktop and larger tablets */
@media (min-width: 768px) {
  .pfp {
    /* Make sure pfp container doesn't expand beyond its intended size */
    width: auto; /* Allow it to grow with content */
    max-width: 100%;
  }

  /* Adjust button positions for desktop */
  /* No longer needed with flex layout */
}

/* Tablet */
@media (max-width: 768px) {
  .pfp-nav-btn {
    width: 36px;
    height: 36px;
  }

  .pfp-nav-btn svg,
  .pfp-nav-btn img {
    width: 20px;
    height: 20px;
  }
}

/* Mobile screens */
@media (max-width: 480px) {
  .pfp-image-container {
    width: 12rem;

    /* Fallback for browsers that don't support aspect-ratio */
    @supports not (aspect-ratio: 1 / 1) {
      height: 12rem;
    }
  }

  .pfp-nav-btn {
    /* Slightly smaller buttons on mobile but still easily tappable */
    width: 32px;
    height: 32px;
    /* Ensure buttons are visible on mobile */
    background-color: rgba(0, 0, 0, 0.7);
  }

  .pfp-nav-btn svg,
  .pfp-nav-btn img {
    width: 18px;
    height: 18px;
  }
}

/* Landscape orientation on small devices */
@media (max-height: 500px) and (orientation: landscape) {
  .pfp {
    width: auto; /* Make the profile section smaller on landscape */
  }

  .pfp-image-container {
    width: 8rem;
  }

  .pfp-nav-btn {
    width: 28px;
    height: 28px;
  }

  .pfp-nav-btn svg,
  .pfp-nav-btn img {
    width: 16px;
    height: 16px;
  }
}
