@font-face { font-family: Vazirmatn; src: url(../fonts/Vazirmatn-FD-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(../fonts/Vazirmatn-FD-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(../fonts/Vazirmatn-FD-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url(../fonts/Vazirmatn-FD-ExtraBold.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
    --bg: #f7f2ea;
    --surface: #ffffff;
    --surface-2: #f1ebe1;
    --ink: #1f1a16;
    --muted: #7b6f63;
    --line: #ece4d8;
    --ember: #b4381e;
    --ember-soft: #fbe9e3;
    --saffron: #e5a234;
    --charcoal: #1b1613;
    --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 6px 18px -8px rgba(60, 40, 20, .18);
    --radius: 18px;
    --bar-h: 60px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #13100e;
        --surface: #1d1916;
        --surface-2: #26201c;
        --ink: #f4ede3;
        --muted: #a89a8b;
        --line: #2d2621;
        --ember: #f0704f;
        --ember-soft: #3a211a;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px -10px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font: 400 15px/1.7 Vazirmatn, Tahoma, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; }
svg { width: 1em; height: 1em; flex: none; }
img { display: block; max-width: 100%; }

.wrap { width: 100%; max-width: 760px; margin-inline: auto; padding-inline: 16px; }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    overflow: hidden;
    background: var(--charcoal);
    color: #f7efe4;
    padding: calc(34px + env(safe-area-inset-top)) 0 34px;
    text-align: center;
}
.hero__glow {
    position: absolute; inset: 0;
    background:
        radial-gradient(60% 80% at 50% 115%, rgba(229, 140, 52, .45), transparent 70%),
        radial-gradient(40% 50% at 85% -10%, rgba(180, 56, 30, .35), transparent 70%),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 14px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 14px);
}
.hero__inner { position: relative; display: flex; flex-direction: column; align-items: center; }
.mark {
    width: 84px; height: 84px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(145deg, #f0b44a, #c2461f 70%);
    box-shadow: 0 0 0 5px rgba(255, 255, 255, .06), 0 10px 30px -6px rgba(229, 120, 40, .6);
    margin-bottom: 14px;
}
.mark span { font-weight: 800; font-size: 28px; color: #fff; letter-spacing: -.5px; transform: translateY(-1px); }
.hero h1 { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.3; }
.hero__tagline { margin: 2px 0 0; color: #d9c8b4; font-size: 14px; }
.hero__meta {
    list-style: none; margin: 16px 0 0; padding: 0;
    display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px;
    font-size: 13px; color: #e8dccd;
}
.hero__meta li { display: inline-flex; align-items: center; gap: 6px; }
.hero__meta svg { font-size: 16px; color: var(--saffron); }
.hero__meta a { text-decoration: none; border-bottom: 1px dashed rgba(255, 255, 255, .35); }
.hero__call {
    margin-top: 16px;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 18px; border-radius: 999px;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14);
    text-decoration: none; font-weight: 700; font-size: 14px; direction: ltr;
}
.hero__call svg { font-size: 16px; color: var(--saffron); }

/* ---------- Sticky category bar ---------- */
.bar {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
}
.bar__inner { display: flex; align-items: center; gap: 8px; height: var(--bar-h); padding-inline: 12px; }
.bar__search-btn {
    width: 40px; height: 40px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: var(--surface); box-shadow: var(--shadow); font-size: 19px;
}
.chips {
    display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
    padding: 4px 2px; margin-inline-end: -12px; padding-inline-end: 12px;
    mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none; padding: 7px 15px; border-radius: 999px;
    font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
    color: var(--muted); background: transparent; transition: background .2s, color .2s;
}
.chip.is-active { background: var(--ink); color: var(--bg); }

.search {
    flex: 1; display: flex; align-items: center; gap: 8px;
    height: 42px; padding-inline: 14px 6px; border-radius: 999px;
    background: var(--surface); box-shadow: var(--shadow);
}
.search[hidden] { display: none; }
.search > svg { font-size: 18px; color: var(--muted); }
.search input {
    flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
    font: inherit; font-size: 16px; color: var(--ink);
}
.search input::-webkit-search-cancel-button { display: none; }
.search button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; color: var(--muted); }
.bar.is-searching .chips, .bar.is-searching .bar__search-btn { display: none; }

/* ---------- Sections ---------- */
main { padding-top: 8px; padding-bottom: 32px; }
[data-section] { scroll-margin-top: calc(var(--bar-h) + 8px); }
.sec-title {
    display: flex; align-items: center; gap: 8px;
    margin: 26px 2px 12px; font-size: 19px; font-weight: 800;
}
.sec-title svg { color: var(--saffron); font-size: 20px; }
.sec-count {
    font-size: 12px; font-weight: 700; color: var(--muted);
    background: var(--surface-2); border-radius: 999px; padding: 1px 9px;
}

/* Featured rail */
.rail {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-inline: -16px; padding: 2px 16px 10px; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.tile {
    flex: none; width: 200px; scroll-snap-align: start;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden; display: flex; flex-direction: column; padding-bottom: 12px;
    transition: transform .15s;
}
.tile:active { transform: scale(.98); }
.tile__img { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.tile__img img { width: 100%; height: 100%; object-fit: cover; }
.tile__img svg { font-size: 40px; color: var(--muted); opacity: .5; }
.tile__title {
    margin: 10px 12px 2px; font-weight: 700; font-size: 14px; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.tile .price { margin-inline: 12px; }

/* Item cards */
.cards { display: grid; gap: 10px; }
.card {
    display: flex; gap: 12px; align-items: stretch; width: 100%;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 10px; transition: transform .15s;
}
.card:active { transform: scale(.985); }
.card__img {
    width: 96px; height: 96px; flex: none; border-radius: 14px; overflow: hidden;
    background: var(--surface-2); display: grid; place-items: center;
}
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__img.is-empty svg { font-size: 34px; color: var(--muted); opacity: .45; }
.card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-block: 2px; }
.card__title { font-weight: 700; font-size: 15px; line-height: 1.55; }
.card__desc {
    margin-top: 2px; font-size: 12.5px; line-height: 1.75; color: var(--muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card.is-out { opacity: .55; }
.card.is-out .card__img img { filter: grayscale(1); }

.price { display: inline-flex; align-items: baseline; gap: 4px; color: var(--ember); white-space: nowrap; }
.price b { font-size: 16px; font-weight: 800; }
.price small { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.badge {
    font-size: 11.5px; font-weight: 500; color: var(--muted);
    background: var(--surface-2); border-radius: 999px; padding: 1px 9px; white-space: nowrap;
}
.badge--out { color: var(--ember); background: var(--ember-soft); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }
.is-hidden { display: none !important; }

/* ---------- Footer ---------- */
.foot {
    background: var(--charcoal); color: #d8cab9; text-align: center;
    padding: 30px 0 calc(28px + env(safe-area-inset-bottom)); font-size: 13.5px;
}
.foot__brand { font-weight: 800; font-size: 18px; color: #fff; margin-bottom: 8px; }
.foot p { margin: 4px 0; display: flex; align-items: center; justify-content: center; gap: 6px; }
.foot svg { color: var(--saffron); font-size: 16px; }
.foot__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.foot__links:empty { display: none; }
.foot__links a {
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
    padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14);
}
.foot small { color: #8d7f70; }

/* ---------- Detail sheet ---------- */
.sheet {
    border: 0; padding: 0; margin: 0; background: transparent; color: var(--ink);
    width: 100%; max-width: 100%; max-height: 100%; height: 100%;
    display: flex; align-items: flex-end; justify-content: center;
}
.sheet:not([open]) { display: none; }
.sheet::backdrop { background: rgba(15, 10, 8, .55); backdrop-filter: blur(2px); }
.sheet__panel {
    position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
    background: var(--surface); border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up .28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } }
.sheet__close {
    position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2;
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(20, 14, 10, .55); color: #fff; font-size: 20px; backdrop-filter: blur(6px);
}
.sheet__img { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.sheet__img img { width: 100%; height: 100%; object-fit: cover; }
.sheet__img svg { font-size: 64px; color: var(--muted); opacity: .4; }
.sheet__img:empty { display: none; }
.sheet__body { padding: 18px 20px 26px; }
.sheet__body h3 { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.5; padding-inline-end: 0; }
.sheet__body p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.9; }
.sheet__body p:empty { display: none; }
#sheetPrice { margin-top: 16px; }
#sheetPrice > .price b { font-size: 20px; }
.opts { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.opts li { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; font-weight: 500; }
.opts li + li { border-top: 1px solid var(--line); }
.opts .price b { font-size: 15px; }

@media (min-width: 560px) {
    .sheet { align-items: center; padding: 24px; }
    .sheet__panel { border-radius: 24px; animation-name: sheet-in; }
    @keyframes sheet-in { from { transform: scale(.96); opacity: 0; } }
}

@media (min-width: 900px) {
    .wrap { max-width: 1000px; }
    .cards { grid-template-columns: 1fr 1fr; }
    .hero { padding-block: 56px 48px; }
    .card:hover, .tile:hover { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
