:root {
    --primary: #2F6F4E;
    --radius: 16px;
    --space: 8px;
    --font: "Cairo", system-ui, sans-serif;
    --display: "Playfair Display", "Cairo", serif;
    --z-nav: 20;
    --z-bar: 40;
    --z-sheet: 100;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100dvh;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[x-cloak] { display: none !important; }

.js-needed {
    background: #7f1d1d;
    color: #fff;
    text-align: center;
    padding: 10px;
}

.hero { position: relative; }
.hero-cover {
    height: 180px;
    background: var(--primary) center/cover no-repeat;
}
.hero-body {
    padding: 0 20px 16px;
    margin-top: -36px;
    position: relative;
}
.hero-identity { display: flex; gap: 14px; align-items: flex-end; }
.hero-logo {
    width: 84px; height: 84px; border-radius: 20px; object-fit: cover;
    border: 3px solid #fff; background: #fff;
}
.hero-logo.fallback {
    display: grid; place-items: center;
    font-weight: 700; font-size: 32px; color: #fff;
    background: var(--primary); border-color: transparent;
}
.hero h1 { margin: 0; font-size: 26px; line-height: 1.3; }
.hero-desc { margin: 6px 0 0; opacity: .82; max-width: 42ch; }
.status-pill {
    margin-top: 12px; display: inline-flex; gap: 10px; align-items: baseline;
    padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.status-pill span { font-weight: 400; opacity: .8; }
.status-pill.is-open { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.status-pill.is-closed { background: rgba(127, 29, 29, .12); color: #7f1d1d; }

/* Search Bar */
.search-section {
    padding: 12px 16px 4px;
    max-width: 920px;
    margin: 0 auto;
}
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid rgba(0,0,0,0.09);
    border-radius: 999px;
    padding: 0 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
}
.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--primary) 20%, transparent);
}
.search-icon {
    color: #94a3b8;
    flex-shrink: 0;
}
.search-box input {
    width: 100%;
    border: none;
    outline: none;
    padding: 12px 10px;
    font-size: 15px;
    background: transparent;
    color: inherit;
}
.search-clear {
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    padding: 0 6px;
    cursor: pointer;
}

.cats {
    position: sticky; top: 0; z-index: var(--z-nav);
    display: flex; gap: 8px; overflow-x: auto;
    padding: 10px 16px; backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cats a {
    flex: 0 0 auto; text-decoration: none; color: inherit;
    padding: 8px 18px; border-radius: 999px; min-height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    background: rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}
.cats a:hover, .cats a:focus-visible {
    background: var(--primary); color: #fff;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 25%, transparent);
}
.menu-wrap { padding: 12px 16px 36px; max-width: 920px; margin: 0 auto; }
.cat-block h2 { font-size: 21px; font-weight: 800; margin: 28px 4px 14px; display: flex; align-items: center; gap: 8px; }
.cat-block h2::before {
    content: ""; display: inline-block; width: 4px; height: 18px;
    background: var(--primary); border-radius: 4px;
}
.item-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
@media (max-width: 480px) {
    .item-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (min-width: 768px) {
    .item-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
}
.item-card {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}
.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}
.item-media {
    width: 100%;
    height: 145px;
    position: relative;
    overflow: hidden;
    background: rgba(0,0,0,0.03);
}
@media (min-width: 768px) {
    .item-media { height: 190px; }
}
.item-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}
.item-card:hover .item-media img {
    transform: scale(1.06);
}
.item-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 34px;
    color: #fff;
    background: var(--primary);
}
.item-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}
.item-body h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: inherit;
}
@media (min-width: 768px) {
    .item-body h3 { font-size: 17px; }
}
.item-body p {
    margin: 4px 0 10px;
    font-size: 12px;
    opacity: 0.72;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed rgba(0,0,0,0.07);
    gap: 6px;
}
.price {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary);
}
.add-btn {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent);
    transition: all 0.2s ease;
}
.add-btn:active {
    transform: scale(0.92);
}
.item-card.is-sold { opacity: .6; }
.sold { font-size: 13px; font-weight: 700; }
.empty-note { text-align: center; padding: 48px 16px; opacity: .7; }

/* Floating Capsule Cart */
.cart-bar {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: var(--z-bar);
    max-width: 540px;
    margin: 0 auto;
}
.cart-toggle {
    width: 100%;
    border: 0;
    color: #fff;
    background: var(--primary);
    min-height: 56px;
    border-radius: 999px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(0,0,0,0.24);
    transition: all 0.2s ease;
}
.cart-toggle:active {
    transform: scale(0.98);
}
.cart-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.18);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 14px;
}
.cart-label {
    font-size: 15px;
    font-weight: 700;
}
.cart-total {
    font-size: 16px;
    font-weight: 800;
}

.sheet-backdrop {
    position: fixed; inset: 0; background: rgba(20, 12, 8, .48);
    z-index: calc(var(--z-sheet) - 1);
}
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet);
    max-height: 88dvh; overflow: auto; padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
}
.sheet-close {
    background: transparent; border: 0; float: left; min-height: 44px; font-weight: 600; font-size: 24px;
}
.sheet-media {
    width: 100%;
    height: 190px;
    border-radius: 16px;
    overflow: hidden;
    margin: 8px 0 14px;
    background: rgba(0,0,0,0.04);
}
.sheet-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sheet h2 { margin: 8px 0 12px; }
.sheet label { display: block; margin: 10px 0; font-weight: 600; }
.sheet input[type="text"], .sheet textarea {
    width: 100%; margin-top: 6px; padding: 12px; border-radius: 12px; border: 1px solid currentColor;
    background: transparent; min-height: 44px;
}
.opt-block { margin: 16px 0; }
.opt-block h3 { margin: 0 0 8px; font-size: 15px; }
.opt {
    display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500;
}
.opt em { margin-inline-start: auto; font-style: normal; opacity: .8; }
.qty-row {
    display: flex; align-items: center; gap: 12px; margin: 16px 0;
}
.qty-row button {
    width: 44px; height: 44px; border-radius: 12px; border: 1px solid currentColor; background: transparent;
}
.qty-row.mini button { width: 36px; height: 36px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 0 18px; border: 0; border-radius: 14px;
    background: var(--primary); color: #fff; font-weight: 700; text-decoration: none;
}
.btn.full { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-alt { background: transparent; color: inherit; border: 1px solid currentColor; }
.send-row { display: grid; gap: 10px; margin-top: 12px; }
.cart-lines { list-style: none; padding: 0; margin: 0; }
.cart-lines li {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}
.cart-lines small, .muted { display: block; opacity: .7; font-weight: 400; }
.total { display: grid; gap: 4px; font-weight: 600; }
.alert-err { color: #9b1c1c; font-weight: 600; }
.copy-box textarea { min-height: 120px; margin-top: 12px; }
.btn-ghost {
    background: transparent; border: 1px solid currentColor; border-radius: 12px;
    min-height: 44px; padding: 0 14px; margin-top: 8px;
}

@media (min-width: 768px) {
    .hero-cover { height: 240px; }
    .item-grid { grid-template-columns: 1fr 1fr; }
    .sheet {
        left: 50%; right: auto; bottom: auto; top: 8%;
        transform: translateX(-50%); width: min(480px, 92vw);
        border-radius: 20px; max-height: 84vh;
    }
}

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