/* ───────── Fonts (self-hosted, no external requests) ───────── */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("../fonts/cormorant-garamond-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("../fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }

/* ───────── Tokens ───────── */
:root {
  --plum-950: #170822;
  --plum-800: #210E2E;
  --plum-700: #2E1840;
  --plum-600: #3B2350;
  --gold-200: #F6E7BC;
  --gold-300: #F1DCA0;
  --gold-400: #DCBF7C;
  --gold-500: #C9A25A;
  --gold-700: #8E6B2E;
  --cream: #F3EADB;
  --mist: #A99BB4;
  --line: rgba(201, 162, 90, .38);
  --line-soft: rgba(201, 162, 90, .18);

  --fa: "Vazirmatn", Tahoma, system-ui, sans-serif;
  --en: "Cormorant Garamond", Georgia, "Times New Roman", serif;

  --gold-text: linear-gradient(180deg, var(--gold-200) 0%, var(--gold-500) 62%, #A9823F 100%);
  --bar-h: 52px;
  --gutter: 16px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 8px); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--fa);
  font-size: 16px;
  line-height: 1.6;
  color: var(--cream);
  background:
    radial-gradient(110% 520px at 50% 0%, #3A2240 0%, rgba(58, 34, 64, 0) 70%),
    var(--plum-800);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-300); outline-offset: 3px; border-radius: 6px; }

.en, [lang="en"] { font-family: var(--en); font-style: italic; }

/* ───────── Hero: the iwan ───────── */
.hero { padding: 28px var(--gutter) 0; }
.iwan {
  position: relative;
  width: min(78vw, 340px);
  aspect-ratio: 320 / 400;
  margin: 0 auto;
}
.iwan-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.iwan-line path { fill: none; stroke: url(#goldStroke); stroke-linecap: round; }
.draw-outer { stroke-width: 1.6; }
.draw-inner { stroke-width: .8; opacity: .55; }
.draw { stroke-dasharray: 1; stroke-dashoffset: 0; }

.iwan-content {
  position: absolute;
  inset: 21% 12% auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.logo { width: 100%; height: auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .35)); }
.hero h1 {
  margin: 10px 0 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--cream);
}
.hero-en { margin: 2px 0 0; font-size: 21px; line-height: 1.2; color: var(--gold-400); }
.iwan-foot {
  position: absolute;
  inset: auto 16% 14px;
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
  color: var(--mist);
  text-wrap: balance;
}

/* One orchestrated moment: the arch draws itself, then the logo settles in. */
@media (prefers-reduced-motion: no-preference) {
  .draw { animation: draw 1.7s cubic-bezier(.65, .05, .25, 1) both; }
  .draw-inner { animation-delay: .25s; }
  .iwan-content, .iwan-foot { animation: rise .9s ease-out .95s both; }
}
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ───────── Sticky category bar ───────── */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  height: var(--bar-h);
  margin-top: 4px;
  background: rgba(23, 8, 34, .9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-block: 1px solid var(--line-soft);
}
.bar-btn {
  flex: none;
  width: 48px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--gold-400);
}
.bar-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.chips {
  flex: 1;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding-inline-end: 24px;
  -webkit-mask-image: linear-gradient(to left, #000 88%, transparent);
  mask-image: linear-gradient(to left, #000 88%, transparent);
}
.chips::-webkit-scrollbar { display: none; }
/* centred when everything fits; auto margins collapse to 0 when it scrolls */
.chip:first-child { margin-inline-start: auto; }
.chip:last-child { margin-inline-end: auto; }
.chip {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  color: var(--mist);
  transition: color .2s;
}
.chip[aria-current="true"] { color: var(--gold-300); }
/* Active marker: a small arch, echoing the logo */
.chip[aria-current="true"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 22px;
  height: 8px;
  border: 1.5px solid var(--gold-400);
  border-bottom: 0;
  border-radius: 11px 11px 0 0;
  transform: translateX(-50%);
}
.search { flex: 1; display: flex; align-items: center; }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 4px;
  background: none;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  color: var(--cream);
}
.search input::placeholder { color: var(--mist); opacity: .8; }
.search input::-webkit-search-cancel-button { display: none; }

/* ───────── Category headings ───────── */
.cat { padding: 52px 0 12px; }
.cat-head { text-align: center; padding: 0 var(--gutter); margin-bottom: 30px; }
.cat-head h2 {
  margin: 0;
  font-size: clamp(30px, 8vw, 40px);
  font-weight: 700;
  line-height: 1.25;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cat-en { margin: 2px 0 0; font-size: 21px; line-height: 1.3; color: var(--cream); opacity: .88; }
.cat-note { margin: 6px 0 0; font-size: 13px; color: var(--mist); }
.orn { display: block; width: 150px; height: 12px; margin: 16px auto 0; fill: none; stroke: var(--gold-500); stroke-width: 1; }
.orn circle { fill: var(--gold-500); stroke: none; }

.sub-head {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1040px;
  margin: 48px auto 28px;
  padding: 0 var(--gutter);
  text-align: center;
}
.sub-head::before, .sub-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sub-head div { flex: none; }
.sub-head h3 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.3;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sub-head p { margin: 0; font-size: 17px; line-height: 1.3; color: var(--mist); }

/* ───────── The arcade ───────── */
.arcade {
  list-style: none;
  margin: 0 auto;
  padding: 0 var(--gutter);
  max-width: 1040px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 14px;
}
@media (min-width: 360px) { .arcade { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 12px; } }
@media (min-width: 640px) { .arcade { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 36px 22px; } }
@media (min-width: 920px) { .arcade { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.dish { text-align: center; }

/* Niche: an arched alcove. With a photo it frames the dish; without one it
   stays an ornamental blind arch, the way empty niches line Persian walls. */
.niche {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 10 / 11;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50% 50% 6px 6px / 45% 45% 6px 6px;
  background: none;
  cursor: default;
  -webkit-appearance: none;
  appearance: none;
}
.niche-in {
  --tile: 20px;
  position: absolute;
  inset: 4px;
  overflow: hidden;
  border-radius: 50% 50% 3px 3px / 45% 45% 3px 3px;
  /* Tiled alcove: an eight-point star lattice, like Yazdi tilework */
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(0, 0, 0, .5), transparent 62%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23C9A25A' stroke-opacity='.18' stroke-width='.6'%3E%3Crect x='6' y='6' width='12' height='12'/%3E%3Crect x='6' y='6' width='12' height='12' transform='rotate(45 12 12)'/%3E%3C/g%3E%3C/svg%3E") center top / var(--tile) var(--tile),
    linear-gradient(180deg, #1E0D2A, #2C1840);
}
.row .niche-in { --tile: 13px; }
.niche img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .45s ease;
}
.has-photo .niche img, .niche-lg img { opacity: 1; }
.has-photo .niche { cursor: zoom-in; border-color: rgba(220, 191, 124, .6); }
.has-photo .niche:active { transform: scale(.985); }
.niche:focus-visible { border-radius: 50% 50% 6px 6px / 45% 45% 6px 6px; }

.dish-name {
  margin: 10px 0 0;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.55;
  text-wrap: balance;
}
.dish-en { margin: 1px 0 0; font-size: 14.5px; line-height: 1.2; color: var(--mist); text-wrap: balance; }
.price { margin: 6px 0 0; font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--gold-400); }
@media (min-width: 640px) {
  .dish-name { font-size: 15.5px; }
  .dish-en { font-size: 15.5px; }
  .price { font-size: 16.5px; }
}

/* ───────── Pizza: three sizes per row ───────── */
.rows { list-style: none; margin: 0 auto; padding: 0 var(--gutter); max-width: 720px; }
.row, .rows-head {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) repeat(3, 50px);
  align-items: center;
  column-gap: 8px;
}
.rows-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); text-align: center; font-size: 12.5px; color: var(--mist); }
.rows-head span:first-child { grid-column: 3; }
.row { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.row .niche { width: 58px; }
.row .niche-in { inset: 3px; }
.row-text { min-width: 0; }
.row .dish-name { margin: 0; }
.row .dish-en { font-size: 14.5px; }
.row .price { margin: 0; text-align: center; font-size: 15.5px; }
@media (min-width: 640px) {
  .row, .rows-head { grid-template-columns: 72px minmax(0, 1fr) repeat(3, 76px); column-gap: 14px; }
  .row .niche { width: 72px; }
}

/* ───────── Search state ───────── */
body.searching .cat-head .cat-note, body.searching .cat-head .orn { display: none; }
body.searching .cat { padding-top: 36px; }
.empty { margin: 48px var(--gutter); text-align: center; color: var(--mist); }

/* ───────── Footer ───────── */
.foot { padding: 72px var(--gutter) calc(44px + env(safe-area-inset-bottom)); text-align: center; }
.foot-title {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.3;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.foot-en { margin: 0; font-size: 20px; color: var(--cream); opacity: .85; }
.foot address { margin-top: 22px; font-style: normal; font-size: 14.5px; line-height: 2.1; }
.foot address a { text-decoration-color: var(--line); text-underline-offset: 5px; }
.foot address .ltr { direction: ltr; unicode-bidi: isolate; }
.foot-note { max-width: 34ch; margin: 18px auto 0; font-size: 12.5px; color: var(--mist); }

/* ───────── Photo sheet ───────── */
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 100dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  overflow: visible;
}
.sheet::backdrop { background: rgba(10, 3, 16, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet-body {
  position: relative;
  padding: 34px 24px calc(30px + env(safe-area-inset-bottom));
  text-align: center;
  background: linear-gradient(180deg, #2C1639 0%, var(--plum-800) 70%);
  border-top: 1px solid var(--line);
  border-radius: 26px 26px 0 0;
}
.niche-lg { width: min(68vw, 290px); margin: 0 auto; }
.sheet-name { margin: 18px 0 0; font-size: 21px; font-weight: 700; line-height: 1.4; }
.sheet-en { margin: 2px 0 0; font-size: 19px; color: var(--mist); }
.sheet-price { margin-top: 12px; font-size: 22px; font-weight: 700; color: var(--gold-400); }
.sheet-price .sizes { display: flex; justify-content: center; gap: 28px; font-size: 20px; }
.sheet-price .sizes small { display: block; font-size: 12.5px; font-weight: 400; color: var(--mist); }
.sheet-note { margin: 10px 0 0; font-size: 13px; color: var(--mist); }
.sheet-note:empty { display: none; }
.sheet-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: rgba(23, 8, 34, .5);
  cursor: pointer;
  color: var(--gold-300);
}
.sheet-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] .sheet-body { animation: sheetUp .32s cubic-bezier(.2, .8, .2, 1); }
  .sheet[open]::backdrop { animation: fade .25s ease; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 640px) {
  .sheet { margin: auto; }
  .sheet-body { border: 1px solid var(--line); border-radius: 26px; }
}
