/* ===== Desktop: >= 1280px ===== */
@media (min-width: 1280px) {
  .desktop-only { display: block; }
  .mobile-only { display: none; }
  .tablet-only { display: none; }
}

/* ===== Tablet: 769px - 1279px ===== */
@media (min-width: 769px) and (max-width: 1279px) {
  .desktop-only { display: none; }
  .tablet-only { display: block; }
  .mobile-only { display: none; }
  
  /* Sidebar adjustments */
  #main-grid {
    padding: 0 1.25rem;
  }
  
  /* Post card grid: 2 columns max */
  .post-list-container[data-layout="grid"] .post-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* ===== Mobile: <= 768px ===== */
@media (max-width: 768px) {
  .desktop-only, .tablet-only { display: none; }
  .mobile-only { display: block; }
  
  html { font-size: 15px; }
  
  #main-grid {
    grid-template-columns: 1fr !important;
    padding: 0 0.75rem;
    gap: 0.75rem;
  }
  
  /* Hide sidebars on mobile */
  .sidebar-left, .sidebar-right { display: none !important; }
  
  /* Show mobile bottom sidebar */
  .mobile-bottom-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 2rem 0 1.5rem;
    grid-column: 1 / -1;
  }
  
  /* Banner adjustments */
  .home-text-title { font-size: clamp(2.2rem, 6vw, 3.2rem) !important; }
  .home-text-subtitle { font-size: clamp(0.95rem, 3vw, 1.2rem) !important; }
  
  /* Post card: single column */
  .post-card-item {
    grid-template-columns: 1fr !important;
  }
  .post-card-cover {
    max-height: 200px;
  }
  
  /* Navbar mobile */
  #navbar-wrapper {
    z-index: 50 !important;
  }
  #navbar > div { padding: 0 0.625rem; margin: 0 0.25rem; }
  
  /* Display settings panel — centered popup overlay */
  .display-settings-panel {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%);
    width: min(85vw, 340px);
    max-height: 80vh;
    border-radius: var(--md-shape-corner-large) !important;
    z-index: 70;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  }
  .display-settings-panel.closed {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    visibility: hidden;
  }
  /* Settings backdrop overlay */
  .settings-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 65;
  }
  .settings-backdrop.open { display: block; }
  
  /* Search panel */
  .search-panel {
    width: 95%;
  }
  
  /* Post navigation: stacked */
  .post-navigation {
    grid-template-columns: 1fr;
  }
  .post-navigation a.next { grid-column: 1; }
  
  /* Pagination */
  .pagination { font-size: 0.875rem; }
}

/* ===== Small mobile: <= 480px ===== */
@media (max-width: 480px) {
  html { font-size: 15px; }
  
  .home-text-title { font-size: clamp(1.8rem, 7vw, 2.5rem) !important; }
  .home-text-subtitle { font-size: clamp(0.85rem, 3.5vw, 1.1rem) !important; }
  
  .post-list-container[data-layout="grid"] .post-list {
    grid-template-columns: 1fr;
  }
  
  .display-settings-panel {
    width: min(90vw, 320px);
    max-height: 85vh;
  }
}

/* ===== Mobile Widget Styles ===== */
@media (max-width: 768px) {
  /* Mobile bottom sidebar container */
  .mobile-bottom-sidebar .widget {
    margin-bottom: 0;
    border-radius: var(--radius-large);
  }

  /* Profile widget: compact horizontal layout */
  .mobile-bottom-sidebar .profile-widget {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
    padding: 1rem;
  }
  .mobile-bottom-sidebar .profile-widget .widget-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
  }
  .mobile-bottom-sidebar .profile-avatar {
    width: 4rem;
    height: 4rem;
    min-width: 4rem;
    margin: 0;
    flex-shrink: 0;
  }
  .mobile-bottom-sidebar .profile-info {
    flex: 1;
    min-width: 0;
  }
  .mobile-bottom-sidebar .profile-name {
    font-size: 1rem;
    margin-bottom: 0.125rem;
  }
  .mobile-bottom-sidebar .profile-bio {
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
  }
  .mobile-bottom-sidebar .profile-social {
    justify-content: flex-start;
    gap: 0.5rem;
  }
  .mobile-bottom-sidebar .profile-social-link {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }

  /* Tags widget: tighter spacing */
  .mobile-bottom-sidebar .tags-widget .tag-item {
    padding: 0.3rem 0.6rem;
    margin: 0.2rem;
    font-size: 0.75rem;
  }

  /* Stats widget: compact */
  .mobile-bottom-sidebar .stats-widget .stat-item {
    padding: 0.4rem 0;
    font-size: 0.8125rem;
  }
}
