/* ========================================================================== 
   MARSA Mobile Styles
   Dedicated phone and tablet overrides (RTL, touch-first, 320px -> 992px)
   Load this file after style.css, components.css, and responsive.css.
   ========================================================================== */

@media (max-width: 992px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    width: 100%;
    min-width: 0;
    overflow-x: clip;
    background-attachment: scroll;
  }

  img,
  svg,
  video,
  canvas,
  iframe {
    max-width: 100%;
  }

  /* Prevent long Arabic/English strings and grid min-content from widening pages. */
  .container,
  main,
  section,
  form,
  .res-grid,
  .order-grid,
  .contact-grid,
  .features-grid,
  #menuGridContainer,
  .calc-card,
  .branch-card,
  .order-box,
  .dish-card,
  .modal-box,
  .cart-drawer,
  [style*="display: grid"] {
    min-width: 0;
  }

  .container > *,
  main * ,
  .footer-grid > * {
    min-width: 0;
  }

  h1,
  h2,
  h3,
  h4,
  p,
  strong,
  label,
  .btn,
  .badge,
  .payment-text {
    overflow-wrap: anywhere;
  }

  /* Header and off-canvas navigation */
  .site-header {
    padding: 0 !important;
  }

  .nav-inner,
  .site-header.scrolled .nav-inner {
    height: 72px;
    gap: 0.75rem;
  }

  .brand-logo {
    min-width: 0;
    flex: 0 1 auto;
  }

  .brand-logo img,
  .brand-logo svg {
    width: clamp(112px, 24vw, 150px);
    max-width: 100%;
    height: auto;
  }

  .nav-actions,
  .header-actions {
    min-width: 0;
    flex-shrink: 0;
    gap: 0.55rem;
  }

  .nav-actions > *,
  .header-actions > * {
    flex-shrink: 0;
  }

  .cart-trigger-btn,
  .mobile-toggle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px;
    z-index: 1000;
  }

  .nav-backdrop {
    z-index: 998;
  }

  .nav-menu {
    top: 0;
    right: 0;
    left: auto;
    width: min(86vw, 340px);
    height: 100vh;
    height: 100dvh;
    padding: calc(5.5rem + env(safe-area-inset-top)) 1.25rem
      calc(1.5rem + env(safe-area-inset-bottom));
    transform: none;
    clip-path: inset(0 0 0 100%);
    opacity: 0;
    transition: clip-path 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.32s;
    visibility: hidden;
    pointer-events: none;
    right: 0;
    z-index: 999;
  }

  .nav-menu.active {
    right: 0;
    clip-path: inset(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-link {
    min-height: 48px;
    padding: 0.8rem 1rem;
  }

  /* All page-level grids collapse without retaining desktop min-content widths. */
  .res-grid,
  .order-grid,
  .contact-grid,
  #menuGridContainer,
  .features-grid,
  main [style*="grid-template-columns"],
  section [style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .res-grid > *,
  .order-grid > *,
  .contact-grid > *,
  #menuGridContainer > *,
  main [style*="grid-template-columns"] > *,
  section [style*="grid-template-columns"] > * {
    min-width: 0 !important;
    max-width: 100%;
  }

  /* Disable sticky desktop checkout summary after the layout stacks. */
  .order-grid .order-box[style*="position: sticky"] {
    position: static !important;
    top: auto !important;
  }

  /* Mobile page banners and vertical rhythm */
  body > section:first-of-type:not(.hero-section) {
    padding: 7.25rem 0 2.5rem !important;
  }

  body > section:first-of-type:not(.hero-section) h1 {
    font-size: clamp(1.85rem, 7vw, 2.55rem) !important;
    line-height: 1.3 !important;
  }

  main[style*="padding:"] {
    padding: 2.75rem 0 4rem !important;
  }

  .catch-section,
  .featured-section,
  .quick-reserve-section,
  .experience-section.experience-full-bg {
    padding: 2.75rem 0 !important;
  }

  .section-header {
    margin-bottom: 2rem;
  }

  .section-subtitle {
    letter-spacing: 1px;
  }

  .section-title {
    font-size: clamp(1.55rem, 6vw, 2.1rem) !important;
  }

  /* Hero */
  .hero-section.hero-full-bg {
    min-height: 100svh;
    min-height: 100vh !important;
    padding: 7.25rem 0 3.5rem !important;
    background-position: 58% center;
  }

  .hero-direct-content {
    width: 100%;
  }

  .hero-title {
    font-size: clamp(1.8rem, 7vw, 2.6rem) !important;
  }

  .hero-direct-content p {
    font-size: 1rem !important;
    line-height: 1.75 !important;
  }

  .hero-actions {
    width: min(100%, 340px) !important;
    max-width: none !important;
  }

  .hero-actions .btn,
  .hero-actions .hero-btn {
    min-height: 46px !important;
  }

  .hero-stats {
    max-width: 430px !important;
  }

  /* Fixed-height editorial imagery */
  img[style*="height: 420px"],
  img[style*="height: 380px"],
  img[style*="height: 350px"],
  img[style*="height: 320px"] {
    height: clamp(210px, 58vw, 300px) !important;
  }

  /* Cards, forms and touch controls */
  .branch-card,
  .order-box,
  .calc-card,
  main [style*="padding: 3rem"],
  main [style*="padding: 3.5rem"] {
    padding: 1.5rem !important;
  }

  .form-control,
  input:not([type="radio"]):not([type="checkbox"]),
  select,
  textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: 16px !important;
  }

  input[type="radio"],
  input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    flex: 0 0 20px;
    accent-color: var(--accent-coral);
  }

  .btn,
  button,
  a.social-btn {
    min-height: 44px;
  }

  .btn {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.45;
  }

  /* Keep homepage CTAs compact on phones without sacrificing tap area. */
  .featured-section .btn-lg,
  .experience-section.experience-full-bg .btn-lg,
  .quick-reserve-section .btn-lg {
    width: auto;
    max-width: min(100%, 340px);
    min-height: 48px;
    padding: 0.72rem 1.15rem !important;
    font-size: 0.95rem !important;
    line-height: 1.45;
    gap: 0.55rem;
  }

  .experience-section.experience-full-bg .btn-lg svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
  }

  .payment-option-label,
  .seating-card-label {
    align-items: flex-start;
  }

  .payment-option-label input,
  .seating-card-label input {
    flex: 0 0 auto;
    margin-top: 0.25rem;
  }

  .payment-text,
  .seating-content {
    flex: 1 1 auto;
    min-width: 0;
  }

  .seating-content strong {
    display: block;
    line-height: 1.55;
    margin-bottom: 0.2rem;
  }

  .seating-content > div {
    line-height: 1.55;
  }

  .dish-footer,
  .dish-actions,
  [style*="display: flex"][style*="gap: 1rem"] {
    flex-wrap: wrap;
  }

  .dish-footer > *,
  .dish-actions > * {
    min-width: 0;
  }

  /* Daily catch rows: content and price stack cleanly on narrow screens. */
  .catch-section [style*="justify-content: space-between"] {
    align-items: flex-start !important;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .catch-section [style*="justify-content: space-between"] > :first-child {
    flex: 1 1 210px;
    min-width: 0;
  }

  .catch-section [style*="justify-content: space-between"] > span {
    flex: 0 0 auto;
  }

  /* Drawers, dialogs and notifications */
  .cart-drawer {
    width: min(100%, 440px) !important;
    max-width: 100% !important;
  }

  .cart-header,
  .cart-body,
  .cart-footer {
    padding-inline: clamp(1rem, 5vw, 2rem);
  }

  .modal-overlay {
    padding: 0.75rem;
  }

  .modal-box {
    max-width: 100% !important;
    max-height: calc(100dvh - 1.5rem);
  }

  .toast-container {
    right: 0.75rem;
    left: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }

  .toast {
    width: 100%;
    min-width: 0;
  }

  .floating-whatsapp-btn {
    left: calc(1rem + env(safe-area-inset-left));
    bottom: calc(1rem + env(safe-area-inset-bottom));
    border: 2px solid rgba(255, 255, 255, 0.92);
    isolation: isolate;
  }

  .floating-whatsapp-btn svg {
    display: block;
    width: 27px;
    height: 27px;
  }

  /* Footer */
  .site-footer {
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)) !important;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .footer-brand {
    text-align: start !important;
  }

  .footer-brand > img {
    width: clamp(230px, 62vw, 240px) !important;
    max-width: calc(100vw - 2rem) !important;
    height: auto !important;
    margin-inline: 0 auto !important;
    margin-bottom: 0.75rem !important;
    transform: translateX(clamp(90px, 25vw, 98px));
  }

  .social-btn,
  .site-footer .social-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
  }
}

@media (max-width: 768px) {
  .container {
    padding-inline: clamp(1rem, 4.5vw, 1.25rem);
  }

  .nav-actions > a.btn {
    padding-inline: 0.85rem;
    font-size: 0.88rem;
  }

  .menu-filter-bar {
    margin-inline: calc(-1 * clamp(1rem, 4.5vw, 1.25rem));
    padding-inline: clamp(1rem, 4.5vw, 1.25rem);
    scroll-padding-inline: clamp(1rem, 4.5vw, 1.25rem);
    overscroll-behavior-inline: contain;
  }

  .menu-filter-pair {
    display: flex;
    flex: 1 0 100%;
    gap: 0.5rem;
    min-width: 0;
  }

  .menu-filter-pair .filter-pill-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    padding: 0.55rem 0.65rem;
    white-space: normal;
    line-height: 1.35;
  }

  .features-grid {
    gap: 0.85rem;
  }

  .feature-box {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 0.9rem;
    row-gap: 0.3rem;
    align-items: center;
    padding: 1.1rem 1rem;
    text-align: right;
  }

  .feature-icon-wrap {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 56px;
    height: 56px;
    margin: 0;
    font-size: 1.45rem;
  }

  .feature-title,
  .feature-desc {
    grid-column: 2;
    margin: 0;
  }

  .feature-title {
    font-size: 1.08rem;
    line-height: 1.4;
  }

  .feature-desc {
    font-size: 0.84rem;
    line-height: 1.55;
  }

  .order-submit-btn,
  .reservation-submit-btn,
  .contact-submit-btn {
    width: min(100%, 330px) !important;
    min-height: 48px !important;
    margin-inline: auto !important;
    padding: 0.68rem 1rem !important;
    font-size: 0.94rem !important;
    line-height: 1.45;
  }

  .menu-search-wrapper {
    margin-bottom: 1.25rem;
  }

  .dish-media {
    height: clamp(190px, 58vw, 260px);
  }

  .dish-content,
  .dish-body {
    padding: 1.2rem;
  }

  .branch-card [style*="justify-content: space-between"] {
    gap: 0.65rem 1rem;
    flex-wrap: wrap;
  }

  .branch-card > [style*="display: flex"][style*="gap: 1rem"] > .btn,
  .catch-section [style*="display: flex"][style*="gap: 1rem"] > .btn {
    width: 100%;
    flex: 1 1 100%;
  }

  .calc-card [style*="display: flex"][style*="align-items: center"] {
    align-items: stretch !important;
  }

  .calc-card select.form-control {
    width: 100% !important;
  }

  #orderSuccessScreen {
    padding: 2rem 1.25rem !important;
  }

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

@media (max-width: 480px) {
  .nav-inner,
  .site-header.scrolled .nav-inner {
    height: 66px;
    gap: 0.4rem;
  }

  .brand-logo img,
  .brand-logo svg {
    width: clamp(98px, 34vw, 118px);
  }

  /* The booking CTA remains available inside the menu; hiding it keeps both
     cart and hamburger controls visible on 320-480px phones. */
  .nav-actions > a.btn,
  .header-actions > a.btn {
    display: none !important;
  }

  body > section:first-of-type:not(.hero-section),
  .hero-section.hero-full-bg {
    padding-top: 6.5rem !important;
  }

  .catch-section,
  .featured-section,
  .quick-reserve-section,
  .experience-section.experience-full-bg {
    padding: 2.25rem 0 !important;
  }

  .section-header {
    margin-bottom: 1.5rem;
  }

  .featured-section .btn-lg,
  .experience-section.experience-full-bg .btn-lg,
  .quick-reserve-section .btn-lg {
    max-width: min(100%, 310px);
    min-height: 46px;
    padding: 0.65rem 1rem !important;
    font-size: 0.9rem !important;
  }

  .badge {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .hero-stat-item,
  .hero-stat-item:not(:first-child) {
    min-width: 0;
    padding-inline: 0.25rem !important;
  }

  .hero-stat-num {
    font-size: 1.1rem !important;
  }

  .hero-stat-label {
    font-size: 0.64rem !important;
    overflow-wrap: normal;
  }

  .branch-card,
  .order-box,
  .calc-card,
  main [style*="padding: 3rem"],
  main [style*="padding: 3.5rem"] {
    padding: 1.2rem !important;
  }

  .branch-card [style*="justify-content: space-between"] {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .branch-card [style*="justify-content: space-between"] > span:last-child {
    color: var(--text-primary);
  }

  .order-box-title {
    font-size: 1.15rem;
  }

  .payment-option-label,
  .seating-card-label {
    padding: 0.9rem;
  }

  .seating-card-label {
    width: 100%;
    min-height: 76px;
    gap: 0.75rem;
  }

  #reservationForm .form-group {
    margin-bottom: 1.15rem;
  }

  #reservationForm > .btn-block {
    min-height: 46px;
    padding-inline: 0.9rem;
  }

  .menu-filter-pair .filter-pill-btn {
    min-height: 46px;
    padding: 0.5rem 0.45rem;
    font-size: 0.74rem;
  }

  .order-submit-btn,
  .reservation-submit-btn,
  .contact-submit-btn {
    width: min(100%, 305px) !important;
    min-height: 46px !important;
    padding: 0.62rem 0.85rem !important;
    font-size: 0.88rem !important;
  }

  .res-grid > div:last-child [style*="justify-content: space-between"] {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem;
  }

  .res-grid > div:last-child [style*="justify-content: space-between"] .btn {
    width: 100%;
  }

  .modal-header,
  .modal-body {
    padding-inline: 1rem;
  }

  .modal-body [style*="display: flex"][style*="gap: 1rem"] > .btn {
    width: 100%;
    flex: 1 1 100%;
  }

  .footer-links {
    gap: 0.55rem 0.75rem !important;
  }
}

@media (max-width: 360px) {
  .container {
    padding-inline: 0.875rem;
  }

  .nav-inner {
    gap: 0.25rem;
  }

  .nav-actions,
  .header-actions {
    gap: 0.25rem;
  }

  .cart-trigger-btn,
  .mobile-toggle {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }

  .brand-logo img,
  .brand-logo svg {
    width: 98px;
  }

  .footer-brand > img {
    width: 230px !important;
  }

  .footer-links {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Mobile header brand: enlarge the visible artwork and offset the SVG's
   built-in trailing whitespace without changing the logo proportions. */
@media (max-width: 768px) {
  .site-header .brand-logo {
    flex: 0 0 auto;
    overflow: visible;
  }

  .site-header .brand-logo img,
  .site-header .brand-logo svg {
    width: clamp(185px, 30vw, 210px) !important;
    max-width: none !important;
    height: auto !important;
    transform: translateX(clamp(76px, 12vw, 86px));
  }
}

@media (max-width: 360px) {
  .site-header .brand-logo img,
  .site-header .brand-logo svg {
    width: 180px !important;
    transform: translateX(74px);
  }
}

/* Full-screen mobile navigation: drops down from the top and covers the
   complete viewport, so no side gutter or uncovered strip remains. */
@media (max-width: 992px) {
  .nav-backdrop,
  .nav-backdrop.active {
    display: block !important;
  }

  .nav-menu {
    inset: 0 0 auto 0 !important;
    width: 100vw !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0;
    max-height: 100dvh;
    box-sizing: border-box;
    padding: calc(4.75rem + env(safe-area-inset-top)) clamp(1.25rem, 6vw, 3rem)
      1.25rem !important;
    gap: 0.75rem;
    justify-content: flex-start;
    border: 0 !important;
    border-bottom: 1px solid rgba(212, 175, 55, 0.35) !important;
    border-radius: 0;
    background: linear-gradient(180deg, #071426 0%, #030811 100%);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55) !important;
    clip-path: none !important;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease, visibility 0.38s;
  }

  .nav-menu.active {
    inset: 0 0 auto 0 !important;
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-menu .nav-link {
    width: 100%;
    min-height: 52px;
    padding: 0.9rem 1.1rem;
    font-size: 1.08rem;
  }

  .mobile-menu-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 68px;
    margin: 0 0 0.25rem;
    overflow: hidden;
  }

  .mobile-menu-brand img {
    display: block;
    width: 260px;
    max-width: 82vw;
    height: auto;
    transform: translateX(52px);
  }
}

@media (max-width: 992px) and (orientation: landscape) and (max-height: 520px) {
  .nav-menu {
    padding-top: calc(4.75rem + env(safe-area-inset-top)) !important;
  }

  .hero-section.hero-full-bg {
    min-height: 100svh;
    padding-block: 5.5rem 2rem !important;
  }

  .hero-stats {
    margin-top: 1rem !important;
  }
}

@media (hover: none) and (pointer: coarse) {
  .dish-card:hover,
  .feature-box:hover,
  .experience-direct-feature:hover,
  .branch-card:hover,
  .btn:hover,
  .social-btn:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
