/* J Bakery Custom Styles */

:root {
  --primary-color: #ec4899;
  --primary-dark: #db2777;
  --primary-light: #f9a8d4;
  --cream: #faf7f2;
  --dark: #1f2937;
  --gray: #6b7280;
  --white: #ffffff;
  --shadow: 0 10px 30px rgba(0,0,0,0.1);
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.05);
  --border-radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--dark);
  background-color: var(--cream);
  overflow-x: hidden;
  /* Fix for iOS Safari bounce scrolling */
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Navigation */
nav {
  transition: all 0.3s ease;
}

.nav-link {
  position: relative;
  color: var(--dark);
  font-weight: 500;
  text-decoration: none;
  padding: 0.5rem 0;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: var(--primary-color);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* JB Logo */
.jb-logo {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--primary-color);
  font-family: 'Arial Black', sans-serif;
  letter-spacing: -2px;
  position: relative;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.jb-logo:hover {
  color: var(--primary-dark);
}

/* iOS safe hover */
@supports (-webkit-touch-callout: none) {
  .jb-logo:hover {
    color: var(--primary-color);
  }
}

.jb-logo::after {
  content: '•';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  font-size: 0.5em;
}

/* Buttons */
.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 0.75rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4);
}

/* iOS Safe hover */
@supports (-webkit-touch-callout: none) {
  .btn-primary:hover {
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
  }
}

.btn-secondary {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: white;
}

/* Active state for touch devices */
.btn-primary:active,
.btn-secondary:active {
  opacity: 0.9;
  box-shadow: 0 2px 10px rgba(236, 72, 153, 0.2);
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--cream) 0%, rgba(249, 168, 212, 0.1) 100%);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 20s infinite ease-in-out;
  pointer-events: none;
  z-index: -1;
}

/* Disable on iOS */
@supports (-webkit-touch-callout: none) {
  .hero-section::before {
    animation: none;
    opacity: 0.3;
  }
}

@keyframes float {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.5; }
}

/* Disable float animation on iOS */
@supports (-webkit-touch-callout: none) {
  @keyframes float {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.3; }
  }
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  color: var(--dark);
  margin-bottom: 1rem;
  animation: fadeInUp 0.8s ease;
}

.hero-title .text-primary {
  color: var(--primary-color);
}

.hero-subtitle {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: var(--gray);
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease 0.2s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* iOS safe animation */
@supports (-webkit-touch-callout: none) {
  @keyframes fadeInUp {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: white;
  border-radius: 50px;
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--dark);
  animation: fadeInUp 0.8s ease 0.4s both;
}

.badge svg {
  color: var(--primary-color);
}

/* Grid Container Fix for iOS */
.grid {
  /* Force proper grid layout on iOS */
  display: grid !important;
  position: relative;
  z-index: 0;
}

.grid > * {
  /* Ensure grid items don't overlap */
  position: relative;
  isolation: isolate;
  contain: layout;
}

/* Specific grid fixes for product cards */
.grid .product-card {
  position: relative !important;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;
  contain: layout style paint;
}

/* Ensure sections don't overlap */
section {
  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow: visible;
}

/* Fix for overlapping during scroll */
.ios-device .grid,
.ios-safari .grid,
.touch-device .grid {
  /* Remove any 3D layers */
  perspective: none !important;
  -webkit-perspective: none !important;
}

.ios-device .product-card,
.ios-safari .product-card,
.touch-device .product-card {
  /* Ensure cards stay in their grid cells */
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  clear: both !important;
}

/* Section Titles */
.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  color: var(--dark);
  position: relative;
  display: inline-block;
  margin-bottom: 3rem;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 60px;
  height: 4px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* Product Cards */
.product-card {
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
  cursor: pointer;
  /* Fix for iOS Safari overlap issue */
  position: relative;
  z-index: 1;
  /* Remove transforms to prevent overlap */
  will-change: box-shadow;
}

/* Desktop hover effect without transform */
@media (hover: hover) and (pointer: fine) {
  .product-card:hover {
    box-shadow: var(--shadow);
    /* Use margin instead of transform for lift effect */
    margin-top: -4px;
    margin-bottom: 4px;
  }
}

/* Touch devices - tap effect */
@media (hover: none) and (pointer: coarse) {
  .product-card:active {
    box-shadow: var(--shadow-sm);
    opacity: 0.95;
  }
}

.product-image {
  width: 100%;
  height: 250px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--cream) 0%, rgba(236, 72, 153, 0.05) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* Contain the image properly */
  contain: layout style paint;
}

.product-image::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.1) 0%, transparent 70%);
  border-radius: 50%;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
  display: block;
}

/* Desktop only zoom effect using opacity overlay */
@media (hover: hover) and (pointer: fine) {
  .product-card:hover .product-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(236, 72, 153, 0.05);
    pointer-events: none;
  }
}

.product-title {
  padding: 1rem 1.5rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
}

.product-description {
  padding: 0.5rem 1.5rem;
  color: var(--gray);
  font-size: 0.95rem;
}

.product-price {
  padding: 1rem 1.5rem 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* About Section */
.stat {
  text-align: center;
  padding: 1rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.about-image {
  position: relative;
  animation: fadeInUp 0.8s ease;
}

.about-image::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 100px;
  height: 100px;
  background: var(--primary-color);
  border-radius: 50%;
  opacity: 0.2;
  z-index: -1;
}

/* Menu Section */
.menu-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 3rem;
}

.menu-category-btn {
  padding: 0.75rem 1.5rem;
  background: white;
  border: 2px solid transparent;
  border-radius: 50px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.3s ease;
}

.menu-category-btn:hover,
.menu-category-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.menu-item {
  background: white;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: start;
  transition: all 0.3s ease;
  animation: fadeInUp 0.5s ease;
}

.menu-item:hover {
  box-shadow: var(--shadow);
  background: linear-gradient(to right, white 0%, var(--cream) 100%);
}

/* iOS safe hover */
@supports (-webkit-touch-callout: none) {
  .menu-item:hover {
    background: white;
  }
}

.menu-item-content h3 {
  font-size: 1.25rem;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.menu-item-content p {
  color: var(--gray);
  font-size: 0.9rem;
}

.menu-item-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
  white-space: nowrap;
  margin-left: 1rem;
}

/* Delivery Cards */
.delivery-card {
  background: white;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
  display: block;
  text-decoration: none;
  border: 2px solid transparent;
}

.delivery-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
  border-color: var(--primary);
}

.delivery-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
}

/* Special Cards */
.special-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 2rem;
  position: relative;
  overflow: visible; /* Changed from hidden to visible */
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
  z-index: 1;
  isolation: isolate;
}

.special-card:hover {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.special-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 0 var(--border-radius) 0 var(--border-radius);
  box-shadow: 0 2px 10px rgba(236, 72, 153, 0.3);
  z-index: 2;
}

/* iOS safe badge */
@supports (-webkit-touch-callout: none) {
  .special-badge {
    position: absolute;
    transform: none !important;
  }
}

.special-title {
  font-size: 1.75rem;
  color: var(--dark);
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.special-description {
  color: var(--gray);
  margin-bottom: 1.5rem;
}

.special-image {
  width: 100%;
  height: 160px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: var(--cream);
}

.special-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.special-card:hover .special-image img {
  opacity: 0.95;
}

/* Instagram Feed */
.instagram-post {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
  aspect-ratio: 1;
  background: var(--cream);
  cursor: pointer;
}

.instagram-post img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.instagram-post:hover img {
  opacity: 0.9;
}

.instagram-post::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.3) 0%, rgba(219, 39, 119, 0.3) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.instagram-post:hover::after {
  opacity: 1;
}

/* Contact Section */
.contact-card {
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.contact-item {
  display: flex;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.contact-item svg {
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.map-container {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--cream);
  height: 400px;
}

/* Footer */
footer {
  background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
}

footer .jb-logo {
  color: white;
}

footer input {
  outline: none;
  border: none;
}

footer input:focus {
  background: #374151;
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  background: white;
  box-shadow: var(--shadow);
  z-index: 40;
  transition: all 0.3s ease;
}

.mobile-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--dark);
}

/* Utilities */
.text-primary {
  color: var(--primary-color);
}

.bg-cream {
  background-color: var(--cream);
}

/* iOS Safari Specific Fixes */
@supports (-webkit-touch-callout: none) {
  /* iOS only styles */
  .product-card {
    /* No transforms */
    position: relative;
    isolation: isolate;
    overflow: hidden;
  }
  
  .product-image {
    overflow: hidden;
    position: relative;
  }
  
  /* Completely disable hover on iOS */
  .product-card:hover {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
  
  /* Prevent any transform animations */
  * {
    -webkit-transform: none !important;
    transform: none !important;
  }
}

/* iOS Safari specific class */
.ios-safari .product-card {
  /* No transforms to prevent overlap */
  position: relative;
  z-index: 1;
  isolation: isolate;
}

.ios-safari .product-image {
  /* Ensure images stay contained */
  overflow: hidden;
  position: relative;
}

.ios-safari .grid {
  /* Create new stacking context */
  position: relative;
  z-index: 0;
}

/* Prevent overlapping on scroll */
.ios-safari section {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

/* Disable all transforms on iOS */
.ios-safari * {
  -webkit-transform: none !important;
  transform: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }
  
  .section-title {
    font-size: 2rem;
  }
  
  .menu-item {
    flex-direction: column;
    align-items: start;
  }
  
  .menu-item-price {
    margin-left: 0;
    margin-top: 1rem;
  }
  
  .special-badge {
    right: -40px;
    top: 10px;
  }
  
  /* Fix grid layout on mobile */
  .grid {
    gap: 1.5rem !important;
  }
  
  .product-card {
    margin-bottom: 1rem;
    /* Ensure no negative margins */
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
  }
  
  /* Prevent image overflow on mobile */
  .product-image {
    max-height: 250px;
    position: relative;
    overflow: hidden;
    /* Force containment */
    contain: layout style paint;
  }
  
  .product-image img {
    position: relative;
    top: 0;
    left: 0;
    /* Prevent bleed */
    max-width: 100%;
    height: auto;
    display: block;
  }
  
  /* iOS Safari specific mobile fixes */
  .ios-safari .product-card {
    margin-bottom: 1.5rem !important;
  }
  
  .ios-safari .product-card:active {
    opacity: 0.9;
  }
}

/* Loading Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s infinite;
}

/* Scroll Animations - Disabled to prevent issues */
/* These styles were causing images to disappear
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

.scroll-reveal.active {
  opacity: 1;
  transform: translateY(0);
}
*/

/* Viewport height fix for iOS */
.hero-section {
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--cream);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* Print Styles */
@media print {
  nav, footer, .btn-primary, .btn-secondary {
    display: none;
  }
  
  body {
    font-size: 12pt;
  }
}