/* ==========================================================================
   Nour Cafe — Custom Design Layer
   Tailwind (CDN) handles utility classes; this file covers everything
   Tailwind can't express cleanly: keyframes, texture, glass effects,
   scroll-reveal machinery, and bespoke micro-interactions.
   ========================================================================== */

:root {
  --ink: #140d09;
  --espresso: #241509;
  --coffee: #5c3a21;
  --caramel: #a9713f;
  --gold: #d4a24c;
  --gold-soft: #e8c98a;
  --cream: #f7ecdd;
  --brick: #7c2d12;
}

html {
  scroll-behavior: smooth;
}

/* Anchor-scroll offset for the fixed/sticky nav (~79px tall at every
   breakpoint) plus a little breathing room. Applied directly to every
   in-page scroll target rather than baked into JS as a pixel constant,
   so it's respected even by a plain native anchor jump (no JS needed). */
#home,
#menu,
#about,
#gallery,
#locations,
#contact {
  scroll-margin-top: 96px;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Playfair Display', serif;
}

::selection {
  background: var(--gold);
  color: var(--ink);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--coffee), var(--espresso));
  border-radius: 10px;
}

/* ==========================================================================
   Preloader
   ========================================================================== */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
#preloader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#preloader .loader-cup {
  animation: steam-pulse 1.8s ease-in-out infinite;
}
@keyframes steam-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.08); opacity: 1; }
}

/* ==========================================================================
   Film-grain / noise texture overlay for cinematic depth
   ========================================================================== */
.grain-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Navigation
   ========================================================================== */
#navbar {
  transition: background-color 0.5s ease, box-shadow 0.5s ease, padding 0.4s ease;
  background-color: rgba(20, 13, 9, 0);
}
#navbar.scrolled {
  background-color: rgba(20, 13, 9, 0.82);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 10px 30px -15px rgba(0,0,0,0.6);
}

.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0%;
  height: 2px;
  background: var(--gold);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Mobile menu */
#mobile-menu {
  transition: max-height 0.5s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.4s ease;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}
#mobile-menu.open {
  max-height: 600px;
  opacity: 1;
}

.hamburger-line {
  transition: transform 0.35s ease, opacity 0.25s ease;
}
#hamburger.open .line-1 { transform: translateY(7px) rotate(45deg); }
#hamburger.open .line-2 { opacity: 0; }
#hamburger.open .line-3 { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero-section {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
  background-color: var(--ink);
}
.hero-gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20,13,9,0.55) 0%, rgba(20,13,9,0.55) 30%, rgba(20,13,9,0.92) 100%),
    linear-gradient(90deg, rgba(20,13,9,0.85) 0%, rgba(20,13,9,0.25) 55%, rgba(20,13,9,0.7) 100%);
}

.hero-title {
  perspective: 1000px;
}
.hero-title span {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px) rotateX(30deg);
  animation: title-rise 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes title-rise {
  to { opacity: 1; transform: translateY(0) rotateX(0); }
}

.scroll-indicator {
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(10px); opacity: 1; }
}

/* Magnetic / glow buttons */
.btn-glow {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}
.btn-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  z-index: -1;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(212,162,76,0.55), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.btn-glow:hover::before { opacity: 1; }
.btn-glow:hover {
  box-shadow: 0 12px 30px -8px rgba(212, 162, 76, 0.55);
  transform: translateY(-2px);
}

.btn-outline-glow {
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.btn-outline-glow:hover {
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 12px 30px -10px rgba(247, 236, 221, 0.4);
  transform: translateY(-2px);
}

/* ==========================================================================
   Scroll-reveal engine (paired with main.js IntersectionObserver)
   ========================================================================== */
.reveal {
  opacity: 0;
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
}
.reveal-up { transform: translateY(56px); }
.reveal-down { transform: translateY(-40px); }
.reveal-left { transform: translateX(-56px); }
.reveal-right { transform: translateX(56px); }
.reveal-scale { transform: scale(0.9); }
.reveal.in-view {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}
/* stagger helper — set via inline style --delay */
.reveal { transition-delay: var(--delay, 0ms); }

/* ==========================================================================
   Section dividers
   ========================================================================== */
.divider-gold {
  height: 2px;
  width: 80px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ==========================================================================
   Menu tabs
   ========================================================================== */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.menu-tab {
  position: relative;
  transition: color 0.35s ease;
}
.menu-tab.active {
  color: var(--gold-soft);
}
#tab-indicator {
  position: absolute;
  bottom: 0;
  height: 2px;
  background: var(--gold);
  transition: left 0.45s cubic-bezier(0.65, 0, 0.35, 1), width 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}

.menu-panel {
  display: none;
}
.menu-panel.active {
  display: grid;
  animation: panel-fade 0.6s ease both;
}
@keyframes panel-fade {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Menu / product cards */
.menu-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s ease;
}
.menu-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 30px 60px -25px rgba(20, 13, 9, 0.45);
}
.menu-card .img-wrap {
  overflow: hidden;
}
.menu-card .img-wrap img {
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), filter 0.8s ease;
}
.menu-card:hover .img-wrap img {
  transform: scale(1.12) rotate(0.5deg);
  filter: brightness(1.05);
}
.menu-card .badge {
  transform: translateY(-6px) scale(0.9);
  opacity: 0;
  transition: all 0.4s ease 0.1s;
}
.menu-card:hover .badge {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ==========================================================================
   Gallery
   ========================================================================== */
.gallery-item {
  overflow: hidden;
  position: relative;
}
.gallery-item img {
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.gallery-item:hover img {
  transform: scale(1.1);
}
.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(20,13,9,0.75), transparent 55%);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.gallery-item:hover::after {
  opacity: 1;
}

/* ==========================================================================
   Stat counters
   ========================================================================== */
.stat-number {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Testimonials
   ========================================================================== */
.testimonial-track {
  transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1);
}
.avatar-circle {
  background: linear-gradient(135deg, var(--gold), var(--brick));
}

/* ==========================================================================
   Newsletter
   ========================================================================== */
.newsletter-input:focus {
  box-shadow: 0 0 0 3px rgba(212, 162, 76, 0.4);
}

/* ==========================================================================
   Back to top
   ========================================================================== */
#back-to-top {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ==========================================================================
   Misc
   ========================================================================== */
.text-outline {
  -webkit-text-stroke: 1px rgba(247, 236, 221, 0.35);
  color: transparent;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
