/* Shop page — sits on top of ../styles.css */
:root {
  --lav: #d9d7fb;         /* panel lavender */
  --lav-ink: #261c63;     /* text on lavender */
  --magenta: var(--pink); /* #da2e70 */
  --hover-bg: #261c63;    /* indigo */
  --hover-ink: #e9a0be;   /* light pink */
  --book-bg: #d2d5fc;     /* matches the book photo's backdrop */
  --featured-bg: #e3f7a8; /* lime */
}


.shop { padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(3rem, 7vw, 5rem); }

/* Featured product */
.featured {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  background: var(--featured-bg);
  color: var(--lav-ink);
}
.featured-img { order: 2; background: var(--book-bg); display: grid; place-items: center; }
.featured-img img {
  width: 100%; height: 100%; max-height: 400px; object-fit: contain;
  /* fade the photo's edges into the panel so no frame shows */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent);
  mask-composite: intersect;
}
.featured-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: clamp(2rem, 5vw, 3.5rem) 1.5rem;
  text-align: center;
}
.featured h1 { font-family: var(--font-body); font-weight: var(--heading-weight); font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.3; }

.featured-desc { max-width: 44rem; font-size: clamp(1.2rem, 2.1vw, 1.6rem); /* same as the organizations text */ line-height: 1.6; display: grid; gap: .5rem; }
.featured-desc a { text-underline-offset: .2em; }
.rule { width: 1.2rem; margin: 0 auto; border: 0; border-top: 1px solid currentColor; }
.product .rule { width: 55%; border-top-width: 2px; }
/* The featured book: a long line like the product cards, not a short dash */
.featured .rule { width: min(60%, 22rem); border-top-width: 2px; }

.price { display: flex; gap: 1.5rem; justify-content: center; font-size: 1.5rem; }
.price s { opacity: .8; }

.buy-btn {
  margin-top: 1.25rem;
  padding: .8rem 3rem;
  border: 0;
  border-radius: 999px;
  background: var(--magenta);
  /* White, not lavender: lavender on magenta is 3.3:1, under the 4.5:1 accessibility minimum */
  color: #fff;
  font: inherit;
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
@media (hover: hover) { .buy-btn:hover { background: var(--hover-bg); color: var(--hover-ink); } }
.buy-btn:active { background: var(--hover-bg); color: var(--hover-ink); }

/* Product row */
.products {
  list-style: none;
  margin: clamp(2.5rem, 5vw, 3rem) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1rem, 2.4vw, 1.5rem);
}
.product { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .9rem; }
.product img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--lav);
}
.product h3 { font-family: var(--font-body); font-weight: 500; font-size: 1.15rem; line-height: 1.35; min-height: 2.7em; }
.product .price { font-size: 1.1rem; }
.add-btn {
  margin-top: auto;
  padding: .55rem 1.4rem;
  border: 2px solid var(--pink);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .95rem;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.add-btn:hover,
.add-btn:active { background: var(--pink); color: #fff; }
/* Collected: once the product is in the cart its button comes back with a chartreuse
   outline, as "בעגלה ✓". It still adds another one; under the mouse it fills chartreuse */
.add-btn.in-cart { border-color: var(--lime); color: var(--text-soft); }
.add-btn.in-cart:hover,
.add-btn.in-cart:active { border-color: var(--lime); background: var(--lime); color: #261c63; }

/* Cart drawer */
.cart {
  width: min(400px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto 0 0;          /* opens on the left edge (end side in RTL) */
  padding: 1.5rem;
  border: 0;
  background: var(--lav);
  color: var(--lav-ink);
  flex-direction: column;
  gap: 1rem;
}
.cart[open] { display: flex; animation: slide .3s var(--ease) both; }
@keyframes slide { from { transform: translateX(-100%); } }
.cart::backdrop { background: rgba(10, 6, 30, .6); }
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-head h2 { font-size: 1.6rem; }
.cart-close { border: 0; background: none; color: inherit; font-size: 1.3rem; cursor: pointer; padding: .25rem .5rem; }
.cart-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; overflow-y: auto; flex: 1; align-content: start; }
.cart-item { display: grid; grid-template-columns: 64px 1fr auto; gap: .8rem; align-items: center; }
.cart-item img { width: 64px; height: 64px; object-fit: contain; background: #fff; }
.cart-item .name { font-size: 1.05rem; line-height: 1.3; }
.cart-item .sub { font-size: 1rem; opacity: .75; }
.qty { display: inline-flex; align-items: center; gap: .4rem; margin-top: .3rem; }
.qty button {
  width: 1.7rem; height: 1.7rem; padding: 0;
  border: 1px solid currentColor; border-radius: 50%;
  background: none; color: inherit; font: inherit; line-height: 1; cursor: pointer;
}
.remove { border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; font-size: .95rem; text-decoration: underline; }
.cart-empty { opacity: .8; }
.cart-foot { border-top: 1px solid rgba(38, 28, 99, .2); padding-top: 1rem; display: grid; gap: .6rem; }
.cart-total { font-size: 1.15rem; }
.checkout-btn {
  padding: .85rem;
  border: 0;
  border-radius: 999px;
  background: var(--magenta);
  color: var(--lav);
  font: inherit;
  font-size: 1.1rem;
  transition: background-color .2s, color .2s;
}
@media (hover: hover) { .checkout-btn:not(:disabled):hover { background: var(--hover-bg); color: var(--hover-ink); } }
.checkout-btn:not(:disabled):active { background: var(--hover-bg); color: var(--hover-ink); }
.checkout-btn:disabled { opacity: .45; cursor: not-allowed; }
.cart-note { font-size: 1rem; text-align: center; opacity: .8; }

/* Checkout details form */
.cart-foot[hidden], .checkout-form[hidden], .cart-items[hidden] { display: none; }
.checkout-form { display: grid; gap: .75rem; overflow-y: auto; align-content: start; flex: 1; }
.form-title { font-weight: 600; }
.ship-choice { border: 0; margin: 0; padding: 0; display: grid; gap: .35rem; }
.ship-choice legend { font-size: 1rem; margin-bottom: .35rem; padding: 0; }
.checkout-form .radio { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; cursor: pointer; }
.checkout-form .radio input { accent-color: var(--lav-ink); width: 1.05rem; height: 1.05rem; margin: 0; }
.ship-fields { display: grid; gap: .75rem; }
.ship-fields[hidden] { display: none; }
.ship-line { font-size: 1rem; }
.checkout-form label { display: grid; gap: .25rem; font-size: 1rem; }
.checkout-form input {
  padding: .6rem .75rem;
  border: 1px solid rgba(38, 28, 99, .3);
  border-radius: 8px;
  background: #fff;
  color: var(--lav-ink);
  font: inherit;
  font-size: 1rem;
}
.checkout-form input[dir="ltr"] { text-align: right; }
.checkout-form input:focus-visible { outline: 2px solid var(--lav-ink); outline-offset: 1px; }
.form-error { color: #b3261e; font-size: 1rem; }
.checkout-form .cart-total { margin-top: .25rem; }
.checkout-btn:not(:disabled) { cursor: pointer; }
.back-btn { border: 0; background: none; color: inherit; font: inherit; font-size: 1rem; text-decoration: underline; cursor: pointer; justify-self: center; }

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translate(-50%, 150%);
  padding: .7rem 1.3rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: .95rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  visibility: hidden;
  transition: transform .3s var(--ease), visibility 0s .3s;
  z-index: 300;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .3s var(--ease); }

@media (max-width: 800px) {
  .featured { grid-template-columns: 1fr; }
  .featured-img { order: 0; }
  .featured-img img { max-width: 380px; max-height: none; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2rem; }
}
@media (max-width: 600px) {
  .products { grid-template-columns: minmax(0, 1fr); row-gap: 2.5rem; }
  .product { width: min(100%, 420px); margin-inline: auto; }
  .product h3 { min-height: 0; }
}


/* Product quick view */
.product-view, .product-title { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: zoom-in; }
.product-view { display: block; width: 100%; }
.product-view img { transition: opacity .2s; }
@media (hover: hover) {
  .product-view:hover img { opacity: .85; }
  .product-title:hover { text-decoration: underline; text-underline-offset: .2em; }
}
.product-title { cursor: pointer; line-height: inherit; }
.product-view:focus-visible, .product-title:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }

.quickview {
  width: min(960px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: clamp(1.25rem, 4vw, 2.75rem);
  border: 0;
  background: #fff;
  color: var(--lav-ink);
  overflow-y: auto;
}
.quickview[open] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; animation: qv-in .25s var(--ease) both; }
@keyframes qv-in { from { opacity: 0; transform: scale(.97); } }
.quickview::backdrop { background: rgba(10, 6, 30, .6); }
.qv-close { position: absolute; top: .6rem; left: .6rem; border: 0; background: none; color: inherit; font-size: 1.3rem; cursor: pointer; padding: .3rem .55rem; }
.qv-img { background: var(--lav); aspect-ratio: 1; display: grid; place-items: center; }
.qv-img img { width: 100%; height: 100%; object-fit: contain; }
.qv-body { display: grid; gap: 1.1rem; padding-top: .5rem; }
.qv-name { font-family: var(--font-body); font-weight: var(--heading-weight); font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.3; }
.qv-price { justify-content: flex-start; font-size: 1.15rem; }
.qv-desc { line-height: 1.6; }
.qv-qty-wrap { display: grid; gap: .4rem; justify-items: start; }
.qv-label { font-size: 1rem; }
.qv-qty { display: inline-flex; align-items: center; border: 1px solid rgba(38, 28, 99, .35); }
.qv-qty button { width: 2.6rem; height: 2.6rem; border: 0; background: none; color: inherit; font: inherit; font-size: 1.2rem; cursor: pointer; }
.qv-qty span { min-width: 2rem; text-align: center; }
.qv-add { margin-top: .5rem; cursor: pointer; }
@media (max-width: 700px) {
  .quickview[open] { grid-template-columns: 1fr; }
  .qv-img { order: -1; margin-top: 1.5rem; }
}

/* "Won something" moment on הוספה לעגלה, like collecting a coin in a game:
   the button vanishes at once, "+price" appears in its place, drifts up a little
   and fades, then the button comes back */
.add-btn { position: relative; }
.add-btn.scored,
.add-btn.scored:hover,
.add-btn.scored:active { background: transparent; border-color: transparent; color: transparent; transition: none; }
.add-btn.back { animation: btn-back .3s var(--ease) both; }
@keyframes btn-back { from { opacity: 0; } }
.score {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #fff;
  font-size: .8rem;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  animation: score .9s linear both;
}
@keyframes score {
  0%   { opacity: 1; transform: translate(-50%, -50%); }
  65%  { opacity: 1; transform: translate(-50%, calc(-50% - 1.1rem)); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 1.6rem)); }
}

/* Phones: the pre-sale text a step smaller than on desktop */
@media (max-width: 600px) {
  .featured-desc { font-size: 1.125rem; }
  .featured .price { font-size: 1.3rem; }
}

/* Black Friday sale, site-wide: black banner above the shop, and every price shows
   the original (struck through) beside the sale price */
.sale-banner {
  margin-bottom: clamp(1rem, 3vw, 1.5rem);
  padding: .75rem 1rem;
  background: #000;
  color: #fff;
  text-align: center;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.5;
}
.sale-banner[hidden] { display: none; }
.sale-banner .bf { color: var(--lime); }
.price { flex-wrap: wrap; align-items: center; column-gap: .9rem; row-gap: .3rem; }
.price .sale-price { font-weight: 600; }
.cart-item .sub { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; }
.cart-item .sub .cart-savings { font-size: 1rem; line-height: 1.5; }
.cart-savings strong { color: var(--magenta); }
.cart-savings[hidden] { display: none; }

/* ״באגים בהייטק״ בפיקסלים בראש החנות, ברוחב העמוד כולו: דף נייר עם מסגרת וצל, והחרק רץ בתוכו (pixel-bugs/pixel-bugs.js) */
.pixel-hero { margin-bottom: clamp(1.25rem, 3vw, 1.75rem); }
.pixel-stage {
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 #000;
}
.pixel-stage canvas { display: block; width: 100%; touch-action: pan-y; cursor: crosshair; }
.pixel-hint {
  display: inline-block;
  margin: 0 14px 14px;
  padding: .3rem .7rem;
  background: var(--lime);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: .85rem;
  font-weight: 600;
  transform: rotate(-2deg);
}
.pixel-hint .hint-touch { display: none; }
@media (hover: none) {
  .pixel-hint .hint-touch { display: inline; }
  .pixel-hint .hint-mouse { display: none; }
}
@media (max-width: 600px) {
  .pixel-stage { box-shadow: 5px 5px 0 #000; }
  .pixel-hint { font-size: .78rem; margin: 0 10px 10px; }
}
