/* ============================================================================
   SG Dedications — on-page accordion (v1.1.0 / Sprint 65).
   Flowing size → memorial → accessory → CTA, inside the product buy area.
   Premium, RTL-native, responsive. Drives (never replaces) the native WC form.
   ============================================================================ */

/* v1.0.13 memorial fonts — self-hosted woff2 (OFL, no CDN), all render nikud. */
@font-face { font-family: 'SGDed Gveret'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/gveretlevin-400.woff2') format('woff2'); }
@font-face { font-family: 'SGDed Alef'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/alef-400.woff2') format('woff2'); }
@font-face { font-family: 'SGDed Alef'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/alef-700.woff2') format('woff2'); }
@font-face { font-family: 'SGDed Noto Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/notoserifhe-400.woff2') format('woff2'); }
@font-face { font-family: 'SGDed Noto Serif'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/notoserifhe-600.woff2') format('woff2'); }

.sg-ded-acc {
  --gold: #b8912f;
  --gold-2: #d8ad45;
  --ink: #2a2620;
  --muted: #7a7166;
  --bd: #e6ded0;
  --bd-2: #d8cdb8;
  --bg-soft: #faf7f1;
  direction: rtl;
  text-align: right;
  font-family: inherit;
  margin: 6px 0 14px;
  max-width: 560px;
}

/* ── hide the native WC controls (kept in DOM so WC still resolves the variation) ── */
.sg-ded-accordion-on .sg-ded-upload { display: none !important; }
.sg-ded-accordion-on form.cart .quantity,
.sg-ded-accordion-on form.cart .single_variation .price,
.sg-ded-accordion-on form.cart .woocommerce-variation-price,
.sg-ded-accordion-on form.cart .woocommerce-variation-availability,
.sg-ded-accordion-on form.cart .single_add_to_cart_button,
.sg-ded-accordion-on form.cart .reset_variations { display: none !important; }
.sg-ded-accordion-on form.cart table.variations {
  position: absolute !important; width: 1px !important; height: 1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; margin: -1px !important; padding: 0 !important; border: 0 !important;
}
/* Programmatic .click() on the (hidden) file input still opens the picker. */
.sg-ded-upload__file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* ── panels ──────────────────────────────────────────────────────────────── */
.sg-ded-acc__panel {
  border: 1.5px solid var(--bd);
  border-radius: 14px;
  background: #fff;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.sg-ded-acc__panel.is-open { border-color: var(--gold); box-shadow: 0 6px 22px rgba(184,145,47,.10); }
.sg-ded-acc__panel.is-done { background: var(--bg-soft); }

.sg-ded-acc__head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 13px 15px;
  background: none; border: 0; cursor: pointer;
  font: inherit; color: var(--ink); text-align: right;
}
.sg-ded-acc__num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-soft); color: var(--muted);
  font-size: 13px; font-weight: 700; border: 1.5px solid var(--bd-2);
}
.sg-ded-acc__panel.is-open .sg-ded-acc__num { background: var(--gold); color: #fff; border-color: var(--gold); }
.sg-ded-acc__panel.is-done .sg-ded-acc__num { background: #3f9d5f; color: #fff; border-color: #3f9d5f; }
.sg-ded-acc__htitle { font-weight: 700; font-size: 1.02rem; }
.sg-ded-acc__hsum { flex: 1 1 auto; color: var(--muted); font-size: .86rem; text-align: left; unicode-bidi: plaintext; }
.sg-ded-acc__chev {
  flex: 0 0 auto; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s ease; margin-inline-start: 2px;
}
.sg-ded-acc__panel.is-open .sg-ded-acc__chev { transform: rotate(-135deg); }

.sg-ded-acc__body { display: none; padding: 4px 15px 16px; }
.sg-ded-acc__panel.is-open .sg-ded-acc__body { display: block; }

.sg-ded-acc__hint { color: var(--muted); font-size: .85rem; margin: 2px 0 10px; }

/* ── option grids ────────────────────────────────────────────────────────── */
/* Force RTL flow so the FIRST option (smallest size, 50×70) sits on the RIGHT,
   regardless of any ambient direction the theme sets on the product form. */
.sg-ded-acc__opts { display: flex; flex-wrap: wrap; gap: 10px; direction: rtl; }
.sg-ded-acc__opts--size { gap: 12px; }

.sg-ded-acc__opt {
  appearance: none; cursor: pointer; font: inherit; color: var(--ink);
  background: #fff; border: 1.5px solid var(--bd-2); border-radius: 12px;
  padding: 12px 16px; transition: all .16s ease; position: relative;
}
.sg-ded-acc__opt:hover { border-color: var(--gold); }
.sg-ded-acc__opt.is-active { border-color: var(--gold); background: #fdf8ec; box-shadow: inset 0 0 0 1px var(--gold); }

/* v1.4.0: 7 sizes — a wrapping grid instead of 2 stretched buttons, so every option
   stays readable and tappable on a phone without a horizontal scroll. */
.sg-ded-acc__opts--size { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; }
.sg-ded-acc__opt--size { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; }
.sg-ded-acc__opt-was { display: block; font-size: .78rem; font-weight: 500; color: #9b8d78; text-decoration: line-through; margin-top: 2px; }
@media (max-width: 380px) {
  .sg-ded-acc__opts--size { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
}
.sg-ded-acc__opt-t { font-weight: 700; font-size: 1.12rem; }
.sg-ded-acc__opt-p { color: var(--gold); font-weight: 700; font-size: .95rem; }
.sg-ded-acc__ltr { unicode-bidi: isolate; direction: ltr; }

.sg-ded-acc__opt--yn { flex: 1 1 0; min-width: 140px; text-align: center; font-weight: 600; }

/* memorial text controls */
.sg-ded-acc__memoin {
  width: 100%; margin-top: 12px; box-sizing: border-box;
  border: 1.5px solid var(--bd-2); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 1rem; resize: vertical; min-height: 52px;
}
.sg-ded-acc__memoin:focus { outline: none; border-color: var(--gold); }
.sg-ded-acc__opts--font { margin-top: 10px; }
.sg-ded-acc__opt--font { font-size: 1.05rem; padding: 9px 14px; }
.sg-ded-acc__opts--color { margin-top: 8px; }
.sg-ded-acc__opt--color { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; }
.sg-ded-acc__chip { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); display: inline-block; }

.sg-ded-acc__next {
  margin-top: 14px; appearance: none; cursor: pointer; font: inherit; font-weight: 700;
  background: var(--ink); color: #fff; border: 0; border-radius: 10px; padding: 10px 22px;
}
.sg-ded-acc__next:hover { background: #000; }

/* accessory live corner preview (design + 4 hanging-accessory discs) */
.sg-ded-acc__preview { display: flex; justify-content: center; margin: 4px 0 14px; }
.sg-ded-acc__pvframe { position: relative; width: 100%; max-width: 240px; border-radius: 10px; overflow: hidden; background: #f6f2ea; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.sg-ded-acc__pvimg { display: block; width: 100%; height: auto; }
/* v1.2.2: smaller + tighter into the corners so the discs don't cover the blessing text
   (preview only — the hanging accessories are never part of the print). */
.sg-ded-acc__pvdisc { position: absolute; width: 9%; height: auto; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.sg-ded-acc__pvdisc--tl { top: 3.5%; inset-inline-start: 3.5%; }
.sg-ded-acc__pvdisc--tr { top: 3.5%; inset-inline-end: 3.5%; }
.sg-ded-acc__pvdisc--bl { bottom: 3.5%; inset-inline-start: 3.5%; }
.sg-ded-acc__pvdisc--br { bottom: 3.5%; inset-inline-end: 3.5%; }

/* accessory swatches */
.sg-ded-acc__opts--acc { gap: 12px; }
.sg-ded-acc__acc {
  appearance: none; cursor: pointer; font: inherit; color: var(--ink);
  background: #fff; border: 1.5px solid var(--bd-2); border-radius: 12px;
  padding: 12px; flex: 1 1 0; min-width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; transition: all .16s ease;
}
.sg-ded-acc__acc:hover { border-color: var(--gold); }
.sg-ded-acc__acc.is-active { border-color: var(--gold); background: #fdf8ec; box-shadow: inset 0 0 0 1px var(--gold); }
.sg-ded-acc__acc-sw { width: 46px; height: 46px; object-fit: contain; border-radius: 50%; background: #f4efe6; }
.sg-ded-acc__acc-l { font-weight: 700; font-size: .95rem; }
.sg-ded-acc__acc-p { color: var(--muted); font-size: .82rem; }
.sg-ded-acc__acc.is-active .sg-ded-acc__acc-p { color: var(--gold); }

/* ── the prominent CTA ───────────────────────────────────────────────────── */
.sg-ded-acc__ctawrap { margin-top: 14px; }
.sg-ded-acc__total {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 6px 4px 12px; border-bottom: 1px dashed var(--bd-2); margin-bottom: 14px;
}
.sg-ded-acc__total-l { color: var(--muted); font-weight: 600; }
.sg-ded-acc__total-v { font-size: 1.5rem; font-weight: 800; color: var(--ink); }

.sg-ded-acc__cta {
  appearance: none; cursor: pointer; width: 100%; border: 0; border-radius: 16px;
  padding: 16px 20px; color: #fff; font: inherit;
  background: linear-gradient(135deg, var(--gold-2), var(--gold) 60%, #9a771f);
  box-shadow: 0 10px 26px rgba(184,145,47,.34); position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px;
  text-align: right; transition: transform .12s ease, box-shadow .2s ease;
  animation: sgDedCtaIn .45s ease both;
}
.sg-ded-acc__cta:hover { transform: translateY(-1px); box-shadow: 0 14px 32px rgba(184,145,47,.42); }
.sg-ded-acc__cta:active { transform: translateY(0); }
.sg-ded-acc__cta::after {
  content: ""; position: absolute; inset: 0; border-radius: 16px;
  box-shadow: 0 0 0 0 rgba(216,173,69,.55); animation: sgDedPulse 2.4s ease-out infinite;
}
.sg-ded-acc__cta-ic { grid-row: 1 / span 2; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.18); }
.sg-ded-acc__cta-t { font-size: 1.22rem; font-weight: 800; align-self: end; }
.sg-ded-acc__cta-sub { font-size: .82rem; opacity: .92; align-self: start; }

@keyframes sgDedCtaIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sgDedPulse { 0% { box-shadow: 0 0 0 0 rgba(216,173,69,.5); } 70% { box-shadow: 0 0 0 14px rgba(216,173,69,0); } 100% { box-shadow: 0 0 0 0 rgba(216,173,69,0); } }
@media (prefers-reduced-motion: reduce) {
  .sg-ded-acc__cta, .sg-ded-acc__cta::after { animation: none; }
}

/* ── persistent WhatsApp ─────────────────────────────────────────────────── */
.sg-ded-acc__wa {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  color: #1c8a4e; font-weight: 600; font-size: .92rem; text-decoration: none;
}
.sg-ded-acc__wa:hover { text-decoration: underline; }
.sg-ded-acc__wa-ic { display: inline-flex; }

/* ── catalogue tile sub-label (bg · blessing) ────────────────────────────── */
.sg-ded-sublabel {
  font-size: .8rem; color: #8a8072; margin-top: 2px; margin-bottom: 4px;
  line-height: 1.3; unicode-bidi: plaintext;
}

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .sg-ded-acc__opt--size, .sg-ded-acc__opt--yn { min-width: 0; }
  .sg-ded-acc__cta-t { font-size: 1.12rem; }
  .sg-ded-acc__total-v { font-size: 1.35rem; }
}
