/* ==========================================================================
   ABDL.pl — wygoda na telefonach
   Feed od krawędzi do krawędzi, większe cele dotyku, panele od dołu,
   wyszukiwarka na cały ekran, pull-to-refresh, przewijane zdjęcia.
   ========================================================================== */

:root {
  --mux-bg: #111827;
  --mux-card: #1f2937;
  --mux-line: rgba(255, 255, 255, 0.06);
  --mux-accent: #e8407f;
  --mux-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Bez powiększania dwuklikiem / szczypaniem */
html, body { touch-action: pan-x pan-y; }

/* ---------- Odpowiedź przy dotyku (tylko ekrany dotykowe) ---------- */
@media (hover: none) {
  a, button, [role="button"], label, summary {
    -webkit-tap-highlight-color: transparent;
  }
  button, [role="button"], .post-action-btn, .mobile-tab-bar__item,
  .site-header__icon-btn, .btn-follow, .story-card {
    transition: scale 0.12s var(--mux-ease), background-color 0.12s ease, opacity 0.12s ease;
  }
  button:active:not(:disabled), [role="button"]:active, .btn-follow:active,
  .site-header__icon-btn:active, .story-card:active {
    scale: 0.96;
  }
  .post-action-btn:active {
    scale: 0.92;
    background-color: rgba(255, 255, 255, 0.08) !important;
  }
  .mobile-tab-bar__item:active { scale: 0.88; }
  /* Linki-karty (np. lista wiadomości) — lekkie podświetlenie zamiast skali */
  .message:active, .notification:active, .search-item:active, #mobileMenu a:active, #dropdownMenu a:active {
    background-color: rgba(255, 255, 255, 0.06) !important;
  }
}

@media (max-width: 767px) {
  /* ---------- Pola tekstowe 16 px — iOS nie przybliża strony ---------- */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  textarea, select, [contenteditable="true"] {
    font-size: 16px !important;
  }

  html, body { overflow-x: clip; }

  /* ---------- Feed od krawędzi do krawędzi ---------- */
  #postContainer > * {
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border-top: 1px solid var(--mux-line);
    border-bottom: 1px solid var(--mux-line);
  }

  /* Przyciski reakcji / komentarzy / obserwacji: min. 44 px */
  .post-action-bar--fb .post-action-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0 12px !important;
    justify-content: center;
    border-radius: 999px !important;
    font-size: 0.875rem;
  }
  .post-action-bar--fb .post-action-bar__left { gap: 2px; margin-left: -12px; }
  .post-action-bar--fb .post-action-icon { font-size: 1.15rem; }

  /* Zdjęcia w poście — od krawędzi */
  .post-gallery.post-gallery--single,
  .post-gallery.post-gallery--swipe {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0 !important;
  }
}

/* ---------- Galeria: jedno zdjęcie ---------- */
.post-gallery--single { display: block; }
.post-gallery--single > a { display: block; }
.post-gallery--single img {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-height: 80vh;
  object-fit: cover;
  border-radius: 0 !important;
  background: #0b1220;
}

/* ---------- Galeria: przewijanie palcem ---------- */
.post-gallery-swipe-wrap { position: relative; }
.post-gallery--swipe {
  display: flex !important;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  height: auto !important;
  background: #0b1220;
}
.post-gallery--swipe::-webkit-scrollbar { display: none; }
.post-gallery--swipe > a {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  position: static !important;
  width: auto !important;
  height: auto !important;
}
.post-gallery--swipe img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 0 !important;
  position: static !important;
  margin: 0 !important;
}
.post-gallery-count {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.post-gallery-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 10px 0 2px;
}
.post-gallery-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  transition: width 0.2s var(--mux-ease), background-color 0.2s ease;
}
.post-gallery-dots span.is-active {
  width: 16px;
  background: var(--mux-accent);
}

/* ---------- Pull-to-refresh ---------- */
.mux-ptr {
  position: fixed;
  left: 50%;
  top: calc(3.5rem + env(safe-area-inset-top, 0px));
  z-index: 45;
  width: 38px;
  height: 38px;
  margin-left: -19px;
  border-radius: 999px;
  background: var(--mux-card);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--mux-line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e5e7eb;
  opacity: 0;
  transform: translateY(-48px);
  pointer-events: none;
}
.mux-ptr.is-animating { transition: transform 0.28s var(--mux-ease), opacity 0.2s ease; }
.mux-ptr svg { width: 20px; height: 20px; }
.mux-ptr.is-ready { color: var(--mux-accent); }
.mux-ptr.is-loading svg { animation: muxSpin 0.8s linear infinite; }
@keyframes muxSpin { to { transform: rotate(360deg); } }
html.mux-ptr-page { overscroll-behavior-y: contain; }

/* ---------- Panele od dołu (powiadomienia, wiadomości, menu) ---------- */
.mux-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(3, 7, 18, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.mux-sheet-backdrop.is-visible { opacity: 1; pointer-events: auto; }
html.mux-lock, html.mux-lock body { overflow: hidden !important; }

.mux-sheet {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  max-height: 82vh;
  max-height: 82dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 1001 !important;
  background: var(--mux-card) !important;
  border: 0 !important;
  border-radius: 20px 20px 0 0 !important;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5) !important;
  padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  font-size: 15px !important;
  animation: muxSheetIn 0.28s var(--mux-ease);
  will-change: transform;
}
.mux-sheet.hidden { display: none !important; }
.mux-sheet::before {
  content: "";
  display: block;
  position: sticky;
  top: 0;
  z-index: 2;
  height: 26px;
  /* uchwyt do przeciągania */
  background:
    radial-gradient(circle at 2.5px 2.5px, rgba(255,255,255,.24) 2.5px, transparent 2.6px) calc(50% - 17.5px) 10px / 5px 5px no-repeat,
    radial-gradient(circle at 2.5px 2.5px, rgba(255,255,255,.24) 2.5px, transparent 2.6px) calc(50% + 17.5px) 10px / 5px 5px no-repeat,
    linear-gradient(rgba(255,255,255,.24), rgba(255,255,255,.24)) center 10px / 35px 5px no-repeat,
    var(--mux-card);
  border-radius: 20px 20px 0 0;
}
.mux-sheet.is-dragging { animation: none; transition: none; }
.mux-sheet.is-settling { transition: transform 0.25s var(--mux-ease); }
@keyframes muxSheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Zawartość paneli — większe wiersze */
.mux-sheet .notification,
.mux-sheet .message { padding: 12px 16px !important; }
.mux-sheet .notification img { width: 40px !important; height: 40px !important; }
.mux-sheet .message .truncate { max-width: calc(100vw - 110px); }
.mux-sheet > a, .mux-sheet nav > a { min-height: 48px; display: flex; align-items: center; }
#dropdownMenu.mux-sheet > a { padding: 0 20px !important; font-size: 16px; }
#mobileMenu.mux-sheet { padding-left: 8px !important; padding-right: 8px !important; }
#mobileMenu.mux-sheet nav > a { font-size: 16px; gap: 14px; padding: 0 12px !important; border-radius: 12px; }
.mux-sheet-title {
  padding: 0 20px 8px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

/* ---------- Wyszukiwarka na cały ekran ---------- */
.mux-search-full {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1002 !important;
  width: auto !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background: var(--mux-bg) !important;
  box-shadow: none !important;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 0 !important;
  display: flex !important;
  flex-direction: column;
  animation: muxFadeUp 0.2s var(--mux-ease);
}
.mux-search-full.hidden { display: none !important; }
.mux-search-full .mux-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.mux-search-full #mobileSearchInput {
  flex: 1;
  height: 44px;
  padding: 0 14px !important;
  border-radius: 999px !important;
  background: var(--mux-card) !important;
  border: 1px solid transparent !important;
}
.mux-search-full #mobileSearchInput:focus { border-color: var(--mux-accent) !important; box-shadow: none !important; --tw-ring-shadow: none !important; }
.mux-search-back {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e5e7eb;
  font-size: 18px;
  background: transparent;
}
.mux-search-full #mobileSearchResults {
  flex: 1;
  max-height: none !important;
  margin: 10px -12px 0 !important;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-y: auto;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
.mux-search-full #mobileSearchResults .search-item { padding: 12px 16px !important; }
.mux-search-hint {
  padding: 28px 16px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}
.mux-search-full #mobileSearchResults:not(.hidden) ~ .mux-search-hint { display: none; }
@keyframes muxFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mux-sheet, .mux-search-full { animation: none; }
  .mux-ptr.is-animating { transition: none; }
}
