/* ==========================================================================
   1. STYLIZACJA SIATKI GALERII NA STRONIE (Artystyczny układ i rotacje)

   ========================================================================== */
.art-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem 0;
  padding: 2rem 1rem;
  max-width: 1480px;
  margin: 0 auto;
}
.gallery-item {
  position: relative;
  transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.75);
  transform: rotate(var(--rotate));
}
.gallery-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  filter: grayscale(0.2) contrast(1.1);
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1), filter 0.7s ease;
}
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.2) 65%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.gallery-item:hover .gallery-img {
  transform: scale(1.03);
  filter: grayscale(0) contrast(1.05);
}
.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

@media (min-width: 768px) {
  .art-gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 3.5rem 2.8rem;
    padding: 4rem 2rem;
  }
  .gallery-item {
    height: 380px !important;
  }
  .gallery-img {
    height: 100%;
    object-fit: cover;
  }
  .gallery-item:nth-child(3n) { grid-row: span 2; height: 795px !important; }
  .gallery-item:nth-child(4n+1) { grid-column: span 2; }

  /* Krzywe ułożenie zdjęć */
  .gallery-item:nth-child(odd)  { --rotate: -2.8deg; }
  .gallery-item:nth-child(even) { --rotate: 2.4deg; }
  .gallery-item:nth-child(3n)  { --rotate: -1.3deg; }

  /* Prostowanie po najechaniu */
  .gallery-item:hover {
    transform: scale(1.05) rotate(0deg) !important;
    z-index: 10;
    box-shadow: 0 25px 55px -12px rgba(0, 0, 0, 0.85);
  }
}

/* ==========================================================================
   2. NATYWNY UKŁAD GLIGHTBOX (Zabezpieczenie zoomu i pływający opis)
   ========================================================================== */
.gslide {
  background: #000000 !important;
}
.gslide-inner-content {
  background: #000000 !important;
}

/* Rezerwacja wolnej przestrzeni nad wiszącym opisem */
.gslide-image {
  padding-bottom: 170px !important; 
  box-sizing: border-box !important;
}

/* OPIS: Wyśrodkowana i pływająca karta kuratorska */
.gslide-description {
  position: fixed !important;
  bottom: 2rem !important; 
  left: 50% !important;
  transform: translateX(-50%) !important; 
  width: 90% !important;
  max-width: 850px !important; 
  height: auto !important; 
  background: rgba(10, 10, 10, 0.95) !important; 
  backdrop-filter: blur(10px) !important; 
  border: 1px solid rgba(255, 255, 255, 0.08) !important; 
  border-radius: 4px !important; 
  padding: 1.5rem 2rem !important;
  box-sizing: border-box !important;
  z-index: 99999 !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8) !important; 
}

/* Ukrycie automatycznych nagłówków biblioteki */
.gslide-title {
  display: none !important;
}

/* Reakcja na aktywny zoom (trzecie kliknięcie) */
.gzoomed .gslide-description {
  display: none !important; 
}
.gzoomed .gslide-image {
  padding-bottom: 0 !important; 
}

/* Dostosowanie mobilne */
@media (max-width: 768px) {
  .gslide-image {
    padding-bottom: 240px !important; 
  }
  .gslide-description {
    bottom: 1rem !important; 
    width: 95% !important;
    padding: 1.25rem 1rem !important;
  }
}

/* ==========================================================================
   3. STYLIZACJA TEKSTU KURATORSKIEGO (Wewnątrz opisu)
   ========================================================================== */
.curatorial-caption {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  text-align: center !important; 
}
.curatorial-caption h4 {
  font-family: 'Playfair Display', serif !important;
  color: #ffffff !important;
  font-size: 1.15rem !important;
  line-height: 1.4 !important;
  margin-bottom: 0.35rem !important;
  letter-spacing: 0.02em !important;
}
.curatorial-caption p {
  font-family: 'Cormorant Garamond', serif !important;
  color: #d1d5db !important;
  font-size: 0.9rem !important;
  line-height: 1.5 !important;
  margin-bottom: 0.4rem !important;
}
.curatorial-caption .print-details {
  font-family: 'Inter', sans-serif !important;
  color: #888888 !important;
  font-size: 0.725rem !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  display: block !important;
  line-height: 1.4 !important;
}
.curatorial-caption .divider {
  color: #4b5563 !important;
  margin: 0 0.4rem !important;
}

/* Styl nakładki po najechaniu na kafelek galerii */
.gallery-overlay {
  position: absolute;
  inset: 0;
  /* Ciemny gradient od dołu, zabezpieczający czytelność tekstu */
  background: linear-gradient(
    to top, 
    rgba(0, 0, 0, 0.9) 0%, 
    rgba(0, 0, 0, 0.4) 50%, 
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem 1.5rem;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none; /* Zapobiega problemom z klikaniem w link pod spodem */
}

/* Wnętrze nakładki - spójna typografia */
.gallery-overlay-content {
  text-align: left;
}

.gallery-overlay-title {
  font-family: 'Playfair Display', serif !important;
  color: #ffffff !important;
  font-size: 1.25rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em !important;
  margin-bottom: 0.25rem !important;
  line-height: 1.3 !important;
}

.gallery-overlay-series {
  font-family: 'Cormorant Garamond', serif !important;
  color: #d1d5db !important;
  font-style: italic !important;
  font-size: 0.95rem !important;
  margin-bottom: 0.4rem !important;
}

.gallery-overlay-year {
  font-family: 'Inter', sans-serif !important;
  color: rgba(255, 255, 255, 0.4) !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
}

/* ==========================================================================
   STEROWANIE KADROWANIEM I DOPASOWANIEM OBRAZÓW (Wsparcie dla klas dynamicznych)
   ========================================================================== */

/* 1. Pozycjonowanie kadru (object-position) */
.gallery-item.pos-top img,
.gallery-item.pos-top picture img,
.gallery-item.pos-top .gallery-img {
  object-position: top center !important;
}

.gallery-item.pos-bottom img,
.gallery-item.pos-bottom picture img,
.gallery-item.pos-bottom .gallery-img {
  object-position: bottom center !important;
}

.gallery-item.pos-center img,
.gallery-item.pos-center picture img,
.gallery-item.pos-center .gallery-img {
  object-position: center center !important;
}

/* 2. Przeskalowanie i dopasowanie (object-fit) */
.gallery-item.fit-contain img,
.gallery-item.fit-contain picture img,
.gallery-item.fit-contain .gallery-img {
  object-fit: contain !important;
  background-color: #000000; /* Czarne tło dla niedopełnionych krawędzi */
}

.gallery-item.fit-cover img,
.gallery-item.fit-cover picture img,
.gallery-item.fit-cover .gallery-img {
  object-fit: cover !important;
}
body {
    font-family: 'Inter', system-ui, sans-serif;
}

.serif {
    font-family: 'Playfair Display', serif;
}

.serif-alt {
    font-family: 'Cormorant Garamond', serif;
}

@media (min-width: 768px) {
  .gallery-item.size-wide {
    grid-column: span 2 !important;
  }
  .gallery-item.size-tall {
    grid-row: span 2 !important;
    height: 795px !important;
  }
  .gallery-item.size-feature {
    grid-column: span 2 !important;
    grid-row: span 2 !important;
    height: 795px !important;
  }
  .gallery-item.size-full {
    grid-column: 1 / -1 !important;
    height: 600px !important;
    transform: rotate(0deg) !important;
  }
}
/* ==========================================================================
   EFEKT "LATENTNEGO NEGATYWU" DLA WSTAWEK NEGATYW (np. NEGATYW 003)
   Przeniesione z marginalia.php - tam było lokalne (w <style> strony),
   więc nie działało na switezianka.php, która nie ładuje <head> marginalii.
   ========================================================================== */
@media (hover: hover) {
    .negative-latent {
        color: #404040;
        filter: blur(1.5px);
        transition: color 3000ms cubic-bezier(0.23,1,0.32,1), filter 3000ms cubic-bezier(0.23,1,0.32,1);
    }
    .group:hover .negative-latent {
        color: #d4d4d4;
        filter: blur(0px);
    }
}
@media (hover: none) {
    .negative-latent { color: #a3a3a3; filter: blur(0px); }
}

/* ==========================================================================
   WSTAWKA NEGATYW - zwolnienie z limitu wysokości/overflow bazowej klasy
   .gallery-item (380px !important + overflow:hidden), które obcinały dolną
   część dłuższego tekstu na desktopie.
   ========================================================================== */
@media (min-width: 768px) {
    .gallery-item.negative-tile {
        height: auto !important;
        overflow: visible !important;
    }
}

/* --- NOWY FORMAT POETYCKI DLA OPISU SERII --- */

/* Główny kontener - nadajemy mu maksymalną szerokość i oddech */
.curatorial-statement {
    max-width: 680px !important; /* Idealna szerokość linii do czytania poezji */
    margin: 60px auto 80px auto !important; /* Marginesy góra/dół dla oddechu */
    text-align: left !important; /* Szlachetne wyrównanie do lewej */
    padding: 0 20px;
}

/* Każda strofa/akapit poetycki */
.curatorial-statement p {
    font-family: 'Playfair Display', 'Georgia', serif !important;
    font-size: 1.25rem !important; /* Większy, ale bardzo lekki font */
    font-weight: 300 !important;
    line-height: 1.95 !important; /* Duża interlinia dająca powietrze */
    color: #a3a3a3 !important; /* Matowy, szlachetny odcień szarości */
    font-style: italic !important; /* Intymny charakter tekstu */
    margin-bottom: 2.5rem !important; /* Przestrzeń między strofami */
    letter-spacing: -0.1px !important;
    text-rendering: optimizeLegibility;
}

/* Pierwsza litera całego tekstu (Subtelny inicjał) */
.curatorial-statement p:first-of-type::first-letter {
    font-size: 3rem !important;
    float: left;
    line-height: 1;
    padding-right: 12px;
    color: #e5e5e5 !important;
    font-family: 'Playfair Display', serif !important;
    font-weight: 300;
}

/* 
   Wyróżnienie dla mocnych, jednozdaniowych wersów.
   Zadziała automatycznie, jeśli w tekście panelu CMS 
   sformatowałeś zdania jako pogrubione (strong).
*/
.curatorial-statement p strong,
.curatorial-statement p b {
    font-family: 'Courier New', monospace !important; /* Surowy, maszynowy kontrast */
    font-weight: 400 !important;
    font-style: normal !important;
    color: #e5e5e5 !important; /* Rozjaśnienie */
    font-size: 1.05rem !important;
    letter-spacing: 0.5px !important;
    display: block;
    margin: 3.5rem 0 !important; /* Potężna pusta przestrzeń wokół manifestu */
    line-height: 1.6 !important;
}

/* Bezpiecznik responsywny dla urządzeń mobilnych */
@media (max-width: 768px) {
    .curatorial-statement {
        margin: 40px auto !important;
        padding: 0 16px;
    }
    .curatorial-statement p {
        font-size: 1.1rem !important; /* Delikatne zmniejszenie na telefonach */
        line-height: 1.8 !important;
        margin-bottom: 1.8rem !important;
    }
    .curatorial-statement p strong,
    .curatorial-statement p b {
        margin: 2.5rem 0 !important;
        font-size: 0.95rem !important;
    }
}
/* ==========================================================================
   EFEKT "LATENTNEGO NEGATYWU" DLA WSTAWEK NEGATYW (np. NEGATYW 003)
   Przeniesione z marginalia.php - tam było lokalne (w <style> strony),
   więc nie działało na switezianka.php, która nie ładuje <head> marginalii.
   ========================================================================== */
@media (hover: hover) {
    .negative-latent {
        color: #404040;
        filter: blur(1.5px);
        transition: color 3000ms cubic-bezier(0.23,1,0.32,1), filter 3000ms cubic-bezier(0.23,1,0.32,1);
    }
    .group:hover .negative-latent {
        color: #d4d4d4;
        filter: blur(0px);
    }
}
@media (hover: none) {
    .negative-latent { color: #a3a3a3; filter: blur(0px); }
}

/* ==========================================================================
   WSTAWKA NEGATYW - zwolnienie z limitu wysokości/overflow bazowej klasy
   .gallery-item (380px !important + overflow:hidden), które obcinały dolną
   część dłuższego tekstu na desktopie.
   ========================================================================== */
@media (min-width: 768px) {
    .gallery-item.negative-tile {
        height: auto !important;
        overflow: visible !important;
    }
}

/* ==========================================================================
   SIZE: POSTER - pełna szerokość, wysokość NIE jest narzucana (w przeciwieństwie
   do .size-full). Kafelek rośnie do naturalnych proporcji zdjęcia - efekt
   plakatu, bez przycinania (cover) i bez czarnych pasów (contain).
   fit/pos są dla tego rozmiaru ignorowane - nic się nie przycina.
   ========================================================================== */
@media (min-width: 768px) {
    .gallery-item.size-poster {
        grid-column: 1 / -1 !important;
        height: auto !important;
        transform: rotate(0deg) !important;
    }
    .gallery-item.size-poster .gallery-img {
        height: auto !important;
        width: 100% !important;
        object-fit: initial !important;
    }
}