/**
 * La Buca Italian Cafe - Responsive Breakpoints
 * Progressive enhancement from mobile to desktop
 */

/* ==========================================================================
   Mobile Only (max-width: 1023px)
   ========================================================================== */

@media (max-width: 767px) {

/* Mobile-specific layout overrides */
.left-area,
.left.area {
  width: 100% !important;
  max-width: 100vw !important;
  float: none !important;
  overflow-x: hidden !important;
}

#page-header {
  width: 100% !important;
  max-width: 100vw !important;
  position: relative;
  overflow-x: hidden !important;
}

#container {
  width: 100% !important;
  max-width: 100vw !important;
  padding: var(--spacing-md) !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

#content {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Menu tabs - transparent background, tight layout */
.menu-tabs {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

.tabs-scroll-container {
  padding: 0 !important;
  gap: var(--spacing-sm) !important;
}

.tab-panel {
  padding-bottom: calc(var(--action-bar-height) + var(--spacing-lg)) !important;
}

/* Tighter padding on menu pages */
body.menu-page #content {
  padding: var(--spacing-sm) !important;
}

body.menu-page .mainbar.entry-content {
  padding: var(--spacing-sm) !important;
  padding-bottom: 0 !important;
}

body.menu-page .subpage {
  padding: var(--spacing-xs) !important;
  padding-bottom: calc(var(--action-bar-height) + var(--spacing-sm)) !important;
  min-height: calc(100vh - var(--header-height-mobile) - var(--action-bar-height) - 20px) !important;
  box-sizing: border-box !important;
}

body.menu-page .mainpage {
  padding-bottom: 0 !important;
}

body.menu-page #container {
  min-height: calc(100vh - var(--header-height-mobile) - var(--action-bar-height) - 20px) !important;
}

/* Prevent any element from causing horizontal overflow */
.entry-content,
.entry-content * {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.entry-content img,
.entry-content iframe {
  max-width: 100% !important;
  height: auto !important;
}

#page-footer {
  position: static !important;
  width: 100% !important;
  right: auto !important;
  height: auto !important;
  padding: var(--spacing-md);
  text-align: center;
}

/* Hide empty footer on mobile */
#page-footer:empty,
footer:empty {
  display: none !important;
}

/* Mobile navigation - slide out from left, below header */
/* NOTE: Using left positioning instead of transform for Safari iOS compatibility */
/* Safari has a bug where position:fixed + transform causes rendering issues */
nav.mainmenu {
  position: fixed !important;
  top: var(--header-height-mobile);
  left: calc(-1 * var(--nav-width-mobile));  /* Hidden off-screen (Safari-safe, no transform) */
  width: var(--nav-width-mobile);
  max-width: 85vw;
  height: calc(100vh - var(--header-height-mobile));
  height: calc(100dvh - var(--header-height-mobile));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;  /* Smooth momentum scrolling on iOS */
  background: var(--color-dark-bg);
  transition: left 0.3s ease;  /* Animate left instead of transform */
  z-index: calc(var(--z-overlay) + 15);  /* = 915: ABOVE header (910), BELOW hamburger (920) */
  padding-top: 0;
}

/* Current page - gold color with Roman building icon */
nav.mainmenu .current-menu-item,
nav.mainmenu .current_page_item {
  background-color: transparent !important;
}

nav.mainmenu .current-menu-item > a,
nav.mainmenu .current_page_item > a {
  color: #D4A56A !important;
  /* Remove legacy styling from theme's style.css */
  background-image: none !important;
  background-color: transparent !important;
  padding-left: var(--spacing-lg) !important;
}

nav.mainmenu .current-menu-item > a::before,
nav.mainmenu .current_page_item > a::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23D4A56A'%3E%3Cpath d='M12 3L2 9v1h2v9H2v2h20v-2h-2v-9h2V9L12 3zm-4 8v7H6v-7h2zm4 0v7h-2v-7h2zm4 0v7h-2v-7h2z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

nav.mainmenu .menu-item a:hover {
  color: #D4A56A;
}

nav.mainmenu ul {
  padding: 0;
  margin: 0;
  border: none !important;
  box-shadow: none !important;
  background: var(--color-dark-bg) !important;
}

/* Override legacy style.css menu item separations */
nav.mainmenu ul li,
nav.mainmenu ul li.menu-item,
.mainmenu ul li.menu-item {
  border: none !important;
  border-top: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  outline: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: var(--color-dark-bg) !important;
  background-image: none !important;
  filter: none !important;
}

nav.mainmenu ul li::before,
nav.mainmenu ul li::after,
nav.mainmenu .menu-item::before,
nav.mainmenu .menu-item::after {
  display: none !important;
  border: none !important;
}

nav.mainmenu .menu-item,
.mainmenu .menu-item {
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  background: var(--color-dark-bg) !important;
  background-image: none !important;
  margin: 0 !important;
}

nav.mainmenu .menu-item a,
.mainmenu .menu-item a {
  display: flex;
  align-items: center;
  border: none !important;
  box-shadow: none !important;
  padding: 8px var(--spacing-lg);
  min-height: var(--touch-min);
  font-size: 14px;
  font-family: var(--font-fancy);
  text-transform: lowercase;
  background: var(--color-dark-bg) !important;
  background-image: none !important;
  margin: 0 !important;
  text-decoration: none !important;
}

/* Sub-menu on mobile - inline instead of flyout */
nav.mainmenu .sub-menu {
  position: static !important;
  left: auto !important;
  width: 100% !important;
  display: none;
  background: rgba(0, 0, 0, 0.3);
}

nav.mainmenu .menu-item:hover .sub-menu,
nav.mainmenu .menu-item.submenu-open .sub-menu {
  display: block;
}

/* Site info on mobile */
.site-info {
  padding: var(--spacing-md) !important;
  text-align: center;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.site-info .logo {
  margin-bottom: var(--spacing-md);
  text-align: center;
}

.site-info .logo img {
  max-width: 200px;
  height: auto;
}

.site-info .tagline {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  text-align: left;
}

.site-info .contact-info,
.site-info .hours-info {
  max-width: 100%;
  overflow: visible;
}

/* Mobile header bar - always show logo with hamburger */
.site-info {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  height: var(--header-height-mobile);
  padding: 0 var(--spacing-md) !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-overlay) + 10);
  background: #000;
}

/* Mobile: sticky menu tabs should sit below fixed header */
.menu-tabs {
  top: var(--header-height-mobile);
  z-index: var(--z-header);
}

.site-info .logo {
  margin: 0 !important;
  flex-shrink: 0;
}

.site-info .logo img {
  max-height: 40px;
  width: auto;
}

/* Hide tagline/contact/hours on mobile - only show logo */
.site-info .tagline {
  display: none !important;
}

/* Hamburger positioned to right of header, vertically centered */
.mobile-nav-toggle {
  position: fixed;
  top: calc((var(--header-height-mobile) - var(--touch-min)) / 2);
  right: var(--spacing-md);
  z-index: calc(var(--z-overlay) + 20);
}

/* Add top padding to content for fixed header */
.mainpage {
  padding-top: 60px;
}

/* Menu pages - same treatment, logo always visible */
body.menu-page .site-info {
  display: flex !important;
}

body.menu-page .site-info .tagline {
  display: none !important;
}

/* Hide background slider on mobile - only show photo gallery */
.background,
.slider-container {
  display: none !important;
}

/* Main content padding for action bar */
.mainpage {
  padding-bottom: calc(var(--action-bar-height) + var(--safe-area-bottom) + var(--spacing-lg));
}

/* Generic page content rules (applies to all pages, not just menu-page) */
.subpage,
.entry-content.mainbar,
.mainbar.entry-content {
  padding-bottom: calc(var(--action-bar-height) + var(--spacing-sm)) !important;
  min-height: calc(100vh - var(--header-height-mobile) - var(--action-bar-height) - 20px) !important;
  box-sizing: border-box !important;
}

/* Entry content on mobile */
.entry-content {
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
}

.entry-content p {
  margin-bottom: 0 !important;
}

/* Children's menu section break above pasta */
.entry-content .menu-section-heading {
  margin-top: var(--spacing-lg) !important;
}

/* Food gallery labels - subtle gradient like desktop featured dishes */
.gallery-label {
  padding: 20px var(--spacing-xs) 4px !important;
  background: linear-gradient(transparent 0%, transparent 50%, rgba(0, 0, 0, 0.25) 100%) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.5);
}

.entry-content img {
  max-width: 100% !important;
  height: auto;
}

/* Fix gallery grid images to show full resolution (1200x1200 square) */
.gallery-grid .gallery-item {
  aspect-ratio: 1 / 1 !important;
}

.gallery-grid .gallery-item img {
  height: 100% !important;
}

/* Right icons (social) on mobile */
#right-icons {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
}

#right-icons li.icon {
  margin: 0 !important;
}

} /* End mobile-only media query */


/* ==========================================================================
   Mobile Gallery Subtitle (max-width: 768px)
   ========================================================================== */

/* Hide gallery subtitle on desktop by default */
.gallery-subtitle {
  display: none;
}

@media (max-width: 767px) {
  .gallery-subtitle {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-brand-primary, #8B4513);
    font-weight: 500;
    margin: 8px 0 0 0;
    padding: 0;
  }

  .family-icon {
    flex-shrink: 0;
    margin-right: 4px;
    width: 12px;
    height: 12px;
    color: #d30000;
  }

  /* Tighten spacing for gallery titles */
  .gallery-title {
    padding: 0 var(--spacing-xs) 0 !important;
    margin-bottom: 2px !important;
  }

  /* Tighten spacing for buttons */
  .home-menu-actions {
    margin-top: -2px !important;
    margin-bottom: 6px !important;
  }
}


/* ==========================================================================
   REMOVED: Tablet (768px-1023px) and iPad Pro (1024px-1199px) breakpoints
   iPads now use desktop layout (768px+) per user preference
   ========================================================================== */


/* ==========================================================================
   Tablet (600px+)
   ========================================================================== */

@media (min-width: 600px) {
  /* Two-column grid for menu items */
  .menu-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
  }

  /* Gallery grid instead of carousel */
  .gallery-scroll-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    overflow-x: visible;
    scroll-snap-type: none;
  }

  .gallery-item {
    flex: none;
    max-width: none;
  }

  .gallery-pagination {
    display: none;
  }

  /* Wider tabs */
  .tab-btn {
    min-width: 120px;
    padding: var(--spacing-sm) var(--spacing-lg);
  }

  /* Entry content */
  .entry-content {
    font-size: 1rem;
  }
}


/* ==========================================================================
   Desktop (768px+) - Restore original layout
   iPad and larger use desktop sidebar layout
   ========================================================================== */

@media (min-width: 768px) {
  /* Restore desktop min-width */
  body {
    min-width: 768px !important;
  }

  /* Hide mobile navigation elements */
  .mobile-nav-toggle,
  .mobile-nav-overlay {
    display: none !important;
  }

  /* Hide mobile-only elements */
  .quick-actions-bar,
  .hours-popup {
    display: none !important;
  }

  .gallery-section {
    display: none !important;
  }

  /* Hide content container on homepage when it only has gallery */
  #content:has(.gallery-section) {
    display: none !important;
  }

  /* Remove action bar padding */
  .mainpage {
    padding-bottom: 0;
  }

  /* Restore original layout widths */
  .left-area {
    width: 836px !important;
    float: left !important;
  }

  #page-header {
    width: 270px !important;
  }

  #container {
    width: 566px !important;
    padding: 0 !important;
  }

  #content {
    padding: 30px;
  }

  #page-footer {
    position: fixed !important;
    right: 30px !important;
    height: 100% !important;
    width: auto !important;
    text-align: left;
  }

  /* Hide old nav.mainmenu on desktop - replaced by .desktop-nav at top of sidebar */
  nav.mainmenu {
    display: none !important;
  }

  /* Restore site info - undo mobile fixed header */
  .site-info {
    display: block !important;
    flex-direction: column;
    position: static !important;
    padding: 25px 25px 0 25px !important;
    text-align: left;
    margin: 0 0 5px;
  }

  /* Sidebar dark overlay for desktop */
  #page-header {
    background: rgba(0, 0, 0, 0.75);
  }

  /* Show site-info on desktop even for menu pages */
  body.menu-page .site-info {
    display: block !important;
  }

  .site-info .logo {
    text-align: center;
    margin-bottom: var(--spacing-md) !important;
  }

  .site-info .logo img {
    max-height: none;
    max-width: 200px;
  }

  /* Show tagline on desktop */
  .site-info .tagline {
    display: block !important;
    padding: 20px 0 30px;
    font-size: 12px;
  }

  /* Remove top padding on desktop */
  .mainpage {
    padding-top: 0;
  }

  /* Restore background slider */
  .background {
    position: fixed !important;
    min-width: 1000px !important;
    height: 100%;
  }

  /* Right widgets restore */
  .right-widgets {
    position: absolute;
    right: 0;
    bottom: 60px;
  }

  #right-icons {
    display: block;
  }

  #right-icons li.icon {
    margin: 0 0 8px 8px !important;
  }

  /* Tabs - center aligned */
  .tabs-scroll-container {
    justify-content: center;
    overflow-x: visible;
    flex-wrap: wrap;
  }

  .menu-tabs {
    position: static;
  }
}


/* ==========================================================================
   Large Desktop (1200px+)
   ========================================================================== */

@media (min-width: 1200px) {
  /* Extra spacing for wide screens */
  .menu-items-grid {
    gap: var(--spacing-lg);
  }

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


/* ==========================================================================
   Small Screen Optimizations (360px and below)
   ========================================================================== */

@media (max-width: 375px) {
  /* Smaller action bar labels on narrow screens - prevent text wrapping */
  .quick-action-label {
    font-size: 0.6rem;
    white-space: nowrap;
    letter-spacing: -0.02em;
  }

  /* Ensure buttons don't wrap text */
  .quick-action {
    padding: var(--spacing-xs) 2px;
    flex: 1;
  }

  .quick-actions-bar {
    justify-content: space-between;
  }
}


/* ==========================================================================
   Landscape Orientation Optimizations
   ========================================================================== */

@media (orientation: landscape) and (max-height: 500px) {
  /* Compact action bar in landscape - maintain 44px touch targets per Apple HIG */
  .quick-actions-bar {
    height: 50px;
    padding: 3px;
    /* Reduced chrome padding in landscape since address bar is typically smaller */
    padding-bottom: calc(3px + var(--safe-area-bottom) + 12px);
  }

  .quick-action {
    padding: 2px 8px;
    min-height: 44px; /* Apple HIG minimum touch target */
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .quick-action-icon {
    width: 18px;
    height: 18px;
    margin-bottom: 1px;
  }

  .quick-action-label {
    font-size: 0.55rem;
    white-space: nowrap;
  }

  /* Adjust main content padding */
  .mainpage {
    padding-bottom: calc(50px + var(--safe-area-bottom) + 12px + var(--spacing-md));
  }

  /* Reduce header height slightly */
  .mobile-header {
    padding: 8px var(--spacing-md) !important;
  }
}


/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .mobile-nav-toggle,
  .mobile-nav-overlay,
  .quick-actions-bar,
  .hours-popup,
  .background,
  #page-footer {
    display: none !important;
  }

  body {
    min-width: auto !important;
  }

  .mainpage {
    padding-bottom: 0;
  }
}
