/* ================================================
   SPOTTED PIG CAFE — COMPONENTS CSS
   Reusable UI components for all pages
   ================================================ */

/* ============ MENU PAGE ============ */

.menu-hero {
  height: 52vh;
  min-height: 380px;
  background: var(--espresso);
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(40px, 6vw, 80px);
  position: relative;
  overflow: hidden;
}

.menu-hero-bg {
  position: absolute;
  inset: 0;
}

.menu-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3;
}

.menu-hero-content {
  position: relative;
  z-index: 1;
}

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(44px, 8vw, 90px);
  font-weight: 600;
  color: var(--warm-white);
  line-height: 1.05;
  margin-bottom: 16px;
}

.page-subtitle {
  font-size: 16px;
  color: rgba(245,245,245,0.6);
  font-weight: 300;
  letter-spacing: 0.02em;
}

/* ============================================================
   SECONDARY STICKY NAV — shared by .menu-tabs & .gallery-filters
   top is set dynamically via JS (initStickySubnav);
   the var(--nav-height) is a CSS-only fallback for no-JS.
   ============================================================ */

/* Category tabs */
.menu-tabs {
  background: rgba(250, 247, 243, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sand-beige);
  position: sticky;
  /* JS overrides this with the live navbar height */
  top: var(--nav-height);
  /* Must be below navbar (1000) but above page content */
  z-index: 99;
  /* Smooth shadow transition when stuck */
  transition: box-shadow 0.25s ease;
}

/* Shadow when actually stuck (sentinel goes out of view) */
.menu-tabs.is-stuck {
  box-shadow: 0 4px 20px rgba(58, 47, 40, 0.10);
}

.menu-tabs-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 60px);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  /* Smooth, touch-friendly horizontal scroll on mobile */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.menu-tabs-inner::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  padding: 18px 24px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--espresso-light);
  cursor: pointer;
  transition: var(--trans-fast);
  position: relative;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--espresso); }

.tab-btn.active {
  color: var(--espresso);
  border-bottom-color: var(--espresso);
}

/* Menu sections */
.menu-section {
  padding: clamp(60px, 8vw, 100px) 0 0;
}

.menu-section:last-child { padding-bottom: clamp(60px, 8vw, 100px); }

.menu-section-header {
  margin-bottom: clamp(32px, 4vw, 52px);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--sand-beige);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.menu-section-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
  color: var(--espresso);
}

.menu-section-desc {
  font-size: 14px;
  color: var(--espresso-light);
  opacity: 0.65;
  max-width: 400px;
  line-height: 1.7;
  text-align: right;
}

.menu-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.menu-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--cream);
  border-radius: 8px;
  border: 1px solid var(--sand-beige);
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast), transform var(--trans-fast);
}

.menu-item:hover {
  border-color: var(--espresso-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.menu-item-img {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  transition: transform 0.4s var(--ease-smooth);
}

.menu-item:hover .menu-item-img { transform: scale(1.04); }

.menu-item-body { flex: 1; }

.menu-item-name {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--espresso);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.menu-item-price {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--espresso);
  flex-shrink: 0;
}

.menu-item-desc {
  font-size: 13px;
  color: var(--espresso-light);
  opacity: 0.7;
  line-height: 1.6;
  margin-bottom: 10px;
}

.menu-item-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.item-tag {
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag-v { background: rgba(95,124,109,0.12); color: var(--tropical-green); }
.tag-gf { background: rgba(201,169,110,0.15); color: #8B6914; }
.tag-sp { background: rgba(58,47,40,0.08); color: var(--espresso); }
.tag-new { background: var(--espresso); color: var(--warm-white); }

/* ============ GALLERY PAGE ============ */

.gallery-hero {
  height: 52vh;
  min-height: 380px;
  background: var(--espresso);
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(40px, 6vw, 80px);
  position: relative;
  overflow: hidden;
}

.gallery-hero-bg {
  position: absolute;
  inset: 0;
}

.gallery-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}

/* Gallery filter */
.gallery-filters {
  background: rgba(250, 247, 243, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 20px clamp(20px, 5vw, 60px);
  border-bottom: 1px solid var(--sand-beige);
  position: sticky;
  /* JS overrides this with live navbar height */
  top: var(--nav-height);
  z-index: 99;
  transition: box-shadow 0.25s ease;
}

.gallery-filters.is-stuck {
  box-shadow: 0 4px 20px rgba(58, 47, 40, 0.10);
}

.filter-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  /* On narrow screens, allow horizontal scroll (same pattern as menu-tabs) */
  gap: 10px;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.filter-inner::-webkit-scrollbar { display: none; }

.filter-btn {
  padding: 10px 24px;
  border: 1.5px solid var(--sand-beige);
  border-radius: 50px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--espresso-light);
  cursor: pointer;
  transition: var(--trans-fast);
}

.filter-btn:hover { border-color: var(--espresso); color: var(--espresso); }

.filter-btn.active {
  background: var(--espresso);
  border-color: var(--espresso);
  color: var(--warm-white);
}

/* Masonry grid — CSS column layout */
.masonry-grid {
  column-count: 3;
  column-gap: 12px;
  padding: clamp(40px, 5vw, 60px) 0;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
}

.masonry-item img {
  display: block;
  width: 100%;
  transition: transform 0.6s var(--ease-smooth);
}

.masonry-item:hover img { transform: scale(1.05); }

.masonry-overlay {
  position: absolute;
  inset: 0;
  background: rgba(58, 47, 40, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--trans-med);
}

.masonry-item:hover .masonry-overlay { opacity: 1; }

.masonry-overlay i {
  font-size: 32px;
  color: var(--warm-white);
  transform: scale(0.7);
  transition: transform 0.3s var(--ease-spring);
}

.masonry-item:hover .masonry-overlay i { transform: scale(1); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(28, 20, 16, 0.96);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease-smooth), visibility 0.3s;
  padding: 20px;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-inner {
  position: relative;
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 40px 120px rgba(0,0,0,0.6);
  transform: scale(0.92);
  transition: transform 0.4s var(--ease-expo);
}

.lightbox.open .lightbox-img { transform: scale(1); }

.lightbox-close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(245,245,245,0.3);
  background: transparent;
  color: var(--warm-white);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans-fast);
  z-index: 10001;
}

.lightbox-close:hover {
  background: rgba(245,245,245,0.1);
  transform: rotate(90deg);
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(245,245,245,0.3);
  background: transparent;
  color: var(--warm-white);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans-fast);
  z-index: 10001;
}

.lightbox-nav:hover { background: rgba(245,245,245,0.1); }
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

.lightbox-caption {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: rgba(245,245,245,0.6);
  font-size: 13px;
  z-index: 10001;
}

/* ============ LOCATION PAGE ============ */

.location-hero {
  height: 52vh;
  min-height: 380px;
  background: var(--espresso);
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(40px, 6vw, 80px);
  position: relative;
  overflow: hidden;
}

.location-hero-bg {
  position: absolute;
  inset: 0;
}

.location-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3;
}

.location-page-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: clamp(48px, 8vw, 80px);
  align-items: start;
  padding: clamp(60px, 8vw, 100px) 0;
}

.location-card {
  background: var(--cream);
  border-radius: 8px;
  padding: clamp(28px, 4vw, 44px);
  border: 1px solid var(--sand-beige);
}

.location-card-title {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--espresso);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sand-beige);
}

.hours-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hours-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.hours-day { color: var(--espresso); font-weight: 500; }
.hours-time { color: var(--tropical-green); font-weight: 600; }
.hours-row.today { background: rgba(95,124,109,0.08); padding: 10px 12px; border-radius: 6px; margin: -2px -12px; }

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.contact-item i {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sand-beige);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--tropical-green);
  flex-shrink: 0;
}

.contact-item span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--espresso-light);
  opacity: 0.6;
  margin-bottom: 2px;
}

.contact-item strong {
  display: block;
  font-size: 14px;
  color: var(--espresso);
  font-weight: 500;
  line-height: 1.5;
}

.map-large {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: calc(var(--nav-height) + 24px);
}

.map-large iframe {
  display: block;
  filter: saturate(0.8) contrast(1.05);
  transition: filter var(--trans-med);
}

.map-large:hover iframe { filter: saturate(1); }

/* Directions strip */
.directions-strip {
  background: var(--espresso);
  padding: clamp(48px, 6vw, 72px) 0;
  text-align: center;
}

.directions-strip h3 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 40px);
  color: var(--warm-white);
  margin-bottom: 12px;
}

.directions-strip p {
  color: rgba(245,245,245,0.6);
  margin-bottom: 28px;
  font-size: 15px;
}

/* ============ BREADCRUMB ============ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0 0;
  font-size: 12px;
  color: rgba(245,245,245,0.5);
}

.breadcrumb a { color: rgba(245,245,245,0.6); transition: color var(--trans-fast); }
.breadcrumb a:hover { color: var(--warm-white); }
.breadcrumb i { font-size: 8px; }

/* ============ BACK TO TOP ============ */

.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--espresso);
  color: var(--warm-white);
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--trans-fast), visibility var(--trans-fast), transform var(--trans-fast), background var(--trans-fast);
  box-shadow: var(--shadow-md);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover { background: var(--tropical-green); transform: translateY(-2px); }

/* ============ RESPONSIVE — COMPONENTS ============ */

@media (max-width: 768px) {
  .menu-items-grid { grid-template-columns: 1fr; }
  .menu-section-header { flex-direction: column; align-items: flex-start; }
  .menu-section-desc { text-align: left; }
  .masonry-grid { column-count: 2; }
  .location-page-grid { grid-template-columns: 1fr; }
  .map-large { position: static; }
  .lightbox-nav { display: none; }

  /* Mobile: unwrap filter pills into a single scrollable row */
  .filter-inner {
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

  /* Ensure tab buttons never wrap on mobile */
  .tab-btn,
  .filter-btn { flex-shrink: 0; }
}

@media (max-width: 480px) {
  .masonry-grid { column-count: 1; }
  .gallery-filters { padding: 14px clamp(16px, 4vw, 24px); }
  .back-to-top { bottom: 20px; right: 20px; }

  /* Slightly smaller tab/filter text on phones */
  .tab-btn { padding: 14px 18px; font-size: 11px; }
  .filter-btn { padding: 9px 18px; font-size: 11px; }
}
