/* ============================================================
   WoodGate Catalog — style.css  v5.0
   Warm Charcoal · Gold Frame · Thumbnail Strip · Hotspots
   ============================================================ */

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* ── TOKENS ──────────────────────────────────────────────── */
:root {
  /* Warm charcoal — not pure black, has a subtle wood warmth */
  --bg:          #1a1612;
  --bg2:         #201c17;
  --bg3:         #262119;
  --bg-bar:      rgba(22, 19, 14, 0.97);

  --gold:        #d4a017;
  --gold-hi:     #f5c842;
  --gold-dim:    rgba(212, 160, 23, 0.22);
  --gold-glow:   rgba(212, 160, 23, 0.40);
  --gold-frame:  rgba(212, 160, 23, 0.30);

  --w:           #ffffff;
  --w90:         rgba(255,255,255,0.90);
  --w70:         rgba(255,255,255,0.70);
  --w40:         rgba(255,255,255,0.40);
  --w20:         rgba(255,255,255,0.20);
  --w10:         rgba(255,255,255,0.10);
  --w06:         rgba(255,255,255,0.06);
  --border:      rgba(255,255,255,0.10);

  --bar-top:     50px;
  --bar-bot:     90px; /* taller — has thumbnail strip */

  --wa-green:    #25D366;
  --wa-dark:     #128C7E;
}

/* ── BASE ────────────────────────────────────────────────── */
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: -apple-system, 'SF Pro Display', 'Segoe UI', sans-serif;
  color: var(--w);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
}

/* ── APP ─────────────────────────────────────────────────── */
#app {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  position: relative; overflow: hidden;
}

/* ── BACKGROUND ──────────────────────────────────────────── */
#bg-layer {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 65% 50% at 8% 12%,  rgba(212,160,23,0.055) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 92% 88%,  rgba(212,160,23,0.040) 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 50% 50%,  rgba(40,30,10,0.3)    0%, transparent 70%),
    var(--bg);
}
#bg-layer.with-image {
  background-image: url('bg.jpg');
  background-size: cover;
  background-position: center;
  filter: brightness(0.25) saturate(0.5);
}

/* ── TOP BAR ─────────────────────────────────────────────── */
#topbar {
  position: relative; z-index: 200;
  width: 100%; height: var(--bar-top); flex-shrink: 0;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--bg-bar);
  border-bottom: 1px solid var(--gold-dim);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  direction: ltr;
}

/* brand */
#brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.bmark {
  width: 30px; height: 30px;
  border: 1.5px solid var(--gold); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(212,160,23,0.15);
}
.bname {
  font-size: clamp(11px,2.8vw,15px); font-weight: 700;
  letter-spacing: 3px; color: var(--w); text-transform: uppercase; line-height: 1.1;
}
.bsub { font-size: 8px; letter-spacing: 2px; color: var(--w40); text-transform: uppercase; }

/* search */
#search-wrap {
  flex: 1; max-width: 180px; position: relative; display: flex; align-items: center;
}
#search-wrap svg { position: absolute; left: 9px; color: var(--w40); pointer-events: none; }
#search-input {
  width: 100%; background: var(--w06);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 38px 6px 26px;
  color: var(--w); font-size: 12px; outline: none;
  direction: ltr; text-align: center; -webkit-appearance: none;
  user-select: text; -webkit-user-select: text;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#search-input::placeholder { color: var(--w40); }
#search-input:focus {
  border-color: rgba(212,160,23,0.5);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.10);
}
#search-input::-webkit-inner-spin-button,
#search-input::-webkit-outer-spin-button { -webkit-appearance: none; }
#search-go {
  position: absolute; right: 5px;
  background: var(--gold); border: none; border-radius: 5px;
  padding: 3px 7px; font-size: 10px; font-weight: 700; color: #000;
  cursor: pointer; transition: opacity 0.15s;
}
#search-go:active { opacity: 0.8; }

/* fullscreen */
#fs-btn {
  background: var(--w06); border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 9px; cursor: pointer; color: var(--w90);
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; letter-spacing: 1px; flex-shrink: 0;
  white-space: nowrap; transition: background 0.2s;
}
#fs-btn:active { background: var(--w10); transform: scale(0.95); }

/* ── STAGE ───────────────────────────────────────────────── */
#stage {
  flex: 1; width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 10px 12px 6px;
  position: relative; z-index: 1;
}

/* ── BOOK ────────────────────────────────────────────────── */
#book-scene { position: relative; }

#book {
  position: relative; border-radius: 4px;
  background: #0f0d0a;
  /* Gold frame — the physical book feel */
  border: 1.5px solid var(--gold-frame);
  box-shadow:
    0 0 0 3px rgba(212,160,23,0.06),
    0 0 0 4px rgba(0,0,0,0.4),
    0 40px 120px rgba(0,0,0,0.95),
    0 12px 32px rgba(0,0,0,0.8),
    0 2px 6px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.05);
  transition: box-shadow 0.4s;
}

/* Ground shadow */
#book::after {
  content: ''; position: absolute; bottom: -22px; left: 6%;
  width: 88%; height: 22px;
  background: radial-gradient(ellipse at 50% 0%, rgba(0,0,0,0.8) 0%, transparent 70%);
  border-radius: 50%; pointer-events: none; transform: scaleY(0.4);
}

/* ── CANVAS ──────────────────────────────────────────────── */
#flip-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: 3px;
  display: block;
  cursor: grab;
  touch-action: none;
}
#flip-canvas:active { cursor: grabbing; }

/* ── SHIMMER ─────────────────────────────────────────────── */
.shimmer-overlay {
  position: absolute; inset: 0; z-index: 5; border-radius: 3px;
  overflow: hidden; pointer-events: none;
  opacity: 1; transition: opacity 0.35s ease;
}
.shimmer-overlay::before {
  content: ''; position: absolute; inset: 0; background: #141008;
}
.shimmer-overlay::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(
    105deg,
    transparent 0%, transparent 35%,
    rgba(255,255,255,0.025) 42%, rgba(255,255,255,0.06) 50%,
    rgba(212,160,23,0.04) 54%, rgba(255,255,255,0.025) 58%,
    transparent 65%, transparent 100%
  );
  background-size: 250% 100%; background-position: 200% 0;
  animation: shimmer-sweep 1.8s ease-in-out infinite;
}
@keyframes shimmer-sweep {
  0%   { background-position:  200% 0; }
  100% { background-position: -100% 0; }
}
.shimmer-lines {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: flex-end; padding: clamp(12px,3%,22px) clamp(14px,4%,28px);
  gap: clamp(6px,1.5%,10px); z-index: 2;
}
.shimmer-line {
  height: clamp(6px,1.5%,10px); border-radius: 3px;
  background: rgba(255,255,255,0.05);
  animation: shimmer-pulse 1.8s ease-in-out infinite;
}
.shimmer-line:nth-child(1){ width:55%; animation-delay:0s;   }
.shimmer-line:nth-child(2){ width:75%; animation-delay:0.1s; }
.shimmer-line:nth-child(3){ width:40%; animation-delay:0.2s; }
.shimmer-block {
  position: absolute; top: clamp(12px,3%,22px);
  left: clamp(14px,4%,28px); right: clamp(14px,4%,28px);
  height: 38%; border-radius: 3px;
  background: rgba(255,255,255,0.04);
  animation: shimmer-pulse 1.8s ease-in-out infinite; z-index: 2;
}
.shimmer-brand {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; z-index: 3;
}
.shimmer-brand-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; opacity: 0.18;
}
.shimmer-brand-icon {
  width: clamp(28px,6vw,40px); height: clamp(28px,6vw,40px);
  border: 1.5px solid var(--gold); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  animation: shimmer-pulse 1.8s ease-in-out infinite;
}
.shimmer-brand-name {
  font-size: clamp(9px,1.8vw,12px); font-weight: 700;
  letter-spacing: 4px; text-transform: uppercase; color: var(--gold);
}
@keyframes shimmer-pulse { 0%,100%{opacity:0.5} 50%{opacity:1} }

/* ── ZOOM OVERLAY ────────────────────────────────────────── */
/* Shows when user is in zoom mode — hides hotspots */
#zoom-mode-hint {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.7); border: 0.5px solid var(--border);
  border-radius: 20px; padding: 5px 14px;
  font-size: 11px; color: var(--w70); letter-spacing: 1px;
  pointer-events: none; opacity: 0;
  transition: opacity 0.3s; z-index: 50; white-space: nowrap;
}
#zoom-mode-hint.show { opacity: 1; }

/* ── HOTSPOTS ────────────────────────────────────────────── */
.hotspot {
  position: absolute;
  width: clamp(22px,5vw,30px);
  height: clamp(22px,5vw,30px);
  border-radius: 50%;
  background: rgba(212,160,23,0.18);
  border: 1.5px solid rgba(212,160,23,0.7);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 30;
  transform: translate(-50%, -50%);
  transition: background 0.2s, transform 0.15s;
  animation: hs-pulse 2.2s ease-in-out infinite;
  touch-action: manipulation;
}
.hotspot:active { transform: translate(-50%,-50%) scale(0.88); }
.hotspot svg { width: 12px; height: 12px; }

@keyframes hs-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(212,160,23,0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(212,160,23,0); }
}

/* Hotspot hidden in zoom mode */
.hotspots-hidden .hotspot { opacity: 0; pointer-events: none; }

/* ── HOTSPOT POPUP CARD ──────────────────────────────────── */
/*
  Fixed at bottom-left of the book stage.
  Bilingual: Arabic primary, English secondary.
  Has WhatsApp CTA.
*/
#hs-popup {
  position: absolute;
  bottom: 14px;
  left: 12px;
  width: clamp(180px, 42vw, 240px);
  background: rgba(22,19,14,0.97);
  border: 1px solid rgba(212,160,23,0.30);
  border-radius: 12px;
  padding: 12px 14px;
  z-index: 40;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.7),
    0 0 0 1px rgba(212,160,23,0.08);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s cubic-bezier(0.4,0,0.2,1),
              transform 0.25s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
#hs-popup.show {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.hs-close-btn {
  position: absolute; top: 8px; right: 10px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--w10); border: none;
  color: var(--w70); font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; line-height: 1;
  transition: background 0.15s;
}
.hs-close-btn:active { background: var(--w20); }

.hs-product-name-ar {
  font-size: clamp(13px,3vw,16px); font-weight: 700;
  color: var(--w); direction: rtl; text-align: right;
  line-height: 1.3; margin-bottom: 2px;
}
.hs-product-name-en {
  font-size: clamp(10px,2.2vw,12px); color: var(--w40);
  direction: ltr; text-align: right;
  letter-spacing: 0.5px; margin-bottom: 8px;
}
.hs-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  margin-bottom: 8px;
}
.hs-price-row {
  display: flex; align-items: baseline; gap: 6px;
  justify-content: flex-end; margin-bottom: 10px;
}
.hs-price-label {
  font-size: 10px; color: var(--w40); letter-spacing: 1px; text-transform: uppercase;
}
.hs-price-value {
  font-size: clamp(16px,4vw,22px); font-weight: 700; color: var(--gold);
  letter-spacing: -0.5px;
}
.hs-price-currency { font-size: 11px; color: var(--w70); }

/* WhatsApp button */
.hs-wa-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 9px 12px;
  background: var(--wa-green);
  border: none; border-radius: 8px;
  color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: 0.3px; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 3px 12px rgba(37,211,102,0.35);
  touch-action: manipulation;
}
.hs-wa-btn:active {
  background: var(--wa-dark);
  transform: scale(0.97);
}
.hs-wa-btn svg { flex-shrink: 0; }
.hs-wa-text-ar { font-size: 12px; }
.hs-wa-text-en { font-size: 10px; opacity: 0.8; }

/* ── BOTTOM BAR ──────────────────────────────────────────── */
#bottombar {
  position: relative; z-index: 200;
  width: 100%; height: var(--bar-bot); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--bg-bar);
  border-top: 1px solid var(--gold-dim);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  direction: ltr;
  padding: 0;
}

/* nav row */
#nav-row {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 6px 14px 4px;
  flex-shrink: 0;
}

.ctrl {
  width: clamp(34px,8.5vw,42px); height: clamp(34px,8.5vw,42px);
  border-radius: 50%; background: var(--w06); border: 1px solid var(--border);
  cursor: pointer; color: var(--w);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.ctrl:not(:disabled):active {
  background: rgba(212,160,23,0.18); border-color: var(--gold);
  box-shadow: 0 0 18px var(--gold-glow); transform: scale(0.88);
}
.ctrl:disabled { opacity: 0.18; cursor: default; pointer-events: none; }

/* dots + counter */
#nav-centre { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; justify-content: center; }
#dots-clip { max-width: min(50vw,200px); overflow: hidden; position: relative; }
#dots-clip::before,
#dots-clip::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 14px; z-index: 2; pointer-events: none;
}
#dots-clip::before { left:  0; background: linear-gradient(to right, var(--bg-bar), transparent); }
#dots-clip::after  { right: 0; background: linear-gradient(to left,  var(--bg-bar), transparent); }
#dots-track {
  display: flex; gap: 6px; align-items: center; padding: 3px 4px;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  will-change: transform;
}
.dot {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,0.16); cursor: pointer;
  transition: background 0.22s, transform 0.22s, box-shadow 0.22s;
}
.dot.active { background: var(--gold); box-shadow: 0 0 7px var(--gold-glow); transform: scale(1.7); }
.dot.near   { background: rgba(255,255,255,0.45); transform: scale(1.25); }

#counter {
  font-size: clamp(10px,2.2vw,12px); font-weight: 500;
  color: var(--w); letter-spacing: 0.8px; white-space: nowrap;
}

/* ── THUMBNAIL STRIP ─────────────────────────────────────── */
#thumb-strip-wrap {
  flex: 1; overflow: hidden; padding: 0 10px 6px;
  position: relative;
}
/* fade edges */
#thumb-strip-wrap::before,
#thumb-strip-wrap::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 18px; z-index: 2; pointer-events: none;
}
#thumb-strip-wrap::before { left:  10px; background: linear-gradient(to right, var(--bg-bar), transparent); }
#thumb-strip-wrap::after  { right: 10px; background: linear-gradient(to left,  var(--bg-bar), transparent); }

#thumb-strip {
  display: flex; gap: 4px; align-items: center;
  height: 100%; overflow-x: auto; overflow-y: hidden;
  scroll-behavior: smooth; scrollbar-width: none;
  padding: 0 4px;
  /* Smooth inertia scrolling on iOS */
  -webkit-overflow-scrolling: touch;
}
#thumb-strip::-webkit-scrollbar { display: none; }

.thumb {
  flex-shrink: 0;
  width: clamp(36px,8vw,46px);
  height: clamp(26px,6vw,33px);
  border-radius: 3px;
  background: var(--bg3) center/cover no-repeat;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  position: relative; overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  touch-action: manipulation;
}
.thumb:active { transform: scale(0.92); }
.thumb.active {
  border-color: var(--gold);
  box-shadow: 0 0 8px var(--gold-glow);
}
.thumb .t-num {
  position: absolute; bottom: 1px; right: 2px;
  font-size: 6px; color: rgba(255,255,255,0.35);
  line-height: 1; letter-spacing: 0;
}
/* Shimmer on unloaded thumbnails */
.thumb.loading::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.04) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer-sweep 1.6s ease-in-out infinite;
}

/* ── LOADER ──────────────────────────────────────────────── */
#loader {
  position: absolute; inset: 0; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  z-index: 999; transition: opacity 0.8s cubic-bezier(0.4,0,0.2,1);
}
#loader.out { opacity: 0; pointer-events: none; }
.l-icon {
  width: 54px; height: 54px; border: 2px solid var(--gold); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px rgba(212,160,23,0.2);
  animation: icon-pulse 2.4s ease-in-out infinite;
}
@keyframes icon-pulse { 0%,100%{box-shadow:0 0 0 0 var(--gold-glow)} 50%{box-shadow:0 0 0 12px transparent} }
.l-name {
  font-size: clamp(26px,6.5vw,38px); font-weight: 700;
  letter-spacing: 7px; text-transform: uppercase; color: var(--w);
  animation: fade-up 0.9s cubic-bezier(0.4,0,0.2,1) both;
}
.l-sub {
  font-size: 10px; letter-spacing: 5px; color: var(--w70); text-transform: uppercase;
  animation: fade-up 0.9s 0.15s cubic-bezier(0.4,0,0.2,1) both;
}
@keyframes fade-up { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
.l-bar-track { width: 160px; height: 1px; background: rgba(255,255,255,0.08); border-radius: 1px; overflow: hidden; }
.l-bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-hi));
  animation: bar-fill 1.6s cubic-bezier(0.4,0,0.2,1) 0.2s both; border-radius: 1px;
}
@keyframes bar-fill { from{width:0} to{width:100%} }

/* ── HOW-TO ──────────────────────────────────────────────── */
#howto {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  z-index: 500; opacity: 0; pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4,0,0.2,1);
}
#howto.show { opacity: 1; pointer-events: all; }
.hw-card {
  background: var(--bg3); border: 1px solid var(--gold-dim); border-radius: 18px;
  padding: clamp(22px,5vw,34px) clamp(26px,6vw,44px);
  text-align: center; max-width: clamp(270px,82vw,390px);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.9);
  animation: card-in 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes card-in { from{transform:scale(0.88) translateY(16px);opacity:0} to{transform:scale(1);opacity:1} }
.hw-title { font-size: clamp(18px,4.5vw,23px); font-weight: 700; color: var(--w); letter-spacing: 1px; }
.hw-title span { color: var(--gold); }
.hw-sep { width: 44px; height: 1px; background: linear-gradient(90deg,transparent,var(--gold),transparent); }
.hw-body { font-size: clamp(12px,2.6vw,14px); color: var(--w90); line-height: 2.2; direction: rtl; }
.hw-btn {
  padding: 12px 38px; background: var(--gold); border: none; border-radius: 10px;
  color: #000; font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; box-shadow: 0 4px 24px rgba(212,160,23,0.4);
  transition: opacity 0.15s, transform 0.15s;
}
.hw-btn:active { opacity: 0.85; transform: scale(0.96); }

/* ── TOAST ───────────────────────────────────────────────── */
#toast {
  position: absolute; bottom: calc(var(--bar-bot) + 12px); left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--bg3); border: 1px solid var(--gold-dim); border-radius: 10px;
  padding: 9px 22px; font-size: 12px; color: var(--w90);
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s;
  z-index: 300; white-space: nowrap; box-shadow: 0 8px 36px rgba(0,0,0,0.7);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── SWIPE HINT ──────────────────────────────────────────── */
#swipe-hint {
  position: absolute; bottom: calc(var(--bar-bot) + 6px); left: 50%;
  transform: translateX(-50%);
  font-size: clamp(7px,1.4vw,9px); color: var(--w20);
  letter-spacing: 1.5px; text-transform: uppercase; pointer-events: none;
  z-index: 5;
}
