/* =============================================================
   Vybe Space — Mobile Consistency Utilities  (mobile.css)
   Sprint 2: Phase 0B design system foundation.
   Additive-only. Responsive helpers using --vs-* tokens.
   ============================================================= */

/* ── Touch target minimum size ────────────────────────────── */

.vs-touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Responsive grid overrides ────────────────────────────── */

@media (max-width: 600px) {
    .vs-grid-2,
    .vs-grid-3 {
        grid-template-columns: 1fr;
    }

    .vs-container {
        padding-inline: var(--vs-space-3);
    }

    .vs-card {
        padding: var(--vs-space-4);
        border-radius: var(--vs-radius-md);
    }

    .vs-row {
        flex-wrap: wrap;
    }

    /* Stack horizontally-aligned rows vertically on small screens */
    .vs-row-stack-mobile {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Hide/show helpers ────────────────────────────────────── */

@media (max-width: 600px) {
    .vs-hide-mobile { display: none !important; }
}
@media (min-width: 601px) {
    .vs-hide-desktop { display: none !important; }
}

/* ── Safe-area insets for notched devices ─────────────────── */

.vs-safe-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.vs-safe-top {
    padding-top: env(safe-area-inset-top, 0px);
}

/* ── Scroll snap for carousels ────────────────────────────── */

.vs-snap-x {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: var(--vs-space-4);
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.vs-snap-x::-webkit-scrollbar { display: none; }

.vs-snap-item {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* Sprint 17 mobile polish for scrapbook + freeform decor */
@media (max-width: 430px) {
    .ms-freeform-toolbar .ms-btn,
    .ms-freeform-actions .ms-btn,
    .cozy-feed-tab,
    .cozy-btn,
    .ms-btn {
        min-height: 44px;
    }

    .ms-freeform-toolbar,
    .ms-freeform-actions {
        gap: 0.4rem;
    }

    .cozy-atmosphere-strip {
        padding: 0.8rem;
    }
}

@media (max-width: 395px) {
    .cozy-feed-tabs {
        gap: 0.35rem;
    }

    .cozy-feed-tab {
        padding: 0.45rem 0.7rem;
        font-size: 0.82rem;
    }

    .ms-profile-decor-stage {
        min-height: 260px;
    }
}

/* Sprint 18 — Mobile immersion polish and touch optimizations */

/* Enhanced touch targets for micro-interactions */
.cozy-react-btn,
.cozy-post-comment-link,
.cozy-post-detail-link,
.ms-btn,
.ms-freeform-toolbar .ms-btn {
  min-height: 48px;
  min-width: 48px;
  touch-action: manipulation;
}

/* Smoother mobile scrolling */
.cozy-feed-list,
.cozy-atmosphere-strip__grid,
.cozy-friends-rail {
  -webkit-overflow-scrolling: touch;
}

/* Mobile animation optimization */
@media (max-width: 430px) {
  .ms-decor-node--fresh {
    animation-duration: 0.25s;
  }
  
  .cozy-scrap-card {
    animation-duration: 0.4s;
  }
  
  .memoryCardIn {
    animation-duration: 0.35s;
  }
}

/* Reduce animation on lower-spec devices */
@media (max-width: 380px) {
  .ms-room-builder::before,
  .ms-public-room-canvas::before,
  .ms-room-spotlight-card::after,
  .ms-room-note {
    animation-duration: 10s;
  }
  
  /* Disable pulsing on very small screens */
  .cozy-scrap-card--room_snapshot,
  .cozy-scrap-card--memory_moment {
    animation: none;
  }
}

/* Touch feedback for drag operations */
@media (hover: none) and (pointer: coarse) {
  .ms-decor-node {
    touch-action: none;
  }
  
  .ms-decor-node:active {
    background: rgba(255, 255, 255, 0.08);
  }
  
  .cozy-react-btn:active,
  .cozy-post-comment-link:active {
    transform: scale(0.96);
  }
}


/* Sprint 19 — Mobile Social Comfort Optimization */

@media (max-width: 430px) {
  .cozy-gentle-reactions {
    gap: 0.25rem;
  }

  .cozy-gentle-react-btn {
    width: 40px;
    height: 40px;
    min-height: 40px;
    font-size: 1rem;
  }

  .ms-room-appreciate-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .cozy-post-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Nostalgia cards on mobile */
  .cozy-nostalgia-card {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: 0.5rem;
    padding: 0.85rem;
  }

  .cozy-nostalgia-card__header {
    font-size: 0.8rem;
  }

  .cozy-nostalgia-card__content {
    font-size: 0.85rem;
  }
}

@media (max-width: 395px) {
  .cozy-gentle-react-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
    font-size: 0.95rem;
  }

  .ms-room-appreciate-btn {
    width: 32px;
    height: 32px;
  }

  .ms-room-appreciate-actions {
    gap: 0.25rem;
    padding: 0.35rem 0;
  }
}

@media (hover: none) and (pointer: coarse) {
  /* Touch-optimized gentle reactions */
  .cozy-gentle-react-btn {
    min-height: 44px;
    min-width: 44px;
  }

  .ms-room-appreciate-btn {
    min-height: 40px;
    min-width: 40px;
  }

  .cozy-gentle-react-btn:active,
  .ms-room-appreciate-btn:active {
    transform: scale(0.92);
  }
}

/* ── Sprint 20 — Mobile Room Experience ──────────────────────────────────── */

@media (max-width: 768px) {
  .cozy-customize-grid {
    grid-template-columns: 1fr;
  }

  .cozy-customize-sidebar {
    position: static;
    order: -1;
  }

  .room-fullscreen-stage {
    border-radius: 1rem;
    padding: 1rem;
    margin-top: 3.5rem;
  }

  .room-fullscreen-header {
    padding: 0.75rem 1rem;
  }

  .room-fullscreen-title {
    font-size: 0.95rem;
  }

  .room-fullscreen-exit {
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
  }

  .room-scrapbook-wall {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

@media (max-width: 430px) {
  .cozy-section__toggle {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
  }

  .cozy-section__inner {
    padding: 0 1rem 1rem;
  }

  .room-fullscreen-content {
    padding: 1rem;
  }

  .room-fullscreen-stage {
    min-height: 280px;
    padding: 0.85rem;
  }

  .room-fullscreen-memory-wall {
    bottom: 0.75rem;
    left: 1rem;
    right: 1rem;
  }

  .room-fullscreen-memory-note {
    max-width: 160px;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
  }

  .room-social-traces {
    bottom: 0.85rem;
    right: 0.85rem;
  }

  .room-vibe-pulse {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }
}

@media (max-width: 395px) {
  .cozy-page-header__title {
    font-size: 1.2rem;
  }

  .cozy-section__subtitle {
    display: none;
  }

  .room-fullscreen-stage {
    min-height: 240px;
    margin-top: 3rem;
  }
}

/* Touch drag comfort for fullscreen room */
@media (hover: none) and (pointer: coarse) {
  .room-fullscreen-decor-node {
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .cozy-section__toggle {
    min-height: 52px;
  }
}
