/*
 * Engraving presentation. Transfers the approved designs onto the EXISTING WAPF markup
 * using the jspp-f-* hooks that snippet 16708/16709 already apply. Nothing is re-parented
 * and no field is replaced: WAPF keeps its own inputs, conditions, pricing formulas,
 * validation and cart metadata, and snippet 16709 keeps rendering the genuine lettering
 * preview into .jspp-ep. This file is presentation only.
 *
 * Two variants, as approved:
 *   .jspd-eng-frame   spacious  - tpl-eng-c, frames (Ripon 8370, Durham 2103, ...)
 *   .jspd-eng-compact compact   - tpl-eng-b, cufflink pairs
 */

/* ---------------- shared panel ----------------
   The older engraving layout widens the WAPF area well beyond its column - measured at
   1350px starting at left 70 inside a 645px summary, so the panel ran underneath the
   gallery. The approved design keeps the engraving inside the right-hand column, so the
   WAPF containers are pulled back to their parent here. The body prefix out-weighs the
   .jspp-lay rules, which that snippet's own script applies and which therefore cannot be
   removed server-side. Nothing is re-parented: the fields stay inside form.cart, so
   WAPF's submission and cart metadata are untouched. */
body.jspd-pdp-active .jspd-pdp .wapf,
body.jspd-pdp-active .jspd-pdp .wapf-wrapper,
body.jspd-pdp-active .jspd-pdp .wapf-field-group,
body.jspd-pdp-active .jspd-pdp .jspp-f-outer,
body.jspd-pdp-active .jspd-pdp .jspp-f-inner{
  width:auto;max-width:100%;min-width:0;margin-left:0;margin-right:0;
  left:auto;right:auto;transform:none;float:none}
body.jspd-pdp-active .jspd-pdp .wapf-field-container{width:auto;max-width:100%}
/* The panel and its sections must be ordinary block boxes. Other rules were giving them
   grid layout, which overlapped the inserted title and tariff and stranded the preview
   in a track of its own. */
body.jspd-pdp-active .jspd-pdp .jspp-f-outer,
body.jspd-pdp-active .jspd-pdp .jspp-f-inner,
body.jspd-pdp-active .jspd-pdp .wapf-field-group{display:block;grid-template-columns:none}
body.jspd-pdp-active .jspd-pdp .jspd-eng-title,
body.jspd-pdp-active .jspd-pdp .jspd-eng-tariff{display:block;position:static;float:none;width:auto}
.jspd-pdp .wapf{margin-top:20px}
.jspd-pdp .jspp-f-outer{border:1px solid var(--jspd-rule);background:var(--jspd-canvas);
  padding:17px 24px 20px;margin:0}
.jspd-pdp .jspd-eng-title{font-family:var(--jspd-display);font-weight:400;font-size:23px;
  margin:0 0 6px;letter-spacing:.012em;color:var(--jspd-ink)}
.jspd-pdp .jspd-eng-tariff{font-family:var(--jspd-ui);font-size:13px;font-weight:300;
  line-height:1.55;color:var(--jspd-ink2);margin:0 0 14px;max-width:64ch}

/* field furniture */
.jspd-pdp .wapf-field-container{margin:0 0 15px}
.jspd-pdp .jspp-f-outer .wapf-field-label label{font-family:var(--jspd-ui);font-size:10.5px;
  font-weight:300;letter-spacing:.12em;text-transform:uppercase;color:var(--jspd-muted);
  margin:0 0 9px;display:block}
.jspd-pdp .jspp-f-outer .wapf-field-description{font-family:var(--jspd-ui);font-size:12px;
  font-weight:300;color:var(--jspd-muted);line-height:1.5}

/* step 1 - the enable checkbox */
.jspd-pdp .jspp-f-enable .wapf-field-label label{font-size:15px;letter-spacing:0;
  text-transform:none;color:var(--jspd-ink);margin:0}
.jspd-pdp .jspp-f-enable label{display:flex;align-items:center;gap:11px;min-height:44px;cursor:pointer}
.jspd-pdp .jspp-f-enable input[type=checkbox]{width:20px;height:20px;margin:0;cursor:pointer;
  accent-color:var(--jspd-navy);float:none}

/* lettering tiles, built over the genuine WAPF select */
.jspd-pdp .jspd-fonts{display:grid;grid-template-columns:repeat(auto-fill,minmax(126px,1fr));gap:8px}
.jspd-pdp .jspd-fonts button{background:#fff;border:1px solid var(--jspd-rule);padding:10px 8px;
  cursor:pointer;font-size:16px;min-height:52px;line-height:1.15;color:var(--jspd-ink);
  border-radius:0;transition:border-color .15s,box-shadow .15s}
.jspd-pdp .jspd-fonts button:hover{border-color:var(--jspd-ink2)}
.jspd-pdp .jspd-fonts button[aria-pressed="true"]{border-color:var(--jspd-navy);
  box-shadow:inset 0 0 0 1px var(--jspd-navy)}
.jspd-pdp .jspd-fonts button small{display:block;font-family:var(--jspd-ui);font-size:9px;
  font-weight:300;letter-spacing:.08em;text-transform:uppercase;color:var(--jspd-muted);margin-top:4px}
.jspd-pdp .jspd-fonts button:focus-visible{outline:2px solid var(--jspd-accent);outline-offset:2px}
/* the real select stays in the DOM, reachable, never replaced */
.jspd-pdp .jspd-realhidden{position:absolute !important;width:1px;height:1px;overflow:hidden;
  clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}

/* swatch choices - engraving area, orientation, same/different */
.jspd-pdp .jspd-swatches{display:flex;gap:8px;flex-wrap:wrap}
.jspd-pdp .jspd-swatches button{background:#fff;border:1px solid var(--jspd-rule);height:44px;
  padding:0 16px;cursor:pointer;font-family:var(--jspd-ui);font-size:13px;font-weight:300;
  color:var(--jspd-ink);border-radius:0;transition:border-color .15s,background .15s}
.jspd-pdp .jspd-swatches button:hover{border-color:var(--jspd-ink2)}
.jspd-pdp .jspd-swatches button[aria-pressed="true"]{border-color:var(--jspd-navy);
  background:var(--jspd-navy);color:#fff}
.jspd-pdp .jspd-swatches button:focus-visible{outline:2px solid var(--jspd-accent);outline-offset:2px}

/* inscriptions */
.jspd-pdp .jspp-f-outer textarea,
.jspd-pdp .jspp-f-outer input[type=text]{border:1px solid var(--jspd-rule);background:#fff;
  font-family:var(--jspd-ui);font-size:14px;font-weight:300;padding:11px 12px;width:100%;
  border-radius:0;min-height:44px;line-height:1.4;resize:vertical}
.jspd-pdp .jspd-counter{font-family:var(--jspd-ui);font-size:11px;font-weight:300;
  color:var(--jspd-muted);text-align:right;margin-top:4px}
.jspd-pdp .jspd-counter.jspd-counter--over{color:#b23b3b}

/* the genuine 16709 preview */
.jspd-pdp .jspp-ep{border:1px dashed #b9a97a;background:#fffdf7;padding:16px}
.jspd-pdp .jspp-ep-head{display:flex;justify-content:space-between;gap:8px;
  font-family:var(--jspd-ui);font-size:9.5px;font-weight:300;letter-spacing:.1em;
  text-transform:uppercase;color:#8a7c52;margin-bottom:10px}
.jspd-pdp .jspp-ep-area{font-family:var(--jspd-ui);font-size:9.5px;font-weight:300;
  letter-spacing:.09em;text-transform:uppercase;color:var(--jspd-muted)}

/* totals, WAPF's own figures */
.jspd-pdp .wapf-product-totals{border-top:1px solid var(--jspd-rule);margin-top:16px;padding-top:12px}
.jspd-pdp .wapf-product-totals .wapf--inner > div{display:flex;justify-content:space-between;
  font-family:var(--jspd-ui);font-size:14px;font-weight:300;color:var(--jspd-ink2);margin:0 0 5px}
.jspd-pdp .wapf-product-totals .wapf--inner > div:last-child{font-weight:500;font-size:16px;
  color:var(--jspd-ink);border-top:1px solid var(--jspd-rule);padding-top:8px;margin-top:4px}
.jspd-pdp .jspp-sizeprompt{font-family:var(--jspd-ui);font-size:12.5px;font-weight:300;
  font-style:italic;color:var(--jspd-muted);margin:10px 0 0}

/* information block, full width, quiet */
.jspd-pdp .jspp-f-info{border-top:1px solid var(--jspd-rule2);padding-top:14px;margin-top:4px}
.jspd-pdp .jspp-f-info .wapf-field-label label{font-size:10px}
.jspd-pdp .jspp-f-info .wapf-field-description{font-size:12.5px;line-height:1.55}

/* ---------------- FRAME variant: spacious, single column ----------------
   The approved reference has TWO frame arrangements: .engslot-full, a two-column
   .engcols layout used only when the engraving occupies the full page width, and
   .engslot-inline, a single column used when it sits in the right-hand summary. The
   template places engraving in the summary, so the in-column arrangement is the correct
   one: inputs in sequence, the lettering preview directly beneath them.

   A two-column grid was tried here first and was wrong - inside a 645px column the
   preview rendered 420px wide against a 285px input column and the two overlapped.
   Flex with explicit order gives the approved sequence regardless of WAPF's DOM order
   (area, top, bottom, preview, orientation, information). */
/* Vertical sequence is handled by placing the preview node after the inscriptions in
   jspd-eng.js - its parent element differs between frame products, so no single CSS
   flex context can order it. */
/* the preview must fit its column, not the width the older layout gave it */
body.jspd-pdp-active .jspd-pdp .jspp-ep{width:auto;max-width:100%;min-width:0;
  position:static;float:none;margin-left:0;margin-right:0}

/* ---------------- COMPACT variant: cufflinks ---------------- */
.jspd-pdp.jspd-eng-compact .jspp-f-outer{padding:16px 20px 18px}
.jspd-pdp.jspd-eng-compact .jspd-fonts{grid-template-columns:repeat(auto-fill,minmax(80px,1fr));gap:6px}
.jspd-pdp.jspd-eng-compact .jspd-fonts button{min-height:46px;font-size:15px;padding:6px 4px}
.jspd-pdp.jspd-eng-compact .jspd-fonts button small{font-size:8px;letter-spacing:.05em}
.jspd-pdp.jspd-eng-compact .jspd-swatches button{height:40px;padding:0 13px;font-size:12.5px}
@media (min-width:1101px){
  /* inscriptions left, live preview right - the approved .cpair */
  .jspd-pdp.jspd-eng-compact .jspp-f-inner{display:grid;grid-template-columns:162px minmax(0,1fr);
    gap:14px;align-items:start}
  .jspd-pdp.jspd-eng-compact .jspp-ep{grid-column:2;grid-row:1 / span 6}
}

/* ---------------- mobile ---------------- */
@media (max-width:1100px){
  .jspd-pdp .jspp-f-outer{padding:16px}
  .jspd-pdp .jspd-fonts{grid-template-columns:1fr 1fr}
  .jspd-pdp .jspd-fonts button{min-height:56px}
  .jspd-pdp .jspd-swatches button{height:44px}
  .jspd-pdp .jspp-ep{margin-top:14px}
}
