/* ============================================
   FOTOBLOG.COM.PL — Mobile Responsive CSS
   Kompleksowa naprawa mobilna
   ============================================ */

/* ───────────────────────────────────────────
   1. GLOBALNE FIXES — każda strona
   ─────────────────────────────────────────── */

/* Zapobiegaj wychodzeniu treści poza ekran */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

/* Container — prawidłowy padding na mobile */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Wszystkie obrazy responsywne */
img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* Tekst nie może wychodzić poza kontener */
p, h1, h2, h3, h4, h5, h6,
.article-body, .article-callout,
.article-tip, .article-warning,
.article-summary, .sidebar-widget {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ───────────────────────────────────────────
   2. NAWIGACJA HAMBURGER — kluczowe naprawy
   ─────────────────────────────────────────── */

/* Hamburger ZAWSZE widoczny na mobile, NIE na desktop */
@media (min-width: 993px) {
  .hamburger-btn { display: none !important; }
  .nav-links     { display: flex !important; }
  .mobile-menu   { display: none !important; }
}

@media (max-width: 992px) {
  /* Ukryj linki desktopowe */
  .nav-links { display: none !important; }

  /* Pokaż hamburger */
  .hamburger-btn {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    z-index: 1010;
  }

  .hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text-dark, #2a2420);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
    pointer-events: none;
  }

  .hamburger-btn.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .hamburger-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  .hamburger-btn.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Mobile menu — ukryty domyślnie */
  .mobile-menu {
    display: block !important;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(250, 248, 245, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #e8e0da;
    padding: 1rem 1.5rem 1.5rem;
    z-index: 999;
    /* Ukryty domyślnie przez visibility/opacity */
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0.3s;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Otwarty mobile menu */
  .mobile-menu.open {
    visibility: visible !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0s !important;
  }

  .mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }

  .mobile-menu ul li a {
    display: block;
    font-family: 'Raleway', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5a4d46;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px; /* touch target */
    display: flex;
    align-items: center;
  }

  .mobile-menu ul li a:hover,
  .mobile-menu ul li a:active {
    color: #a67b6e;
    background: #f5ede8;
    padding-left: 1.4rem;
  }

  /* Navbar padding mobile */
  .navbar-inner {
    padding: 0 1rem;
  }
}

/* ───────────────────────────────────────────
   3. HERO — strona główna
   ─────────────────────────────────────────── */

@media (max-width: 992px) {
  .hero {
    min-height: auto;
    padding-top: 90px;
    padding-bottom: 3rem;
  }
  .hero-bg-element { display: none; }
  .hero-image-wrap { margin-top: 2.5rem; }
  .hero-image-placeholder { max-width: 100%; }
  .hero-badge { left: 0 !important; right: auto; }
  .hero-actions { flex-wrap: wrap; gap: 0.75rem; }
}

@media (max-width: 768px) {
  .hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }
  .hero-stat {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 120px;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

/* ───────────────────────────────────────────
   4. GRIDY SEKCJI — strona główna
   ─────────────────────────────────────────── */

@media (max-width: 992px) {
  .about-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem;
  }
  .topics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .portfolio-item.featured {
    grid-column: span 2 !important;
  }
  .blog-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .social-platforms {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem;
  }
  .eeat-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 680px) {
  .topics-grid,
  .blog-grid,
  .social-platforms,
  .tips-grid {
    grid-template-columns: 1fr !important;
  }
  .portfolio-grid {
    grid-template-columns: 1fr !important;
  }
  .portfolio-item.featured {
    grid-column: span 1 !important;
    aspect-ratio: 4/3 !important;
  }
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }
  .eeat-cards {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ───────────────────────────────────────────
   5. BLOG CARDS GRID — blog/index.html i kategorie
   ─────────────────────────────────────────── */

/* Nadpisz gridy inline z HTML */
@media (max-width: 900px) {
  /* Grid 3-kolumnowy → 2 kolumny */
  [style*="repeat(3,1fr)"],
  [style*="repeat(3, 1fr)"],
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 580px) {
  /* Grid wszelki → 1 kolumna */
  [style*="repeat(3,1fr)"],
  [style*="repeat(3, 1fr)"],
  [style*="repeat(2,1fr)"],
  [style*="repeat(2, 1fr)"],
  [style*="grid-template-columns: 1fr 320px"],
  [style*="grid-template-columns: 1fr 280px"],
  [style*="grid-template-columns: 1fr 260px"] {
    grid-template-columns: 1fr !important;
  }
}

/* Blog card — mobile layout */
@media (max-width: 580px) {
  .blog-card {
    flex-direction: column;
  }
  .blog-card-thumb {
    width: 100%;
    height: 180px;
    flex-shrink: 0;
  }
}

/* ───────────────────────────────────────────
   6. ARTYKUŁY — layout i sidebar
   ─────────────────────────────────────────── */

@media (max-width: 900px) {
  /* Layout artykułu: 2 kolumny → 1 kolumna */
  .article-layout {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    padding: 2rem 0 3rem !important;
  }

  /* Sidebar nie sticky na mobile */
  .article-sidebar {
    position: static !important;
    top: auto !important;
  }

  /* Related grid → 2 kolumny */
  .related-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }
}

@media (max-width: 580px) {
  /* Article hero */
  .article-hero {
    padding: 2.5rem 0 2rem !important;
  }
  .article-hero-title {
    font-size: clamp(1.7rem, 7vw, 2.4rem) !important;
    line-height: 1.2 !important;
  }
  .article-hero-desc {
    font-size: 1rem !important;
  }
  .article-breadcrumb {
    font-size: 0.72rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
  }
  .article-meta {
    gap: 0.6rem;
    flex-wrap: wrap;
  }
  .article-meta-item {
    font-size: 0.72rem;
  }

  /* Article body */
  .article-layout {
    padding: 1.5rem 0 2.5rem !important;
  }
  .article-body {
    font-size: 0.97rem !important;
    line-height: 1.8 !important;
  }
  .article-body h2 {
    font-size: 1.35rem !important;
    margin: 2rem 0 0.9rem !important;
  }
  .article-body h3 {
    font-size: 1.15rem !important;
  }
  .article-featured-img {
    margin-bottom: 1.8rem;
    border-radius: 16px;
  }
  .article-featured-placeholder {
    min-height: 180px;
  }

  /* Callout, tip, warning */
  .article-callout {
    padding: 1rem 1.1rem;
  }
  .article-tip,
  .article-warning {
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.1rem;
  }

  /* Lists */
  .article-list li {
    flex-direction: row;
    gap: 0.75rem;
  }
  .article-list-num {
    flex-shrink: 0;
  }
  .check-list li {
    gap: 0.6rem;
    font-size: 0.9rem;
  }

  /* Summary box */
  .article-summary {
    padding: 1.3rem 1.2rem;
    border-radius: 14px;
  }

  /* Author box */
  .article-author-box {
    flex-direction: column;
    gap: 1rem;
    padding: 1.3rem;
    border-radius: 16px;
  }
  .author-avatar-lg {
    width: 54px;
    height: 54px;
    font-size: 1.5rem;
  }

  /* Related section */
  .related-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  .related-section {
    padding: 2.5rem 0 3.5rem;
  }

  /* Sidebar */
  .sidebar-widget,
  .sidebar-cta {
    margin-bottom: 1.2rem;
    padding: 1.2rem;
  }

  /* Tags */
  .article-tags { gap: 0.4rem; padding-top: 1.5rem; }
  .article-tag  { font-size: 0.7rem; padding: 0.28rem 0.7rem; }
}

/* ───────────────────────────────────────────
   7. STRONA GŁÓWNA — o mnie, about sekcja
   ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .tip-card {
    flex-direction: column;
  }
  .about-accent-box {
    position: static !important;
    margin-top: 1.5rem;
    display: inline-block;
  }
  .section-header { margin-bottom: 2.5rem; }
}

/* ───────────────────────────────────────────
   8. FOOTER
   ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr !important;
  }
  .footer-badge { display: none; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* ───────────────────────────────────────────
   9. SPACING — spacing reductions na małych ekranach
   ─────────────────────────────────────────── */

@media (max-width: 576px) {
  .section    { padding: 3rem 0 !important; }
  .section-sm { padding: 2rem 0 !important; }

  /* Scroll to top — mniejszy i niżej */
  .scroll-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  /* Buttons — full width w hero */
  .btn {
    padding: 0.8rem 1.8rem;
    font-size: 0.8rem;
  }

  /* Typography scaling */
  h1 { font-size: clamp(2rem, 8vw, 3rem) !important; }
  h2 { font-size: clamp(1.6rem, 6vw, 2.4rem) !important; }
  h3 { font-size: clamp(1.2rem, 5vw, 1.8rem) !important; }
}

/* ───────────────────────────────────────────
   10. MAPA STRONY / BLOG INDEX — inline grid
   ─────────────────────────────────────────── */

@media (max-width: 680px) {
  /* Sidebar inline przy kategoriach */
  [style*="grid-template-columns:1fr 280px"],
  [style*="grid-template-columns: 1fr 280px"],
  [style*="grid-template-columns:1fr 260px"],
  [style*="grid-template-columns: 1fr 260px"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns: 1fr 320px"] {
    grid-template-columns: 1fr !important;
  }

  /* Mapa strony — auto-fill grid */
  [style*="grid-template-columns:repeat(auto-fill"],
  [style*="grid-template-columns: repeat(auto-fill"] {
    grid-template-columns: 1fr !important;
  }
}

/* ───────────────────────────────────────────
   11. TOUCH TARGETS — minimum 44×44px
   ─────────────────────────────────────────── */

@media (max-width: 992px) {
  .nav-links li a,
  .mobile-menu ul li a,
  .btn,
  .article-tag,
  .sidebar-cat-list li a,
  .toc-list li a {
    min-height: 44px;
  }

  /* Article list items touch target */
  .sidebar-cat-list li a,
  .toc-list li a,
  .footer-links li a {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }
}

/* ───────────────────────────────────────────
   12. SPECJALNE NAPRAWY — sekcja "o mnie"
   ─────────────────────────────────────────── */

@media (max-width: 768px) {
  /* Zdjęcie autora — nie wystawaj poza kontener */
  .about-image-wrap,
  .about-image-placeholder {
    max-width: 100%;
    width: 100%;
  }

  /* Stats grid w about */
  .about-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }
}

/* ───────────────────────────────────────────
   13. PORTFOLIO GRID
   ─────────────────────────────────────────── */

@media (max-width: 680px) {
  .portfolio-grid {
    grid-template-columns: 1fr !important;
  }
  .portfolio-item {
    aspect-ratio: 4/3 !important;
  }
  .portfolio-item.featured {
    grid-column: span 1 !important;
    aspect-ratio: 16/9 !important;
  }
}

/* ───────────────────────────────────────────
   14. FORMULARZ KONTAKTOWY / CTA
   ─────────────────────────────────────────── */

@media (max-width: 576px) {
  .contact-form-inner {
    grid-template-columns: 1fr !important;
  }
  .cta-content h2 {
    font-size: clamp(1.5rem, 7vw, 2.2rem) !important;
  }
}
