/* =============================================================================
   Ember & Spice — Responsive System (mobile-first enhancements)
   Breakpoints: 480px (sm) | 640px (md) | 768px (lg) | 1024px (xl)
   ============================================================================= */

/* --- Global overflow & safe areas --- */
html {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  max-width: 100vw;
}

.site-header {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.cart-bar,
.cookie-banner {
  padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.cart-panel {
  padding-bottom: max(var(--space-xl), env(safe-area-inset-bottom));
  max-height: 90dvh;
  max-height: 90vh;
}

/* Grid/flex children won't blow out containers */
.grid-2, .grid-3, .grid-4, .grid-6,
.menu-grid, .deals-grid, .gallery-grid,
.story-section, .featured-slide,
.contact-layout, .reservation-layout {
  min-width: 0;
}

/* --- Utility classes --- */
.btn-block { width: 100%; }

.form-narrow {
  max-width: 500px;
  margin: 0 auto;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.map-embed {
  width: 100%;
  height: 400px;
  border: none;
  border-radius: var(--radius-lg);
}

.section-alt { background: var(--bg-secondary); }

.text-sm { font-size: 0.9rem; }
.text-xs { font-size: 0.85rem; }
.mt-md { margin-top: var(--space-md); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.footer-minimal { border: none; padding: var(--space-xl) 0; }
.video-constrained { max-width: 900px; margin: 0 auto; }
.gallery-videos-section { margin-top: var(--space-3xl); }
.map-overview { margin-top: var(--space-2xl); text-align: center; }
.discount-banner-text { margin: 0; color: rgba(255, 255, 255, 0.8); }
.alert-spaced { margin-bottom: var(--space-2xl); }
.form-spaced { margin-top: var(--space-lg); }
.is-hidden { display: none !important; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--space-container));
  padding: 0 var(--space-container);
  position: relative;
}

.table-scroll::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to left, var(--bg-primary), transparent);
  pointer-events: none;
}

.table-scroll .menu-table {
  min-width: 480px;
  margin-bottom: 0;
}

/* --- Spacing tokens (tablet & mobile) --- */
@media (max-width: 768px) {
  :root {
    --space-section: var(--space-2xl);
    --space-container: var(--space-md);
    --header-height: var(--header-height-mobile);
    --chrome-height: calc(var(--marquee-height) + var(--header-height-mobile));
  }

  .section { padding: var(--space-section) 0; }
  .container { padding: 0 var(--space-container); }

  .logo {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
  }

  .hamburger {
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    display: flex !important;
  }

  .story-section {
    gap: var(--space-xl);
  }

  .story-image,
  .featured-slide-image,
  .deal-card-image,
  .cuisine-card {
    width: 100%;
    max-width: 100%;
  }

  .featured-slide {
    gap: var(--space-lg);
  }

  .mobile-nav-overlay {
    padding-top: env(safe-area-inset-top);
  }

  .mobile-nav-overlay a {
    font-size: clamp(1.5rem, 5vw, 1.75rem);
  }

  .page-hero {
    height: 40vh;
    min-height: 280px;
  }

  .page-hero-content h1 {
    font-size: clamp(1.75rem, 8vw, 3rem);
    letter-spacing: 0.05em;
    word-break: break-word;
  }

  .hero {
    height: 100vh;
    height: 100dvh;
    min-height: 500px;
  }

  .hero-content h1 {
    font-size: clamp(1.75rem, 7vw, 4.5rem);
    letter-spacing: clamp(0.05em, 2vw, 0.15em);
    word-break: break-word;
  }

  .hero-content .subheadline {
    font-size: clamp(0.9rem, 3.5vw, 1.25rem);
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
  }

  .text-urdu {
    font-size: clamp(1rem, 4vw, 1.5rem);
  }

  .section-label {
    letter-spacing: 0.15em;
  }

  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding: 0.625rem 1rem; }
  .cart-qty-btn { width: 44px; height: 44px; }
  .modal-close { width: 44px; height: 44px; }

  .carousel-dot {
    width: 10px;
    height: 10px;
    padding: 12px;
    background-clip: content-box;
    box-sizing: content-box;
  }

  .site-footer {
    padding: var(--space-2xl) 0 var(--space-lg);
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-social a {
    width: 44px;
    height: 44px;
  }

  .discount-banner {
    flex-direction: column;
    text-align: center;
  }

  .discount-banner .btn { width: 100%; }

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

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

  .menu-item-image {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 4 / 3;
    min-height: clamp(150px, 40vw, 180px);
    max-height: 220px;
    overflow: hidden;
  }

  .menu-item-image img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
  }

  .section:has(.timeline) .container {
    overflow-x: hidden;
  }
  .menu-item-footer .btn { width: 100%; }

  .menu-controls .branch-toggle {
    flex-direction: column;
    width: 100%;
  }

  .menu-controls .branch-toggle .cart-toggle-btn {
    flex: 1;
  }

  .menu-categories {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .menu-cat-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .cart-toggle-group {
    flex-wrap: wrap;
  }

  .cart-toggle-btn {
    min-height: 44px;
  }

  #whatsappOrder {
    width: 100%;
    min-height: 48px;
  }

  .deal-card-body {
    padding: var(--space-md);
  }

  .deal-card-body .btn { width: 100%; }

  .deal-card-image {
    max-height: 200px;
  }

  .deal-price { font-size: 1.25rem; }

  /* Carousel — constrain slides to viewport width */
  .carousel {
    width: 100%;
    max-width: 100%;
  }

  .carousel-slide {
    padding: 0 var(--space-xs);
  }

  .featured-slide {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    width: 100%;
  }

  .featured-slide-image {
    aspect-ratio: 16 / 10;
    max-height: 220px;
  }

  .featured-slide-content {
    text-align: center;
    padding: 0 var(--space-xs);
  }

  .featured-slide-content h3 {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
  }

  .featured-slide-content .btn {
    width: 100%;
  }

  /* Deals — vertical stack, no horizontal scroll */
  .deals-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    overflow: visible;
  }

  .deals-strip .deal-card--preview {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  /* Testimonials */
  .testimonial-card {
    padding: var(--space-lg) var(--space-md);
    max-width: 100%;
  }

  .testimonial-text {
    font-size: clamp(0.95rem, 3.8vw, 1.2rem);
    line-height: 1.7;
    padding: 0;
  }

  .testimonial-stars {
    font-size: 1rem;
    letter-spacing: 2px;
  }

  .carousel-nav {
    gap: var(--space-md);
    margin-top: var(--space-lg);
  }

  /* From Our Kitchen — insta grid */
  .kitchen-grid,
  .grid-6.kitchen-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
    width: 100%;
    max-width: 100%;
  }

  .insta-grid-item {
    width: 100%;
    min-width: 0;
    aspect-ratio: 1;
  }

  .insta-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Homepage — cuisine cards */
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-md);
  }

  .cuisine-card {
    aspect-ratio: 4 / 5;
    max-height: 320px;
  }

  /* Homepage — story & video */
  .story-section {
    gap: var(--space-xl);
  }

  .story-image {
    aspect-ratio: 16 / 10;
    max-height: 360px;
  }

  .story-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .video-section {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
  }

  /* Homepage — location cards */
  .location-preview-card img {
    aspect-ratio: 16 / 10;
    height: auto;
  }

  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-lg);
  }

  .press-logos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
    margin: var(--space-xl) auto;
    padding: 0 var(--space-xs);
    max-width: 100%;
  }

  .press-logo {
    font-size: clamp(0.8rem, 3.5vw, 0.95rem);
    padding: var(--space-sm);
  }

  .alert { font-size: 0.85rem; padding: var(--space-sm) var(--space-md); }

  .video-play-btn {
    width: 64px;
    height: 64px;
  }

  .video-play-btn svg {
    width: 28px;
    height: 28px;
  }

  .location-actions {
    flex-direction: column;
  }

  .location-actions .btn { width: 100%; }

  .location-map-embed,
  .map-embed {
    height: 250px;
  }

  body.cart-panel-open .cookie-banner {
    display: none;
  }

  .reservation-form-panel {
    padding: var(--space-lg);
  }

  .reservation-image { height: 220px; }

  .form-row-2 {
    grid-template-columns: 1fr;
  }

  .accordion-trigger {
    font-size: 1rem;
  }

  .team-card img {
    width: 150px;
    height: 150px;
  }

  .timeline {
    padding-left: var(--space-lg);
    padding-right: var(--space-sm);
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .timeline::before {
    left: 0;
  }

  .timeline-item {
    padding-bottom: var(--space-xl);
  }

  .timeline-item::before {
    left: -5px;
  }

  .timeline-year {
    font-size: 1.25rem;
  }

  .timeline-content h4 {
    font-size: 1rem;
    line-height: 1.35;
  }

  .timeline-content p {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  #desserts .menu-item-image {
    min-height: clamp(160px, 42vw, 200px);
    max-height: 220px;
  }

  .gallery-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: var(--space-sm);
  }

  .gallery-filter-btn {
    flex-shrink: 0;
    scroll-snap-align: start;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .lightbox-image {
    max-width: 95vw;
    max-height: 75dvh;
    max-height: 75vh;
  }

  .lightbox-close {
    top: max(var(--space-lg), env(safe-area-inset-top));
  }

  .lightbox-nav {
    font-size: 2rem;
    min-width: 48px;
    min-height: 48px;
  }

  .modal {
    max-width: 95vw;
  }

  .modal-content {
    padding: var(--space-lg);
  }

  .modal-actions .btn { width: 100%; }

  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

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

  .promo-toast {
    left: var(--space-md);
    right: var(--space-md);
    max-width: none;
    bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  }

  body.cart-bar-visible .promo-toast {
    bottom: calc(var(--cart-bar-height) + var(--space-md) + env(safe-area-inset-bottom));
  }

  .back-to-top {
    width: 44px;
    height: 44px;
    bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  }

  body.cart-bar-visible .back-to-top {
    bottom: calc(var(--cart-bar-height) + var(--space-md) + env(safe-area-inset-bottom));
  }

  body.cart-panel-open .back-to-top,
  body.cart-panel-open .promo-toast {
    display: none;
  }

  .star-rating button {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .carousel-arrow {
    display: none;
  }
}

@media (max-width: 640px) {
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-md);
  }

  .cuisine-card {
    aspect-ratio: 16 / 10;
    max-height: 280px;
  }
}

@media (max-width: 480px) {
  :root {
    --space-section: var(--space-xl);
    --space-container: var(--space-md);
  }

  .marquee-content {
    font-size: 0.65rem;
    gap: var(--space-md);
    padding: 0 var(--space-md);
  }

  .hero-ctas {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }

  .hero-ctas .btn { width: 100%; }

  .cuisine-card {
    aspect-ratio: 16 / 10;
    max-height: none;
  }

  .kitchen-grid,
  .grid-6.kitchen-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(6px, 2vw, var(--space-sm));
  }

  .insta-grid-item {
    border-radius: var(--radius-md);
    aspect-ratio: 1;
  }

  .story-image {
    aspect-ratio: 16 / 9;
    max-height: none;
  }

  .featured-slide-image {
    max-height: 240px;
    aspect-ratio: 16 / 10;
  }

  .deal-card-image {
    max-height: 180px;
    aspect-ratio: 16 / 10;
  }

  .location-preview-card img {
    aspect-ratio: 16 / 9;
  }

  .press-logos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
    margin: var(--space-xl) auto;
    padding: 0 var(--space-xs);
  }

  .press-logo {
    font-size: clamp(0.8rem, 3.5vw, 0.95rem);
    padding: var(--space-sm);
  }

  .stats-grid {
    gap: var(--space-md);
  }

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

  .deals-grid,
  .menu-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Landscape phones --- */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: 100dvh;
    min-height: 100vh;
  }

  .hero-content h1 {
    font-size: 1.5rem;
  }

  .scroll-indicator {
    display: none;
  }

  .page-hero {
    min-height: 200px;
    height: 35vh;
  }

  .mobile-nav-overlay {
    gap: var(--space-md);
  }

  .mobile-nav-overlay a {
    font-size: 1.25rem;
  }
}

/* --- Tablet / laptop homepage images --- */
@media (min-width: 769px) and (max-width: 1023px) {
  .kitchen-grid,
  .grid-6.kitchen-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-md);
  }

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

  .cuisine-card {
    aspect-ratio: 3 / 4;
    max-height: 360px;
  }

  .story-image {
    aspect-ratio: 4 / 5;
    max-height: 480px;
  }

  .featured-slide-image {
    max-height: 320px;
  }

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

  .menu-item-image {
    aspect-ratio: 4 / 3;
    min-height: 170px;
    max-height: 200px;
  }
}

/* --- Desktop homepage images --- */
@media (min-width: 1024px) {
  .kitchen-grid,
  .grid-6.kitchen-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-md);
  }

  .cuisine-card {
    aspect-ratio: 3 / 4;
    max-height: none;
  }

  .story-image {
    aspect-ratio: 4 / 5;
    max-height: none;
  }
}

@media (min-width: 1200px) {
  .kitchen-grid,
  .grid-6.kitchen-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--space-sm);
  }

  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* --- Tablet --- */
@media (min-width: 768px) and (max-width: 1024px) {
  .deals-grid,
  .menu-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
