/* ===== Freelance page — carousel, lightbox & page-specific styles ===== */

/* ---- Back button ---- */
.fl-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: var(--transition);
}
.fl-back-btn:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
}

/* ---- Page hero ---- */
.fl-hero {
  padding: calc(72px + var(--space-2xl)) 0 var(--space-lg);
  text-align: center;
}
.fl-hero .section-title    { margin-bottom: var(--space-xs); }
.fl-hero .section-subtitle { margin-bottom: 0; }

/* ===== Carousel ===== */
.carousel {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-gradient-1), var(--color-gradient-2));
}
.carousel .slides { position: absolute; inset: 0; }

.carousel .slide {
  position: absolute; inset: 0;
  opacity: 0; transform: scale(1.015);
  transition: opacity 0.32s ease, transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.carousel .slide.active {
  opacity: 1; transform: scale(1); pointer-events: auto;
}
.carousel .slide--hidden { display: none; }

.slide-img {
  width: 100%; height: 100%; display: block; object-fit: cover;
  cursor: zoom-in;
}

/* Placeholder */
.carousel-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: var(--color-text-muted);
  font-size: var(--fs-small); font-weight: var(--fw-medium);
}
.carousel-placeholder i { font-size: 2rem; opacity: 0.35; }
.carousel:not([data-empty]) .carousel-placeholder { display: none; }

/* Nav buttons */
.car-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: var(--radius-full);
  z-index: 4; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-hover);
  color: var(--color-text);
  opacity: 0;
  transition: opacity 0.22s ease, background 0.2s ease, border-color 0.2s ease;
}
.carousel:hover .car-btn { opacity: 1; }
.car-btn:hover { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.car-btn svg { width: 18px; height: 18px; }
.car-btn.prev { left: 12px; }
.car-btn.next { right: 12px; }
[data-empty] .car-btn { display: none; }

/* Counter badge */
.car-count {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  font-size: 0.72rem; font-weight: var(--fw-semibold);
  letter-spacing: 0.03em; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px;
  color: var(--color-text);
  background: var(--color-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-hover);
}
[data-empty] .car-count { display: none; }

/* Dot strip */
.car-dots {
  position: absolute; left: 0; right: 0; bottom: 12px; z-index: 4;
  display: flex; justify-content: center; gap: 7px;
}
.car-dots button {
  width: 7px; height: 7px; border-radius: 999px; padding: 0; cursor: pointer;
  background: color-mix(in srgb, var(--color-text) 30%, transparent);
  border: none;
  transition: width 0.28s ease, background 0.28s ease;
}
.car-dots button.on { width: 20px; background: var(--color-primary); }
[data-empty] .car-dots { display: none; }

/* ===== Lightbox ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, 0.93);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease;
}
.lightbox.open {
  opacity: 1; pointer-events: auto;
}

/* Stage: constrains image size */
.lightbox__stage {
  display: flex; align-items: center; justify-content: center;
  max-width: min(88vw, 1100px);
  max-height: 88vh;
  user-select: none;
}

.lightbox__img {
  max-width: 100%; max-height: 88vh;
  object-fit: contain;
  border-radius: 6px;
  display: block;
  opacity: 1;
  transition: opacity 0.15s ease;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox__img.fading { opacity: 0; }

/* Close */
.lightbox__close {
  position: fixed; top: 18px; right: 18px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  color: #fff; font-size: 1.15rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 1;
}
.lightbox__close:hover { background: rgba(255,255,255,0.18); transform: scale(1.08); }

/* Side nav buttons */
.lightbox__nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 1;
}
.lightbox__nav:hover { background: rgba(255,255,255,0.18); }
.lightbox__nav--prev { left: 20px; }
.lightbox__nav--next { right: 20px; }
.lightbox__nav svg { width: 22px; height: 22px; }
/* Hide nav arrows when only 1 image */
.lightbox[data-single] .lightbox__nav { display: none; }

/* Counter */
.lightbox__counter {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  font-size: 0.82rem; font-weight: var(--fw-semibold); letter-spacing: 0.04em;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  padding: 5px 14px; border-radius: 999px;
  white-space: nowrap;
}
.lightbox[data-single] .lightbox__counter { display: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .fl-hero { padding-top: calc(72px + var(--space-xl)); }
  .fl-back-btn span { display: none; }

  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
  .lightbox__nav { width: 42px; height: 42px; }
  .lightbox__nav svg { width: 18px; height: 18px; }
  .lightbox__stage { max-width: 96vw; max-height: 80vh; }
  .lightbox__img { max-height: 80vh; }
  .lightbox__close { top: 12px; right: 12px; }
}
