/* ==========================================================================
   FACEBOOK POSTS — Arnoldio
   Used on front-page (section preview) and page-facebook (archive).
   ========================================================================== */

/* ===== Section header ===== */
.az-fb__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: var(--space-lg, 32px);
}

.az-fb__head .az-h2 {
  margin-bottom: 0;
}

/* ===== Posts grid ===== */
.az-fb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md, 24px);
}

/* ===== Single post card ===== */
.az-fb-post {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.az-fb-post:hover {
  border-color: var(--az-border-2, var(--primary));
  box-shadow: var(--az-shadow-md);
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .az-fb-post,
  .az-fb-post:hover {
    transition: none;
    transform: none;
  }
}

/* Image — full, no crop, skeleton before load */
.az-fb-post__img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--az-skeleton, #e4e4e4);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.az-fb-post__img.is-loaded {
  opacity: 1;
}

/* Body */
.az-fb-post__body {
  padding: var(--space-sm, 16px) var(--space-md, 24px);
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.az-fb-post__date {
  font-size: var(--fs-1, 0.75rem);
  color: var(--az-muted, #666);
  font-weight: 500;
}

.az-fb-post__text {
  font-size: var(--fs-2, 0.875rem);
  line-height: 1.55;
  color: var(--text);
  flex: 1;

  /* Clamp to 4 lines */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty / unconfigured state */
.az-fb-post--empty {
  padding: var(--space-md, 24px);
  color: var(--az-muted, #666);
  font-size: var(--fs-2, 0.875rem);
}

/* ===== "See all" footer row ===== */
.az-fb-footer {
  margin-top: var(--space-lg, 32px);
  display: flex;
  justify-content: center;
}

/* ===== Archive page ===== */
.fb-archive-page__header {
  margin-bottom: var(--space-lg, 32px);
}

.fb-archive-page__title {
  font-size: var(--fs-h1, 2rem);
  font-weight: 800;
  margin: 0 0 8px;
}

.fb-archive-page__lead {
  color: var(--az-muted, #666);
  margin: 0;
}

/* Larger grid on archive page */
.fb-archive-page .az-fb-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* ==========================================================================
   MODAL
   ========================================================================== */

.az-fb-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.az-fb-modal[hidden] {
  display: none;
}

.az-fb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

/* Two-column box */
.az-fb-modal__box {
  position: relative;
  background: var(--surface, #1a1a1a);
  border-radius: var(--radius, 12px);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Topbar: counter + close — always at top */
.az-fb-modal__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

/* Inner grid: image left, body right */
.az-fb-modal__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* When no image — full width for body */
.az-fb-modal__inner:has(.az-fb-modal__media[hidden]) {
  grid-template-columns: 1fr;
}

/* Left: image */
.az-fb-modal__media {
  position: relative;
  background: #000;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.az-fb-modal__media[hidden] {
  display: none;
}

.az-fb-modal__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* FB icon link — top-right corner of image panel */

.az-fb-modal__fb-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s;
}

.az-fb-modal__fb-icon[hidden] {
  display: none;
}

.az-fb-modal__fb-icon:hover {
  background: rgba(24, 119, 242, 0.85);
}

/* Modal image fade-in */
.az-fb-modal__img {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.az-fb-modal__img.is-loaded {
  opacity: 1;
}

/* Nav arrows on image */
.az-fb-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  font-size: 16px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.15s;
}

.az-fb-modal__nav[hidden] {
  display: none;
}

.az-fb-modal__nav:hover {
  background: rgba(255, 255, 255, 0.32);
}

.az-fb-modal__prev { left: 8px; }
.az-fb-modal__next { right: 8px; }

/* Right: body */
.az-fb-modal__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.az-fb-modal__counter {
  font-size: 0.8rem;
  color: var(--az-muted, #999);
  font-weight: 500;
}

.az-fb-modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(128, 128, 128, 0.15);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  flex-shrink: 0;
}

.az-fb-modal__close:hover {
  background: rgba(128, 128, 128, 0.28);
}

.az-fb-modal__date {
  font-size: 0.8rem;
  color: var(--az-muted, #999);
}

.az-fb-modal__date[hidden] {
  display: none;
}

.az-fb-modal__text {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-line;
  margin: 0;
  flex: 1;
}

/* FB link button at bottom */
.az-fb-modal__link {
  display: block;
  text-align: center;
  padding: 12px 20px;
  background: var(--primary, #1877f2);
  color: #fff;
  border-radius: var(--radius, 8px);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  margin-top: auto;
  transition: opacity 0.15s;
}

.az-fb-modal__link[hidden] {
  display: none;
}

.az-fb-modal__link:hover {
  opacity: 0.88;
}

/* Lock scroll when modal open */
body.az-modal-open {
  overflow: hidden;
}

/* Mobile: pełny ekran, topbar na górze, reszta scrolluje */
@media (max-width: 640px) {
  .az-fb-modal {
    padding: 0;
    align-items: stretch;
  }

  .az-fb-modal__box {
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    max-width: 100%;
  }

  .az-fb-modal__inner {
    grid-template-columns: 1fr;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .az-fb-modal__media {
    min-height: unset;
    max-height: unset;
  }

  .az-fb-modal__img {
    width: 100%;
    height: auto;
    max-height: unset;
    object-fit: contain;
  }

  .az-fb-modal__body {
    overflow-y: unset;
  }
}
