/* Piece pages (/products/…), category and search pages: the website's look (site.css: ivory, deep green, gold, serif
   headings), a photo gallery with a full-screen zoom (commerce-product.js). */
.commerce-page {
  --ivory: #fbf8f2; --ivory-2: #f4eee3; --paper: #ffffff; --green: #123a2b; --green-2: #1d4d3a; --gold: #b8892f; --gold-2: #d6b06a;
  --gold-soft: #f3e7cc; --ink: #1b241f; --muted: #6b746e; --line: rgba(18, 58, 43, 0.12);
  --serif: "Cormorant Garamond", "Amiri", Georgia, serif; --sans: "Jost", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  color-scheme: light; font-family: var(--sans); color: var(--ink); background: var(--ivory); margin: 0; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] .commerce-page { --serif: "Amiri", "Cormorant Garamond", Georgia, serif; --sans: "IBM Plex Sans Arabic", "Jost", "Segoe UI", Tahoma, Arial, sans-serif; }
.commerce-page * { box-sizing: border-box; }
.commerce-page a { color: var(--green-2); text-underline-offset: 4px; overflow-wrap: anywhere; }
.commerce-page header, .commerce-page main, .commerce-page footer { max-width: 1200px; margin: auto; padding: 20px 24px; }

/* Header: the shop's name in the serif, the language as a pill. */
.commerce-page header { display: flex; justify-content: space-between; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); }
.commerce-page header a:first-child { font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--green); text-decoration: none; letter-spacing: 0.01em; }
.commerce-page #langToggle { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px; color: var(--green); background: var(--paper); font-size: 14px; }
.commerce-page main > nav { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.commerce-page main > nav a { display: inline-block; text-decoration: none; font-size: 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px; background: var(--paper); }
/* "All pieces": back to the catalog, the clear way out of a piece. */
.commerce-page main > nav a.c-back { color: #fff; background: var(--green); border-color: var(--green); font-weight: 500; }
.commerce-page main > nav a.c-back::before { content: "← "; }
html[dir="rtl"] .commerce-page main > nav a.c-back::before { content: "→ "; }

.commerce-page h1 { font-family: var(--serif); font-size: clamp(28px, 4vw, 40px); font-weight: 700; line-height: 1.25; color: var(--green); margin: 0 0 10px; overflow-wrap: anywhere; }
.commerce-page h2 { font-family: var(--serif); font-size: 28px; color: var(--green); margin: 48px 0 18px; }
.commerce-page h3 { font-size: 16px; font-weight: 500; margin: 10px 0 2px; }
.commerce-page p { line-height: 1.8; }

/* The piece: the gallery beside the details (stacked on phones). */
.commerce-product { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 44px; margin-top: 20px; align-items: start; }
.commerce-product > div:last-child { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: 0 1px 2px rgba(18, 58, 43, 0.05), 0 12px 32px rgba(18, 58, 43, 0.07); }

/* Gallery. Without JavaScript: the photos in a grid. With it (commerce-product.js): one large photo, thumbnails below,
   and a tap opens it full screen with zoom. */
.commerce-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.commerce-gallery > img:first-child { grid-column: 1 / -1; }
.commerce-gallery img, .commerce-tile img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; background: var(--paper); border-radius: 16px; }
.commerce-gallery.g-ready { display: block; }
.c-media { position: sticky; top: 16px; display: grid; gap: 12px; }
/* The piece's Instagram reel or post. */
.c-instagram { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 18px; border-radius: 999px; color: #fff !important; text-decoration: none; font-weight: 600; background: linear-gradient(120deg, #f58529, #dd2a7b 50%, #8134af); box-shadow: 0 8px 20px rgba(221, 42, 123, 0.25); }
.c-instagram svg { width: 22px; height: 22px; }
.c-instagram:hover { filter: brightness(1.05); }
.g-main { position: relative; margin: 0; border-radius: 20px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); cursor: zoom-in; }
.g-main img { display: block; border-radius: 0; transition: transform 0.5s ease; }
.g-main:hover img { transform: scale(1.03); }
.g-zoom-hint { position: absolute; inset-inline-end: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); color: var(--green); font-size: 13px; border: 1px solid var(--line); pointer-events: none; }
.g-zoom-hint svg { width: 16px; height: 16px; }
.g-count { position: absolute; inset-inline-start: 12px; top: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(18, 58, 43, 0.75); color: #fff; font-size: 12px; direction: ltr; }
.g-thumbs { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.g-thumbs button { flex: 0 0 auto; width: 76px; height: 76px; padding: 0; border: 2px solid transparent; border-radius: 12px; overflow: hidden; background: var(--paper); cursor: pointer; opacity: 0.7; transition: opacity 0.2s, border-color 0.2s; }
.g-thumbs button:hover { opacity: 1; }
.g-thumbs button[aria-current="true"] { border-color: var(--gold); opacity: 1; }
.g-thumbs img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; aspect-ratio: auto; }

/* Full screen with zoom. */
.g-viewer { position: fixed; inset: 0; z-index: 1000; background: #0b130f; display: grid; grid-template-rows: auto 1fr auto; color: #fff; touch-action: none; }
.g-viewer[hidden] { display: none; }
.g-viewer-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; direction: ltr; }
.g-viewer-top span { font-size: 14px; opacity: 0.85; }
.g-viewer button { background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px; width: 44px; height: 44px; font-size: 20px; line-height: 1; cursor: pointer; padding: 0; display: inline-grid; place-items: center; }
.g-viewer button:hover { background: rgba(255, 255, 255, 0.22); }
.g-stage { position: relative; overflow: hidden; display: grid; place-items: center; }
.g-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: 0 0; will-change: transform; user-select: none; -webkit-user-drag: none; cursor: zoom-in; background: transparent; border-radius: 0; aspect-ratio: auto; width: auto; height: auto; }
.g-stage.zoomed img { cursor: grab; }
.g-prev, .g-next { position: absolute; top: 50%; transform: translateY(-50%); }
.g-prev { left: 12px; } .g-next { right: 12px; }
.g-viewer-bottom { text-align: center; padding: 10px 16px 16px; font-size: 13px; opacity: 0.75; }
.g-viewer-tools { display: inline-flex; gap: 10px; margin-bottom: 8px; }

/* Details. */
.commerce-price { font-size: 30px; color: var(--gold); font-weight: 700; margin: 12px 0 6px; font-variant-numeric: tabular-nums; }
.commerce-price del { font-size: 18px; color: var(--muted); font-weight: 400; margin-inline-end: 8px; }
/* Real interest in the piece: 🔥 in demand, views this week, questions on WhatsApp. */
.c-interest { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.c-hot { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #f0883e, #d9480f); box-shadow: 0 4px 12px rgba(217, 72, 15, 0.25); }
.c-preview { flex-basis: 100%; font-size: 12px; color: #8a5a12; background: #fff4dc; border: 1px dashed #d9a441; border-radius: 10px; padding: 4px 10px; }
.c-stat { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; font-size: 13px; color: var(--muted); background: var(--ivory); border: 1px solid var(--line); }
.c-availability { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; font-size: 14px; background: #e7f3ec; color: #1d6b43; }
.c-availability::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.c-availability.off { background: #f1ecec; color: #8a3a2d; }
.commerce-description { white-space: pre-line; overflow-wrap: anywhere; color: #3c4640; }
.commerce-offer { margin: 18px 0; padding: 16px 18px; border-radius: 16px; background: linear-gradient(135deg, #fff8e8, var(--gold-soft)); border: 1px solid rgba(184, 137, 47, 0.35); }
.commerce-offer strong { color: var(--green); }
.commerce-offer p { margin: 4px 0; }
#clock { display: flex; gap: 10px; direction: ltr; margin-block: 12px 0; }
#clock div { display: grid; gap: 2px; text-align: center; min-width: 58px; padding: 8px 6px; border-radius: 12px; background: var(--paper); border: 1px solid rgba(184, 137, 47, 0.3); }
#clock b { font-size: 24px; color: var(--green); font-variant-numeric: tabular-nums; }
#clock small { font-size: 11px; color: var(--muted); }
.commerce-page dl { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 20px 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.commerce-page dt, .commerce-page dd { padding: 10px 14px; border-bottom: 1px solid var(--line); margin: 0; }
.commerce-page dt { color: var(--muted); font-size: 14px; background: var(--ivory); }
.commerce-page dd { font-weight: 500; overflow-wrap: anywhere; }
.commerce-page dt:nth-last-of-type(1), .commerce-page dd:last-of-type { border-bottom: 0; }
#specs { list-style: none; padding: 0; margin: 14px 0 22px; display: grid; gap: 8px; }
#specs li { position: relative; padding-inline-start: 22px; }
#specs li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 0.7em; width: 7px; height: 7px; transform: rotate(45deg); background: var(--gold-2); }
.commerce-action, .commerce-page .commerce-action, .commerce-page button.commerce-action { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: #1f8f4d; color: #fff; border: 0; border-radius: 999px; padding: 15px 26px; text-decoration: none; cursor: pointer; font: inherit; font-weight: 600; box-shadow: 0 8px 20px rgba(31, 143, 77, 0.25); transition: transform 0.15s, box-shadow 0.15s; }
.commerce-action:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(31, 143, 77, 0.3); }
#whatsapp { width: 100%; }
#whatsapp svg { width: 22px; height: 22px; }

/* "Tell me" on a sold piece or an offer that hasn't started. */
.c-notify { margin: 18px 0; padding: 16px 18px; border-radius: 16px; background: var(--ivory); border: 1px solid rgba(184, 137, 47, 0.35); display: grid; gap: 10px; }
.c-notify strong { color: var(--green); }
.c-notify p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.c-notify-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.commerce-page .c-notify-btn { background: var(--green); box-shadow: none; }
.c-notify-msg { color: #1d6b43 !important; font-weight: 600; }
.c-notify .c-notify-btn { justify-self: start; text-decoration: none; }
/* What the offer is: one line in the offer box, and the saving next to the price. */
.c-offer-line { margin: 0 0 8px; font-size: 17px; font-weight: 800; color: #8a3a2d; }
.commerce-price del { color: var(--muted); font-weight: 500; font-size: 0.8em; margin-inline-end: 6px; }
.c-save { display: inline-block; margin-inline-start: 10px; padding: 3px 10px; border-radius: 999px; background: #c0392b; color: #fff; font-size: 14px; font-weight: 800; vertical-align: middle; }
.c-notify-join { color: #a87a2a; font-weight: 700; font-size: 14px; }
.c-notify-msg.error { color: #8a3a2d !important; }
@media (max-width: 760px) { .c-notify-row { grid-template-columns: 1fr; } }

/* Related pieces, category and search pages. */
.commerce-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.commerce-tile { display: block; text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 10px 10px 14px; transition: transform 0.2s, box-shadow 0.2s; }
.commerce-tile:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(18, 58, 43, 0.1); }
.commerce-tile img { border-radius: 12px; }
.commerce-tile h3 { color: var(--ink); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.commerce-tile span { color: var(--gold); font-weight: 600; }
.commerce-filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; align-items: end; }
.commerce-filters label { width: 150px; display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.commerce-page input, .commerce-page select { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font: inherit; background: var(--paper); }
.commerce-page button:not(.g-viewer button):not(.g-thumbs button) { display: inline-block; background: var(--green); color: #fff; border: 0; border-radius: 999px; padding: 12px 22px; cursor: pointer; font: inherit; }
.commerce-page footer { border-top: 1px solid var(--line); margin-top: 48px; color: var(--muted); }
.commerce-page footer strong { font-family: var(--serif); font-size: 22px; color: var(--green); }

@media (max-width: 760px) {
  .commerce-page header, .commerce-page main, .commerce-page footer { padding: 14px 16px; }
  .commerce-page header a:first-child { font-size: 22px; }
  .commerce-product { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .c-media { position: static; }
  .commerce-product > div:last-child { padding: 18px; }
  .commerce-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .commerce-filters label { width: calc(50% - 6px); }
  .g-thumbs button { width: 64px; height: 64px; }
  .g-prev, .g-next { display: none; }
}
@media (prefers-reduced-motion: reduce) { .g-main img, .commerce-tile, .commerce-action { transition: none; } }
