/* Social Radar v2 — Responsive */

/* ============================================================
   Tablet Breakpoint (1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .search-box input {
    width: 16vw;
    min-width: 140px;
    max-width: 220px;
  }

  .capsule-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .capsule-btn {
    font-size: 0.9rem;
    padding: 5px 8px;
  }

  .header-bar {
    gap: 12px;
    padding: 0 14px;
  }

  .header-right {
    gap: 10px;
  }

  .navbar-nav a {
    font-size: 0.9rem;
  }

  /* Transparency: hero 2-col on tablet */
  .tp-hero {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   Mobile Breakpoint (768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Graph meta bar */
  .graph-meta {
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    font-size: 0.7rem;
  }

  /* Header */
  .header-bar {
    padding: 0 10px;
    padding-top: env(safe-area-inset-top);
    height: auto;
    min-height: 48px;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
  }

  .header-left {
    flex-shrink: 0;
  }

  .navbar-brand {
    font-size: 0.95rem;
  }

  .brand-logo {
    height: 40px;
  }

  /* Search: collapse to icon */
  .search-box {
    display: none;
  }

  .search-box.mobile-open {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 8px 12px;
    background: var(--color-navbar);
    z-index: 150;
    align-items: center;
  }

  .search-box.mobile-open input {
    width: 100%;
    max-width: none;
    min-width: unset;
    height: 40px;
    font-size: 1rem;
  }

  .search-box.mobile-open .search-close-btn {
    display: flex;
  }

  .search-toggle-btn {
    display: flex;
  }

  /* Category chips horizontal scroll */
  .header-center {
    flex: 1;
    overflow: hidden;
  }

  .capsule-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent);
  }

  .capsule-btn {
    font-size: 0.85rem;
    min-height: 44px;
    padding: 4px 8px;
  }

  /* Right section: hide content, show hamburger */
  .header-right {
    flex: unset;
    border-left: none;
    padding-left: 0;
    position: relative;
  }

  .header-right-content {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 120;
    min-width: 200px;
    flex-direction: column;
    gap: 12px;
  }

  .header-right-content.mobile-open {
    display: flex;
  }

  .header-right-content .navbar-nav {
    flex-direction: column;
    gap: 4px;
  }

  .header-right-content .navbar-nav a {
    font-size: 0.95rem;
    padding: 8px 4px;
    display: block;
  }

  .header-right-content .spotlight-chips {
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
  }

  .header-right-content .spotlight-chip {
    min-height: 44px;
    font-size: 0.85rem;
  }

  .hamburger-btn {
    display: flex;
  }

  /* Layout: graph full width on mobile */
  .layout-container {
    flex-direction: column;
    height: auto;
    overflow: auto;
    flex: 1;
  }

  .layout-main {
    min-height: 60vh;
    flex: 1;
  }

  .graph-legend {
    bottom: 8px;
    left: 8px;
    font-size: 0.65rem;
    gap: 8px;
    padding: 4px 8px;
  }


  #graph-container {
    min-height: 300px;
  }

  /* Detail drawer → bottom sheet */
  .detail-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 75vh;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-top: 1px solid var(--color-border);
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .detail-drawer.open {
    transform: translateY(0);
  }

  .drawer-drag-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
    cursor: grab;
    flex-shrink: 0;
  }

  .edge-detail-card {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

  /* Secondary page responsive */
  .sources-page,
  .transparency-page,
  .devlog-page {
    padding: 16px;
  }

  /* Transparency page responsive */
  .tp-content {
    padding: 20px 16px 32px;
  }

  .tp-hero {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .tp-hero-value {
    font-size: 1.4rem;
  }

  .tp-status-text {
    font-size: 1.2rem;
  }

  /* Pipeline: stack vertically */
  .tp-pipeline-split {
    flex-direction: column;
  }

  .tp-pipeline-list {
    flex: none;
  }

  .tp-pipeline-detail-wrap {
    flex: none;
  }

  .tp-pipeline-detail {
    padding: 24px 20px;
  }

  .tp-pipe-item.active::after {
    display: none;
  }

  .tp-pipe-item {
    padding: 16px;
  }

  .tp-pipe-right {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }

  .tp-pipe-kpi-num {
    font-size: 1.2rem;
  }

  /* Sources: single column */
  .source-lists {
    grid-template-columns: 1fr;
  }

  /* Methods: stack vertically */
  .tp-method-split {
    grid-template-columns: 1fr;
  }

  .tp-method-detail {
    min-height: auto;
  }

  .tp-method-chevron {
    transform: rotate(90deg);
  }

  .tp-method-card.active .tp-method-chevron {
    transform: rotate(90deg);
  }

  /* Quality badges wrap */
  .tp-tier-badges {
    gap: 10px;
  }

  .tp-badge {
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  .tp-callout {
    flex-direction: column;
    gap: 10px;
  }

  /* Devlog page responsive */
  .dl-content {
    padding: 20px 16px 32px;
  }

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

  .dl-stat-card {
    padding: 20px 12px;
  }

  .dl-stat-value {
    font-size: 1.4rem;
  }

  .dl-stat-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
  }

  .dl-roadmap-phases {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .dl-phase-arrow {
    display: none;
  }

  .dl-phase-card {
    min-width: 100px;
    padding: 12px 14px;
  }

  .dl-phase-card.dl-phase-current {
    transform: scale(1);
  }

  /* Developer card stacks vertically */
  .dl-dev-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 20px;
    gap: 16px;
  }

  .dl-dev-avatar-img {
    width: 72px;
    height: 72px;
  }

  /* Contact links single column */
  .dl-contact-grid {
    grid-template-columns: 1fr;
  }

  /* Footer responsive */
  .footer {
    gap: 8px;
    padding: 10px 12px;
  }

  .quick-start {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .info-tip-dialog {
    min-width: 260px;
    max-width: calc(100vw - 32px);
    left: auto;
    right: 0;
    transform: none;
    position: fixed;
    top: auto;
    bottom: 16px;
    margin: 0 16px;
  }
}

@media (max-width: 480px) {
  .navbar-brand span:last-child {
    display: none;
  }

  /* Hero cards single column on small screens */
  .tp-hero {
    grid-template-columns: 1fr;
  }
}
