/* =========================================================
   GUSTO Restaurant & Cafe — digital menu
   Brand: GUSTO Teal #056475 · charcoal · sand · off-white
   Typeface: CODEC PRO (brand) → fallback IBM Plex Sans Arabic + Outfit
   ========================================================= */

:root {
  --teal: #056475;
  --teal-700: #04525f;
  --teal-900: #0b3b45;
  --teal-300: #3a8c9b;
  --teal-200: #6cb6c3; /* teal for small text on dark surfaces (AA contrast) */
  --teal-glow: rgba(5, 100, 117, 0.35);

  --ink: #141a1c;
  --ink-800: #1b2225;
  --surface: #1e2629;
  --surface-raised: #26302f;
  --line: rgba(255, 255, 255, 0.08);

  --sand: #d4c4a8;
  --sand-200: #e8dfcf;
  --cream: #f2eee6;
  --gray: #8c8c8c;
  --text: var(--cream);
  --text-muted: #a9b1b3;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --font-ar: "Codec Pro", "IBM Plex Sans Arabic", "Outfit", system-ui, sans-serif;
  --font-en: "Codec Pro", "Outfit", "IBM Plex Sans Arabic", system-ui, sans-serif;

  --topbar-h: 60px;
  --nav-h: 56px;
  --search-h: 72px;
  --container: 1120px;
  --gutter: clamp(16px, 4vw, 32px);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html[dir="rtl"] {
  font-family: var(--font-ar);
}

html[dir="ltr"] {
  font-family: var(--font-en);
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* Controls that need menu data stay inert until data/menu.json has loaded. */
body:not(.is-ready) .venue-switch,
body:not(.is-ready) #search-toggle {
  pointer-events: none;
  opacity: 0.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--sand);
  outline-offset: 3px;
}

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Skip link: hidden until it receives keyboard focus, then shown above the sticky bar. */
.skip-link {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--sand);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
  opacity: 0;
}

.skip-link:focus-visible {
  transform: none;
  opacity: 1;
  outline-color: var(--cream);
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: rgba(20, 26, 28, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__logo {
  height: 34px;
  width: auto;
  opacity: 0.95;
}

.hero__logo,
.footer__logo,
.topbar__logo {
  object-fit: contain;
}

.topbar__spacer {
  flex: 1;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  min-width: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.16);
}

.icon-btn:active {
  transform: scale(0.97);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.search-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 39;
  height: var(--search-h); /* fixed so the category nav's sticky offset stays exact */
  display: flex;
  align-items: center;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

.search-bar__field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding-block: 4px;
  padding-inline: 16px 6px;
}

.search-bar__field svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex: none;
}

.search-bar__field input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  padding: 8px 0;
}

.search-bar__field input:focus {
  outline: none;
}

.search-bar__field input::placeholder {
  color: var(--text-muted);
}

.search-bar__clear {
  height: 34px;
  width: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-bar__clear svg {
  color: var(--text);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--teal) 0%, var(--teal-900) 48%, var(--ink) 100%);
  padding: clamp(28px, 6vw, 56px) 0 0;
  text-align: center;
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(to bottom, transparent, var(--ink));
  z-index: -1;
}

.waves {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.55;
}

.waves path {
  fill: none;
  stroke: var(--sand);
  stroke-width: 1.4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  /* Slow river drift. Each line has its own speed, so they slide in and out of phase like water. */
  animation: wave-drift var(--wave-duration, 34s) linear infinite;
  animation-delay: var(--wave-delay, 0s);
  will-change: transform;
}

.waves path:nth-child(1) { stroke-opacity: 0.35; --wave-duration: 30s; }
.waves path:nth-child(2) { stroke-opacity: 0.22; --wave-duration: 38s; --wave-delay: -9s; }
.waves path:nth-child(3) { stroke-opacity: 0.16; --wave-duration: 46s; --wave-delay: -19s; }
.waves path:nth-child(4) { stroke-opacity: 0.1;  --wave-duration: 56s; --wave-delay: -31s; }

/* One wave period is 960 user units, so the loop is seamless. px inside SVG = user units. */
@keyframes wave-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-960px); }
}

.hero__logo {
  width: clamp(180px, 42vw, 300px);
  height: auto;
  margin-inline: auto;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.35));
  animation: rise 0.7s ease-out both;
}

.hero__tagline {
  margin: 18px 0 4px;
  font-size: clamp(1.15rem, 3.4vw, 1.5rem);
  font-weight: 600;
  color: var(--sand-200);
  letter-spacing: 0.01em;
  animation: rise 0.7s 0.08s ease-out both;
}

.hero__subtitle {
  margin: 0 0 24px;
  color: rgba(242, 238, 230, 0.75);
  font-size: 0.95rem;
  animation: rise 0.7s 0.14s ease-out both;
}

.venue-switch {
  display: inline-flex;
  padding: 5px;
  background: rgba(20, 26, 28, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-bottom: 26px;
  position: relative;
  z-index: 2;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  animation: rise 0.7s 0.2s ease-out both;
}

.venue-switch button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.25s, color 0.25s;
}

.venue-switch button.is-active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 6px 18px var(--teal-glow);
}

/* ---------- category nav ---------- */

.category-nav {
  position: sticky;
  top: var(--topbar-h);
  z-index: 38;
  background: rgba(20, 26, 28, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.search-bar:not([hidden]) ~ .category-nav {
  top: calc(var(--topbar-h) + var(--search-h));
}

.search-bar:not([hidden]) ~ .menu .menu-section {
  scroll-margin-top: calc(var(--topbar-h) + var(--search-h) + var(--nav-h) + 8px);
}

.category-nav__scroller {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.category-nav__scroller::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  scroll-snap-align: start;
  appearance: none;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.chip:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
}

.chip.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

/* ---------- sections & cards ---------- */

.menu {
  padding: 8px 0 48px;
}

.menu-section {
  padding-top: 28px;
  scroll-margin-top: calc(var(--topbar-h) + var(--nav-h) + 8px);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  font-size: clamp(1.3rem, 3.6vw, 1.6rem);
  font-weight: 700;
  color: var(--cream);
}

.section-title .wave-icon {
  width: 44px;
  height: 12px;
  color: var(--teal-200);
  flex: none;
}

.grid {
  display: grid;
  gap: 12px;
}

.card {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 14px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: rgba(5, 100, 117, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.card__media {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--ink-800);
  aspect-ratio: 1 / 1;
  align-self: start;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card__media img {
  transform: scale(1.05);
}

.badge {
  position: absolute;
  inset-inline-start: 8px;
  top: 8px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--sand);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding-block: 2px;
  padding-inline: 0 4px;
}

.card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--cream);
}

.card__desc {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.card__pricing {
  margin-top: auto;
  padding-top: 6px;
}

.price {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.price__value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sand);
  white-space: nowrap;
}

.unit {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.variants {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.variant {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
}

.variant__label {
  color: var(--text-muted);
  position: relative;
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.variant__label::after {
  content: "";
  flex: 1;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.18);
  transform: translateY(-4px);
}

.variant__price {
  font-weight: 700;
  color: var(--sand);
  white-space: nowrap;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 16px;
  font-size: 1.05rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  padding: 10px 22px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--teal);
  color: #fff;
  font-weight: 600;
}

/* ---------- footer ---------- */

.footer {
  position: relative;
  margin-top: 24px;
  padding: 56px 0 32px;
  background: linear-gradient(to bottom, var(--ink), var(--teal-900) 140%);
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer__logo {
  width: 150px;
  height: auto; /* the img has width/height attributes; without this the height attr wins and squashes it */
  margin: 0 auto 14px;
  opacity: 0.95;
}

.footer__story {
  max-width: 560px;
  margin: 0 auto 26px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer__meta {
  display: grid;
  gap: 18px;
  margin: 0 auto 26px;
  max-width: 640px;
}

.footer__meta h3 {
  margin: 0 0 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--teal-200);
}

.footer__meta p {
  margin: 0;
  color: var(--cream);
}

.footer__meta p:empty {
  display: none;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.2s, border-color 0.2s;
}

.contact-link:hover {
  background: var(--teal);
  border-color: var(--teal);
}

.contact-link svg {
  width: 18px;
  height: 18px;
}

.footer__notes {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer__brand {
  margin: 0;
  color: var(--sand);
  font-weight: 600;
  font-size: 0.9rem;
}

.footer__copy {
  margin: 8px 0 0;
  color: var(--gray);
  font-size: 0.78rem;
}

/* ---------- dialog ---------- */

.item-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(92vw, 520px);
  width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
}

.item-dialog::backdrop {
  background: rgba(10, 14, 16, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.item-dialog__panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: var(--text);
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.item-dialog__panel img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--ink-800);
}

.item-dialog__body {
  padding: 18px 20px 22px;
  overflow: auto;
}

.item-dialog__body h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.item-dialog__body p {
  margin: 0 0 14px;
  color: var(--text-muted);
}

.item-dialog__body p:empty {
  display: none;
}

.item-dialog__close {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 26, 28, 0.75);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}

.item-dialog__close svg {
  width: 18px;
  height: 18px;
}

/* ---------- back to top ---------- */

.back-to-top {
  position: fixed;
  bottom: 18px;
  inset-inline-end: 18px;
  z-index: 35;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ---------- animation ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.menu-section {
  animation: rise 0.3s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- responsive ---------- */

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .card__media {
    aspect-ratio: 4 / 3;
  }

  .card__body {
    padding-block: 2px 6px;
    padding-inline: 4px;
  }

  .footer__meta {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  .hero {
    padding-top: 64px;
  }

  .topbar__logo {
    height: 40px;
  }
}

@media (min-width: 1280px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media print {
  .topbar,
  .search-bar,
  .category-nav,
  .back-to-top,
  .venue-switch,
  .card__media {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    grid-template-columns: 1fr;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .price__value,
  .variant__price,
  .card__title {
    color: #000;
  }
}
