/* ==========================================================================
   PROSTAKTIV SVERIGE — prostaktivsverige.info — MOBILE-FIRST RESPONSIVE DESIGN
   Comprehensive Breakpoint Matrix: 320px – 768px – 1100px+
   Strict Rules: Zero horizontal overflow, touch targets >= 44px, safe area insets
   ========================================================================== */

/* Large Tablets & Small Desktops (<= 1100px) */
@media (max-width: 1100px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 3.5rem;
  }

  .hero-image-wrapper {
    max-width: 580px;
    margin: 0 auto;
    width: 100%;
  }

  .hero-overlay-card {
    left: 10px;
    bottom: -15px;
  }

  .footer-top-grid {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }

  .motion-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .prostata-grid {
    grid-template-columns: 1fr;
  }
}

/* Tablets & Mobile Screens (< 768px) */
@media (max-width: 767.98px) {
  /* Navigation switch */
  .nav-menu,
  .nav-actions .btn-secondary {
    display: none !important;
  }

  .hamburger-btn {
    display: flex !important;
    min-width: 44px;
    min-height: 44px;
  }

  /* Section Spacings */
  .section {
    padding-top: 3.5rem;
    padding-bottom: 3.5rem;
  }

  /* All CSS Grids Collapse to 1fr on Mobile */
  .kropp-grid,
  .prostata-grid,
  .data-panels-grid,
  .somn-grid,
  .motion-grid,
  .kost-split-grid,
  .kost-pillars-grid,
  .articles-preview-grid,
  .footer-top-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  /* Hero Section Single Column */
  .hero-section {
    min-height: auto;
    padding-top: 2rem;
    padding-bottom: 3.5rem;
  }

  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 2.5rem;
  }

  .hero-title {
    font-size: clamp(1.75rem, 6vw, 2.75rem);
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.15;
  }

  .hero-subtitle {
    font-size: 1.05rem;
    line-height: 1.6;
  }

  .hero-image-wrapper {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
  }

  .hero-overlay-card {
    position: absolute;
    right: 12px;
    bottom: 12px;
    left: auto;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
  }

  /* Circadian Timeline Swiper */
  .timeline-nav {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    width: 100%;
  }

  .timeline-nav::-webkit-scrollbar {
    display: none;
  }

  .timeline-step-btn {
    flex: 0 0 auto;
    flex-shrink: 0;
    scroll-snap-align: start;
    min-width: 90px;
    min-height: 48px;
    padding: 0.85rem 0.75rem;
    box-sizing: border-box;
  }

  .timeline-detail-content {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  .timeline-detail-box {
    padding: 1.5rem 1.25rem;
  }

  /* Section Header column without inline flex */
  .articles-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .articles-section-header .btn {
    align-self: flex-start;
  }
}

/* Compact Screens (<= 640px) */
@media (max-width: 640px) {
  :root {
    --header-height: 66px;
  }

  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .motion-card {
    height: 280px;
  }

  .footer-bottom-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .footer-legal-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    width: 100%;
  }

  .footer-legal-links .footer-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    width: 100%;
    padding: 0.25rem 0;
  }

  .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Mobile Devices (<= 480px) */
@media (max-width: 480px) {
  /* Hero full-width actions & static card */
  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  .hero-actions .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.875rem 1.25rem;
  }

  .hero-overlay-card {
    position: static;
    margin-top: 1rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    left: auto;
    bottom: auto;
    right: auto;
  }

  /* Cookie Consent Banner Mobile Layout */
  #cookie-consent-banner,
  .cookie-banner {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    max-width: 100% !important;
    width: auto !important;
    flex-direction: column !important;
    padding: 1rem !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    gap: 0.85rem !important;
  }

  .cookie-banner-actions {
    width: 100%;
  }

  #accept-cookies-btn,
  .cookie-banner-btn {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  /* Mobile Drawer full width on <= 480px */
  .mobile-drawer {
    max-width: 100%;
  }
}

/* Small / Compact Mobile Screens (<= 375px e.g. iPhone SE, 320px) */
@media (max-width: 375px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero-title {
    font-size: clamp(1.5rem, 5.5vw, 1.95rem);
  }

  .section-title {
    font-size: clamp(1.35rem, 5vw, 1.75rem);
    word-break: break-word;
  }

  .brand-logo-main {
    font-size: 0.95rem;
  }

  .brand-logo-sub {
    font-size: 0.62rem;
    letter-spacing: 0.12em;
  }

  .data-panel {
    padding: 1.25rem 1rem;
  }

  .kropp-card {
    padding: 1.25rem 1rem;
  }

  .somn-card {
    padding: 1.25rem 1rem;
  }

  .timeline-detail-box {
    padding: 1.25rem 1rem;
  }

  .timeline-step-btn {
    min-width: 82px;
    padding: 0.75rem 0.5rem;
  }

  .mag-card-body {
    padding: 1.15rem 1rem;
  }
}
