/* ------------------------------------------
   ARTIST PAGE GALLERY — BASE STYLES
------------------------------------------- */

/* Override overflow for artist show page to show arrows outside gallery */
body.artists.show main.page {
  overflow: visible;
}

/* Increase page width by 10% for artist page on medium and large devices */
@media (min-width: 768px) {
  body.artists.show {
    --text-maxwidth: 1540px;
    /* 1400px + 10% */
  }
}

@media (min-width: 1024px) {
  body.artists.show {
    --text-maxwidth: 1540px;
    /* 1400px + 10% */
  }
}

/* Gallery wrapper */
.artistpage-gallery-container {
  width: 100%;
  position: relative;
  overflow: visible;
}

/* Controls container (holds arrows + track) */
.artistpage-gallery-controls {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: visible;
  --gap: 90px;
  --visible: 3;
  box-sizing: border-box;
}

/* Track: horizontal carousel */
.artistpage-gallery {
  display: flex;
  gap: auto;
  overflow: hidden;
  scroll-behavior: smooth;
  align-items: center;
}

/* Artwork card */
.artwork-card {
  flex: 0 0 calc((100% - (var(--visible) - 1) * var(--gap)) / var(--visible));
  aspect-ratio: 4 / 5;
  box-sizing: border-box;
  display: block;
  overflow: hidden;
  background: var(--grey-100);
}

/* Image */
.artwork-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ------------------------------------------
   ARROWS (Switch to Image Icons)
------------------------------------------- */

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: none;
  /* remove background */
  border: 0;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.arrow-img {
  width: 30px;
  height: auto;
  object-fit: contain;
}

.gallery-arrow--left {
  left: -60px;
  /* Position outside the page width */
  transform: translateY(-50%);
}

.gallery-arrow--right {
  right: -60px;
  /* Position outside the page width */
  transform: translateY(-50%);
}

/* hide arrow when disabled */
.gallery-arrow[aria-hidden="true"] {
  display: none;
}


/* ------------------------------------------
   RESPONSIVE — MOBILE FIRST
------------------------------------------- */

@media (max-width: 640px) {
  .artistpage-gallery-controls {
    --visible: 1;
    --gap: 24px;
    padding-left: 50px;
    /* Smaller padding for mobile */
    padding-right: 50px;
  }

  .artistpage-gallery {
    padding: 8px 0;
  }

  .gallery-arrow {
    width: 32px;
    height: 32px;
  }

  .gallery-arrow--left {
    left: -40px;
  }

  .gallery-arrow--right {
    right: -40px;
  }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 980px) {
  .artistpage-gallery-controls {
    --visible: 3;
    --gap: 60px;
  }

  .gallery-arrow {
    width: 36px;
    height: 36px;
  }
}

/* Desktop */
@media (min-width: 981px) {
  .artistpage-gallery-controls {
    --visible: 3;
    --gap: 90px;
  }
}



/* ------------------------------------------
   COVER HERO SECTION
------------------------------------------- */

.cover-hero {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.cover-logo {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  height: 40px;
  width: auto;
}

.cover-title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--shw);
  text-align: center;
  font-family: Montserrat;
  font-size: 64px;
  font-weight: 600;
  line-height: 52px;
  letter-spacing: 2.56px;
  text-transform: uppercase;
}

/* Mobile hero optimization */
@media (max-width: 600px) {

  .cover-hero,
  .cover-img {
    height: 22vh;
  }

  .cover-title {
    font-size: 1.6rem;
    line-height: 1.1;
    width: 90%;
  }
}

/* Default cover background when no image is uploaded */
.cover-hero--default {
  background-color: var(--dc-greys-900);
}

/* Cover image change button styling */
.cover-image-actions {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 10;
}

.cover-image-form {
  display: flex;
  align-items: center;
}

.cover-image-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}



@media (max-width: 600px) {
  .cover-image-actions {
    bottom: 12px;
    right: 12px;
  }

  .cover-image-button {
    padding: 8px 14px;
    font-size: 10px;
  }
}


/* ------------------------------------------
   DASHBOARD ARTWORK GALLERY
------------------------------------------- */

.gallery-hint {
  color: var(--dc-greys-900);
  font-size: 14px;
  margin-bottom: var(--quaver);
}

.artworks-dashboard-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--crotchet);
  margin-bottom: var(--minim);
}

@media only screen and (min-width: 640px) {
  .artworks-dashboard-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

/* Artwork gallery item */
.artwork-gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: grab;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  background: var(--grey-100);
}

.artwork-gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.artwork-gallery-item:active {
  cursor: grabbing;
}

/* Position badge */
.artwork-gallery-item__position {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  z-index: 3;
  pointer-events: none;
}

/* Drag handle */
.artwork-gallery-item__drag-handle {
  position: absolute;
  top: 8px;
  right: 40px;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 3;
  color: var(--dc-greys-700);
}

.artwork-gallery-item:hover .artwork-gallery-item__drag-handle {
  opacity: 1;
}

.artwork-gallery-item__drag-handle:active {
  cursor: grabbing;
}

/* Delete button */
.artwork-gallery-item__delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
  z-index: 3;
  color: var(--dc-greys-700);
}

.artwork-gallery-item:hover .artwork-gallery-item__delete {
  opacity: 1;
}

.artwork-gallery-item__delete:hover {
  background: #dc2626;
  color: white;
}

/* Link wrapper */
.artwork-gallery-item__link {
  display: block;
  width: 100%;
  height: 100%;
}

.artwork-in-grid {
  object-fit: cover;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
}

/* ------------------------------------------
   DRAG AND DROP STATES
------------------------------------------- */

.artwork-gallery-item.dragging {
  opacity: 0.5;
  transform: scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.artwork-gallery-item.drag-ghost {
  opacity: 0.3;
}

.artwork-gallery-item.drag-over {
  transform: scale(0.98);
  box-shadow: 0 0 0 3px var(--dc-primary, #3b82f6);
}

.artwork-gallery-item.touch-dragging {
  opacity: 0.7;
  transform: scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

/* Removing animation */
.artwork-gallery-item.removing {
  animation: fadeOutScale 0.3s ease forwards;
}

@keyframes fadeOutScale {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* ------------------------------------------
   TOAST NOTIFICATIONS
------------------------------------------- */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--dc-greys-900, #1f2937);
  color: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  /* animation moved to components/toast.css to avoid conflicts */
}


@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

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

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* ------------------------------------------
   ARTWORK FORM
------------------------------------------- */

.artwork-form-preview {
  object-fit: contain;
  height: 100%;
  width: 100%;
}

/* artwork form */
.artwork-form-image-preview {
  display: block;
  width: 400px;
  object-fit: contain;

  &.placeholder {
    height: 200px;
    background-color: var(--grey-100);
  }
}

/* ------------------------------------------
   MOBILE RESPONSIVE — GALLERY MANAGEMENT
------------------------------------------- */

@media (max-width: 640px) {

  .artwork-gallery-item__drag-handle,
  .artwork-gallery-item__delete {
    opacity: 1;
  }

  .artwork-gallery-item__drag-handle {
    top: 6px;
    right: 34px;
    width: 24px;
    height: 24px;
  }

  .artwork-gallery-item__delete {
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
  }

  .artwork-gallery-item__position {
    top: 6px;
    left: 6px;
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    padding: 10px 16px;
    font-size: 13px;
  }
}