/* ==========================================================================
   محصولات، معادن و نمایشگر عکس
   عکس سنگ خودِ محصول است؛ پس عکس همه‌جا بزرگ است و متن رویش می‌نشیند.
   ========================================================================== */
:root {
  --gx-bg: rgba(24, 25, 24, .97);
  --stone-a: #d8d4cd;
  --stone-b: #b9b3a9;
  --stone-c: #8f897f;
  --tile-radius: 14px;
}

/* --------------------------------------------------------------------------
   کاشی بدون عکس: بافت سنگ به‌جای عکس شکسته
   -------------------------------------------------------------------------- */
.stone-fill {
  position: absolute; inset: 0; display: grid; place-items: center;
  background:
    radial-gradient(120% 80% at 18% 22%, rgba(255, 255, 255, .45), transparent 55%),
    radial-gradient(90% 70% at 85% 80%, rgba(0, 0, 0, .18), transparent 60%),
    linear-gradient(115deg, transparent 46%, rgba(255, 255, 255, .25) 47%, transparent 49%),
    linear-gradient(160deg, transparent 62%, rgba(0, 0, 0, .08) 63%, transparent 66%),
    linear-gradient(135deg, var(--stone-a), var(--stone-b) 60%, var(--stone-c));
}
.stone-fill.is-dark { --stone-a: #5b5a57; --stone-b: #3c3b39; --stone-c: #262625; }
.stone-fill.is-warm { --stone-a: #e9dcc4; --stone-b: #cdb48d; --stone-c: #a8865a; }

/* --------------------------------------------------------------------------
   فهرست محصولات
   -------------------------------------------------------------------------- */
.shop-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}
.shop-tabs { display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; }
.shop-tabs::-webkit-scrollbar { display: none; }
.shop-tabs a {
  flex: 0 0 auto; padding: .6rem 1.1rem; border-radius: 999px;
  color: var(--text-soft); text-decoration: none; font-weight: 600; font-size: .95rem;
  border: 1px solid var(--line); background: var(--paper);
}
.shop-tabs a:hover { color: var(--text); border-color: var(--text-soft); }
.shop-tabs a.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.shop-search { position: relative; flex: 0 1 280px; }
.shop-search input {
  width: 100%; min-height: 44px; padding-inline: 1rem 2.6rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  font: inherit; color: var(--text);
}
.shop-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.shop-search button {
  position: absolute; inset-block: 0; inset-inline-end: .3rem; width: 38px;
  border: 0; background: none; color: var(--text-soft); cursor: pointer;
}
.shop-search svg { width: 18px; height: 18px; }

.shop-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin: 0 0 1rem;
}
.shop-head h2 { margin: 0; font-size: clamp(1.25rem, 2.6vw, 1.6rem); }
.shop-head span { color: var(--text-soft); font-size: .9rem; }

/* معادن: نوار افقی کاشی‌های بلند */
.quarry-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 24%);
  gap: 1rem; overflow-x: auto; padding-bottom: .6rem; margin-bottom: clamp(2.5rem, 6vw, 4rem);
  scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.quarry-tile { display: block; color: inherit; text-decoration: none; scroll-snap-align: start; }
.quarry-tile-media {
  position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden;
  border-radius: var(--tile-radius); background: var(--paper-2);
}
.quarry-tile-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease;
}
.quarry-tile-text { display: block; padding: .75rem .15rem 0; }
.quarry-tile-text strong { display: block; font-size: 1.05rem; line-height: 1.4; }
.quarry-tile-text span { font-size: .86rem; color: var(--text-soft); }

/* کاشی محصول */
.stone-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: clamp(.8rem, 2vw, 1.4rem);
}
.stone-card { display: block; color: inherit; text-decoration: none; }
.stone-card-media {
  position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: var(--tile-radius); background: var(--paper-2);
}
.stone-card-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease;
}
.stone-card-body { padding: .8rem .15rem 0; }
.stone-card-body h3 { margin: 0 0 .2rem; font-size: 1.05rem; line-height: 1.4; }
.stone-card-body p { margin: 0; color: var(--text-soft); font-size: .88rem; }
@media (hover: hover) {
  .quarry-tile:hover img, .stone-card:hover .stone-card-media img { transform: scale(1.05); }
  .stone-card:hover h3, .quarry-tile:hover strong { color: var(--accent-deep); }
}
.quarry-tile:focus-visible, .stone-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: var(--tile-radius); }

.shop-empty {
  padding: 3rem 1rem; text-align: center; color: var(--text-soft);
  border: 1px dashed var(--line); border-radius: var(--tile-radius);
}
.shop-empty a { color: var(--accent-deep); }

/* --------------------------------------------------------------------------
   صفحه معدن: عکس بزرگ بالا، دیوار عکس پایین
   -------------------------------------------------------------------------- */
.quarry-hero { background: var(--paper); }
.quarry-hero-media {
  position: relative; display: block; height: clamp(300px, 58vh, 620px);
  overflow: hidden; background: var(--paper-2); cursor: zoom-in;
}
.quarry-hero-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.quarry-hero-text {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem;
  padding-block: clamp(1.4rem, 4vw, 2.2rem) 0;
}
.quarry-hero h1 {
  margin: 0; font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.2; color: var(--ink);
}
.quarry-hero nav { margin-bottom: .35rem; font-size: .88rem; }
.quarry-hero nav a { color: var(--text-soft); text-decoration: none; }
.quarry-hero nav a:hover { color: var(--accent-deep); }
.hero-open {
  display: inline-flex; align-items: center; gap: .55rem;
  min-height: 46px; padding: 0 1.2rem; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; font: inherit; font-weight: 600;
}
.hero-open:hover { background: var(--accent-deep); }
.hero-open svg { width: 20px; height: 20px; }

/* دیوار عکس: هر عکس با نسبت طبیعی خودش */
.rock-wall { columns: 3 260px; column-gap: clamp(.6rem, 1.5vw, 1rem); }
.rock-wall a {
  display: block; margin-bottom: clamp(.6rem, 1.5vw, 1rem); break-inside: avoid;
  border-radius: 12px; overflow: hidden; background: var(--paper-2); cursor: zoom-in;
}
.rock-wall img { display: block; width: 100%; height: auto; transition: transform .5s ease, opacity .3s ease; }
@media (hover: hover) { .rock-wall a:hover img { transform: scale(1.03); } }
.rock-wall a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.quarry-ask {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: clamp(2rem, 5vw, 3rem); padding: 1.4rem 1.6rem;
  border-radius: var(--tile-radius); background: var(--ink); color: #fff;
}
.quarry-ask p { margin: 0; font-size: 1.05rem; }

/* --------------------------------------------------------------------------
   صفحه محصول: عکس بزرگ و نوار عکس‌ها
   -------------------------------------------------------------------------- */
.pd-media { display: grid; gap: .7rem; }
.pd-main {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--tile-radius); background: var(--paper-2); cursor: zoom-in;
}
.pd-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pd-main .pd-zoom {
  position: absolute; inset-block-end: .8rem; inset-inline-end: .8rem; z-index: 1;
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--text);
}
.pd-main .pd-zoom svg { width: 20px; height: 20px; }
.pd-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .5rem; }
.pd-thumbs a {
  display: block; aspect-ratio: 1; overflow: hidden; border-radius: 10px;
  border: 2px solid transparent; background: var(--paper-2);
}
.pd-thumbs a:first-child { border-color: var(--accent); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --------------------------------------------------------------------------
   نمایشگر تمام‌صفحه
   -------------------------------------------------------------------------- */
html.gx-locked, html.gx-locked body { overflow: hidden; }

.gx {
  --gx-fade: 1;
  position: fixed; inset: 0; z-index: 1000;
  display: grid; grid-template-rows: auto 1fr auto auto;
  background: rgba(24, 25, 24, calc(.97 * var(--gx-fade)));
  color: #fff; user-select: none; -webkit-user-select: none;
  padding-block: env(safe-area-inset-top, 0) env(safe-area-inset-bottom, 0);
  animation: gxIn .2s ease;
}
.gx[hidden] { display: none; }
@keyframes gxIn { from { opacity: 0; } }

.gx-bar { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1rem; }
.gx-count { font-size: .95rem; opacity: .85; font-variant-numeric: tabular-nums; }
.gx-tools { display: flex; gap: .4rem; }

.gx-btn, .gx-nav {
  display: grid; place-items: center; border: 0; cursor: pointer; color: #fff;
  background: rgba(255, 255, 255, .12); border-radius: 50%;
  transition: background .15s ease;
}
.gx-btn { width: 44px; height: 44px; }
.gx-btn:hover, .gx-nav:hover { background: rgba(255, 255, 255, .24); }
.gx-btn:focus-visible, .gx-nav:focus-visible, .gx-thumb:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.gx svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gx-btn[hidden] { display: none; }

.gx-stage {
  position: relative; display: grid; place-items: center; overflow: hidden;
  touch-action: none; cursor: grab; min-height: 0;
}
.gx.is-zoomed .gx-stage { cursor: move; }
.gx-img {
  max-width: calc(100vw - 2rem); max-height: 100%; object-fit: contain;
  transition: transform .28s ease, opacity .28s ease; will-change: transform;
  -webkit-user-drag: none;
}
.gx.is-loading .gx-stage::before {
  content: ''; position: absolute; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .2); border-top-color: #fff;
  animation: gxSpin .8s linear infinite;
}
@keyframes gxSpin { to { transform: rotate(360deg); } }

.gx-nav {
  position: absolute; inset-block-start: 50%; width: 52px; height: 52px; margin-top: -26px;
}
.gx-prev { inset-inline-start: 1rem; }
.gx-next { inset-inline-end: 1rem; }
/* در راست‌به‌چپ پیکان‌ها برعکس می‌شوند */
[dir="rtl"] .gx-nav svg { transform: scaleX(-1); }
.gx.is-single .gx-nav, .gx.is-single .gx-strip { display: none; }
.gx.is-zoomed .gx-nav, .gx.is-zoomed .gx-caption, .gx.is-zoomed .gx-strip { opacity: 0; pointer-events: none; }

.gx-caption {
  margin: 0; padding: .5rem 1rem 0; text-align: center; font-size: .92rem; opacity: .85;
  transition: opacity .2s ease;
}
.gx-caption[hidden] { display: none; }

.gx-strip {
  display: flex; gap: .45rem; padding: .8rem 1rem 1rem; overflow-x: auto;
  scrollbar-width: none; justify-content: safe center; transition: opacity .2s ease;
}
.gx-strip::-webkit-scrollbar { display: none; }
.gx-thumb {
  flex: 0 0 auto; width: 58px; height: 58px; padding: 0; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; border-radius: 9px; background: rgba(255, 255, 255, .08);
  opacity: .5; transition: opacity .15s ease, border-color .15s ease;
}
.gx-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gx-thumb:hover { opacity: .85; }
.gx-thumb.is-active { opacity: 1; border-color: #fff; }

@media (max-width: 640px) {
  .gx-nav { display: none; }   /* روی گوشی کشیدن انگشت کافی است */
  .gx-img { max-width: 100vw; }
  .gx-thumb { width: 48px; height: 48px; }
  .quarry-strip { grid-auto-columns: 62%; }
  .stone-grid { grid-template-columns: repeat(2, 1fr); gap: .7rem .6rem; }
  .stone-card-body h3 { font-size: .95rem; }
  .rock-wall { columns: 2; }
  .shop-search { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .gx, .gx-img, .quarry-tile img, .stone-card-media img, .rock-wall img { animation: none; transition: none; }
}
