/* ============================================================================
   previewer-skin.css — "Gift-Tag Builder" skin for the Sunroom previewer.
   Styles the personalizer UI, the pillow composite scene, and the flagship
   gift-tag card. Motion is defined here but zeroed by the global reduced-motion
   gate in sunroom.css.
   ========================================================================== */

.ew-hidden-mount { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── personalizer shell ─────────────────────────────────────────────────────── */
.personalizer {
  display: grid; gap: clamp(1.4rem, 4vw, 2.4rem);
  grid-template-columns: 1fr;
}
@media (min-width: 900px) { .personalizer { grid-template-columns: 1fr 1fr; align-items: start; } }
/* grid items default to min-width:auto, so a wide engine render (e.g. the full
   name in the fabric-preview swatch) can force a track past the viewport. Let the
   columns shrink to their share and clip the swatch instead of overflowing. */
.personalizer > * { min-width: 0; }

.pz-preview { display: grid; gap: 1.2rem; }
.pz-panel {
  background: var(--card); border-radius: var(--r-lg); padding: clamp(1.2rem, 3vw, 1.7rem);
  box-shadow: var(--sh-sm);
}
.pz-field { margin-bottom: 1.3rem; }
.pz-field:last-child { margin-bottom: 0; }
.pz-label { display: block; font-weight: 700; font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--walnut-soft); margin-bottom: .6rem; }

/* segmented toggles (mode + variant) */
.segmented { display: inline-flex; background: var(--cream); border-radius: var(--r-pill); padding: 4px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; cursor: pointer; font-family: 'Karla', sans-serif; font-weight: 700;
  font-size: .92rem; color: var(--walnut-soft); padding: .55em 1.2em; border-radius: var(--r-pill);
  transition: background-color .18s ease, color .18s ease;
  /* the two most-used previewer toggles — meet the 44px touch target */
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
}
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--walnut-ink); box-shadow: var(--sh-sm); }
.segmented button:hover { color: var(--walnut-ink); }

/* style thumbnails */
.style-thumbs { display: flex; flex-wrap: wrap; gap: .6rem; }
.style-thumb {
  display: flex; flex-direction: column; align-items: center; gap: .35rem; cursor: pointer;
  background: var(--cream); border: 2px solid transparent; border-radius: var(--r-md); padding: .7rem .8rem .55rem;
  transition: border-color .18s ease, transform .18s var(--ease);
}
.style-thumb:hover { transform: translateY(-2px); }
.style-thumb[aria-pressed="true"] { border-color: var(--sun); background: var(--apricot-tint); }
.style-thumb__glyph { width: 34px; height: 34px; color: var(--walnut-ink); display: flex; align-items: center; justify-content: center; }
.style-thumb__glyph svg { width: 100%; height: 100%; }
.style-thumb__name { font-size: .78rem; font-weight: 700; color: var(--walnut); }

/* text inputs */
.pz-inputs { display: flex; flex-wrap: wrap; gap: .8rem; }
.pz-input { flex: 1 1 90px; }
.pz-input label { display: block; font-size: .78rem; font-weight: 600; color: var(--walnut-soft); margin-bottom: .3rem; }
.pz-input input, .pz-name input, .pz-recipient input, .pz-select select {
  width: 100%; font-family: 'Karla', sans-serif; font-size: 1rem; color: var(--walnut-ink);
  background: var(--warm-white); border: 2px solid var(--cream-deep); border-radius: var(--r-sm);
  padding: .6em .8em; transition: border-color .18s ease;
}
.pz-input input:focus, .pz-name input:focus, .pz-recipient input:focus, .pz-select select:focus { border-color: var(--sun); outline-offset: 1px; }
.pz-name input { text-transform: uppercase; }
.pz-help { font-size: .82rem; color: var(--walnut-soft); margin: .5rem 0 0; }

/* block toggle */
.pz-check { display: inline-flex; align-items: center; gap: .55em; margin-top: 1rem; cursor: pointer; font-weight: 600; font-size: .95rem; }
.pz-check input { width: 18px; height: 18px; accent-color: var(--sun); cursor: pointer; }

/* etiquette line */
.etq { margin: 1rem 0 0; font-size: .95rem; color: var(--walnut); background: var(--cornflower-tint); border-radius: var(--r-md); padding: .8em 1em; }
.etq-render { font-family: 'Fraunces', serif; font-weight: 600; letter-spacing: .04em; color: var(--walnut-ink); }

/* thread swatches */
.thread-row { display: flex; align-items: center; gap: .7rem; margin-bottom: .8rem; }
.thread-name { font-weight: 700; color: var(--walnut-ink); }
.swatches { display: flex; flex-wrap: wrap; gap: .55rem; }
.swatch {
  --sw: #ccc; width: 34px; height: 34px; border-radius: var(--r-pill); cursor: pointer;
  background: var(--sw); border: 2px solid rgba(74,63,53,.14); padding: 0;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.12);
  transition: transform .18s var(--ease), box-shadow .18s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--warm-white), 0 0 0 4px var(--sun); transform: scale(1.08); }

/* custom block (fabric + welting) */
#custom-block { margin-top: 1rem; }
.pz-select { margin-bottom: 1rem; }
.fabric-preview { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.fabric-chip { width: 62px; height: 62px; border-radius: var(--r-md); border: 5px solid transparent; background: var(--cream); box-shadow: var(--sh-sm); flex: none; }
.fabric-cap { font-size: .92rem; color: var(--walnut); font-weight: 600; }
.see-colors summary { cursor: pointer; color: var(--link); font-weight: 700; font-size: .9rem; }
.see-colors[open] summary { margin-bottom: .6rem; }
.swatch-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: .35rem; }
.swatch-wall span { aspect-ratio: 1; border-radius: 6px; border: 1px solid rgba(74,63,53,.12); }

/* the engine's small fabric-preview surface (thread on fabric + welt) — a colour
   swatch, not a full readout. Clip + scale it: in Name mode the engine draws the
   whole name at glyph size (~1200px wide), which otherwise stretches the surface
   and blows the entire personalizer past the viewport at narrow widths. */
#fabric-preview-mount { max-width: 100%; }
#fabric-preview-mount .ew-surface { min-height: 120px; border-radius: var(--r-md); max-width: 100%; overflow: hidden; }
#fabric-preview-mount .ew-render { transform: scale(.5); }

/* ── pillow composite scene ─────────────────────────────────────────────────── */
.ew-scene {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--sh-md); aspect-ratio: 3 / 4; background: var(--cream);
  --ew-base-scale: .66; /* the engine draws glyphs at a fixed 120px; scale to sit in the pillow face */
}
.ew-scene > img { width: 100%; height: 100%; object-fit: cover; }
/* scene-scoped so it beats the engine's later-injected .ew-render.ew-on-fabric rule */
.ew-scene .ew-render.ew-on-fabric,
.tag-scene .ew-render.ew-on-fabric {
  transform: translate(-50%, -50%) scale(var(--ew-base-scale, 1)) rotate(var(--ew-rotate, 0deg));
}
/* suppress the engine's composite plate box: its inset-shadow ::after reads as a
   faint translucent rectangle sitting ON the pillow/tag. Kill it at skin level so
   the monogram threads INTO the fabric (multiply blend already carries the sink).
   Adopted from Prototype C's fix; Prototype A adopted it too. */
.ew-scene .ew-render.ew-on-fabric::after,
.tag-scene .ew-render.ew-on-fabric::after { content: none !important; display: none !important; }
.scene-caption { font-size: .82rem; color: var(--walnut-soft); text-align: center; margin: .7rem 0 0; }

/* ── the gift tag (flagship shareable) ──────────────────────────────────────── */
/* cap the tag to a real tag-like width and centre it: full-bleed on desktop the
   card stretched into a wide banner with the monogram marooned in empty space;
   held to ~420px it reads as an actual gift tag — the money shot — at every width. */
.gift-tag-wrap { display: grid; gap: .9rem; width: 100%; max-width: 420px; margin-inline: auto; }
.gift-tag {
  position: relative; background: linear-gradient(155deg, #FCF4E7 0%, #F4E6D0 100%);
  border-radius: 18px; padding: 2.5rem 1.5rem 1.5rem; box-shadow: var(--sh-md);
  overflow: hidden;
}
.gift-tag::after { /* running-stitch frame */
  content: ""; position: absolute; inset: 12px; border-radius: 12px;
  border: 2px dashed var(--stitch); opacity: .65; pointer-events: none;
}
.gift-tag__hole {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3;
  width: 20px; height: 20px; border-radius: 50%; background: var(--warm-white);
  box-shadow: inset 0 1px 3px rgba(74,63,53,.4), 0 0 0 2px rgba(200,154,110,.5);
}
.gift-tag__ribbon { position: absolute; top: -2px; left: 50%; transform: translateX(-50%); z-index: 2; width: 84px; height: 40px; pointer-events: none; }

.tag-scene {
  position: relative; z-index: 1; margin: .3rem auto 0; width: 100%; max-width: 280px;
  aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
  --ew-base-scale: .5; /* smaller card → smaller render so the monogram sits inside the tag */
}
.tag-scene .ew-render.ew-on-fabric { mix-blend-mode: normal; } /* thread reads true on the tag */

.gift-tag__to {
  position: relative; z-index: 1; text-align: center; font-family: 'Fraunces', serif; font-style: italic;
  font-weight: 500; font-size: 1.35rem; color: var(--walnut-ink); margin: .2rem 0 .1rem;
}
.gift-tag__to.is-empty { color: var(--walnut-soft); }
.gift-tag__summary {
  position: relative; z-index: 1; text-align: center; font-weight: 700; font-size: .82rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--sun-text); margin: 0;
}
.gift-tag__hint { position: relative; z-index: 1; text-align: center; font-size: .78rem; color: var(--walnut-soft); margin: .4rem 0 0; }

.pz-recipient { margin-top: .9rem; }
.pz-recipient label { display: block; font-size: .78rem; font-weight: 600; color: var(--walnut-soft); margin-bottom: .3rem; }

/* proof line — always visible under the render */
.proof-line {
  display: flex; align-items: center; gap: .6em; justify-content: center; text-align: center;
  background: var(--garden-tint); color: var(--walnut-ink); border-radius: var(--r-md);
  padding: .85em 1.1em; font-weight: 600; font-size: .96rem; margin-top: .2rem;
}
.proof-line svg { width: 20px; height: 20px; color: var(--garden); flex: none; }

/* order actions */
.order-box { background: var(--card); border-radius: var(--r-lg); padding: 1.4rem; box-shadow: var(--sh-sm); margin-top: 1.2rem; }
.order-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .3rem; }
.order-price { font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.6rem; color: var(--walnut-ink); }
.variant-note { font-size: .9rem; color: var(--walnut-soft); margin: 0 0 1.1rem; }
.order-actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.order-actions .btn { flex: 1 1 auto; }
.copy-link {
  display: inline-flex; align-items: center; gap: .5em; background: transparent; border: 2px solid var(--cream-deep);
  color: var(--walnut-ink); font-weight: 700; font-size: .95rem; padding: .75em 1.3em; border-radius: var(--r-pill); cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease;
}
.copy-link:hover { border-color: var(--cornflower); background: var(--cornflower-tint); }
.copy-link.is-copied { border-color: var(--garden); background: var(--garden-tint); }
.copy-link svg { width: 17px; height: 17px; }
.copy-status { font-size: .88rem; color: var(--garden); font-weight: 600; margin: .7rem 0 0; }

.confirm-panel {
  margin-top: 1rem; background: var(--garden-tint); border-radius: var(--r-md); padding: 1rem 1.1rem;
  display: flex; gap: .7em; align-items: flex-start; font-size: .95rem; color: var(--walnut-ink);
}
.confirm-panel svg { width: 22px; height: 22px; color: var(--garden); flex: none; margin-top: .1em; }

/* ── micro-interactions (gated globally by prefers-reduced-motion) ───────────── */
@keyframes ewBounce {
  0% { transform: translate(-50%, -50%) scale(var(--ew-base-scale, 1)); }
  35% { transform: translate(-50%, -58%) scale(calc(var(--ew-base-scale, 1) * 1.07)); }
  70% { transform: translate(-50%, -46%) scale(calc(var(--ew-base-scale, 1) * .97)); }
  100% { transform: translate(-50%, -50%) scale(var(--ew-base-scale, 1)); }
}
.ew-scene .ew-render.ew-on-fabric.ew-bounce,
.tag-scene .ew-render.ew-on-fabric.ew-bounce { animation: ewBounce .55s var(--ease); }
@keyframes ewSettle { 0% { transform: scale(.86); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.swatch.ew-settle { animation: ewSettle .4s var(--ease); }
/* NOTE: the "design your gift" teaser (.pz-teaser*) lives in sunroom.css — the Home
   page uses it but does NOT load this previewer skin. Keep it there, not here. */
