/* ============================================================================
   Savor Bistro — css/styles.css
   Design tokens, motion keyframes and the few component classes that read
   cleaner in CSS than in a utility soup. Tailwind (CDN) supplies the utility
   layer; this file supplies the brand layer. Keep token values in sync with
   the tailwind.config block that js/pages.js injects into every page.
   ========================================================================= */

/* ---------- 1. Design tokens -------------------------------------------- */
:root {
  --cream-50: #FFF8EC;
  --tomato-600: #E8384F;
  --citrus-500: #FFB627;
  --basil-700: #2D5A3D;
  --charcoal-900: #221A17;
  --ink-900: #2A211D;

  /* derived tones — all stay bright, nothing is desaturated */
  --cream-100: #FBEED8;
  --cream-200: #F4E1C3;
  --tomato-700: #C42A40;
  --tomato-100: #FDE3E6;
  --citrus-600: #E9A012;
  --citrus-100: #FFF0D2;
  --basil-100: #E2EFE6;

  --shadow-soft: 0 10px 30px -18px rgba(34, 26, 23, 0.35);
  --shadow-lift: 0 26px 50px -22px rgba(34, 26, 23, 0.45);

  --font-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --font-body: "Work Sans", "Segoe UI", sans-serif;

  --nav-h: 76px;
}

/* ---------- 2. Base ----------------------------------------------------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px); /* sticky nav never covers a jump target */
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden; /* belt: the viewport can never scroll sideways */
}

/* Media baseline: nothing image-like may push the page wider than its box. */
img, video, iframe { max-width: 100%; }

body {
  background-color: var(--cream-50);
  color: var(--ink-900);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* no accidental horizontal scroll at 375px */
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.05;
}

/* Measure helpers — body copy stays under 80 characters per line */
.measure { max-width: 72ch; }
.measure-tight { max-width: 58ch; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--tomato-600);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--citrus-500); color: var(--charcoal-900); }

.scroll-x {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--tomato-600) transparent;
}
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--tomato-600); border-radius: 999px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Typography scale ---------------------------------------- */
.hero-title {
  font-size: clamp(2.5rem, 7vw, 5.25rem); /* ~40px @375px -> ~84px @1440px */
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
}
.section-title { font-size: clamp(1.9rem, 4.2vw, 3.25rem); font-weight: 700; }
.card-title    { font-size: clamp(1.25rem, 2.2vw, 1.75rem); font-weight: 600; }

.kicker {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- 4. Components ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  padding: 0.95rem 1.6rem;
  min-height: 48px; /* comfortable touch target */
  transition: transform 220ms ease, box-shadow 220ms ease, background-color 220ms ease, color 220ms ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary  { background: var(--tomato-600); color: #fff; box-shadow: 0 14px 26px -16px rgba(232, 56, 79, 0.9); }
.btn-primary:hover  { background: var(--tomato-700); box-shadow: 0 20px 34px -16px rgba(232, 56, 79, 0.95); }
.btn-citrus   { background: var(--citrus-500); color: var(--charcoal-900); box-shadow: 0 14px 26px -16px rgba(255, 182, 39, 0.95); }
.btn-citrus:hover   { background: var(--citrus-600); }
.btn-ghost    { background: transparent; color: var(--ink-900); border: 2px solid rgba(34, 26, 23, 0.22); }
.btn-ghost:hover    { border-color: var(--tomato-600); color: var(--tomato-600); }
.btn-on-dark  { background: rgba(255, 255, 255, 0.1); color: #fff; border: 2px solid rgba(255, 255, 255, 0.4); }
.btn-on-dark:hover { background: #fff; color: var(--charcoal-900); border-color: #fff; }
.btn-sm { padding: 0.7rem 1.15rem; font-size: 0.9375rem; min-height: 44px; }

.card {
  background: #fff;
  border: 1px solid var(--cream-200);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* Media frames — the hover zoom lives on the inner <img> */
.media { position: relative; overflow: hidden; background: var(--cream-100); }
.media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 700ms cubic-bezier(.2,.7,.2,1);
}
.group:hover .media img,
.media:hover img { transform: scale(1.06); } /* 1.05–1.08 tactile zoom */
.shadow-lift { transition: box-shadow 400ms ease; }
.group:hover .shadow-lift { box-shadow: var(--shadow-lift); }

/* Dietary / allergen badges */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; line-height: 1.35; white-space: nowrap;
}
.badge svg { width: 14px; height: 14px; }
.badge-veg     { background: var(--basil-100);  color: var(--basil-700); }
.badge-vegan   { background: var(--basil-700);  color: #fff; }
.badge-gf      { background: var(--citrus-100); color: #8A5A00; }
.badge-nutfree { background: var(--tomato-100); color: var(--tomato-700); }
.badge-wine    { background: #F3E7DA;           color: #7A4A1E; }

/* Menu rows: dotted leader between dish name and price */
.menu-row + .menu-row { border-top: 1px dashed var(--cream-200); }
/* Thumbnail anchor: small square photo left of each item's text. Text-first
   layout (photo ~64px) keeps the row scannable and indexable HTML intact. */
.menu-thumb {
  width: 120px; height: 120px; flex: none;
  border-radius: 0.75rem; object-fit: cover;
  background: var(--cream-100); /* soft tile while the file loads */
}
@media (min-width: 640px) { .menu-thumb { width: 160px; height: 160px; } }
.menu-fallback {
  display: grid; place-items: center;
  width: 120px; height: 120px; flex: none; border-radius: 0.75rem;
  background: var(--basil-100); color: var(--basil-700);
}
@media (min-width: 640px) { .menu-fallback { width: 160px; height: 160px; } }
.menu-fallback svg { width: 28px; height: 28px; }
.leader {
  flex: 1 1 auto; min-width: 1.5rem;
  border-bottom: 1px dotted rgba(42, 33, 29, 0.35);
  transform: translateY(-0.35rem);
}
.price { font-family: var(--font-display); font-weight: 700; color: var(--citrus-600); font-size: 1.0625rem; }
.price-lg { font-size: 1.5rem; }

/* Filter pills (menu page) */
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.95rem; border-radius: 999px;
  border: 2px solid var(--cream-200); background: #fff; color: var(--ink-900);
  font-size: 0.875rem; font-weight: 600; min-height: 44px;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.pill:hover { border-color: var(--citrus-500); }
.pill[aria-pressed="true"] { background: var(--basil-700); border-color: var(--basil-700); color: #fff; }

/* Sticky nav — charcoal once scrolled (high-contrast section treatment) */
.site-header { transition: background-color 260ms ease, box-shadow 260ms ease, backdrop-filter 260ms ease; }
.site-header.is-stuck {
  background-color: var(--charcoal-900);
  box-shadow: 0 12px 30px -20px rgba(34, 26, 23, 0.9);
  backdrop-filter: saturate(140%) blur(6px);
}
.site-header.is-stuck .nav-link { color: #fff; }
/* Logo wordmark: "Savor" is dark on the transparent header; switch it to
   cream once the header turns charcoal. "Bistro" stays tomato-600 in both. */
.logo-text { color: var(--ink-900); transition: color 200ms ease; }
.site-header.is-stuck .logo-text { color: var(--cream-50); }
/* Hamburger: Lucide icons inherit text color, so the button needs explicit
   colors per nav state (dark ink on cream pre-scroll, light on charcoal). */
.nav-burger {
  color: var(--ink-900);
  transition: color 200ms ease, background-color 200ms ease, border-color 200ms ease;
}
.site-header.is-stuck .nav-burger { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
/* Home hero: pre-scroll the nav floats over the food photo, so the wordmark
   and hamburger switch to light with a soft dark halo/backdrop for legibility
   over busy imagery. Scoped to body.has-hero-nav - other pages sit over the
   cream background pre-scroll and keep their dark ink. */
body.has-hero-nav .site-header:not(.is-stuck) .logo-text {
  color: #fff;
  text-shadow: 0 1px 10px rgba(34, 26, 23, 0.65), 0 0 3px rgba(34, 26, 23, 0.5);
}
body.has-hero-nav .site-header:not(.is-stuck) .nav-burger {
  color: #fff;
  background: rgba(34, 26, 23, 0.38);
  border-color: rgba(255, 255, 255, 0.5);
}
.nav-link { position: relative; font-weight: 500; color: var(--ink-900); transition: color 200ms ease; }
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 3px; border-radius: 999px;
  background: var(--tomato-600); transform: scaleX(0); transform-origin: left; transition: transform 260ms ease;
}
.nav-link:hover::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); }
.nav-link[aria-current="page"] { color: var(--tomato-600); }
.site-header.is-stuck .nav-link[aria-current="page"] { color: var(--citrus-500); }
.site-header.is-stuck .nav-link[aria-current="page"]::after,
.site-header.is-stuck .nav-link:hover::after { background: var(--citrus-500); }

/* Mobile slide-in panel (< 768px) */
.mobile-panel {
  position: fixed; inset: 0 0 0 auto; width: min(88vw, 22rem); z-index: 60;
  background: var(--charcoal-900); color: #fff;
  transform: translateX(100%); transition: transform 340ms cubic-bezier(.2,.7,.2,1);
  display: flex; flex-direction: column; padding: 1.25rem; overflow-y: auto;
}
.mobile-panel.is-open { transform: translateX(0); }
.mobile-scrim {
  position: fixed; inset: 0; z-index: 55; background: rgba(34, 26, 23, 0.55);
  opacity: 0; visibility: hidden; transition: opacity 300ms ease, visibility 300ms ease;
}
.mobile-scrim.is-open { opacity: 1; visibility: visible; }
.mobile-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.95rem 0.5rem; border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1.0625rem; font-weight: 500;
}
.mobile-link[aria-current="page"] { color: var(--citrus-500); }
body.nav-open { overflow: hidden; }

.skip-link {
  position: absolute; left: 1rem; top: -5rem; z-index: 100;
  background: var(--tomato-600); color: #fff; padding: 0.7rem 1.1rem; border-radius: 999px; font-weight: 600;
  transition: top 200ms ease;
}
.skip-link:focus { top: 1rem; }

/* ---------- 5. Motion --------------------------------------------------- */

/* 5a. Hero: Ken-Burns drift on the signature dish photograph */
@keyframes ken-burns {
  0%   { transform: scale(1.03) translate3d(0, 0, 0); }
  100% { transform: scale(1.12) translate3d(-1.2%, -1.6%, 0); }
}
.ken-burns { animation: ken-burns 26s ease-in-out infinite alternate; }

/* 5b. Hero: CSS-only steam rising over the signature dish.
       Soft, semi-transparent shapes that drift up and fade out. */
.steam-field { position: absolute; inset: auto 0 0 0; height: 78%; pointer-events: none; z-index: 20; }
.steam-wisp {
  position: absolute; bottom: 8%; border-radius: 50%;
  background: radial-gradient(circle at 50% 55%,
    rgba(255, 255, 255, 0.95),
    rgba(255, 248, 236, 0.35) 55%,
    rgba(255, 248, 236, 0) 72%);
  filter: blur(9px);
  opacity: 0;
  animation: steam-rise 7.5s linear infinite;
}
@keyframes steam-rise {
  0%   { opacity: 0;    transform: translate3d(0, 18px, 0) scale(0.72); }
  18%  { opacity: 0.62; }
  55%  { opacity: 0.34; transform: translate3d(14px, -120px, 0) scale(1.08); }
  100% { opacity: 0;    transform: translate3d(-10px, -250px, 0) scale(1.5); }
}
/* stagger the wisps so they read as one loose column of steam */
.steam-wisp:nth-child(1) { left: 6%;  width: 92px;  height: 92px;  animation-delay: 0s;   }
.steam-wisp:nth-child(2) { left: 20%; width: 128px; height: 128px; animation-delay: 1.4s; animation-duration: 8.6s; }
.steam-wisp:nth-child(3) { left: 34%; width: 76px;  height: 76px;  animation-delay: 2.9s; animation-duration: 6.9s; }
.steam-wisp:nth-child(4) { left: 48%; width: 112px; height: 112px; animation-delay: 4.1s; animation-duration: 9.2s; }
.steam-wisp:nth-child(5) { left: 62%; width: 84px;  height: 84px;  animation-delay: 5.6s; animation-duration: 7.8s; }

/* 5c. Interaction motion: price / badge fade when a value is revealed or filtered */
@keyframes value-fade { from { opacity: 0; } to { opacity: 1; } }
.price-flash { animation: value-fade 300ms ease both; }

/* 5d. Success checkmark draw-in (reservation, inquiry, newsletter) */
@keyframes draw-stroke { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: scale(1); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.check-draw path, .check-draw circle { stroke-dasharray: 100; animation: draw-stroke 700ms cubic-bezier(.65,0,.35,1) forwards; }
.check-draw circle { animation-delay: 60ms; animation-duration: 520ms; }
.check-pop { animation: pop-in 380ms cubic-bezier(.2,.8,.3,1.2) both; }
.rise-in { animation: rise-in 420ms ease both; }

/* 5e. Add-to-order tick */
@keyframes tick-pop {
  0% { transform: scale(.4); opacity: 0; }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); opacity: 1; }
}
.tick-pop { animation: tick-pop 420ms cubic-bezier(.2,.8,.3,1.2) both; }

/* 5f. Soft pulsing ring behind the live-review feed dot */
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(232, 56, 79, .55); }
  100% { box-shadow: 0 0 0 12px rgba(232, 56, 79, 0); }
}
.live-dot { animation: pulse-ring 2.2s ease-out infinite; }

/* 5g. Static brand glow behind feature blocks (decorative, no motion) */
.glow-citrus::before {
  content: ""; position: absolute; z-index: -1; inset: -18% -30% auto -18%; height: 58%;
  background: radial-gradient(60% 60% at 30% 40%, rgba(255, 182, 39, .55), rgba(255, 182, 39, 0) 70%);
  filter: blur(10px); pointer-events: none;
}
.glow-tomato::before {
  content: ""; position: absolute; z-index: -1; inset: auto -25% -22% auto; width: 55%; height: 70%;
  background: radial-gradient(60% 60% at 60% 50%, rgba(232, 56, 79, .40), rgba(232, 56, 79, 0) 70%);
  filter: blur(14px); pointer-events: none;
}
.has-glow { position: relative; z-index: 0; overflow: hidden; } /* clip the decorative glow at the card edge */

/* 5h. Order-portal "added" state (pairs with .tick-pop in js/main.js) */
.is-added { border-color: var(--basil-700) !important; color: var(--basil-700) !important; background: var(--basil-100) !important; }

/* 5g. Menu rows held back behind the "show those items" control.
       `display: none` keeps them out of the layout until revealed; the reveal
       itself is acknowledged by the `.price-flash` fade below. */
.menu-deferred > [data-deferred] { display: none; }

/* 5i. Hero scrim — a narrow, subtle gradient only where the copy sits, so the
       photography stays bright and high-key rather than muddy and dark. */
.hero-scrim {
  background:
    linear-gradient(to top, rgba(255, 248, 236, 0.97) 0%, rgba(255, 248, 236, 0.86) 26%, rgba(255, 248, 236, 0) 58%),
    linear-gradient(to right, rgba(34, 26, 23, 0.34) 0%, rgba(34, 26, 23, 0.05) 46%, rgba(34, 26, 23, 0) 70%);
}
@media (min-width: 1024px) {
  .hero-scrim {
    background:
      linear-gradient(105deg, rgba(255, 248, 236, 0.98) 0%, rgba(255, 248, 236, 0.92) 34%, rgba(255, 248, 236, 0.45) 52%, rgba(255, 248, 236, 0) 68%),
      linear-gradient(to top, rgba(255, 248, 236, 0.9) 0%, rgba(255, 248, 236, 0) 34%);
  }
}

/* ---------- 6. Lightbox (gallery) -------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90; background: rgba(20, 15, 13, 0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; visibility: hidden; transition: opacity 240ms ease, visibility 240ms ease;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: min(94vw, 1200px); max-height: 74vh; object-fit: contain; border-radius: 1rem;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8);
}
.lightbox-caption { color: var(--cream-50); text-align: center; margin-top: .9rem; font-size: .9375rem; max-width: 70ch; }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 999px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .35);
  transition: background-color 200ms ease;
}
.lb-btn:hover { background: var(--tomato-600); }
.lb-prev { left: max(1rem, env(safe-area-inset-left)); }
.lb-next { right: max(1rem, env(safe-area-inset-right)); }
.lb-close { top: 1rem; right: 1rem; transform: none; }

/* ---------- 7. Forms --------------------------------------------------- */
.field-label { display: block; font-weight: 600; font-size: .9375rem; margin-bottom: .4rem; }
.field {
  width: 100%; min-height: 48px; padding: .8rem .95rem;
  border: 2px solid var(--cream-200); border-radius: .85rem;
  background: #fff; color: var(--ink-900); font: inherit; font-size: 1rem;
  transition: border-color 200ms ease;
}
.field::placeholder { color: rgba(42, 33, 29, .45); }
.field:hover { border-color: var(--citrus-500); }
.field[aria-invalid="true"] { border-color: var(--tomato-600); background: #FFF4F5; }
.field-error {
  display: none; margin-top: .4rem; font-size: .875rem; font-weight: 500;
  color: var(--tomato-700); align-items: center; gap: .3rem;
}
.field-error svg { width: 15px; height: 15px; flex: none; }
.field[aria-invalid="true"] ~ .field-error { display: flex; }
.form-status { display: none; }
.form-status.is-visible { display: block; animation: rise-in 420ms ease both; }
.form-fields.is-hidden { display: none; }

/* ---------- 8. Masonry gallery (CSS multi-column) ---------------------- */
.masonry { column-gap: 1rem; column-count: 1; }
@media (min-width: 640px)  { .masonry { column-count: 2; column-gap: 1.1rem; } }
@media (min-width: 1024px) { .masonry { column-count: 3; column-gap: 1.25rem; } }
@media (min-width: 1440px) { .masonry { column-count: 4; } }
.masonry-item { break-inside: avoid; margin-bottom: 1rem; display: block; width: 100%; }
@media (min-width: 1024px) { .masonry-item { margin-bottom: 1.25rem; } }

/* ---------- 9. Reduced motion: switch the flourishes off --------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  /* the hero's food-specific motion is turned off, the photo stays crisp */
  .steam-field { display: none !important; }
  .ken-burns { animation: none !important; transform: none !important; }
  .live-dot { box-shadow: none !important; }
  .btn:hover, .group:hover .media img, .media:hover img { transform: none !important; }
  .price-flash, .check-draw path, .check-draw circle, .check-pop, .tick-pop, .rise-in, .form-status.is-visible {
    animation: none !important; opacity: 1 !important; transform: none !important; stroke-dashoffset: 0 !important;
  }
}




