/*!
 * Mușuroi — Album Block (public)
 * 6 layouts: justified-rows, masonry, grid-fixed, mozaic-asimetric,
 *            marquee-orizontal, stack-fullbleed.
 *
 * Conventions:
 * - Toate clasele prefixate `mus-block-` / `mus-album-` (no Blocksy/WP collision).
 * - NU setăm object-position aici — backend-ul îl pune inline (focal point).
 * - Reduced motion respectat global.
 * @version 1.29.0
 */

/* ---------- Tokens locale (gap, radius) ---------- */
.mus-block-album {
  --mus-album-gap: 12px;
  --mus-album-radius: 4px;
  --mus-album-row-height: 240px; /* fallback pentru justified-rows */
  --mus-album-cols: 3;
  --mus-album-aspect: auto;
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

.mus-album-gap-xs { --mus-album-gap: 4px; }
.mus-album-gap-sm { --mus-album-gap: 8px; }
.mus-album-gap-md { --mus-album-gap: 12px; }
.mus-album-gap-lg { --mus-album-gap: 20px; }
.mus-album-gap-xl { --mus-album-gap: 32px; }

.mus-album-cols-2 { --mus-album-cols: 2; }
.mus-album-cols-3 { --mus-album-cols: 3; }
.mus-album-cols-4 { --mus-album-cols: 4; }

.mus-album-aspect-1-1  { --mus-album-aspect: 1 / 1; }
.mus-album-aspect-4-5  { --mus-album-aspect: 4 / 5; }
.mus-album-aspect-3-2  { --mus-album-aspect: 3 / 2; }
.mus-album-aspect-16-9 { --mus-album-aspect: 16 / 9; }
.mus-album-aspect-21-9 { --mus-album-aspect: 21 / 9; }
.mus-album-aspect-auto { --mus-album-aspect: auto; }

/* ---------- Header ----------
 * Aliniat cu sistemul Alt Nivel (--an-font-display, --an-content-wide,
 * paletă --an-color-*) cu fallback-uri pentru pagini fără tokens.
 * Centrat, constrâns în page wrap, cu spațiu generos față de grid.
 * 1.30.3 — redesign h2 pagina-style + center + breathing room.
 */
.mus-album__header {
  max-width: var(--an-content-wide, 1080px);
  margin: 0 auto 3rem;
  padding: 1.5rem 1.25rem 0;
  text-align: center;
}
.mus-album__heading {
  margin: 0 0 0.75rem;
  font-family: var(--an-font-display, "Fraunces", "Tiempos Headline", Georgia, serif);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  font-weight: 500;
  color: var(--an-color-noapte, #0a0a0a);
}
.mus-album__subheading {
  max-width: 560px;
  margin: 0 auto;
  font-family: var(--an-font-body, inherit);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--an-color-cenusa, rgba(0, 0, 0, 0.65));
}
@media (max-width: 600px) {
  .mus-album__header {
    margin-bottom: 2rem;
    padding-top: 1rem;
  }
  .mus-album__heading {
    font-size: clamp(1.625rem, 6vw, 2.25rem);
  }
  .mus-album__subheading {
    font-size: 0.9375rem;
  }
}

/* ---------- Item base (figure) ---------- */
.mus-album__item {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--mus-album-radius);
  background: #f3f3f3;
  /* Scroll-reveal default state */
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.mus-album__item.is-visible {
  opacity: 1;
  transform: none;
}
.mus-album__link {
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
  text-decoration: none;
  color: inherit;
}
.mus-album__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* object-position vine inline din PHP — NU îl suprascriem */
  transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}
.mus-album__item:hover img {
  transform: scale(1.03);
}
.mus-album__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}
.mus-album__item:hover .mus-album__caption {
  opacity: 1;
}

/* ---------- Empty state ---------- */
.mus-album__grid.is-empty {
  min-height: 0;
}

/* ====================================================================
   1) JUSTIFIED-ROWS — JS computes flex-basis via --mus-w/--mus-h
   ==================================================================== */
.mus-album-layout-justified-rows .mus-album__grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mus-album-gap);
}
.mus-album-layout-justified-rows .mus-album__item {
  /* JS setează flex-grow + width în pixeli; fallback pre-JS = aspect-ratio uniform */
  flex: 0 0 auto;
  height: var(--mus-album-row-height);
  width: calc(var(--mus-album-row-height) * (var(--mus-w, 3) / var(--mus-h, 2)));
}
@media (max-width: 600px) {
  .mus-album-layout-justified-rows {
    --mus-album-row-height: 160px;
  }
}

/* ====================================================================
   2) MASONRY — pure CSS columns
   ==================================================================== */
.mus-album-layout-masonry .mus-album__grid {
  column-count: var(--mus-album-cols);
  column-gap: var(--mus-album-gap);
}
.mus-album-layout-masonry .mus-album__item {
  break-inside: avoid;
  margin-bottom: var(--mus-album-gap);
  display: block;
}
.mus-album-layout-masonry .mus-album__item img {
  height: auto; /* preserve raport native */
  aspect-ratio: auto;
}
@media (max-width: 800px) {
  .mus-album-layout-masonry .mus-album__grid { column-count: 2; }
}
@media (max-width: 480px) {
  .mus-album-layout-masonry .mus-album__grid { column-count: 1; }
}

/* ====================================================================
   3) GRID-FIXED — uniform columns + aspect-ratio
   ==================================================================== */
.mus-album-layout-grid-fixed .mus-album__grid {
  display: grid;
  grid-template-columns: repeat(var(--mus-album-cols), 1fr);
  gap: var(--mus-album-gap);
}
.mus-album-layout-grid-fixed .mus-album__item {
  aspect-ratio: var(--mus-album-aspect, 1 / 1);
}
.mus-album-layout-grid-fixed.mus-album-aspect-auto .mus-album__item {
  aspect-ratio: 1 / 1; /* fallback când e "auto" */
}
@media (max-width: 800px) {
  .mus-album-layout-grid-fixed .mus-album__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .mus-album-layout-grid-fixed .mus-album__grid {
    grid-template-columns: 1fr;
  }
}

/* ====================================================================
   4) MOZAIC ASIMETRIC — primă mare, restul mici
   nth-child spans pe grid 4-col
   ==================================================================== */
.mus-album-layout-mozaic-asimetric .mus-album__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 180px;
  gap: var(--mus-album-gap);
}
.mus-album-layout-mozaic-asimetric .mus-album__item {
  grid-column: span 1;
  grid-row: span 1;
}
/* Pattern repetitiv 6-item: 1 mare + 2 medii + 3 mici */
.mus-album-layout-mozaic-asimetric .mus-album__item:nth-child(6n + 1) {
  grid-column: span 2;
  grid-row: span 2;
}
.mus-album-layout-mozaic-asimetric .mus-album__item:nth-child(6n + 2),
.mus-album-layout-mozaic-asimetric .mus-album__item:nth-child(6n + 3) {
  grid-column: span 2;
  grid-row: span 1;
}
@media (max-width: 800px) {
  .mus-album-layout-mozaic-asimetric .mus-album__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 140px;
  }
  .mus-album-layout-mozaic-asimetric .mus-album__item:nth-child(6n + 1) {
    grid-column: span 2;
    grid-row: span 2;
  }
  .mus-album-layout-mozaic-asimetric .mus-album__item:nth-child(6n + 2),
  .mus-album-layout-mozaic-asimetric .mus-album__item:nth-child(6n + 3) {
    grid-column: span 1;
    grid-row: span 1;
  }
}

/* ====================================================================
   5) MARQUEE ORIZONTAL — track auto-scroll, JS dublează items
   ==================================================================== */
.mus-album-layout-marquee-orizontal {
  overflow: hidden;
  position: relative;
}
/* Legacy single-row marquee (păstrat pentru fallback înainte de hidratare JS) */
.mus-album-layout-marquee-orizontal .mus-album__grid:not(.mus-album__grid--marquee-two-rows) {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--mus-album-gap);
  width: max-content;
  animation: mus-album-marquee var(--mus-album-marquee-duration, 90s) linear infinite;
  animation-play-state: running;
}

/* 1.30.0 — Două rânduri în sensuri opuse (built by album.js setupMarquee). */
.mus-album-layout-marquee-orizontal .mus-album__grid--marquee-two-rows {
  display: flex;
  flex-direction: column;
  gap: var(--mus-album-gap);
  width: 100%;
  animation: none;
}
.mus-album__marquee-row {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--mus-album-gap);
  width: max-content;
  animation-duration: var(--mus-album-marquee-duration, 90s);
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-play-state: running;
  will-change: transform;
}
.mus-album__marquee-row--ltr {
  animation-name: mus-album-marquee;
}
.mus-album__marquee-row--rtl {
  animation-name: mus-album-marquee-reverse;
}
.mus-album-layout-marquee-orizontal:hover .mus-album__marquee-row {
  animation-play-state: paused;
}
.mus-album-layout-marquee-orizontal[data-paused="1"] .mus-album__marquee-row {
  animation-play-state: paused !important;
}

/* Pause/play button (touch + a11y) */
.mus-album__marquee-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
.mus-album__marquee-toggle:hover,
.mus-album__marquee-toggle:focus-visible {
  background: rgba(0, 0, 0, 0.75);
  outline: 0;
}
.mus-album__marquee-toggle:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}
.mus-album__marquee-toggle svg {
  display: block;
}
.mus-album-layout-marquee-orizontal .mus-album__item {
  flex: 0 0 auto;
  width: 320px;
  height: 220px;
  /* Dezactivăm scroll-reveal (animația e mereu vizibilă) */
  opacity: 1;
  transform: none;
}
@media (max-width: 600px) {
  .mus-album-layout-marquee-orizontal .mus-album__item {
    width: 220px;
    height: 160px;
  }
}

/* 1.187.0 — Marquee cu portrete. Caseta implicită e landscape (320x220), ceea ce
   taie capetele când albumul e făcut din cadre verticale. Când shortcode-ul cere
   un `aspect` explicit, lățimea rămâne fixă și înălțimea vine din raport, așa cum
   se întâmplă deja la grid-fixed. `aspect="auto"` păstrează comportamentul vechi,
   deci albumele existente nu se mișcă. */
.mus-album-layout-marquee-orizontal:not(.mus-album-aspect-auto) .mus-album__item {
  height: auto;
  aspect-ratio: var(--mus-album-aspect, 3 / 2);
}
@media (max-width: 600px) {
  .mus-album-layout-marquee-orizontal:not(.mus-album-aspect-auto) .mus-album__item {
    width: 170px;
    height: auto;
  }
}
@keyframes mus-album-marquee {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}
@keyframes mus-album-marquee-reverse {
  from { transform: translate3d(-50%, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

/* ====================================================================
   6) STACK FULLBLEED — vertical cinematic
   ==================================================================== */
.mus-album-layout-stack-fullbleed .mus-album__grid {
  display: flex;
  flex-direction: column;
  gap: var(--mus-album-gap);
}
.mus-album-layout-stack-fullbleed .mus-album__item {
  width: 100%;
  height: 80vh;
  min-height: 480px;
  border-radius: 0;
  /* Reveal mai dramatic */
  transform: translateY(40px);
  transition: opacity 900ms ease, transform 900ms cubic-bezier(0.16, 1, 0.3, 1);
}
.mus-album-layout-stack-fullbleed .mus-album__item.is-visible {
  transform: none;
}
.mus-album-layout-stack-fullbleed .mus-album__caption {
  font-size: 1rem;
  padding: 1.25rem 1.5rem;
}
@media (max-width: 600px) {
  .mus-album-layout-stack-fullbleed .mus-album__item {
    height: 60vh;
    min-height: 320px;
  }
}

/* ====================================================================
   PhotoSwipe — caption overlay (lightbox)
   ==================================================================== */
.pswp__custom-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 24px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  color: #fff;
  font-size: 0.9375rem;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
  z-index: 10;
}
@media (max-width: 600px) {
  .pswp__custom-caption {
    font-size: 0.875rem;
    padding: 12px 16px;
  }
}

/* ====================================================================
   Reduced motion — kill animations
   ==================================================================== */
@media (prefers-reduced-motion: reduce) {
  .mus-album__item {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .mus-album__item:hover img {
    transform: none;
  }
  .mus-album-layout-marquee-orizontal .mus-album__grid,
  .mus-album-layout-marquee-orizontal .mus-album__marquee-row {
    animation: none !important;
    /* Permitem scroll manual */
    overflow-x: auto;
  }
}
