/*
 * Go Menu — Elementor Widget  v1.4.0
 * Frontend Stylesheet
 *
 * New in 1.4:
 *   • Sub-category header blocks (gm-subcat-*)
 *   • Image focal-point via inline object-position (no CSS change needed)
 *   • Full tab & sub-cat colour/typography now driven by Elementor selectors
 */

/* Google Fonts are enqueued separately as their own <link> tag (see
   get_style_depends() in class-go-menu-grid.php / frontend_styles() in
   go-menu-widget.php) instead of an @import here. @import forces the
   browser to fetch and parse that stylesheet before it can continue
   parsing the rest of this file — a real render-blocking cost — where a
   normal <link> can be fetched in parallel with everything else. */

/* ── CSS custom properties ─────────────────────────────────────────────── */
.elementor-widget-go-menu-grid {
  --gm-green:      #1a4a2e;
  --gm-green-mid:  #2d6a4a;
  --gm-green-lt:   rgba(26,74,46,0.08);
  --gm-gold:       #c8962a;
  --gm-gold-lt:    rgba(200,150,42,0.12);
  --gm-cream:      #f5f0e8;
  --gm-white:      #ffffff;
  --gm-ink:        #1c1c1c;
  --gm-muted:      #6b7280;
  --gm-border:     #e5e0d8;
  --gm-radius:     16px;
  --gm-radius-sm:  10px;
  --gm-shadow:     0 2px 12px rgba(0,0,0,0.07);
  --gm-shadow-lg:  0 8px 40px rgba(0,0,0,0.13);
  --gm-font-head:  'Playfair Display', Georgia, serif;
  --gm-font-body:  'Inter', system-ui, sans-serif;
  --gm-transition: 0.22s ease;
}

/* ── Widget shell ──────────────────────────────────────────────────────── */
.gm-menu-widget {
  position: relative;
  background-color: var(--gm-cream);
  border-radius: var(--gm-radius);
  padding: 0;
  font-family: var(--gm-font-body);
  overflow: hidden;
}
.gm-bg-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.gm-menu-widget__content {
  position: relative;
  z-index: 1;
}

/* ════════════════════════════════════════════════════════════════
   CATEGORY TABS
   ════════════════════════════════════════════════════════════════ */
.gm-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1.5px solid var(--gm-border);
  padding: 0 2px;
  margin-bottom: 24px;
  background: transparent;
}
.gm-tabs::-webkit-scrollbar { display: none; }

.gm-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: var(--gm-font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gm-muted);
  background: none;
  border: none;
  padding: 14px 18px 12px;
  cursor: pointer;
  position: relative;
  transition: color var(--gm-transition), background-color var(--gm-transition);
  flex-shrink: 0;
  /* Active underline drawn with ::after */
}
.gm-tab::after {
  content: '';
  position: absolute;
  bottom: -1.5px;
  left: 0;
  right: 0;
  height: 2.5px;
  background: transparent;
  border-radius: 2px 2px 0 0;
  transition: background var(--gm-transition);
}
/* hover/active colours are Elementor-selector driven; these are sensible
   fallbacks so the widget works out-of-the-box before any customisation */
.gm-tab:hover  { color: var(--gm-green); }
.gm-tab.active { color: var(--gm-gold); }
.gm-tab.active::after { background: var(--gm-gold); }

.gm-tab__num  { font-size: 10px; opacity: 0.6; }
.gm-tab__icon { font-size: 13px; line-height: 1; }

/* ════════════════════════════════════════════════════════════════
   GRID SHELL
   (.gm-grid is now just a flex column of gm-subcat-blocks;
    column layout lives in .gm-subcat-items injected per-widget)
   ════════════════════════════════════════════════════════════════ */
.gm-grid {
  display: flex;
  flex-direction: column;
}

/* ════════════════════════════════════════════════════════════════
   SUB-CATEGORY BLOCKS
   ════════════════════════════════════════════════════════════════ */

/* The entire block (header + item grid) — hidden by JS when no
   visible cards remain after a category-tab filter */
.gm-subcat-block {
  display: block; /* toggled to none by JS */
}
.gm-subcat-block + .gm-subcat-block {
  margin-top: 32px; /* overridden by Elementor selector */
}

/* Header row */
.gm-subcat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background-color: var(--gm-cream);
  border-left: 4px solid var(--gm-green);
  border-radius: 10px;
  margin-bottom: 16px;
  color: var(--gm-green);
  font-family: var(--gm-font-body);
  /* justify-content driven by Elementor alignment control */
}

.gm-subcat-header__icon {
  font-size: 20px;
  line-height: 1;
  color: inherit; /* overridden by Elementor color control */
  flex-shrink: 0;
}

.gm-subcat-header__label {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

/* Item grid inside a sub-cat block */
.gm-subcat-items {
  display: grid;
  gap: 16px; /* overridden by Elementor slider */
  /* grid-template-columns injected per widget via inline <style> */
}

/* Hidden helper used by JS to hide individual cards */
.gm-card.gm--hidden { display: none; }

/* ════════════════════════════════════════════════════════════════
   CARD
   ════════════════════════════════════════════════════════════════ */
.gm-card {
  background: var(--gm-white);
  border-radius: var(--gm-radius);
  overflow: hidden;
  transition: transform var(--gm-transition), box-shadow var(--gm-transition);
  display: flex;
  flex-direction: column;
}
.gm-card--shadow { box-shadow: var(--gm-shadow); }
.gm-card:hover   { transform: translateY(-3px); box-shadow: var(--gm-shadow-lg); }

/* ── Image area ─────────────────────────────────────────────────── */
.gm-card__img-wrap {
  position: relative;
  height: 220px;        /* fallback only — each widget instance sets its own
                            Desktop/Tablet/Mobile height via inline <style> */
  overflow: hidden;
  background: var(--gm-cream);
  flex-shrink: 0;
}
.gm-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* object-position set inline per-item from focal-point sliders */
  transition: transform 0.4s ease;
  display: block;
}
.gm-card:hover .gm-card__img { transform: scale(1.04); }

.gm-card__img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gm-border, #d8d0c0);
  background: var(--gm-cream);
}

/* ── Badge ──────────────────────────────────────────────────────── */
.gm-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--gm-font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  pointer-events: none;
}
.gm-badge--star      { background: var(--gm-gold); }
.gm-badge--protein   { background: var(--gm-green); }
.gm-badge--signature { background: #7c3aed; }

/* ── Card body ──────────────────────────────────────────────────── */
.gm-card__body {
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.gm-card__name {
  font-family: var(--gm-font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--gm-ink);
  margin: 0 0 4px;
  line-height: 1.35;
}
.gm-card__desc {
  font-size: 11px;
  color: var(--gm-muted);
  font-style: italic;
  margin: 0 0 8px;
  line-height: 1.4;
}

/* ── Footer (price + button) ────────────────────────────────────── */
.gm-card__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}
.gm-card__pricing {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.gm-card__price {
  font-family: var(--gm-font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--gm-green);
  line-height: 1;
}
.gm-card__meta {
  font-size: 11px;
  color: var(--gm-muted);
  font-weight: 400;
  line-height: 1.2;
}
.gm-card__add {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--gm-gold);
  background: none;
  color: var(--gm-gold);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--gm-transition), color var(--gm-transition),
              border-color var(--gm-transition), transform var(--gm-transition);
  padding: 0;
}
.gm-card__add:hover {
  background: var(--gm-gold);
  color: #fff;
  transform: rotate(90deg) scale(1.1);
}

/* ════════════════════════════════════════════════════════════════
   MODAL (Premium Modal Box vendor + Go Menu overrides)
   ════════════════════════════════════════════════════════════════ */
.gm-modal__loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}
.gm-modal__loader.gm--hidden { display: none; }

.gm-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--gm-border);
  border-top-color: var(--gm-green);
  border-radius: 50%;
  animation: gmSpin 0.75s linear infinite;
}
@keyframes gmSpin { to { transform: rotate(360deg); } }

.gm-modal__body { padding: 0; min-height: 80px; }
.gm-modal__error {
  padding: 48px 32px;
  text-align: center;
  font-size: 14px;
  color: var(--gm-muted);
  line-height: 1.6;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .gm-tab { font-size: 10px; padding: 12px 12px 10px; }
  .gm-subcat-header__label { font-size: 14px; }
}
@media (max-width: 599px) {
  .gm-card__body      { padding: 10px 10px 9px; }
  .gm-card__name      { font-size: 12px; }
  .gm-card__price     { font-size: 12px; }
  .gm-card__meta      { font-size: 10px; }
  .gm-card__add       { width: 24px; height: 24px; font-size: 14px; }
  /* .gm-card__img-wrap height is no longer hard-coded here — each widget
     instance now sets its own Desktop/Tablet/Mobile frame heights (see the
     "Image / Frame Height" controls) via an inline <style> block scoped to
     that widget, at these same breakpoints. See widgets/class-go-menu-grid.php render(). */
  .gm-subcat-header   { padding: 10px 14px; gap: 8px; }
  .gm-subcat-header__label { font-size: 13px; }
  .gm-subcat-header__icon  { font-size: 16px; }
}

/* ════════════════════════════════════════════════════════════════
   ELEMENTOR TEMPLATE CONTENT RESET
   ════════════════════════════════════════════════════════════════ */
.gm-modal__body .elementor { margin: 0; }
.gm-modal__body .elementor-section-wrap { padding: 0; }

/* ══════════════════════════════════════════════════════════════
   v1.5 additions:
   · Frame-based image rendering (pan/zoom transform)
   · Description show/hide
   ══════════════════════════════════════════════════════════════ */

/* Frame: the wrap clips; the img always fills the fixed frame via
   object-fit:cover FIRST — regardless of the original photo's size or
   aspect ratio, this guarantees every item image renders at the same
   consistent size with no gaps and no distortion, with no cropping of
   the original file and no need for a second, pre-cropped image.
   The admin's pan/zoom/rotate (from the Frame Editor) is then applied as
   a transform on top of that cover-fitted baseline. */
.gm-card__img-wrap {
  /* overflow: hidden is already set in base rule */
  position: relative;
  background: #f0ede6;
}

.gm-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;   /* baseline: always fills the frame, any image size */
  object-position: center;
  /* inline style provides: transform: translate(X%,Y%) scale(S) rotate(Rdeg);
                             transform-origin: center center;
     X/Y are percentages of the frame's own rendered size (not raw px), so
     the same numeric values reproduce an identical crop no matter how big
     the frame actually is on screen — this is what the Frame Editor shows. */
  /* DO NOT add transition here — causes lag while editing in the frame editor */
}

/* Description hidden via Elementor control */
.gm-card__desc[style*="display:none"],
.gm-desc-hidden .gm-card__desc { display: none !important; }

/* Card hover colour transitions for typography controls */
.gm-card__name,
.gm-card__desc,
.gm-card__price,
.gm-card__meta {
  transition: color 0.2s ease;
}
