/* =========================================================
   Borj Dhiafa — Menu digital
   Palette tirée du logo : bordeaux profond + ivoire + or
   ========================================================= */

:root {
  --bordeaux-900: #5c0d24;
  --bordeaux: #9b1a38;
  --bordeaux-600: #b23752;
  --bordeaux-100: #f5e4e8;
  --gold: #c6a15b;
  --gold-soft: #e7d5ab;
  --ivoire: #fbf5ec;
  --ivoire-2: #f4ead9;
  --ink: #2a1a1c;
  --ink-soft: #6f5c5e;
  --line: #e8dcd0;
  --white: #ffffff;

  --font-display: "Cormorant Garamond", serif;
  --font-body: "Jost", sans-serif;

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 10px 24px -12px rgba(92, 13, 36, 0.28);
  --shadow-pop: 0 20px 50px -18px rgba(42, 26, 28, 0.45);

  --phone-w: 430px;
  --phone-h: min(932px, 100dvh);
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bordeaux-900);
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  display: block;
}
button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hidden {
  display: none !important;
}

/* ===================== STAGE =====================
   On mobile: the stage IS the phone (full-bleed).
   On larger screens: the app stays locked at a phone width,
   centered in a decorative backdrop — "always opens like mobile". */
.stage {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(
      1200px 800px at 15% 10%,
      rgba(155, 26, 56, 0.55),
      transparent 60%
    ),
    radial-gradient(
      1000px 700px at 90% 90%,
      rgba(198, 161, 91, 0.25),
      transparent 55%
    ),
    var(--bordeaux-900);
}

.stage-bg {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.stage-bg__arch {
  position: absolute;
  border: 1px solid rgba(231, 213, 171, 0.18);
  border-bottom: none;
  border-radius: 280px 280px 0 0;
}
.stage-bg__arch--1 {
  width: 900px;
  height: 620px;
  top: -60px;
}
.stage-bg__arch--2 {
  width: 700px;
  height: 480px;
  top: -40px;
  border-color: rgba(231, 213, 171, 0.28);
}
.stage-bg__caption {
  position: absolute;
  bottom: 38px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--gold-soft);
  font-size: 13px;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

/* ===================== PHONE FRAME ===================== */
.phone {
  position: relative;
  width: var(--phone-w);
  height: var(--phone-h);
  border-radius: 38px;
  overflow: hidden;
  background: var(--ivoire);
  box-shadow: var(--shadow-pop);
  border: 8px solid #241014;
  isolation: isolate;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--ivoire);
}

/* ===================== TOP BAR ===================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px 12px;
  background: linear-gradient(180deg, var(--bordeaux-900), var(--bordeaux));
  color: var(--ivoire);
  flex: 0 0 auto;
  position: relative;
  z-index: 5;
}
.topbar__brand {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar__brand img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ivoire);
  border: 1.5px solid var(--gold-soft);
}
.topbar__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  overflow: hidden;
}
.topbar__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__subtitle {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-soft);
}
.iconbtn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--ivoire);
  flex: 0 0 auto;
}
.iconbtn:active {
  background: rgba(255, 255, 255, 0.12);
}
.iconbtn--light {
  color: var(--ink);
}

/* ===================== SCREENS ===================== */
.screens {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  background: var(--ivoire);
}
.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 28px;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--ivoire);
}
.screen.is-active {
  transform: translateX(0);
}
.screen.is-behind {
  transform: translateX(-28%);
}
#screen-home.screen {
  transform: translateX(0);
}

.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ink-soft);
}
.loader__arch {
  width: 46px;
  height: 46px;
  border: 3px solid var(--bordeaux-100);
  border-top-color: var(--bordeaux);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px;
  text-align: center;
  color: var(--ink-soft);
}

/* ===================== HOME SCREEN ===================== */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 34px 26px 10px;
  min-height: 100%;
  background: radial-gradient(
      420px 260px at 50% 0%,
      var(--bordeaux-100),
      transparent 65%
    ),
    var(--ivoire);
}
.home__arch {
  width: 132px;
  height: 132px;
  /*border-radius: 50%;*/
  /*background: var(--white);*/
  display: flex;
  align-items: center;
  justify-content: center;
  /*box-shadow: var(--shadow-card);*/
  /*border: 1px solid var(--line);*/
  margin-bottom: 18px;
  overflow: hidden;
}
.home__arch img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}
.home__title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  color: var(--bordeaux-900);
  margin: 0 0 2px;
}
.home__subtitle {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 6px;
}
.home__tagline {
  font-family: var(--font-display);
  color: var(--bordeaux);
  font-size: 18px;
  direction: rtl;
  margin: 0 0 22px;
}
.home__divider {
  width: 64px;
  height: 1px;
  background: var(--gold);
  position: relative;
  margin: 6px 0 22px;
}
.home__divider::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--gold);
}
.home__cta {
    text-align: -webkit-center;
  width: 100%;
  max-width: 280px;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 22px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}
.btn--primary {
  background: linear-gradient(135deg, var(--bordeaux), var(--bordeaux-900));
  color: var(--ivoire);
  box-shadow: 0 12px 22px -10px rgba(155, 26, 56, 0.55);
}
.btn--primary:active {
  transform: scale(0.98);
}
.btn--ghost {
  background: var(--white);
  color: var(--bordeaux);
  border: 1px solid var(--bordeaux-100);
}

.home__shortcuts {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 26px;
}
.shortcut {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-card);
}
.shortcut img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 10px;
}
.shortcut span {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}

.home__stars {
  margin-top: 24px;
  display: flex;
  gap: 4px;
  color: var(--gold);
}
.home__stars svg {
  width: 14px;
  height: 14px;
  fill: var(--gold);
  stroke: none;
}

/* ===================== HEADER (sub-screens) ===================== */
.screen-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  position: sticky;
  top: 0;
  background: var(--ivoire);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.back-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bordeaux);
  flex: 0 0 auto;
}
.screen-head__titles {
  min-width: 0;
}
.screen-head__eyebrow {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 1px;
}
.screen-head__title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--bordeaux-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================== CATEGORY LIST (level 1) ===================== */
.cat-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cat-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 132px;
  box-shadow: var(--shadow-card);
  isolation: isolate;
}
.cat-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cat-card::after {
  content: "";
  position: absolute;
  inset: 0;

}
.cat-card__body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 16px;
  color: var(--ivoire);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
background: linear-gradient(
    0deg,
    rgba(28, 10, 17, 0.86) 0%,
    rgba(28, 10, 17, 0.25) 55%,
    rgba(28, 10, 17, 0.05) 100%
  );
}
.cat-card__name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}
.cat-card__count {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--gold-soft);
  text-transform: uppercase;
}
.cat-card__arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.cat-card__arrow svg {
  width: 16px;
  height: 16px;
  stroke: var(--ivoire);
}

/* ===================== SUBCATEGORY LIST (level 2) ===================== */
.subcat-list {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.subcat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-card);
}
.subcat-row__img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--ivoire-2);
}
.subcat-row__body {
  flex: 1;
  min-width: 0;
}
.subcat-row__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
  color: var(--ink);
}
.subcat-row__count {
  font-size: 11.5px;
  color: var(--ink-soft);
}
.subcat-row__chevron {
  color: var(--bordeaux);
  flex: 0 0 auto;
}
.subcat-row__chevron svg {
  width: 16px;
  height: 16px;
}

/* ===================== ITEM LIST (level 3) ===================== */
.item-list {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.item-row {
  display: flex;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.item-row:last-child {
  border-bottom: none;
}
.item-row__img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--ivoire-2);
}
.item-row__body {
  flex: 1;
  min-width: 0;
}
.item-row__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.item-row__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.25;
}
.item-row__price {
  font-size: 14px;
  font-weight: 600;
  color: var(--bordeaux);
  white-space: nowrap;
}
.item-row__price::after {
  content: " DT";
  font-size: 10.5px;
  font-weight: 500;
  color: var(--gold);
}
.item-row__desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13.5px;
}

/* ===================== INFO SCREEN ===================== */
.info-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.info-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-card);
}
.info-card svg {
  color: var(--bordeaux);
  flex: 0 0 auto;
  margin-top: 2px;
}
.info-card h4 {
  margin: 0 0 3px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--bordeaux-900);
}
.info-card p,
.info-card a {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ===================== TAB BAR ===================== */
.tabbar {
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--white);
  padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 8px);
  flex: 0 0 auto;
  z-index: 5;
}
.tabbar__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--ink-soft);
}
.tabbar__btn svg {
  width: 20px;
  height: 20px;
}
.tabbar__btn span {
  font-size: 10px;
  letter-spacing: 0.03em;
}
.tabbar__btn.is-active {
  color: var(--bordeaux);
}

/* ===================== DRAWER ===================== */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 8, 12, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 20;
}
.overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.drawer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 82%;
  max-width: 320px;
  background: var(--ivoire);
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 21;
  display: flex;
  flex-direction: column;
  box-shadow: 20px 0 40px rgba(0, 0, 0, 0.3);
}
.drawer.is-open {
  transform: translateX(0);
}
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px 16px;
  background: linear-gradient(135deg, var(--bordeaux-900), var(--bordeaux));
}
.drawer__head img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ivoire);
  border: 1.5px solid var(--gold-soft);
}
.drawer__label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 8px;
}
.drawer__lang {
  padding: 16px 16px 6px;
}
.lang-switch {
  display: flex;
  gap: 6px;
}
.lang-switch__btn {
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.lang-switch__btn.is-active {
  background: var(--bordeaux);
  color: var(--ivoire);
  border-color: var(--bordeaux);
}

.drawer__nav {
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.drawer__nav button {
  text-align: left;
  padding: 11px 8px;
  border-radius: 10px;
  font-size: 14.5px;
  color: var(--ink);
}
.drawer__nav button:active {
  background: var(--bordeaux-100);
}

.drawer__info {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.drawer__row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.drawer__row svg {
  width: 17px;
  height: 17px;
  color: var(--bordeaux);
  flex: 0 0 auto;
  margin-top: 1px;
}

.drawer__follow {
  padding: 16px;
}
.drawer__social {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.drawer__social a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bordeaux);
}
.drawer__social svg {
  width: 17px;
  height: 17px;
}

/* ===================== ITEM DETAIL SHEET ===================== */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 8, 12, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 29;
}
.sheet-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(430px, 100vw);
  transform: translate(-50%, 100%);
  background: var(--ivoire);
  border-radius: 24px 24px 0 0;
  z-index: 30;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 78dvh;
  overflow-y: auto;
  padding-bottom: 24px;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.35);
}
.sheet.is-open {
  transform: translate(-50%, 0);
}
.sheet__handle {
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 12px auto 6px;
}
.sheet__img {
  width: 100%;
  height: 180px;
  background-size: cover;
  background-position: center;
  background-color: var(--ivoire-2);
}
.sheet__body {
  padding: 18px 20px 4px;
}
.sheet__body h3 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--bordeaux-900);
  margin: 0 0 8px;
}
.sheet__body p {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 14px;
}
.sheet__price {
  display: inline-block;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(135deg, var(--bordeaux), var(--bordeaux-900));
  padding: 8px 18px;
  border-radius: 999px;
}
.sheet__price::after {
  content: " DT";
  font-weight: 500;
  font-size: 11px;
  color: var(--gold-soft);
}

/* ===================== RESPONSIVE ===================== */
/* Below phone width: true full-bleed mobile (no frame border) */
@media (max-width: 480px) {
  .stage {
    padding: 0;
  }
  .phone {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}

/* Above phone width: show the decorative backdrop, keep app phone-sized */
@media (min-width: 481px) {
  .stage-bg {
    display: flex;
  }
  .stage {
    padding: 40px;
  }
}

@media (min-width: 900px) {
  .stage-bg__caption {
    display: block;
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .screen,
  .drawer,
  .overlay,
  .sheet,
  .sheet-overlay {
    transition: none;
  }
}

/* Focus visibility for keyboard users */
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
