/* ============================================================
   Way-Trix — the diner-facing menu
   Built to read on a tablet in a leather folder, in daylight:
   ivory panels floating over the venue photo, maroon accents.
   ============================================================ */

:root{
  --ivory:        #f3efe6;
  --ivory-warm:   #ebe4d6;
  --ink:          #2a2622;
  --ink-soft:     #6b635a;
  --accent:       #8e2727;
  --accent-soft:  #b04a3d;
  --gold:         #b9945a;

  /* rgb triplets so alpha variants can follow the branding colour */
  --accent-rgb:   142,39,39;
  --ink-rgb:      42,38,34;
  --ivory-rgb:    243,239,230;

  /* the venue photograph, swapped per restaurant by theme.js */
  /* Neutral by default. A restaurant supplies its own in its theme;
     inheriting another restaurant's photograph would be a leak. */
  --venue-image:    linear-gradient(160deg, #2a2622 0%, #14110f 100%);
  --venue-position: center 62%;

  --panel:        rgba(var(--ivory-rgb),.94);
  --panel-quiet:  rgba(var(--ivory-rgb),.86);
  --hairline:     rgba(var(--ink-rgb),.14);

  --radius:       2px;
  --gutter:       clamp(14px, 3.2vw, 26px);
  --topbar-h:     clamp(60px, 9vh, 82px);

  /* text-size control multiplies this */
  --scale:        1;

  --sans:  'Jost', 'Segoe UI', system-ui, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --arabic:'Noto Kufi Arabic', 'Segoe UI', sans-serif;

  color-scheme: dark;
}

*{ box-sizing: border-box; }
[hidden]{ display: none !important; }

html, body{
  height: 100%;
  margin: 0;
}

body{
  font-family: var(--sans);
  font-size: calc(16px * var(--scale));
  color: var(--ink);
  background: #14110f;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

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

/* ---------- backdrop ---------------------------------------- */

.backdrop{
  position: fixed;
  inset: 0;
  z-index: 0;
}
/* The photo is cropped to the terrace itself — the skyline is context,
   not the subject — so it is held low and never scaled past 1:1. */
.backdrop-img{
  position: absolute;
  inset: 0;
  background: var(--venue-image) var(--venue-position) / cover no-repeat;
}
/* On a tall, narrow screen `cover` fits the height and there is no vertical
   slack left to position with — so oversize it deliberately and push the
   framing down onto the terrace. */
@media (max-aspect-ratio: 3/4){
  .backdrop-img{
    background-size: auto 140%;
    background-position: center 74%;
  }
}
.backdrop-scrim{
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(14,12,10,.52) 0%, rgba(14,12,10,.14) 24%, rgba(14,12,10,.18) 60%, rgba(14,12,10,.60) 100%);
}

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

.topbar{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
}
/* keeps the title legible as cards scroll beneath it */
.topbar::before{
  content: '';
  position: absolute;
  inset: 0 0 -22px;
  z-index: -1;
  background: linear-gradient(180deg, rgba(14,12,10,.72) 0%, rgba(14,12,10,.46) 55%, rgba(14,12,10,0) 100%);
  opacity: 0;
  transition: opacity .25s ease;
}
body:not([data-screen="home"]) .topbar::before{ opacity: 1; }
body[data-screen="home"] .topbar{ pointer-events: none; }
body[data-screen="home"] .topbar .back,
body[data-screen="home"] .page-title{ opacity: 0; visibility: hidden; }
body[data-screen="home"] .tools{ pointer-events: auto; }

.icon-btn, .tool{
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(var(--ivory-rgb),.18);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  color: #fff;
  transition: background .18s ease, transform .18s ease, opacity .2s ease;
}
.icon-btn:active, .tool:active{ transform: scale(.94); }
.icon-btn:hover, .tool:hover{ background: rgba(var(--ivory-rgb),.32); }

.icon-btn{
  width: 40px; height: 40px;
  border-radius: 50%;
  flex: none;
}
.icon-btn svg{
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.page-title{
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.35rem, 4.4vw, 2.1rem);
  letter-spacing: .10em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tools{
  flex: none;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(20,17,15,.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tool{
  width: 38px; height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  backdrop-filter: none;
}
.tool svg{
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.tool .aa{ font-size: .95rem; letter-spacing: -.02em; }
.tool .aa small{ font-size: .7em; }
.tool .lang-label{ font-family: var(--arabic); font-size: .95rem; }
.tool[aria-pressed="true"]{ background: rgba(var(--ivory-rgb),.9); color: var(--accent); }

/* ---------- screens ----------------------------------------- */

#app{
  position: relative;
  z-index: 10;
  min-height: 100%;
  padding: calc(var(--topbar-h) + 6px) var(--gutter) 84px;
}
.screen[hidden]{ display: none; }
.screen{ animation: rise .38s cubic-bezier(.22,.7,.3,1) both; }

@keyframes rise{
  from{ opacity: 0; transform: translateY(14px); }
  to  { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce){
  .screen{ animation: none; }
}

/* ---------- landing ----------------------------------------- */

.home{
  min-height: calc(100svh - var(--topbar-h) - 90px);
  display: grid;
  place-items: center;
}
.home-inner{
  width: min(460px, 100%);
  text-align: center;
}
.home-logo{
  display: block;
  width: min(260px, 66%);
  margin: 0 auto clamp(22px, 5vh, 46px);
  filter: drop-shadow(0 4px 22px rgba(0,0,0,.5));
}
.home-card{
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0,0,0,.42), 0 2px 0 rgba(255,255,255,.18) inset;
  overflow: hidden;
}
.home-link{
  display: block;
  width: 100%;
  padding: clamp(15px, 2.6vh, 22px) 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: clamp(.92rem, 2.9vw, 1.05rem);
  font-weight: 300;
  letter-spacing: .20em;
  text-transform: uppercase;
  transition: background .2s ease, color .2s ease;
}
.home-link + .home-link{ border-top: 1px solid rgba(var(--accent-rgb),.42); }
.home-link:hover{ background: rgba(var(--accent-rgb),.06); color: var(--accent); }
.home-link:active{ background: rgba(var(--accent-rgb),.12); }

.home-foot{
  margin: clamp(18px, 4vh, 30px) 0 0;
  color: rgba(255,255,255,.72);
  font-size: .72rem;
  font-weight: 300;
  letter-spacing: .26em;
  text-transform: uppercase;
  text-shadow: 0 1px 10px rgba(0,0,0,.6);
}

/* ---------- grids ------------------------------------------- */

.grid{
  display: grid;
  gap: clamp(9px, 1.8vw, 14px);
  grid-template-columns: repeat(2, 1fr);
  padding-bottom: 8px;
}
@media (min-width: 620px){ .grid{ grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1020px){ .grid{ grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1440px){ .grid{ grid-template-columns: repeat(5, 1fr); } }

/* a full-width label that splits a grid into named bands */
.band{
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: clamp(10px, 2.4vw, 20px) 0 2px;
  color: #fff;
  font-size: .74rem;
  font-weight: 300;
  letter-spacing: .28em;
  text-transform: uppercase;
  text-shadow: 0 1px 12px rgba(0,0,0,.7);
}
.band::after{
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,.45), rgba(255,255,255,0));
}
.grid > .band:first-child{ margin-top: 0; }

/* ---------- cards ------------------------------------------- */

.card{
  position: relative;
  display: flex;
  flex-direction: column;
  border: 0;
  padding: 0;
  text-align: center;
  background: var(--panel-quiet);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0,0,0,.34);
  overflow: hidden;
  transition: transform .2s cubic-bezier(.2,.8,.3,1), box-shadow .2s ease;
}
.card:hover{ transform: translateY(-2px); box-shadow: 0 16px 36px rgba(0,0,0,.42); }
.card:active{ transform: scale(.985); }

/* photo half (only rendered when the item has an image) */
.card-photo{
  aspect-ratio: 4 / 3;
  background: #cfc7b8 center / cover no-repeat;
}

/* no photo → an ivory tile carrying the category's line mark */
.card-plate{
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,.6), rgba(255,255,255,0) 70%),
    linear-gradient(160deg, var(--ivory) 0%, var(--ivory-warm) 100%);
  border-bottom: 1px solid var(--hairline);
}
.card-plate svg{
  width: clamp(38px, 13vw, 58px);
  height: auto;
  fill: none;
  stroke: rgba(var(--accent-rgb),.55);
  stroke-width: 1.05;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* an item with no photograph: no image slot, just a printed-menu tile */
.card--plain{
  background: var(--ivory);
  border-top: 2px solid rgba(var(--accent-rgb),.55);
}
.card--plain .card-body{
  min-height: clamp(96px, 20vw, 128px);
  padding: clamp(14px, 3vw, 20px) clamp(10px, 2.4vw, 16px);
}
.card--plain .card-name{ font-size: clamp(.72rem, 2.5vw, .84rem); }
.card--plain .card-price{
  margin-top: 8px;
  font-size: clamp(.82rem, 2.9vw, .95rem);
}

.card-body{
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: clamp(10px, 2.2vw, 15px) clamp(8px, 2vw, 14px);
  background: var(--ivory);
}
.card-name{
  font-size: clamp(.68rem, 2.35vw, .8rem);
  font-weight: 400;
  letter-spacing: .12em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--ink);
}
.card-ar{
  font-family: var(--arabic);
  font-size: clamp(.66rem, 2.2vw, .76rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink-soft);
  direction: rtl;
}
.card-note{
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.card-price{
  margin-top: 2px;
  font-size: clamp(.7rem, 2.3vw, .8rem);
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--accent);
}
.card-price .cur{ font-size: .82em; opacity: .8; }

.card-chev{
  margin-top: 4px;
  font-size: .62rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(var(--accent-rgb),.62);
}

/* price table rows (wine & spirits) */
.card-prices{
  display: flex;
  justify-content: center;
  gap: clamp(8px, 2.4vw, 18px);
  margin-top: 4px;
}
.card-prices > div{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 42px;
}
.card-prices dt{
  font-size: .54rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.card-prices dd{
  margin: 0;
  font-size: clamp(.68rem, 2.2vw, .78rem);
  color: var(--accent);
}
.card-prices dd.empty{ color: rgba(107,99,90,.45); }

/* tags — an item may carry several, so they live in a group */
.badges{
  position: absolute;
  top: 8px; right: 8px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: calc(100% - 16px);
}
.badge{
  padding: 3px 8px 2px;
  border-radius: 999px;
  font-size: .52rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  background: var(--accent);       /* overridden inline by the tag's colour */
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.badge--more{ background: rgba(var(--ink-rgb),.55); letter-spacing: .04em; }

/* with no photo to sit on, the tags take their own line above the name */
.card--plain .badges{
  position: static;
  justify-content: center;
  margin: clamp(11px, 2.4vw, 15px) auto -4px;
}

/* calories: present but never competing with the price */
.kcal{
  margin-top: 3px;
  font-size: .58rem;
  font-weight: 300;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.detail-kcal{
  margin: 6px 0 0;
  font-size: .68rem;
  font-weight: 300;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.detail .badges{
  top: 14px; right: 14px;
}

/* ---------- item detail ------------------------------------- */

.detail{
  display: grid;
  justify-items: center;
}
.detail-card{
  width: min(620px, 100%);
  background: var(--ivory);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  overflow: hidden;
}
.detail-photo{
  aspect-ratio: 4 / 3;
  background: #cfc7b8 center / cover no-repeat;
}
.detail-plate{
  aspect-ratio: 16 / 6;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,.6), rgba(255,255,255,0) 70%),
    linear-gradient(160deg, var(--ivory) 0%, var(--ivory-warm) 100%);
  border-bottom: 1px solid var(--hairline);
}
.detail-plate svg{
  width: clamp(54px, 14vw, 74px);
  height: auto;
  fill: none;
  stroke: rgba(var(--accent-rgb),.5);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.detail-body{
  padding: clamp(22px, 5vw, 38px) clamp(20px, 5vw, 44px) clamp(26px, 6vw, 44px);
  text-align: center;
}
.detail-name{
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 5.2vw, 1.85rem);
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink);
}
.detail-ar{
  margin: 8px 0 0;
  font-family: var(--arabic);
  font-size: clamp(.9rem, 3.6vw, 1.05rem);
  color: var(--ink-soft);
  direction: rtl;
}
.detail-price{
  margin: 14px 0 0;
  font-size: clamp(.95rem, 3.6vw, 1.1rem);
  letter-spacing: .1em;
  color: var(--accent);
}
.detail-rule{
  width: 54px; height: 1px;
  margin: clamp(16px, 3.4vw, 24px) auto;
  background: rgba(var(--accent-rgb),.4);
}
.detail-desc{
  margin: 0 auto;
  max-width: 46ch;
  font-size: clamp(.82rem, 3.1vw, .92rem);
  font-weight: 300;
  line-height: 1.75;
  color: var(--ink-soft);
}
.detail-note{
  margin: 14px 0 0;
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.detail-addons{
  margin: clamp(18px, 4vw, 28px) auto 0;
  max-width: 340px;
  border-top: 1px solid var(--hairline);
}
.detail-addons div{
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--hairline);
  font-size: .8rem;
  font-weight: 300;
}
.detail-addons span:last-child{ color: var(--accent); }

.detail-table{
  width: 100%;
  margin-top: clamp(16px, 3.6vw, 24px);
  border-collapse: collapse;
  font-size: .82rem;
  font-weight: 300;
}
.detail-table th{
  padding: 0 0 8px;
  font-size: .6rem;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: right;
}
.detail-table th:first-child{ text-align: left; }
.detail-table td{
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
  text-align: right;
  color: var(--accent);
}
.detail-table td:first-child{
  text-align: left;
  color: var(--ink);
  letter-spacing: .04em;
}

/* ---------- search ------------------------------------------ */

.search-sheet{
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) var(--gutter) 0;
  background: rgba(16,13,11,.72);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  animation: fade .2s ease both;
}
@keyframes fade{ from{ opacity: 0 } to{ opacity: 1 } }

.search-field{
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--ivory);
  box-shadow: 0 12px 34px rgba(0,0,0,.4);
}
.search-field > svg{
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: var(--ink-soft); stroke-width: 1.7;
  stroke-linecap: round;
}
.search-field input{
  flex: 1;
  min-width: 0;
  padding: 14px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: .95rem;
  font-weight: 300;
  color: var(--ink);
  outline: none;
}
.search-field input::-webkit-search-cancel-button{ display: none; }
.search-close{
  display: grid; place-items: center;
  width: 30px; height: 30px; flex: none;
  border: 0; border-radius: 50%;
  background: rgba(var(--ink-rgb),.08);
}
.search-close svg{
  width: 15px; height: 15px;
  fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round;
}

.search-results{
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 14px;
  padding-bottom: 30px;
}
.result{
  display: flex;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 7px;
  border: 0;
  border-radius: var(--radius);
  text-align: left;
  background: var(--panel-quiet);
}
.result:hover{ background: var(--ivory); }
.result-main{ flex: 1; min-width: 0; }
.result-name{
  font-size: .84rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
}
.result-path{
  margin-top: 3px;
  font-size: .66rem;
  font-weight: 300;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.result-price{ flex: none; font-size: .84rem; color: var(--accent); }
.search-empty{
  padding: 40px 10px;
  text-align: center;
  color: rgba(255,255,255,.66);
  font-size: .82rem;
  font-weight: 300;
  letter-spacing: .1em;
}

/* ---------- loading / failure ------------------------------- */

/* Nothing paints until a restaurant has actually loaded, so a slow network
   shows an empty stage rather than a half-branded flash of the wrong menu. */
body:not([data-ready]) .screen,
body:not([data-ready]) .byline{ visibility: hidden; }

.load-state{
  display: grid;
  place-items: center;
  min-height: 60svh;
  padding: 0 var(--gutter);
  text-align: center;
  color: rgba(255,255,255,.76);
  font-size: .85rem;
  font-weight: 300;
  letter-spacing: .12em;
  text-shadow: 0 1px 10px rgba(0,0,0,.6);
}

/* ---------- byline ------------------------------------------ */

.byline{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: .58rem;
  font-weight: 300;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
  background: linear-gradient(180deg, rgba(14,12,10,0), rgba(14,12,10,.55));
  pointer-events: none;
}
.byline strong{ font-weight: 400; color: rgba(255,255,255,.78); }

/* ---------- arabic mode ------------------------------------- */

body[data-rtl] .card-name,
body[data-rtl] .detail-name,
body[data-rtl] .page-title,
body[data-rtl] .band{
  font-family: var(--arabic);
  text-transform: none;
  letter-spacing: 0;
}
body[data-rtl] .card-name,
body[data-rtl] .detail-name{ direction: rtl; }
body[data-rtl] .card-ar,
body[data-rtl] .detail-ar{
  font-family: var(--sans);
  direction: ltr;
  text-transform: uppercase;
  letter-spacing: .1em;
}
body[data-rtl] .home-link span{
  font-family: var(--arabic);
  letter-spacing: 0;
  text-transform: none;
  font-size: 1.05em;
}
body[data-rtl] .grid{ direction: rtl; }
body[data-rtl] .card{ direction: rtl; }
body[data-rtl] .topbar{ flex-direction: row-reverse; }
body[data-rtl] .icon-btn.back svg{ transform: scaleX(-1); }
body[data-rtl] .page-title{ text-align: right; }
body[data-rtl] .band{ flex-direction: row-reverse; }
body[data-rtl] .band::after{
  background: linear-gradient(270deg, rgba(255,255,255,.45), rgba(255,255,255,0));
}

/* Restaurants without a logo show their name instead of an empty space. */
.home-name{
  margin: 0 auto clamp(22px, 5vh, 46px);
  font-family: var(--serif);
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0,0,0,.6);
}
.home-name:empty{ display: none; }
