/* ============================================================
   MELODY LIMNOS — PWA Banners + Instagram Feed
   ============================================================ */

/* ─── PWA INSTALL BANNER (Android/Desktop) ─── */
.pwa-install-banner {
  position: fixed;
  bottom: calc(var(--player-h) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 250;
  background: var(--navy);
  border: 1px solid rgba(204,26,26,0.4);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  max-width: 380px;
  width: calc(100vw - 2rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
}

.pwa-install-banner.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.pwa-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: white;
  padding: 3px;
  flex-shrink: 0;
}

.pwa-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-banner-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: white;
  margin-bottom: 2px;
}

.pwa-banner-sub {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.45);
  line-height: 1.4;
}

.pwa-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-btn-install {
  background: var(--red);
  color: white;
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.pwa-btn-install:hover { background: var(--red-light); }

.pwa-btn-dismiss {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  align-self: center;
}

.pwa-btn-dismiss:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* ─── PWA UPDATE BANNER ─── */
.pwa-update-banner {
  position: fixed;
  top: 70px;
  right: 1rem;
  z-index: 250;
  background: var(--navy);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.7);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
}

.pwa-update-banner.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.pwa-update-btn {
  background: var(--red);
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .pwa-install-banner {
    bottom: calc(var(--player-h-mob) + 10px);
    border-radius: 12px;
    padding: 0.85rem 1rem;
  }
}

/* ─── iOS PWA BANNER — #pwaIOSBanner ───────────────────────
   Built entirely via inline styles in pwa.js for portability.
   These rules handle edge cases and safe-area insets.
─────────────────────────────────────────────────────────── */
#pwaIOSBanner {
  /* Safe area for iPhone notch/home bar */
  bottom: calc(var(--player-h-mob, 64px) + 10px + env(safe-area-inset-bottom, 0px)) !important;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  #pwaIOSBanner {
    transition: opacity 0.15s !important;
  }
}

/* ─── INSTAGRAM FEED SECTION ─── */
.instagram-section {
  background: var(--navy);
  padding: 4rem 1.5rem;
  position: relative;
  overflow: hidden;
}

/* Subtle background pattern */
.instagram-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 70% 60% at 50% 100%,
    rgba(204,26,26,0.06) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.instagram-inner {
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.instagram-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.instagram-title-wrap {}

.instagram-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: white;
  margin-bottom: 0.25rem;
}

.instagram-handle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
  transition: color 0.2s;
  text-decoration: none;
}

.instagram-handle:hover { color: #e1306c; }

.instagram-handle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.instagram-follow-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  color: white;
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.instagram-follow-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.instagram-follow-btn svg {
  width: 16px;
  height: 16px;
}

/* ─── INSTAGRAM GRID ─── */
.instagram-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

/* Large featured post */
.instagram-post {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  transition: transform 0.2s;
}

.instagram-post:hover { transform: scale(1.02); z-index: 2; }

.instagram-post:nth-child(1) {
  grid-column: span 2;
  grid-row: span 2;
}

.instagram-post img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s;
}

.instagram-post:hover img { transform: scale(1.06); }

/* Hover overlay */
.instagram-post-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13,27,42,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  transition: opacity 0.25s;
}

.instagram-post:hover .instagram-post-overlay { opacity: 1; }

.instagram-post-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  color: white;
  font-size: 0.82rem;
  font-weight: 500;
}

.instagram-post-stat svg {
  width: 16px;
  height: 16px;
  fill: white;
}

/* Placeholder / loading skeleton */
.instagram-skeleton {
  background: rgba(255,255,255,0.05);
  animation: skel-pulse 1.8s ease-in-out infinite;
}

@keyframes skel-pulse {
  0%, 100% { background: rgba(255,255,255,0.05); }
  50%       { background: rgba(255,255,255,0.1); }
}

/* Embed fallback widget */
.instagram-embed-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}

/* ─── LOAD MORE ─── */
.instagram-load-more {
  text-align: center;
  margin-top: 1.5rem;
}

.instagram-load-more a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  transition: color 0.2s;
}

.instagram-load-more a:hover { color: white; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .instagram-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .instagram-post:nth-child(1) {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 480px) {
  .instagram-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
  }
}

/* ─── ELFSIGHT WIDGET WRAPPER ─── */
.elfsight-widget-wrap {
  width: 100%;
  min-height: 340px;
  border-radius: var(--radius);
  overflow: hidden;
  /* Elfsight injects its own styles — we just contain it */
}

/* Override Elfsight default white background to match our dark theme */
.elfsight-widget-wrap .eapps-instagram-feed-posts-grid-post-image {
  border-radius: 8px;
}

/* Loading placeholder — shown until Elfsight JS fires */
.instagram-placeholder {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  min-height: 300px;
}

.instagram-placeholder::before,
.instagram-placeholder::after {
  content: '';
}

/* Skeleton tiles — generated by instagram.js */
.instagram-placeholder .skel {
  aspect-ratio: 1;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  animation: skel-pulse 1.8s ease-in-out infinite;
}

/* Hide placeholder once Elfsight loads */
.eapps-instagram-feed-loaded ~ #instagramGrid,
.eapps-instagram-feed-loaded .instagram-placeholder {
  display: none;
}

@media (max-width: 768px) {
  .instagram-placeholder {
    grid-template-columns: repeat(3, 1fr);
  }
  .elfsight-widget-wrap {
    min-height: 260px;
  }
}

/* ─── SETUP NOTICE (shown when APP_ID is still placeholder) ─── */
.elfsight-app-PLACEHOLDER .instagram-placeholder {
  display: grid;
}

.instagram-setup-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 2rem;
  border: 1.5px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius);
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 0.88rem;
  line-height: 1.6;
}

.instagram-setup-notice strong {
  color: var(--red-light);
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.instagram-setup-notice a {
  color: var(--red-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.instagram-setup-notice a:hover { color: white; }
