/* Syrian Nuts storefront. Layout: cream brand band, sticky search bar, one photo grid per category, order drawer. */
:root {
  --bg: #f6eedd;
  --surface: #fffaf0;
  --frame: #efe5d1;
  --ink: #2b1a12;
  --muted: #76655a;
  --line: #e4d4b2;
  --band: #6e1414;
  --band-ink: #fbefd2;
  --red: #8a1b1b;
  --heading: #6e1414;
  --gold: #d4a03a;
  --gold-soft: #f1d48a;
  --green: #3d6a37;
  --chip: #f3e6c6;
  --shadow: 0 1px 2px rgba(70, 35, 15, .08), 0 6px 18px rgba(70, 35, 15, .08);
  --display: "Playfair Display", Georgia, "Times New Roman", serif;
  --text: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--text); font-size: 16px; line-height: 1.45;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--surface);
}
.wrap { max-width: 1180px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }

/* Brand band */
.band { background: linear-gradient(180deg, #fffdf7 0%, var(--surface) 100%); color: var(--ink); border-bottom: 1px solid var(--line); box-shadow: inset 0 -3px 0 var(--gold); }
.band .wrap { display: flex; align-items: center; gap: 24px; padding-block: 22px; }
.band img { width: 128px; height: auto; flex: none; filter: drop-shadow(0 4px 10px rgba(90,40,15,.22)); }
.band h1 { font-family: var(--display); font-size: clamp(28px, 4vw, 40px); line-height: 1.1; margin: 0; color: var(--heading); text-wrap: balance; }
.band p { margin: 6px 0 0; font-size: 16px; color: var(--muted); max-width: 52ch; }

/* Sticky toolbar */
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-block: 12px; }
.search { position: relative; flex: 1 1 260px; min-width: 0; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 10px 36px 10px 38px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg);
}
.search input::placeholder { color: var(--muted); }
.search .clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip span { font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.chip[aria-pressed="true"] span { color: var(--gold-soft); }
.sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.sort select {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}

/* Groups and grid */
main { padding-block: 28px 40px; display: grid; gap: 40px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; padding-bottom: 10px; margin-bottom: 18px; border-bottom: 2px solid var(--gold); }
.group-head h2 { font-family: var(--display); font-size: 30px; margin: 0; color: var(--heading); }
.group-head p { margin: 0; color: var(--muted); font-size: 14.5px; display: flex; gap: 12px; }
.group-head .by { font-weight: 600; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.tall { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(70,35,15,.1), 0 14px 30px rgba(70,35,15,.16); }
.frame { background: var(--frame); aspect-ratio: 4 / 3; overflow: hidden; max-width: 100%; }
.tall .frame { aspect-ratio: 476 / 671; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.tall .frame img { object-fit: contain; }
.card:hover .frame img { transform: scale(1.04); }
.body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.brand { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--red); }
.name { margin: 0 0 8px; font-size: 17px; line-height: 1.3; font-weight: 700; text-wrap: balance; }
.facts {
  margin: auto 0 0; display: grid; grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto; grid-auto-flow: column; column-gap: 10px;
  padding-top: 10px; border-top: 1px dashed var(--line);
}
.facts dt { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); line-height: 1.25; align-self: end; }
.facts dd { margin: 3px 0 0; font-size: 15.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts dd.price { font-size: 19px; font-weight: 700; color: var(--red); }
.facts dd.qty { color: var(--green); }
.hit { position: absolute; inset: 0; border: 0; background: transparent; cursor: zoom-in; border-radius: 14px; }
.hit:focus-visible, .chip:focus-visible, .search input:focus-visible, .sort select:focus-visible, .viewer button:focus-visible, .empty button:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty strong { display: block; font-family: var(--display); font-size: 24px; color: var(--ink); margin-bottom: 6px; }
.empty button { margin-top: 14px; font: inherit; font-weight: 600; padding: 9px 18px; border-radius: 999px; border: 0; background: var(--red); color: #fff; cursor: pointer; }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer .wrap { padding-block: 22px 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; }

/* Viewer */
.viewer {
  border: 0; padding: 0; border-radius: 18px; width: min(920px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px); background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0,0,0,.45); overflow: auto;
}
.viewer::backdrop { background: rgba(25, 10, 6, .72); }
.v-inner { display: grid; grid-template-columns: 1.25fr 1fr; min-height: 420px; }
.v-media { background: var(--frame); display: grid; place-items: center; min-width: 0; }
.v-media img { width: 100%; height: 100%; max-height: 72dvh; object-fit: contain; display: block; }
.v-info { padding: 28px 26px 22px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.v-info h3 { font-family: var(--display); font-size: 26px; line-height: 1.2; margin: 2px 0 14px; text-wrap: balance; }
.v-facts { margin: 0; display: grid; gap: 0; }
.v-facts div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.v-facts dt { color: var(--muted); font-size: 15px; }
.v-facts dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.v-facts .price dd { font-size: 24px; color: var(--red); }
.v-facts .qty dd { color: var(--green); }
.v-nav { margin-top: auto; padding-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.v-nav button {
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink);
}
.v-pos { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.v-close {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--surface); color: var(--ink); font-size: 24px; line-height: 1;
  cursor: pointer; box-shadow: var(--shadow); z-index: 1;
}

@media (max-width: 720px) {
  .band .wrap { gap: 16px; padding-block: 16px; }
  .band img { width: 92px; }
  .band p { font-size: 14.5px; }
  .sort { margin-left: auto; }
  .v-inner { grid-template-columns: 1fr; min-height: 0; }
  .v-media img { max-height: 46dvh; }
  .v-info { padding: 18px 18px 18px; }
  .v-info h3 { font-size: 22px; margin-bottom: 8px; }
}
@media (max-width: 560px) {
  .grid, .grid.tall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .body { padding: 10px 11px 12px; }
  .name { font-size: 14.5px; }
  .brand { font-size: 10.5px; }
  .facts { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto; row-gap: 0; }
  .facts dt:nth-of-type(1) { grid-column: 1 / -1; grid-row: 1; }
  .facts dd:nth-of-type(1) { grid-column: 1 / -1; grid-row: 2; margin-bottom: 6px; }
  .facts dt:nth-of-type(2) { grid-column: 1; grid-row: 3; }
  .facts dd:nth-of-type(2) { grid-column: 1; grid-row: 4; }
  .facts dt:nth-of-type(3) { grid-column: 2; grid-row: 3; }
  .facts dd:nth-of-type(3) { grid-column: 2; grid-row: 4; }
  .facts dd { font-size: 14.5px; }
  .facts dd.price { font-size: 18px; }
  .facts dt { font-size: 9.5px; letter-spacing: .3px; }
  .group-head h2 { font-size: 25px; }
  .bar .wrap { padding-block: 9px; gap: 8px; }
  .search input { padding-block: 8px; }
  .chips { gap: 5px; }
  .chip { padding: 6px 10px; font-size: 14px; gap: 4px; }
  .chip span { font-size: 11.5px; }
  .sort .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sort select { font-size: 14px; padding: 6px 6px; max-width: 108px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .frame img { transition: none; }
  .card:hover { transform: none; }
  .card:hover .frame img { transform: none; }
}

/* ---------- Ordering ---------- */
a { color: var(--red); }
.frame { position: relative; }
.badge-out {
  position: absolute; left: 10px; top: 10px; z-index: 1;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase; padding: 4px 9px; border-radius: 999px;
}
.card.out .frame img { filter: grayscale(.7) opacity(.75); }
.act { position: relative; z-index: 2; padding: 0 16px 16px; }
.act .add, .stepper button, .submit, .fab, .d-close, .line .rm {
  font: inherit; cursor: pointer;
}
.act .add {
  width: 100%; font-weight: 700; font-size: 15px; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--red); background: transparent; color: var(--red);
  transition: background .15s ease, color .15s ease;
}
.act .add:hover { background: var(--red); color: #fff; }
.act .add:disabled { border-color: var(--line); color: var(--muted); background: var(--frame); cursor: not-allowed; }
.stepper {
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center;
  border: 1.5px solid var(--red); border-radius: 10px; overflow: hidden; background: var(--surface);
}
.stepper button {
  height: 40px; border: 0; background: var(--red); color: #fff; font-size: 20px; font-weight: 700; line-height: 1;
}
.stepper button:hover { background: var(--heading); }
.stepper .q { text-align: center; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.stepper .q b { font-size: 16px; font-variant-numeric: tabular-nums; }
.v-act { padding: 18px 0 0; }

.fab {
  position: fixed; z-index: 20;
  right: max(16px, calc(env(safe-area-inset-right, 0px) + 16px));
  bottom: max(16px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px 12px 16px; border: 0; border-radius: 999px;
  background: var(--red); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 10px 28px rgba(110, 20, 20, .35);
}
.fab svg { width: 22px; height: 22px; }
.fab b {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--gold-soft); color: var(--heading);
  display: inline-grid; place-items: center; font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.fab-total { font-weight: 600; opacity: .9; font-variant-numeric: tabular-nums; }
.fab.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.08); } }
main { padding-bottom: 96px; }

/* Order drawer */
.drawer {
  margin: 0 0 0 auto; padding: 0; border: 0; height: 100dvh; max-height: 100dvh;
  width: min(480px, 100vw); max-width: 100vw; border-radius: 18px 0 0 18px;
  background: var(--surface); color: var(--ink); box-shadow: -20px 0 60px rgba(0,0,0,.25);
  display: none; flex-direction: column;
}
.drawer[open] { display: flex; }
.drawer::backdrop { background: rgba(25, 10, 6, .55); }
.d-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 20px 14px; border-bottom: 1px solid var(--line);
}
.d-head h2 { font-family: var(--display); font-size: 26px; margin: 0; color: var(--heading); }
.d-close { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 24px; line-height: 1; }
.d-body { flex: 1; overflow-y: auto; padding: 16px 20px calc(env(safe-area-inset-bottom, 0px) + 24px); }
.d-empty { text-align: center; color: var(--muted); padding: 40px 10px; display: grid; gap: 6px; }
.d-empty strong { font-family: var(--display); font-size: 22px; color: var(--ink); }

.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.line { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg); display: grid; gap: 10px; }
.line-top { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: start; }
.line-top img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: var(--frame); }
.line-name { margin: 0; font-weight: 700; font-size: 15px; line-height: 1.3; }
.line-name small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--red); margin-bottom: 2px; }
.line-meta { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.line .rm { border: 0; background: transparent; color: var(--muted); font-size: 13.5px; text-decoration: underline; padding: 4px; }
.line-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.line-ctl input, .line-ctl select {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
}
.line-ctl input { width: 84px; font-variant-numeric: tabular-nums; }
.line-total { margin-left: auto; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }

.summary { margin: 16px 0 6px; padding: 14px 0; border-top: 2px solid var(--gold); }
.summary div { display: flex; justify-content: space-between; align-items: baseline; }
.summary span { font-weight: 600; }
.summary b { font-size: 24px; color: var(--red); font-variant-numeric: tabular-nums; }
.summary p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }

.checkout { display: grid; gap: 14px; margin-top: 8px; }
.checkout h3 { margin: 6px 0 0; font-family: var(--display); font-size: 20px; color: var(--heading); }
.field { display: grid; gap: 5px; }
.field label { font-weight: 600; font-size: 14.5px; }
.field .opt { font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%;
}
.field textarea { resize: vertical; min-height: 76px; }
.field.bad input, .field.bad textarea { border-color: #b3261e; background: #fff7f6; }
.err { color: #b3261e; font-size: 13px; min-height: 0; }
.err:empty { display: none; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fdecea; color: #8c1d18; font-size: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.submit {
  width: 100%; padding: 14px; border: 0; border-radius: 12px; background: var(--red); color: #fff;
  font-size: 17px; font-weight: 700;
}
.submit:hover { background: var(--heading); }
.submit:disabled { opacity: .65; cursor: progress; }
.submit.ghost { background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.submit.ghost:hover { background: var(--red); color: #fff; }
.fine { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }

.d-done { text-align: center; display: grid; align-content: start; justify-items: center; gap: 8px; padding-top: 40px; }
.d-done[hidden] { display: none; }
.done-mark { width: 68px; height: 68px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; }
.done-mark svg { width: 36px; height: 36px; }
.d-done h3 { font-family: var(--display); font-size: 28px; margin: 8px 0 0; color: var(--heading); }
.done-num { margin: 0; font-size: 16px; }
.done-num b { font-variant-numeric: tabular-nums; color: var(--red); }
#done-msg { margin: 0 0 14px; color: var(--muted); max-width: 36ch; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: max(84px, calc(env(safe-area-inset-bottom, 0px) + 84px));
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100vw - 32px);
}
.act .add:focus-visible, .stepper button:focus-visible, .fab:focus-visible, .submit:focus-visible,
.d-close:focus-visible, .line .rm:focus-visible, .line-ctl input:focus-visible, .line-ctl select:focus-visible,
.field input:focus-visible, .field textarea:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}
footer a { color: inherit; font-weight: 600; }

@media (max-width: 560px) {
  .act { padding: 0 11px 12px; }
  .act .add { font-size: 14px; padding: 9px 8px; }
  .stepper { grid-template-columns: 34px 1fr 34px; }
  .stepper button { height: 36px; font-size: 18px; }
  .stepper .q { font-size: 12.5px; }
  .stepper .q b { font-size: 14.5px; }
  .drawer { width: 100vw; border-radius: 0; }
  .fab { padding: 11px 16px 11px 14px; font-size: 15px; }
  .fab-total { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fab.bump { animation: none; }
}
