/* =========================================================================
   Flava Catering — shared interaction layer
   Component styles for behaviors wired up in assets/site.js.
   Relies on the design tokens (--navy, --blue, --orange, …) each page
   already declares in its inline :root block.
   ========================================================================= */

/* ---------- Scroll progress bar ---------- */
.scroll-progress {
  position: fixed;
  inset: 0 auto auto 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--blue), var(--orange));
  z-index: 60;
  transition: width 0.08s linear;
  will-change: width;
}

/* ---------- Sticky header: solidify + lift on scroll ---------- */
.site-header {
  transition: box-shadow 0.25s ease, background 0.25s ease, padding 0.25s ease;
}
.site-header.scrolled {
  background: rgba(244, 247, 252, 0.98);
  box-shadow: 0 6px 24px -14px rgba(0, 43, 92, 0.5);
}

/* ---------- Reveal stagger (delay set inline by JS) ---------- */
.reveal { transition-delay: var(--reveal-delay, 0s); }

/* ---------- Scrollspy: active in-page nav link ---------- */
.primary-nav a.active { color: var(--blue); }
.primary-nav a.active::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 3px;
  border-radius: 2px;
  background: var(--orange);
  animation: navUnderline 0.25s ease;
}
@keyframes navUnderline { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (max-width: 960px) {
  .primary-nav a.active::after { display: none; }
}

/* ---------- Back-to-top button ---------- */
.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px) scale(0.9);
  pointer-events: none;
  z-index: 55;
  box-shadow: 0 8px 24px -8px rgba(0, 43, 92, 0.55);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--orange); }
.to-top svg { width: 20px; height: 20px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(0, 20, 44, 0.88);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img {
  max-width: min(1040px, 92vw);
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 24px 70px -24px rgba(0, 0, 0, 0.7);
  transform: scale(0.96);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.lightbox.open img { transform: scale(1); }
.lightbox figcaption {
  color: #fff;
  font-family: var(--serif);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
  font-size: 1.25rem;
  text-align: center;
}
.lb-btn {
  position: absolute;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.lb-btn:hover { background: var(--orange); border-color: var(--orange); }
.lb-close { top: clamp(1rem, 3vw, 2rem); right: clamp(1rem, 3vw, 2rem); }
.lb-prev { left: clamp(0.5rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }
.lb-next { right: clamp(0.5rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
  .lb-prev { top: auto; bottom: clamp(1rem, 4vw, 2rem); left: 25%; transform: none; }
  .lb-next { top: auto; bottom: clamp(1rem, 4vw, 2rem); right: 25%; transform: none; }
}

/* Make lightbox-able images announce themselves */
[data-lightbox] { cursor: zoom-in; }

/* ---------- Filter chips (menu) ---------- */
/* Sticky category nav — jumps to each food section, nothing is hidden */
.filter-bar {
  position: sticky;
  top: 0; /* JS sets exact offset below the sticky header */
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  padding: clamp(0.7rem, 2vw, 1rem) var(--pad);
  background: rgba(244, 247, 252, 0.97);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.menu-section.first.has-filter { padding-top: clamp(2.5rem, 6vw, 4rem); }
.chip {
  font: 600 0.78rem/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.6rem 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip:active { transform: scale(0.96); }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Dish filtering animation */
.dish.is-hidden { display: none; }
.dish.filtering { animation: dishIn 0.4s ease both; }
@keyframes dishIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Menu order builder: per-dish controls ---------- */
.dish-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.85rem;
  width: 100%;
}
.size-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}
.size-toggle button {
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.42rem 0.7rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.size-toggle button.active { background: var(--blue); color: #fff; }
.size-toggle .price { font-variant-numeric: tabular-nums; }
.add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: 600 0.74rem/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--blue);
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}
.add-btn:hover { background: var(--blue); color: #fff; }
.add-btn.added { background: var(--orange); border-color: var(--orange); color: #fff; }
.add-btn:active { transform: scale(0.95); }

/* ---------- Order tray (fixed) ---------- */
.tray {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 110%);
  width: min(560px, calc(100% - 1.5rem));
  background: var(--navy);
  color: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -12px 40px -16px rgba(0, 20, 44, 0.8);
  z-index: 58;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
.tray.visible { transform: translate(-50%, 0); }
.tray-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  cursor: pointer;
  user-select: none;
}
.tray-head .tray-icon { font-size: 1.15rem; }
.tray-head .tray-summary { flex: 1; font-weight: 600; letter-spacing: 0.02em; }
.tray-head .tray-summary small {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-soft);
}
.tray-head .tray-total { font-family: var(--serif); font-size: 1.5rem; color: var(--orange); }
.tray-head .chevron { transition: transform 0.25s ease; opacity: 0.7; }
.tray.open .tray-head .chevron { transform: rotate(180deg); }
.tray-body {
  max-height: 0;
  overflow-y: auto;
  transition: max-height 0.3s ease;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.tray.open .tray-body { max-height: min(48vh, 420px); }
.tray-list { list-style: none; margin: 0; padding: 0.5rem 0.5rem 0; }
.tray-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
}
.tray-item + .tray-item { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.tray-item .ti-name { font-size: 0.9rem; line-height: 1.3; }
.tray-item .ti-name span {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.stepper { display: inline-flex; align-items: center; gap: 0.5rem; }
.stepper button {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.stepper button:hover { background: var(--orange); border-color: var(--orange); }
.stepper .qty { min-width: 1.2ch; text-align: center; font-variant-numeric: tabular-nums; }
.tray-item .ti-price { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--orange-soft); }
.tray-foot {
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem 1rem 1rem;
}
.tray-foot .btn { flex: 1; justify-content: center; }
.tray-foot .btn-send { background: var(--orange); color: #fff; }
.tray-foot .btn-send:hover { background: var(--orange-2); }
.tray-foot .btn-clear {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.85);
}
.tray-foot .btn-clear:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- Contact form: inline validation + success ---------- */
.field-error {
  display: none;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #ffb4a2;
}
.inquiry-form label.invalid .field-error { display: block; }
.inquiry-form label.invalid input,
.inquiry-form label.invalid select,
.inquiry-form label.invalid textarea {
  border-color: #ff8a6a;
  background: rgba(255, 138, 106, 0.08);
}
.form-success {
  margin: 1.5rem auto 0;
  max-width: 42ch;
  text-align: center;
  padding: 1.75rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  animation: dishIn 0.45s ease both;
}
.form-success .check {
  width: 52px; height: 52px;
  margin: 0 auto 0.75rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 1.6rem;
}
.form-success h3 { color: #fff; margin-bottom: 0.4rem; }
.form-success p { color: rgba(255, 255, 255, 0.8); margin: 0; }
.order-prefill-note {
  margin: 0 0 1rem;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--orange);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  text-align: left;
}

/* ---------- Bar estimator (bartending) ---------- */
.estimator {
  max-width: 620px;
  margin: 0 auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.estimator-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.estimator label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font: 600 0.74rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.estimator .range-value { color: var(--blue); font-size: 0.95rem; }
.estimator input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue) var(--fill, 30%), var(--line) var(--fill, 30%));
  cursor: pointer;
}
.estimator input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--orange);
  border: 3px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.estimator input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
}
.estimate-out {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1.25rem 0 0.25rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.estimate-out div strong {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 600;
  color: var(--orange);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.estimate-out div span {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.estimator .est-note {
  margin: 1.25rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}
.estimator .btn-request {
  display: inline-flex;
  margin: 1.25rem auto 0;
  background: var(--blue);
  color: #fff;
}
.estimator .btn-request:hover { background: var(--navy); }
.estimator-cta { text-align: center; }

/* cocktail select toggle (bartending) */
.cocktail-select {
  margin-top: 0.7rem;
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--blue);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.cocktail-select:hover { border-color: var(--blue); }
.cocktail-select.selected { background: var(--orange); border-color: var(--orange); color: #fff; }

@media (max-width: 540px) {
  .estimator-inputs { grid-template-columns: 1fr; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 200%);
  background: var(--ink);
  color: #fff;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(0, 20, 44, 0.6);
  z-index: 90;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.show { transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .scroll-progress, .to-top, .lightbox img, .tray, .toast,
  .dish.filtering, .form-success { transition: none !important; animation: none !important; }
}
