/* ==========================================================================
   MesaQR UI kit  (mesa-ui.css)
   Reusable components for every public page. Built ONLY on the Stitch tokens
   defined in stitch-theme.css (--stitch-*), so there is one palette, one radius
   scale and one shadow scale across the site. Uses logical properties
   (inline/block start/end) so the same rule serves Arabic (RTL) and English (LTR).
   Prefix: mq-  (never collides with Bootstrap or the Stitch homepage classes)
   ========================================================================== */

:root {
  --mq-container: 1200px;
  --mq-gutter: clamp(1rem, 4vw, 1.5rem);
  --mq-section-y: clamp(2.5rem, 6vw, 4.5rem);
  --mq-navbar-h: 70px;
  --mq-focus: 0 0 0 3px rgba(5, 150, 105, 0.28);
  --mq-danger: #dc2626;
  --mq-danger-soft: rgba(220, 38, 38, 0.08);
  --mq-info: #2563eb;
  --mq-info-soft: rgba(37, 99, 235, 0.08);
  --mq-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Page shell ---------------------------------------------------- */
.mq-page {
  background: var(--stitch-canvas);
  color: var(--stitch-text-primary);
  min-height: 60vh;
  padding-block-start: var(--mq-navbar-h);
}
.mq-container {
  width: 100%;
  max-width: var(--mq-container);
  margin-inline: auto;
  padding-inline: var(--mq-gutter);
}
.mq-container--narrow { max-width: 820px; }
.mq-section { padding-block: var(--mq-section-y); }
.mq-section--tight { padding-block: calc(var(--mq-section-y) * 0.6); }

/* Page header band (title + lead + breadcrumb) */
.mq-pagehead {
  background: var(--stitch-surface);
  border-block-end: 1px solid var(--stitch-border);
  padding-block: clamp(2rem, 5vw, 3.25rem);
}
.mq-pagehead__title {
  font-size: clamp(1.75rem, 4.2vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--stitch-text-primary);
}
.mq-pagehead__lead {
  margin: 0.75rem 0 0;
  max-width: 62ch;
  color: var(--stitch-text-secondary);
  font-size: 1.0625rem;
  line-height: 1.65;
}

/* Headings use the Stitch face (IBM Plex Sans / IBM Plex Sans Arabic) instead of the legacy Bootstrap heading stack */
.mq-pagehead__title, .mq-h2, .mq-h3, .mq-h4, .mq-empty__title, .mq-error-code { font-family: var(--stitch-font-sans); }
[dir="rtl"] .mq-pagehead__title, [dir="rtl"] .mq-h2, [dir="rtl"] .mq-h3, [dir="rtl"] .mq-h4, [dir="rtl"] .mq-empty__title, [dir="rtl"] .mq-error-code { font-family: var(--stitch-font-ar); line-height: 1.4; letter-spacing: 0; }
[dir="rtl"] .mq-prose, [dir="rtl"] .mq-text { line-height: 1.9; }

/* ---------- Typography ---------------------------------------------------- */
.mq-h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); font-weight: 700; line-height: 1.3; margin: 0 0 1rem; }
.mq-h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.35; margin: 0 0 0.75rem; }
.mq-h4 { font-size: 1.0625rem; font-weight: 700; line-height: 1.4; margin: 0 0 0.5rem; }
.mq-text { font-size: 1rem; line-height: 1.7; color: var(--stitch-text-secondary); }
.mq-small { font-size: 0.875rem; color: var(--stitch-text-secondary); }
.mq-caption { font-size: 0.75rem; color: var(--stitch-text-muted); }
.mq-muted { color: var(--stitch-text-muted); }

/* Long-form content (CMS pages, blog posts, privacy/terms) */
.mq-prose { font-size: 1.0625rem; line-height: 1.8; color: var(--stitch-text-secondary); max-width: 72ch; overflow-wrap: anywhere; }
.mq-prose > * + * { margin-block-start: 1.1em; }
.mq-prose h1, .mq-prose h2, .mq-prose h3, .mq-prose h4 { color: var(--stitch-text-primary); font-weight: 700; line-height: 1.3; margin-block: 1.8em 0.6em; }
.mq-prose h2 { font-size: 1.5rem; }
.mq-prose h3 { font-size: 1.25rem; }
.mq-prose a { color: var(--stitch-emerald-dark); text-decoration: underline; text-underline-offset: 3px; }
.mq-prose img, .mq-prose video, .mq-prose iframe { max-width: 100%; height: auto; border-radius: var(--stitch-radius-lg); }
.mq-prose ul, .mq-prose ol { padding-inline-start: 1.4em; }
.mq-prose blockquote { margin-inline: 0; padding-inline-start: 1rem; border-inline-start: 3px solid var(--stitch-emerald); color: var(--stitch-text-primary); }
.mq-prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.mq-prose th, .mq-prose td { border: 1px solid var(--stitch-border); padding: 0.55rem 0.75rem; text-align: start; }
.mq-prose--pre { white-space: pre-line; }

/* ---------- Breadcrumb ---------------------------------------------------- */
.mq-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; list-style: none; padding: 0; margin: 0 0 1rem; font-size: 0.875rem; color: var(--stitch-text-muted); }
.mq-breadcrumb li + li::before { content: "/"; margin-inline-end: 0.4rem; color: var(--stitch-border-strong); }
.mq-breadcrumb a { color: var(--stitch-text-secondary); text-decoration: none; }
.mq-breadcrumb a:hover { color: var(--stitch-emerald-dark); }
.mq-breadcrumb [aria-current="page"] { color: var(--stitch-text-primary); font-weight: 600; }

[dir="rtl"] .stitch-blog-arrow, [dir="rtl"] .mq-arrow-flip { transform: scaleX(-1); }
.stitch-blog-link { display: inline-flex; align-items: center; gap: 0.4rem; }
.stitch-blog-card:focus-within { box-shadow: var(--mq-focus); }

/* ---------- Cards --------------------------------------------------------- */
.mq-card {
  background: var(--stitch-surface);
  border: 1px solid var(--stitch-border);
  border-radius: var(--stitch-radius-lg);
  box-shadow: var(--stitch-shadow-subtle);
}
.mq-card__body { padding: clamp(1.25rem, 3vw, 2rem); }
.mq-card--hover { transition: transform 0.3s var(--mq-ease), box-shadow 0.3s var(--mq-ease), border-color 0.3s var(--mq-ease); }
.mq-card--hover:hover { transform: translateY(-3px); border-color: var(--stitch-border-strong); box-shadow: var(--stitch-shadow-elevated); }

.mq-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.mq-split { display: grid; gap: clamp(1.5rem, 4vw, 3rem); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 992px) { .mq-split { grid-template-columns: 1fr 1fr; } .mq-split--wide-start { grid-template-columns: 1.15fr 1fr; } }

/* ---------- Buttons (extends .stitch-btn from stitch-theme.css) ----------- */
.stitch-btn-outline { background: transparent; color: var(--stitch-text-primary) !important; border: 1px solid var(--stitch-border-strong); }
.stitch-btn-outline:hover { background: var(--stitch-surface-subtle); }
.stitch-btn-ghost { background: transparent; color: var(--stitch-text-secondary) !important; border: 1px solid transparent; }
.stitch-btn-ghost:hover { background: var(--stitch-surface-subtle); color: var(--stitch-text-primary) !important; }
.stitch-btn-danger { background: var(--mq-danger); color: var(--mq-on-dark, #fff) !important; border: 1px solid #b91c1c; }
.stitch-btn-danger:hover { background: #b91c1c; }
.stitch-btn:focus-visible, .mq-input:focus-visible, .mq-link:focus-visible { outline: none; box-shadow: var(--mq-focus); }
.stitch-btn[disabled], .stitch-btn.is-disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; transform: none; box-shadow: none; }
.stitch-btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.stitch-btn.is-loading::after { content: ""; position: absolute; inset: 50% auto auto 50%; width: 1.1rem; height: 1.1rem; margin: -0.55rem 0 0 -0.55rem; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: var(--mq-surface, #fff); border-radius: 50%; animation: mq-spin 0.7s linear infinite; }
.stitch-btn-secondary.is-loading::after, .stitch-btn-outline.is-loading::after { border-color: rgba(10, 13, 18, 0.25); border-top-color: var(--stitch-obsidian); }
.stitch-btn-block { width: 100%; }
@keyframes mq-spin { to { transform: rotate(360deg); } }
.mq-link { color: var(--stitch-emerald-dark); font-weight: 600; text-decoration: none; }
.mq-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Forms --------------------------------------------------------- */
.mq-field { margin-block-end: 1.15rem; }
.mq-label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--stitch-text-primary); margin-block-end: 0.4rem; }
.mq-input {
  display: block; width: 100%; min-height: 48px; padding: 0.7rem 1rem;
  font: inherit; font-size: 1rem; color: var(--stitch-text-primary);
  background: var(--mq-surface, #fff); border: 1px solid var(--stitch-border-strong); border-radius: var(--stitch-radius-md);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s; appearance: none;
}
textarea.mq-input { min-height: 140px; resize: vertical; line-height: 1.6; }
select.mq-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-inline-end: 2.5rem; }
[dir="rtl"] select.mq-input { background-position: left 1rem center; }
.mq-input::placeholder { color: var(--stitch-text-muted); }
.mq-input:hover { border-color: #9ca3af; }
.mq-input:focus { outline: none; border-color: var(--stitch-emerald-dark); box-shadow: var(--mq-focus); }
.mq-input:disabled { background: var(--stitch-surface-subtle); color: var(--stitch-text-muted); cursor: not-allowed; }
.mq-input.is-invalid { border-color: var(--mq-danger); }
.mq-input.is-invalid:focus { box-shadow: 0 0 0 3px rgb(var(--mq-rgb-danger, 220 38 38) / 0.2); }
.mq-input.is-valid { border-color: var(--stitch-emerald-dark); }
.mq-help { font-size: 0.8125rem; color: var(--stitch-text-muted); margin-block-start: 0.35rem; }
.mq-error { font-size: 0.8125rem; color: var(--mq-danger); margin-block-start: 0.35rem; }
.mq-check { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.9rem; color: var(--stitch-text-secondary); }
.mq-check input { margin-block-start: 0.25rem; accent-color: var(--stitch-emerald-dark); width: 1.05rem; height: 1.05rem; }

/* ---------- Alerts / badges / empty / pagination ------------------------- */
.mq-alert { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.9rem 1.1rem; border-radius: var(--stitch-radius-md); border: 1px solid; font-size: 0.9375rem; line-height: 1.5; margin-block-end: 1rem; }
.mq-alert--success { color: var(--mq-link, #065f46); background: var(--stitch-emerald-soft); border-color: rgb(var(--mq-rgb-primary-dark, 5 150 105) / 0.3); }
.mq-alert--warning { color: var(--mq-warning, #92400e); background: var(--stitch-amber-soft); border-color: rgb(var(--mq-rgb-accent, 245 158 11) / 0.35); }
.mq-alert--danger  { color: #991b1b; background: var(--mq-danger-soft); border-color: rgb(var(--mq-rgb-danger, 220 38 38) / 0.3); }
.mq-alert--info    { color: #1e40af; background: var(--mq-info-soft); border-color: rgb(var(--mq-rgb-info, 37 99 235) / 0.3); }
.mq-alert ul { margin: 0; padding-inline-start: 1.1rem; }

.mq-badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.65rem; border-radius: var(--stitch-radius-full); font-size: 0.75rem; font-weight: 600; line-height: 1.3; background: var(--stitch-surface-subtle); color: var(--stitch-text-secondary); }
.mq-badge--success { background: var(--stitch-emerald-soft); color: var(--stitch-emerald-dark); }
.mq-badge--warning { background: var(--stitch-amber-soft); color: #b45309; }
.mq-badge--danger  { background: var(--mq-danger-soft); color: var(--mq-danger); }
.mq-badge--dark    { background: var(--stitch-obsidian); color: var(--mq-on-dark, #fff); }

.mq-empty { text-align: center; padding: clamp(2.5rem, 7vw, 4.5rem) 1.5rem; background: var(--stitch-surface); border: 1px dashed var(--stitch-border-strong); border-radius: var(--stitch-radius-lg); }
.mq-empty__icon { width: 3.5rem; height: 3.5rem; margin: 0 auto 1rem; display: grid; place-items: center; border-radius: 50%; background: var(--stitch-emerald-soft); color: var(--stitch-emerald-dark); font-size: 1.4rem; }
.mq-empty__title { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.4rem; }
.mq-empty__text { margin: 0 auto 1.25rem; max-width: 46ch; color: var(--stitch-text-secondary); }

.mq-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; list-style: none; padding: 0; margin: 2.5rem 0 0; }
.mq-pagination .page-link, .mq-pagination a, .mq-pagination span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.5rem; height: 2.5rem; padding: 0 0.85rem;
  border: 1px solid var(--stitch-border); border-radius: var(--stitch-radius-md); background: var(--mq-surface, #fff); color: var(--stitch-text-primary);
  font-size: 0.9rem; font-weight: 600; text-decoration: none; transition: all 0.2s;
}
.mq-pagination a:hover { border-color: var(--stitch-emerald-dark); color: var(--stitch-emerald-dark); }
.mq-pagination .active > *, .mq-pagination .active .page-link { background: var(--stitch-obsidian); border-color: var(--stitch-obsidian); color: var(--mq-on-dark, #fff); }
.mq-pagination .disabled > *, .mq-pagination .disabled .page-link { opacity: 0.45; cursor: not-allowed; }
[dir="rtl"] .mq-pagination .mq-arrow { transform: scaleX(-1); }

/* ---------- Media ---------------------------------------------------------- */
.mq-media { position: relative; background: var(--stitch-surface-subtle); overflow: hidden; aspect-ratio: 16 / 10; }
.mq-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mq-media--hero { aspect-ratio: 21 / 9; border-radius: var(--stitch-radius-xl); }

/* ---------- Accessibility & motion --------------------------------------- */
.mq-skip { position: absolute; inset-inline-start: 1rem; inset-block-start: -4rem; z-index: 2000; background: var(--stitch-obsidian); color: var(--mq-on-dark, #fff); padding: 0.6rem 1rem; border-radius: var(--stitch-radius-md); }
.mq-skip:focus { inset-block-start: 0.75rem; }
.mq-page a:focus-visible, .mq-page button:focus-visible { outline: 2px solid var(--stitch-emerald-dark); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .mq-card--hover, .stitch-btn { transition: none !important; } .mq-card--hover:hover { transform: none; } .stitch-btn.is-loading::after { animation-duration: 2s; } }

/* ---------- Error pages --------------------------------------------------- */
.mq-error-page { min-height: 70vh; display: grid; place-items: center; padding: calc(var(--mq-navbar-h) + 2rem) var(--mq-gutter) 3rem; text-align: center; }
.mq-error-code { font-size: clamp(4rem, 14vw, 7rem); font-weight: 800; line-height: 1; letter-spacing: -0.04em; color: var(--mq-text, var(--stitch-obsidian)); }
.mq-error-code span { color: var(--stitch-emerald); }

/* ---------- Section sub-navigation (restaurant directory pages) ------------ */
.mq-subnav { background: var(--stitch-surface); border-block-end: 1px solid var(--stitch-border); }
.mq-subnav .mq-container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; }
.mq-subnav__list { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem; list-style: none; margin: 0; padding: 0; }
.mq-subnav__list a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.85rem; font-size: 0.875rem; font-weight: 600; color: var(--stitch-text-secondary); text-decoration: none; border-block-end: 2px solid transparent; }
.mq-subnav__list a:hover { color: var(--stitch-text-primary); }
.mq-subnav__list a.is-active { color: var(--stitch-text-primary); border-block-end-color: var(--stitch-emerald); }
.mq-subnav__cta { color: var(--stitch-emerald-dark) !important; }
@media (max-width: 575.98px) { .mq-subnav .mq-container { flex-direction: column; align-items: flex-start; } }

/* ---------- Accordion (FAQ) ------------------------------------------------ */
.mq-accordion { display: grid; gap: 0.75rem; }
.mq-accordion__item { overflow: hidden; }
.mq-accordion__title { margin: 0; font-size: 1rem; }
.mq-accordion__btn { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; padding: 1.1rem 1.25rem; background: transparent; border: 0; font: inherit; font-weight: 700; text-align: start; color: var(--stitch-text-primary); cursor: pointer; }
.mq-accordion__btn:hover { background: var(--stitch-surface-subtle); }
.mq-accordion__btn:focus-visible { outline: 2px solid var(--stitch-emerald-dark); outline-offset: -2px; }
.mq-accordion__icon { transition: transform 0.25s var(--mq-ease); color: var(--stitch-text-muted); flex: none; }
.mq-accordion__btn[aria-expanded="true"] .mq-accordion__icon { transform: rotate(180deg); }
.mq-accordion__panel { padding: 0 1.25rem 1.25rem; max-width: none; }
.mq-accordion__panel[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .mq-accordion__icon { transition: none; } }

/* storefront <picture> wrappers must not create an inline box around sized images */
picture { display: contents; }
