/*
 * Guest menu styles.
 *
 * The <html> element carries the restaurant's design:
 *   data-palette  ivory | noir | olive | bordeaux | slate
 *   data-type     classic | modern | elegant
 *   data-layout   classic | cards | showcase
 *   lang / dir    en / ltr or ar / rtl
 * Every visual decision below derives from those attributes.
 */

/* ---------- Palettes ---------- */

:root,
[data-palette="ivory"] {
  --paper: #f5efe3;
  --surface: #fbf7ef;
  --ink: #2b241d;
  --muted: #786c5e;
  --accent: #8e3b2b;
  --on-accent: #fbf7ef;
  --rule: #dccfba;
  color-scheme: light;
}

[data-palette="noir"] {
  --paper: #12110f;
  --surface: #1c1a17;
  --ink: #efe8da;
  --muted: #a0988a;
  --accent: #cda65e;
  --on-accent: #1a1610;
  --rule: #34302a;
  color-scheme: dark;
}

[data-palette="olive"] {
  --paper: #efefe6;
  --surface: #f8f8f2;
  --ink: #1f271d;
  --muted: #666e5e;
  --accent: #51693b;
  --on-accent: #f8f8f2;
  --rule: #d5d8c6;
}

[data-palette="bordeaux"] {
  --paper: #f7f0ec;
  --surface: #fdf9f6;
  --ink: #2a191c;
  --muted: #80696c;
  --accent: #762036;
  --on-accent: #fdf9f6;
  --rule: #e8d7d3;
}

[data-palette="slate"] {
  --paper: #f3f4f5;
  --surface: #ffffff;
  --ink: #15191d;
  --muted: #68717b;
  --accent: #1c5b57;
  --on-accent: #ffffff;
  --rule: #dee1e4;
}

:root {
  --placeholder: color-mix(in srgb, var(--ink) 6%, var(--surface));
  --shadow: 0 24px 48px -24px color-mix(in srgb, var(--ink) 35%, transparent);
  --gutter: 24px;
  --column: 680px;
  --nav-height: 54px;
  --bar-height: 60px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Typography ---------- */

[data-type="classic"] {
  --display: "Playfair Display", "Amiri", Georgia, serif;
  --body: "Lora", "Noto Naskh Arabic", Georgia, serif;
  --display-weight: 600;
  --display-spacing: 0;
  --scale: 1;
  --description-style: italic;
}

[data-type="modern"] {
  --display: "Manrope", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --body: "Manrope", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --display-weight: 700;
  --display-spacing: -0.02em;
  --scale: 0.92;
  --description-style: normal;
}

[data-type="elegant"] {
  --display: "Cormorant Garamond", "Reem Kufi", Georgia, serif;
  --body: "Jost", "Noto Kufi Arabic", system-ui, sans-serif;
  --display-weight: 600;
  --display-spacing: 0.005em;
  --scale: 1.12;
  --description-style: normal;
}

/* Arabic-script menus (Arabic, Kurdish, Persian) lead with the Arabic face of each pairing. */
[dir="rtl"][data-type="classic"] {
  --display: "Amiri", "Playfair Display", serif;
  --body: "Noto Naskh Arabic", "Lora", serif;
  --display-weight: 700;
}

[dir="rtl"][data-type="elegant"] {
  --display: "Reem Kufi", "Cormorant Garamond", serif;
  --body: "Noto Kufi Arabic", "Jost", sans-serif;
  --scale: 0.95;
}

[dir="rtl"] {
  --description-style: normal;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s ease, color 0.3s ease;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* Restaurant text orders itself by its own content (so an English dish
   keeps its full stop at the end on an Arabic menu) while aligning with
   the page's direction. */
[data-content] {
  unicode-bidi: plaintext;
}

/* Browsers resolve "start" per paragraph under plaintext, so align to the
   page's edge explicitly, keeping centred blocks centred. */
[dir="ltr"] [data-content] {
  text-align: left;
}

[dir="rtl"] [data-content] {
  text-align: right;
}

[data-layout="classic"] :is(.masthead, .section-header) [data-content],
.page-footer [data-content],
[data-content].notice {
  text-align: center;
}

.column {
  width: 100%;
  max-width: var(--column);
  margin-inline: auto;
}

.label {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.2;
}

[dir="rtl"] .label {
  font-size: 12.5px;
  letter-spacing: 0;
}

.display {
  font-family: var(--display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-spacing);
  line-height: 1.12;
  margin: 0;
}

.description {
  color: var(--muted);
  font-size: 14px;
  font-style: var(--description-style);
  line-height: 1.5;
  margin: 0;
}

[dir="rtl"] .description {
  line-height: 1.75;
}

.price {
  color: var(--accent);
  font-weight: 600;
  font-size: 15.5px;
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
}

/* A hairline with a small lozenge at its centre. */
.ornament {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 120px;
  margin-inline: auto;
}

.ornament::before,
.ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.ornament i {
  width: 6px;
  height: 6px;
  background: var(--accent);
  transform: rotate(45deg);
}

.photo {
  background: var(--placeholder);
  overflow: hidden;
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.photo img.loaded {
  opacity: 1;
}

/* ---------- Platform notice ---------- */

.notice {
  padding: 12px var(--gutter);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  text-align: center;
  line-height: 1.4;
}

/* ---------- Masthead ---------- */

.masthead {
  padding: 56px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  text-align: start;
}

[data-layout="classic"] .masthead {
  align-items: center;
  text-align: center;
}

.masthead h1 {
  font-size: calc(40px * var(--scale));
}

.masthead .tagline {
  margin-top: -2px;
}

.masthead .logo {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--rule);
  margin-bottom: 8px;
}

.masthead .logo .photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.masthead .accent-rule {
  width: 36px;
  height: 2px;
  background: var(--accent);
  margin-top: 12px;
}

.masthead .ornament {
  margin-top: 12px;
  width: 140px;
}

.cover {
  position: relative;
  height: 280px;
}

.cover .photo {
  position: absolute;
  inset: 0;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, color-mix(in srgb, var(--paper) 15%, transparent) 45%, var(--paper) 100%);
}

.cover + .masthead {
  padding-top: 0;
  margin-top: -44px;
  position: relative;
}

.top-action.start {
  inset-inline-start: 12px;
  inset-inline-end: auto;
}

.top-action {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  inset-inline-end: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--rule);
  font-weight: 600;
  font-size: 14px;
  backdrop-filter: blur(8px);
}

/* ---------- Signatures ---------- */

.signatures {
  padding-bottom: 20px;
}

.signatures .label {
  padding: 8px var(--gutter) 14px;
}

.signatures .strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 0 var(--gutter) 4px;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}

.signatures .strip::-webkit-scrollbar {
  display: none;
}

.signature {
  flex: 0 0 220px;
  text-align: start;
  scroll-snap-align: start;
}

.signature .photo {
  height: 160px;
  border-radius: 18px;
  margin-bottom: 12px;
}

.signature .name {
  font-weight: 600;
  font-size: 16.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Category navigation ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.3s ease;
}

.nav .tabs {
  display: flex;
  gap: 24px;
  height: var(--nav-height);
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav .tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  flex: none;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.tab::after {
  content: "";
  position: absolute;
  inset-inline-start: 50%;
  bottom: 8px;
  width: 24px;
  height: 2px;
  background: var(--accent);
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.25s var(--ease);
}

[dir="rtl"] .tab::after {
  transform: translateX(50%) scaleX(0);
}

.tab[aria-current="true"] {
  color: var(--ink);
  font-weight: 600;
}

.tab[aria-current="true"]::after {
  transform: translateX(-50%) scaleX(1);
}

[dir="rtl"] .tab[aria-current="true"]::after {
  transform: translateX(50%) scaleX(1);
}

/* ---------- Sections ---------- */

.sections {
  padding: 0 var(--gutter);
}

.section {
  scroll-margin-top: var(--nav-height);
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 36px 0 10px;
}

.section-header h2 {
  font-size: calc(28px * var(--scale));
}

[data-layout="classic"] .section-header {
  align-items: center;
  text-align: center;
  padding: 40px 0 12px;
  gap: 12px;
}

[data-layout="showcase"] .section-header {
  padding: 48px 0 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}

/* ---------- Items ---------- */

.item {
  display: block;
  width: 100%;
  text-align: start;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.item:active:not([disabled]) {
  transform: scale(0.985);
  opacity: 0.75;
}

.item[disabled] {
  cursor: default;
}

.item.sold-out {
  opacity: 0.5;
}

.item .name {
  font-weight: 600;
  font-size: 16.5px;
  line-height: 1.3;
}

.item .description {
  margin-top: 4px;
}

.item .marks {
  margin-top: 8px;
}

.qty {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

.sold-out-label {
  color: var(--muted);
}

/* Classic: name, dotted leader, price — as in print. */
[data-layout="classic"] .item {
  display: flex;
  gap: 16px;
  padding: 14px 0;
}

[data-layout="classic"] .item .text {
  flex: 1;
  min-width: 0;
}

[data-layout="classic"] .item .line {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

[data-layout="classic"] .item .line .name {
  max-width: 70%;
}

[data-layout="classic"] .item .leader {
  flex: 1;
  min-width: 12px;
  height: 2px;
  margin-bottom: 7px;
  background-image: radial-gradient(circle, var(--rule) 0.9px, transparent 1.1px);
  background-size: 5px 2px;
  background-repeat: repeat-x;
}

[data-layout="classic"] .item .photo {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 12px;
}

/* Cards: a soft card with the photo beside the text. */
[data-layout="cards"] .item {
  display: flex;
  gap: 14px;
  margin: 12px 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
  border-radius: 20px;
}

[data-layout="cards"] .item .text {
  flex: 1;
  min-width: 0;
  padding: 2px 4px 0;
  display: flex;
  flex-direction: column;
}

[data-layout="cards"] .item .description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-layout="cards"] .item .footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
}

[data-layout="cards"] .item .photo {
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: 14px;
}

/* Showcase: a wide photograph with the dish set beneath it. */
[data-layout="showcase"] .item {
  padding: 16px 0;
}

[data-layout="showcase"] .item .photo {
  aspect-ratio: 16 / 10;
  border-radius: 20px;
  margin-bottom: 16px;
}

[data-layout="showcase"] .item .line {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

[data-layout="showcase"] .item .name {
  flex: 1;
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: calc(22px * var(--scale));
  letter-spacing: var(--display-spacing);
  line-height: 1.15;
}

[data-layout="showcase"] .item .price {
  padding-bottom: 2px;
}

/* ---------- Footer & empty states ---------- */

.page-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px var(--gutter) calc(40px + env(safe-area-inset-bottom));
  color: var(--muted);
  text-align: center;
}

.page-footer .ornament {
  width: 80px;
}

.page-footer .label {
  color: var(--muted);
}

body.has-bar .page-footer {
  padding-bottom: calc(40px + var(--bar-height) + 24px + env(safe-area-inset-bottom));
}

.message {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px;
  text-align: center;
}

.message h1 {
  font-size: calc(24px * var(--scale));
}

.message .description {
  max-width: 340px;
}

.empty-menu {
  padding: 80px var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.empty-menu h2 {
  font-size: calc(22px * var(--scale));
  text-align: center;
}

.noscript {
  padding: 40px;
  text-align: center;
}

/* ---------- Order bar ---------- */

.order-bar {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 6;
  max-width: calc(var(--column) - 32px);
  margin-inline: auto;
  height: var(--bar-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-radius: 18px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: var(--shadow);
  transform: translateY(calc(100% + 40px));
  transition: transform 0.35s var(--ease);
}

.order-bar.visible {
  transform: none;
}

.order-bar .count {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--on-accent) 16%, transparent);
}

.order-bar .title {
  flex: 1;
  text-align: start;
}

/* ---------- Sheets ---------- */

.sheet {
  width: 100%;
  max-width: 640px;
  max-height: calc(100dvh - 24px);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
}

.sheet::backdrop {
  background: rgb(0 0 0 / 0.42);
  backdrop-filter: blur(2px);
}

.sheet[open] {
  animation: sheet-in 0.38s var(--ease);
}

.sheet[open]::backdrop {
  animation: fade-in 0.3s ease;
}

.sheet.closing {
  animation: sheet-out 0.22s ease forwards;
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
}

@keyframes sheet-out {
  to { transform: translateY(100%); }
}

@keyframes fade-in {
  from { opacity: 0; }
}

@media (min-width: 700px) {
  .sheet {
    margin: auto;
    border-radius: 28px;
  }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  margin: 12px auto 4px;
  border-radius: 2px;
  background: var(--rule);
}

.sheet-photo {
  aspect-ratio: 16 / 10;
}

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 24px calc(24px + env(safe-area-inset-bottom));
}

.sheet-body h2 {
  font-size: calc(26px * var(--scale));
}

.sheet-body .item-title {
  font-size: calc(22px * var(--scale));
}

.sheet-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--rule);
  z-index: 1;
}

.field {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--placeholder);
  color: var(--ink);
  font: inherit;
  resize: none;
}

.field::placeholder {
  color: var(--muted);
}

.field:focus {
  outline: none;
  border-color: var(--accent);
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  align-items: center;
}

/* On narrow phones the button drops below the stepper rather than truncate. */
.actions .button {
  flex: 1 1 240px;
}

.button {
  flex: 1;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.15s ease;
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.button.quiet {
  flex: none;
  min-height: 44px;
  background: none;
  color: var(--accent);
  align-self: center;
}

.stepper {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.stepper button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
}

.stepper button:disabled {
  border-color: var(--rule);
  opacity: 0.45;
  cursor: default;
}

.stepper output {
  width: 44px;
  text-align: center;
  font-weight: 600;
  font-size: 18px;
}

.review-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}

.review-line .text {
  flex: 1;
  min-width: 0;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
}

.total-row .price {
  font-size: 18px;
}

.error {
  color: var(--accent);
  font-size: 14px;
}

/* ---------- Order tracking ---------- */

.order-card {
  padding: 20px;
  border-radius: 20px;
  background: var(--paper);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.order-card .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.track {
  display: flex;
  align-items: center;
}

.track .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--rule);
  background: var(--surface);
  transition: all 0.4s ease;
}

.track .dot.on {
  border-color: var(--accent);
  background: var(--accent);
}

.track .bar {
  flex: 1;
  height: 1.5px;
  background: var(--rule);
  transition: background 0.4s ease;
}

.track .bar.on {
  background: var(--accent);
}

.status-title {
  font-weight: 600;
  font-size: 16.5px;
}

.order-lines {
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.order-lines div {
  display: flex;
  gap: 10px;
}

.order-lines .count {
  color: var(--muted);
  min-width: 28px;
}

.confirmation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding-top: 8px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Language choice ---------- */

.language-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.language-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--rule);
  background: var(--paper);
  font-size: 16px;
  font-weight: 500;
}

.language-option[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
