/* =========================================================
   بن السعودي: store, cart, checkout and order pages
   (uses the tokens defined in style.css)
   ========================================================= */

/* elements toggled with the hidden attribute must stay hidden even when a class sets display */
[hidden] { display: none !important; }

/* ---------- nav additions ---------- */
a.lang-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.cart-btn {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid rgba(243,230,211,.3); background: transparent; color: var(--cream);
  display: grid; place-items: center; cursor: pointer; transition: border-color .2s, color .2s;
}
.cart-btn:hover { border-color: var(--orange); color: var(--orange); }
.cart-btn svg { width: 21px; height: 21px; }
.cart-btn__count {
  position: absolute; top: -5px; inset-inline-end: -5px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--orange); color: var(--black);
  font: 700 .72rem/20px var(--font-body); text-align: center;
}
.cart-btn__count.bump { animation: bump .4s ease; }
@keyframes bump { 40% { transform: scale(1.35); } }

.btn--dark { background: var(--black); color: var(--orange); margin-top: 1.2rem; }
.btn--dark:hover { background: var(--coffee-800); }
.board__table a { color: inherit; text-decoration: none; }
.board__table a:hover { text-decoration: underline; text-underline-offset: 4px; }
html.no-scroll { overflow: hidden; }

/* ---------- cart drawer ---------- */
.cart-drawer { position: fixed; inset: 0; z-index: 100; }
.cart-drawer__backdrop { position: absolute; inset: 0; background: rgba(8,5,3,.6); opacity: 0; transition: opacity .25s; }
.cart-drawer__panel {
  position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(420px, 100%);
  display: flex; flex-direction: column; background: var(--coffee-900);
  border-inline-start: 1px solid rgba(253,154,25,.25); box-shadow: 0 0 60px rgba(0,0,0,.6);
  transform: translateX(100%); transition: transform .25s ease;
}
html[dir="rtl"] .cart-drawer__panel { transform: translateX(-100%); }
.cart-drawer.is-open .cart-drawer__backdrop { opacity: 1; }
.cart-drawer.is-open .cart-drawer__panel { transform: none; }
.cart-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.3rem; border-bottom: 1px solid rgba(243,230,211,.1); }
.cart-drawer__head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.7rem; }
html:lang(en) .cart-drawer__head h2 { font-weight: 700; font-size: 1.4rem; }
.cart-drawer__close { width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; background: rgba(243,230,211,.08); color: var(--cream); cursor: pointer; }
.cart-drawer__close svg { width: 20px; height: 20px; }
.cart-drawer__close:hover { background: var(--orange); color: var(--black); }
.cart-drawer__body { flex: 1; overflow-y: auto; padding: .6rem 1.3rem; transition: opacity .2s; }
.cart-drawer__body.is-loading { opacity: .5; }
.cart-drawer__foot { padding: 1.1rem 1.3rem 1.4rem; border-top: 1px solid rgba(243,230,211,.1); display: grid; gap: .9rem; }
.cart-drawer__sum { display: flex; justify-content: space-between; font-size: 1.05rem; }
.cart-drawer__go { width: 100%; }
.cart-empty { text-align: center; padding: 3rem 0; color: var(--cream-dim); display: grid; gap: 1rem; justify-items: center; }
.cart-error { color: #ff9a7a; }

.cart-line { display: grid; grid-template-columns: 64px 1fr auto; gap: .9rem; padding: 1rem 0; border-bottom: 1px dashed rgba(243,230,211,.12); }
.cart-line__img { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: var(--coffee-800); }
.cart-line__info { display: grid; gap: .1rem; font-size: .9rem; color: var(--cream-dim); }
.cart-line__info strong { color: var(--cream); font-size: 1rem; }
.cart-line__end { display: grid; justify-items: end; align-content: space-between; gap: .4rem; }
.cart-line__price { font-weight: 700; white-space: nowrap; }
.cart-line__remove { border: 0; background: none; color: var(--mocha); font-size: .82rem; cursor: pointer; text-decoration: underline; padding: 0; }
.cart-line__remove:hover { color: var(--orange); }
.qty { display: inline-flex; align-items: center; gap: .2rem; margin-top: .4rem; border: 1px solid rgba(243,230,211,.2); border-radius: 999px; width: max-content; }
.qty button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; cursor: pointer; font-size: 1.1rem; }
.qty button:hover { color: var(--orange); }
.qty output, .qty input { min-width: 1.8em; text-align: center; font-weight: 700; color: var(--cream); }
.qty input { width: 3em; border: 0; background: none; font: inherit; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ---------- store grid ---------- */
.store { background: var(--pattern), var(--black); padding-top: 50px; }
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 2.2rem; }
.filters a { padding: .55rem 1.2rem; border-radius: 999px; border: 1.5px solid rgba(243,230,211,.2); color: var(--cream-dim); font-weight: 700; text-decoration: none; transition: .2s; }
.filters a:hover { color: var(--cream); border-color: var(--orange); }
.filters a[aria-current="true"] { background: var(--orange); border-color: var(--orange); color: var(--black); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.2rem; }
.pcard {
  position: relative; display: flex; flex-direction: column; text-decoration: none;
  border-radius: var(--radius); overflow: hidden; background: linear-gradient(170deg, var(--coffee-800), var(--coffee-900));
  border: 1px solid rgba(243,230,211,.1); transition: transform .3s, border-color .3s, box-shadow .3s;
}
.pcard:hover { transform: translateY(-5px); border-color: rgba(253,154,25,.55); box-shadow: 0 24px 50px -24px rgba(253,154,25,.35); }
.pcard__img { aspect-ratio: 1 / 1; background: radial-gradient(circle at 50% 40%, #F6EBD6, #E5D3B3); display: grid; place-items: center; overflow: hidden; }
.pcard__img img { width: 100%; height: 100%; object-fit: contain; }
.pcard__img img.is-photo { object-fit: cover; }
.pcard__body { padding: 1rem 1.15rem 1.2rem; display: grid; gap: .25rem; flex: 1; }
.pcard__origin { color: var(--orange); font-size: .82rem; font-weight: 700; }
.pcard__name { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; line-height: 1.25; margin: 0; }
html:lang(en) .pcard__name { font-weight: 700; font-size: 1.25rem; }
.pcard__notes { color: var(--cream-dim); font-size: .88rem; margin: 0; }
.pcard__foot { display: flex; align-items: center; justify-content: space-between; margin-top: .6rem; }
.pcard__price { font-weight: 700; }
.pcard__price small { color: var(--mocha); font-weight: 600; margin-inline-end: .3em; }
.pcard__cta { color: var(--orange); font-weight: 700; font-size: .9rem; }
.pcard__tag { position: absolute; top: .8rem; inset-inline-start: .8rem; background: var(--orange); color: var(--black); font-size: .72rem; font-weight: 700; padding: .15rem .65rem; border-radius: 999px; }

/* ---------- product page ---------- */
.product { padding-top: 110px; background: var(--pattern), var(--black); min-height: 100svh; }
.product__grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
/* the photo sits in its place on the page and scrolls with it (it does not follow the scroll) */
.product__gallery { align-self: start; }
.product__media { border-radius: 24px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #F6EBD6, #DCC6A2); aspect-ratio: 1 / 1; display: grid; place-items: center; }
.product__thumbs { display: flex; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }
.product__thumb { width: 72px; height: 72px; padding: 0; border-radius: 14px; overflow: hidden; border: 2px solid rgba(243,230,211,.15); background: var(--coffee-800); cursor: pointer; opacity: .7; transition: opacity .2s, border-color .2s; }
.product__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product__thumb:hover { opacity: 1; }
.product__thumb[aria-pressed="true"] { border-color: var(--orange); opacity: 1; }
.product__media img { width: 100%; height: 100%; object-fit: contain; }
.product__media img.is-photo { object-fit: cover; }
.crumb { display: block; width: max-content; color: var(--cream-dim); text-decoration: none; font-size: .9rem; margin-bottom: 1rem; }
.crumb:hover { color: var(--orange); }
.product h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1.15; margin: .2rem 0 .5rem; }
html:lang(en) .product h1 { font-weight: 700; }
.product__notes { color: var(--cream-dim); margin: 0 0 1.5rem; }
.product__story { color: var(--orange); font-weight: 700; text-decoration: none; }
.product__story:hover { text-decoration: underline; }
.pick { border: 0; padding: 0; margin: 0 0 1.3rem; }
.pick legend, .pick__label { display: block; font-weight: 700; margin-bottom: .55rem; color: var(--cream); font-size: .95rem; }
.pick__opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.pick__opts label { position: relative; }
.pick__opts input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pick__opts span {
  display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 12px;
  border: 1.5px solid rgba(243,230,211,.2); color: var(--cream-dim); font-weight: 600; cursor: pointer; transition: .15s;
}
.pick__opts input:checked + span { border-color: var(--orange); color: var(--cream); background: rgba(253,154,25,.12); }
.pick__opts input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 2px; }
.pick__opts input:disabled + span { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.pick__opts small { color: var(--mocha); font-weight: 600; }
.select { width: 100%; padding: .75rem 1rem; border-radius: 12px; background-color: var(--coffee-800); color: var(--cream); border: 1.5px solid rgba(243,230,211,.2); font: inherit; }
.buy { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding-top: 1.2rem; border-top: 1px solid rgba(243,230,211,.12); }
.buy__price { font-size: 1.8rem; font-weight: 700; font-family: var(--font-en-display); margin-inline-end: auto; }
.buy .qty { margin: 0; }
.buy__msg { width: 100%; margin: 0; color: var(--orange); font-weight: 700; min-height: 1.5em; }
.dot { width: .75em; height: .75em; border-radius: 50%; display: inline-block; }
.dot--light { background: #C08A4E; } .dot--medium { background: #7A4A24; } .dot--dark { background: #3A2213; box-shadow: 0 0 0 1px rgba(243,230,211,.3); }

/* ---------- checkout ---------- */
.checkout { padding-top: 110px; background: var(--pattern), var(--black); min-height: 100svh; }
.checkout h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3rem); margin: 0 0 1.5rem; }
html:lang(en) .checkout h1 { font-weight: 700; }
.checkout__grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.panel { background: var(--coffee-900); border: 1px solid rgba(243,230,211,.1); border-radius: 20px; padding: clamp(1.2rem, 3vw, 1.8rem); margin-bottom: 1.2rem; }
.panel h2 { font-size: 1.15rem; margin: 0 0 1rem; }
.choice { display: grid; gap: .6rem; }
.choice label { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 14px; border: 1.5px solid rgba(243,230,211,.15); cursor: pointer; transition: .15s; }
.choice label:has(input:checked) { border-color: var(--orange); background: rgba(253,154,25,.08); }
.choice input { accent-color: var(--orange); margin-top: .3rem; }
.choice b { display: block; }
.choice small { display: block; color: var(--cream-dim); }
.choice .fee { margin-inline-start: auto; font-weight: 700; white-space: nowrap; }
.field { display: grid; gap: .35rem; margin-bottom: .9rem; }
.field label { font-weight: 600; font-size: .92rem; }
.field input, .field textarea, .promo__row input { width: 100%; padding: .8rem 1rem; border-radius: 12px; background: var(--coffee-800); color: var(--cream); border: 1.5px solid rgba(243,230,211,.18); font: inherit; }
.field input:focus, .field textarea:focus, .promo__row input:focus { outline: none; border-color: var(--orange); }
/* message boxes: drag to make taller or shorter only, so they can't push past the form */
.field textarea { resize: vertical; max-width: 100%; min-height: 3.4rem; max-height: 24rem; }
.field input[aria-invalid="true"] { border-color: #ff7a5c; }
.field__err { color: #ff9a7a; font-size: .85rem; min-height: 0; }
.summary { position: sticky; top: 100px; }
.summary__line { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; font-size: .92rem; color: var(--cream-dim); }
.summary__line b { color: var(--cream); font-weight: 600; }
.summary__line span:last-child { white-space: nowrap; }
.summary__total { display: flex; justify-content: space-between; padding-top: .9rem; margin-top: .5rem; border-top: 1px solid rgba(243,230,211,.15); font-size: 1.2rem; font-weight: 700; }
.form-err { color: #ff9a7a; font-weight: 600; margin: .8rem 0 0; }
.choice small.welcome-hint { color: var(--orange); font-weight: 600; margin-top: .2rem; }
.summary__note { display: block; color: var(--orange); font-size: .82rem; font-weight: 600; }
.summary__line s { opacity: .6; }
.summary__line--save, .summary__line--save b { color: #8fd19e; }
.promo { margin: 1rem 0 .2rem; padding-top: .9rem; border-top: 1px dashed rgba(243,230,211,.18); }
.promo label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .45rem; color: var(--cream-dim); }
.promo__row { display: flex; gap: .5rem; }
.promo__row input { flex: 1; min-width: 0; padding: .6rem .9rem; text-transform: uppercase; letter-spacing: .06em; }
.promo__on { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.promo__chip { padding: .35rem .8rem; border-radius: 999px; background: rgba(143,209,158,.14); color: #8fd19e; font-weight: 700; letter-spacing: .06em; }
.promo__remove { background: none; border: 0; color: var(--cream-dim); text-decoration: underline; cursor: pointer; font: inherit; font-size: .88rem; }
.promo__msg { margin: .45rem 0 0; font-size: .85rem; min-height: 0; color: var(--cream-dim); }
.promo__msg:empty { display: none; }
.promo__msg.is-err { color: #ff9a7a; }
.place { width: 100%; margin-top: 1rem; font-size: 1.05rem; padding: 1rem; }
.place[disabled] { opacity: .6; cursor: progress; }

/* ---------- order page ---------- */
.order { padding-top: 120px; background: var(--pattern), var(--black); min-height: 100svh; }
.order__card { max-width: 640px; margin: 0 auto; text-align: center; }
.order__mark { width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 1rem; display: grid; place-items: center; background: var(--orange); color: var(--black); font-size: 2.2rem; font-weight: 700; }
.order__mark--warn { background: #3a2213; color: var(--orange); border: 2px solid var(--orange); }
.order h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 5vw, 2.8rem); margin: 0 0 .5rem; }
html:lang(en) .order h1 { font-weight: 700; }
.order__code { font-size: 1.1rem; margin: 0 0 1.5rem; color: var(--cream-dim); }
.order__code strong { color: var(--orange); font-size: 1.4rem; font-family: var(--font-en-display); letter-spacing: .04em; }
.order__facts { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; text-align: start; margin: 1.5rem 0; }
.order__facts div { background: var(--coffee-900); border-radius: 14px; padding: .8rem 1rem; border: 1px solid rgba(243,230,211,.1); }
.order__facts dt { color: var(--mocha); font-size: .82rem; font-weight: 700; }
.order__facts dd { margin: 0; font-weight: 700; }
.order__items { text-align: start; }
.order__actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
/* order notifications and the receipt button */
.order__push { margin-bottom: 1.2rem; }
.order__push h2 { margin-top: 0; }
.order__push.is-on .btn { background: transparent; color: var(--cream, #F3E6D3); border: 1px solid rgba(253, 154, 25, .5); }
.order__push-state { min-height: 1.2em; margin: .6rem 0 0; font-size: .9rem; opacity: .85; }
.order__receipt { margin: 0 0 1.2rem; }

/* ---------- policies ---------- */
.prose { max-width: 760px; margin: 0 auto; }
.prose h2 { font-size: 1.35rem; margin: 2.2rem 0 .6rem; color: var(--orange); }
.prose p, .prose li { color: var(--cream-dim); }
.policy-nav { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-bottom: 2rem; }
.policy-nav a { padding: .45rem 1rem; border-radius: 999px; border: 1px solid rgba(243,230,211,.2); color: var(--cream-dim); text-decoration: none; font-weight: 600; }
.policy-nav a:hover { color: var(--orange); border-color: var(--orange); }

@media (max-width: 900px) {
  .product__grid, .checkout__grid { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 520px) {
  .pgrid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .pcard__body { padding: .8rem; }
  .pcard__name { font-size: 1.2rem; }
  html:lang(en) .pcard__name { font-size: 1.05rem; }
  .pcard__notes { display: none; }
  .pcard__foot { flex-direction: column; align-items: flex-start; gap: .2rem; }
  .order__facts { grid-template-columns: 1fr; }
  .nav__actions { gap: .4rem; }
  .cart-btn { width: 38px; height: 38px; }
}

/* pickup branch choice */
.branch-pick { border: 0; padding: 0; margin: 1.1rem 0 0; }
.branch-pick legend { font-weight: 700; margin-bottom: .6rem; padding: 0; }
.order__addr { display: block; color: var(--cream-dim); font-weight: 400; font-size: .9rem; }
.order__dir { display: inline-block; margin-top: .3rem; color: var(--orange); font-weight: 700; font-size: .9rem; }
