/* Shared design tokens, fonts and components for the customer menu and the admin area. */

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('/assets/fonts/playfair-display-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/assets/fonts/nunito-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}
@font-face {
  font-family: 'Lora';
  src: url('/assets/fonts/lora-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --font-heading: var(--font-sans);
  --font-body: var(--font-sans);

  /* Accent is overwritten at runtime from the cafe's settings. */
  --accent: #d4a373;
  --on-accent: #1a1410;
  --accent-text-dark: #d9ad82;
  --accent-text-light: #8a5a2e;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 6px 20px rgb(0 0 0 / 0.06);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --gutter: 16px;
  --maxw: 760px;

  /* Light theme */
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f2eee8;
  --surface-3: #e9e3da;
  --border: #e6e0d7;
  --text: #1d1a17;
  --text-2: #5c544b;
  --text-3: #857c72;
  --accent-text: var(--accent-text-light);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --veg: #188a40;
  --nonveg: #c0392b;
  --egg: #c77a0a;
  --danger: #c0392b;
  --success: #188a40;
  --warning-bg: #fff4d6;
  --warning-text: #6b4e00;
  --overlay: rgb(20 16 12 / 0.5);
  --skeleton: #ece6dd;
  color-scheme: light;
}

html[data-theme='dark'] {
  --bg: #121110;
  --surface: #1c1a18;
  --surface-2: #262320;
  --surface-3: #312d29;
  --border: #36312c;
  --text: #f3efe9;
  --text-2: #bdb4a9;
  --text-3: #8f867c;
  --accent-text: var(--accent-text-dark);
  --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  --veg: #3cc46d;
  --nonveg: #f0645a;
  --egg: #f2a93b;
  --danger: #f0645a;
  --success: #3cc46d;
  --warning-bg: #3a2f10;
  --warning-text: #f5d98a;
  --overlay: rgb(0 0 0 / 0.62);
  --skeleton: #2a2724;
  color-scheme: dark;
}

html[data-font='elegant'] { --font-heading: 'Playfair Display', Georgia, serif; }
html[data-font='friendly'] {
  --font-heading: 'Nunito', var(--font-sans);
  --font-body: 'Nunito', var(--font-sans);
}
html[data-font='classic'] {
  --font-heading: 'Lora', Georgia, serif;
  --font-body: 'Lora', Georgia, serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.2; margin: 0; }
p { margin: 0; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }
dialog:not([open]) { display: none; }

/* Long words or links never push the page sideways. */
body { overflow-wrap: break-word; overflow-wrap: anywhere; }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: 6px;
}

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

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 8px 14px; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 15px; text-decoration: none;
  cursor: pointer; user-select: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-danger { color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn svg { width: 18px; height: 18px; flex: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.small { width: 32px; height: 32px; border: 0; background: transparent; }
.icon-btn.small svg { width: 16px; height: 16px; }

/* ---------- Diet markers (Indian veg / non-veg / egg symbol) ---------- */
.diet {
  --c: var(--veg);
  display: inline-grid; place-items: center; flex: none;
  width: 16px; height: 16px;
  border: 1.6px solid var(--c); border-radius: 3px;
}
.diet::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.diet-nonveg { --c: var(--nonveg); }
.diet-nonveg::after {
  width: 0; height: 0; border-radius: 0; background: none;
  border-left: 4.5px solid transparent; border-right: 4.5px solid transparent;
  border-bottom: 8px solid var(--c);
}
.diet-egg { --c: var(--egg); }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; line-height: 1.5;
  background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.tag-bestseller { background: var(--accent-soft); color: var(--accent-text); }
.tag-chefs_special { background: rgba(142, 107, 216, 0.18); color: #9c7ce6; }
html:not([data-theme='dark']) .tag-chefs_special { color: #6844b8; }
.tag-new { background: rgba(43, 155, 216, 0.18); color: #3aa8e4; }
html:not([data-theme='dark']) .tag-new { color: #12669a; }
.tag-spicy { background: rgba(229, 83, 60, 0.16); color: var(--nonveg); }

/* ---------- Bottom sheet / dialog ---------- */
dialog.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; max-height: min(92dvh, 900px);
  margin: auto auto 0; padding: 0;
  border: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface); color: var(--text);
  box-shadow: 0 -10px 40px rgb(0 0 0 / 0.3);
  overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-up 0.28s var(--ease); }
dialog.sheet::backdrop { background: var(--overlay); animation: fade-in 0.2s ease; }
@media (min-width: 640px) {
  dialog.sheet { margin: auto; border-radius: var(--radius-lg); }
  dialog.sheet[open] { animation: pop-in 0.22s var(--ease); }
}
.sheet-scroll { overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(6px);
}
.sheet-handle {
  width: 40px; height: 4px; border-radius: 4px; background: var(--surface-3);
  margin: 8px auto 0; flex: none;
}
@media (min-width: 640px) { .sheet-handle { display: none; } }

/* Fallback for browsers without <dialog> support (iOS < 15.4). */
dialog.sheet.sheet-fallback {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  box-shadow: 0 0 0 100vmax var(--overlay);
}
body.sheet-lock { overflow: hidden; }

@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop-in { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------- Toast ---------- */
.toast-region {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 1000;
  display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none;
}
.toast {
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--text); color: var(--bg);
  font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow);
  animation: pop-in 0.2s var(--ease); pointer-events: auto;
}
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Skeleton ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--skeleton); border-radius: 8px; }
.skeleton::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.08), transparent);
  animation: shimmer 1.4s infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}
