/* Prehook Try-On — storefront widget styles */

/* The CSS custom properties below are set inline by tryon-button.liquid
   from the theme-editor block settings. Sensible defaults here so the
   button doesn't render broken if a setting is missing. */
.prehook-tryon-block {
  --prehook-bg: #111111;
  --prehook-fg: #ffffff;
  --prehook-border-color: #111111;
  --prehook-border-width: 0px;
  --prehook-radius: 999px;
  /* Legacy alias kept so old block instances that still set
     --prehook-accent (pre-customization upgrade) don't break. The
     button reads --prehook-bg in the new flow; --prehook-accent is
     no longer consulted here but stays defined to avoid var() cascades
     resolving to whatever was on a parent. */
  --prehook-accent: var(--prehook-bg);
  margin: 12px 0;
}

/* Alignment is applied at the block (wrapper) level — the block is
   `display: block` for layout positioning, and the button itself is
   inline-flex so it sizes to its content unless full-width. */
.prehook-tryon-block { display: block; }
.prehook-tryon-block--left   { text-align: left; }
.prehook-tryon-block--center { text-align: center; }
.prehook-tryon-block--right  { text-align: right; }

.prehook-tryon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--prehook-radius);
  border: var(--prehook-border-width) solid var(--prehook-border-color);
  background: var(--prehook-bg);
  color: var(--prehook-fg);
  /* Font family / weight / style are also set INLINE on the button
     element by the Liquid template (see tryon-button.liquid) so
     theme stylesheets can't silently override the merchant's
     choice. Defaults here are the fallback for any custom embed
     that bypasses the inline style. */
  font-family: var(--prehook-font-family, inherit);
  font-size: 14px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

/* Size variants. Padding + font-size scale together. */
.prehook-tryon-btn--small  { padding: 8px 14px;  font-size: 13px; gap: 6px; }
.prehook-tryon-btn--medium { padding: 12px 18px; font-size: 14px; gap: 8px; }
.prehook-tryon-btn--large  { padding: 16px 24px; font-size: 16px; gap: 10px; }

.prehook-tryon-btn--full {
  display: flex;
  width: 100%;
}

.prehook-tryon-btn:hover { opacity: 0.92; }
.prehook-tryon-btn:active { transform: scale(0.98); }
.prehook-tryon-btn__icon { display: inline-flex; }
.prehook-tryon-btn__icon svg {
  width: 1em;
  height: 1em;
}

.prehook-tryon-placeholder {
  padding: 12px;
  border: 1px dashed #d0d0d0;
  border-radius: 8px;
  font-size: 13px;
  color: #666;
}

/* ---------- Modal ---------- */

.prehook-tryon-modal {
  position: fixed;
  inset: auto 16px 16px auto;
  z-index: 2147483600;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
}

.prehook-tryon-modal.is-open { pointer-events: auto; }

.prehook-tryon-modal__card {
  pointer-events: auto;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  padding: 18px 18px 16px;
  /* Entrance animation is applied via .prehook-tryon-pop-animate (added
   * once per open in paint()) so repaints don't re-trigger the fade. */
}

/* The card node persists between opens; hide it while the modal is closed
 * so an empty card doesn't linger in the corner. */
.prehook-tryon-modal:not(.is-open) .prehook-tryon-modal__card { display: none; }

.prehook-tryon-modal__card.prehook-tryon-pop-animate {
  animation: prehook-tryon-pop 0.18s ease-out;
}

@keyframes prehook-tryon-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Modal placement (theme-editor: position + size) ----------
 * Classes set once per open() by applyModalPlacement(), never in paint(),
 * so they don't disturb the once-per-open pop animation. Default (corner /
 * bottom-right) matches the base rules above for installs without settings. */

/* Corner size — compact card anchored to one screen corner. */
.prehook-tryon-modal--pos-bottom-right { inset: auto 16px 16px auto; }
.prehook-tryon-modal--pos-bottom-left  { inset: auto auto 16px 16px; }
.prehook-tryon-modal--pos-top-right    { inset: 16px 16px auto auto; }
.prehook-tryon-modal--pos-top-left     { inset: 16px auto auto 16px; }

/* Popup + fullscreen both cover the screen and center the card. */
.prehook-tryon-modal--size-popup,
.prehook-tryon-modal--size-fullscreen {
  inset: 0;
  display: flex;
  justify-content: center;
}
/* Popup floats a centered card over a dimmed page; a backdrop click
 * (handled in ensureMount) closes it. */
.prehook-tryon-modal--size-popup {
  align-items: center;
  padding: 16px;
}
.prehook-tryon-modal--size-popup.is-open { background: rgba(0, 0, 0, 0.45); }
.prehook-tryon-modal--size-popup .prehook-tryon-modal__card {
  width: min(460px, calc(100vw - 32px));
}
/* Fullscreen is an opaque white takeover. The content stays in a centered
 * max-width column (not stretched edge-to-edge on wide screens) and is top-
 * aligned; the card scrolls within the viewport if it's tall. */
.prehook-tryon-modal--size-fullscreen {
  align-items: flex-start;
}
.prehook-tryon-modal--size-fullscreen.is-open { background: #fff; }
.prehook-tryon-modal--size-fullscreen .prehook-tryon-modal__card {
  width: min(480px, calc(100vw - 32px));
  max-height: 100vh;
  box-shadow: none;
  border-radius: 0;
}

@media (max-width: 480px) {
  /* On phones all corner positions hug the screen with an 8px gutter. */
  .prehook-tryon-modal--pos-bottom-right,
  .prehook-tryon-modal--pos-bottom-left { inset: auto 8px 8px 8px; }
  .prehook-tryon-modal--pos-top-right,
  .prehook-tryon-modal--pos-top-left { inset: 8px 8px auto 8px; }
}

.prehook-tryon-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.prehook-tryon-modal__title { font-size: 18px; line-height: 1.2; margin: 0; font-weight: 700; }
.prehook-tryon-modal__subtitle { font-size: 12px; line-height: 1.3; margin: 2px 0 0; color: #6b6b6b; }
.prehook-tryon-modal__title-block { flex: 1 1 auto; }

.prehook-tryon-modal__close,
.prehook-tryon-modal__back {
  appearance: none;
  background: #f3f3f3;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #1a1a1a;
  flex: 0 0 auto;
}
@media (max-width: 480px) {
  .prehook-tryon-modal__close,
  .prehook-tryon-modal__back { width: 36px; height: 36px; font-size: 20px; }
}

.prehook-tryon-modal__close:hover,
.prehook-tryon-modal__back:hover { background: #e7e7e7; }

/* Result-header "My saved try-ons" — a circular icon button matching
 * close/back, sitting just left of the close button. Icon-only + native
 * tooltip so it never crowds the 380px header. */
.prehook-tryon-modal__saved-result-btn {
  appearance: none;
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4a4a4a;
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s;
}
.prehook-tryon-modal__saved-result-btn:hover { background: #e7e7e7; color: #1a1a1a; }
.prehook-tryon-modal__saved-result-icon { display: inline-flex; }
.prehook-tryon-modal__saved-result-icon svg { width: 18px; height: 18px; }
@media (max-width: 480px) {
  .prehook-tryon-modal__saved-result-btn { width: 36px; height: 36px; }
}

.prehook-tryon-modal__steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 6px;
}

.prehook-tryon-modal__step {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ececec;
  color: #6b6b6b;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.prehook-tryon-modal__step.is-active { background: #1a1a1a; color: #fff; }
.prehook-tryon-modal__step.is-done {
  background: #1a1a1a;
  color: #fff;
  opacity: 0.55;
}

.prehook-tryon-modal__step-line {
  flex: 0 1 60px;
  height: 2px;
  background: #ececec;
}
.prehook-tryon-modal__step-line.is-done { background: #1a1a1a; opacity: 0.55; }

.prehook-tryon-modal__body { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 6px; }

.prehook-tryon-modal__lead { margin: 8px 0 0; font-size: 16px; font-weight: 700; }
.prehook-tryon-modal__lead-sub { margin: 0 0 4px; font-size: 13px; color: #6b6b6b; text-align: center; }

.prehook-tryon-modal__thumb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f3f3;
  display: block;
}
.prehook-tryon-modal__thumb--empty { background: #eee; }

.prehook-tryon-modal__file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.prehook-tryon-modal__primary {
  appearance: none;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 999px;
  background: #1a1a1a;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, opacity 0.15s;
}
.prehook-tryon-modal__primary:hover:not(:disabled) { background: #2a2a2a; }
.prehook-tryon-modal__primary:disabled,
.prehook-tryon-modal__secondary:disabled,
.prehook-tryon-modal__tertiary:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}
.prehook-tryon-modal__secondary:disabled,
.prehook-tryon-modal__tertiary:disabled {
  /* Both these tiers rely on hover/focus changes for affordance —
   * neutralize them so a disabled button doesn't appear to react. */
  background: inherit;
}

/* Inline spinner — used inside any button rendering a busy state.
 * 14px because it has to share the line with the button label
 * without crowding the padding. Animated via @keyframes spin. */
.prehook-tryon-modal__btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: prehook-tryon-btn-spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes prehook-tryon-btn-spin {
  to { transform: rotate(360deg); }
}

.prehook-tryon-modal__plus {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.prehook-tryon-modal__secondary {
  appearance: none;
  width: 100%;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid #d0d0d0;
  background: #fff;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}

/* Tertiary button — visually lighter than __secondary; used for the
 * "My saved try-ons" entry that sits below the two upload CTAs.
 * Borderless + lower contrast so it doesn't compete with the
 * primary actions, but still a full-width tappable target. */
.prehook-tryon-modal__tertiary {
  appearance: none;
  width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #4a4a4a;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.15s, color 0.15s;
}
.prehook-tryon-modal__tertiary:hover,
.prehook-tryon-modal__tertiary:focus-visible {
  background: #f4eaff;
  color: #6a1b9a;
}
.prehook-tryon-modal__tertiary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.prehook-tryon-modal__tertiary-icon svg {
  width: 16px;
  height: 16px;
}

.prehook-tryon-modal__legal {
  font-size: 11px;
  color: #8a8a8a;
  text-align: center;
  margin: 4px 0 0;
}
.prehook-tryon-modal__legal a { color: inherit; text-decoration: underline; }
.prehook-tryon-modal__brand { font-size: 11px; color: #b0b0b0; margin: 0; }
.prehook-tryon-modal__brand a { color: inherit; text-decoration: none; }
.prehook-tryon-modal__brand a:hover { text-decoration: underline; }

/* ---------- Loading ---------- */

.prehook-tryon-modal__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 0 4px;
}

/* ---------- Webcam capture step ---------- */

.prehook-tryon-modal__webcam {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  background: #1a1a1a;
  margin: 4px 0 14px;
}
.prehook-tryon-modal__webcam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Mirror the live preview so the user sees themselves like a
     mirror — feels natural. The captured frame is drawn from the
     un-mirrored stream (drawImage uses the raw video feed), so the
     image we send to the AI matches reality. */
  transform: scaleX(-1);
}
.prehook-tryon-modal__webcam-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 0 4px;
}
.prehook-tryon-modal__cam-glyph {
  margin-right: 6px;
}

.prehook-tryon-modal__loading-imgs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prehook-tryon-modal__loading-img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 16px;
  background: #f3f3f3;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.prehook-tryon-modal__loading-spin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2bb673;
  font-size: 18px;
  animation: prehook-tryon-spin 1.4s linear infinite;
}

@keyframes prehook-tryon-spin {
  to { transform: rotate(360deg); }
}

.prehook-tryon-modal__loading-text { font-size: 16px; font-weight: 600; margin: 0; }

.prehook-tryon-modal__progress {
  width: 200px;
  height: 4px;
  background: #ececec;
  border-radius: 2px;
  overflow: hidden;
}
/* Width is 100%; the bar is filled via scaleX from JS (see
 * loadingProgressPct in widget-src/tryon-widget.ts), bumped once per second.
 * `transition: transform 1s linear` smooths each 1s step into one continuous
 * fill. transform-origin: left keeps the fill anchored to the left edge. */
/* Descendant selector (two classes = 0,2,0) so it outranks a theme reset like
 * `div:empty { display:none }` (0,1,1) that would otherwise hide/zero this empty
 * fill div. Explicit display + px height too — the track is a flex item, so a
 * percentage height wouldn't resolve. */
.prehook-tryon-modal__progress .prehook-tryon-modal__progress-bar {
  display: block;
  width: 100%;
  height: 4px;
  background: #1a1a1a;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1s linear;
}

.prehook-tryon-modal__tip {
  margin-top: 14px;
  border: 1px solid #ececec;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
}
.prehook-tryon-modal__tip-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #8a8a8a;
  letter-spacing: 0.08em;
}
.prehook-tryon-modal__tip-text {
  display: block;
  font-size: 13px;
  color: #1a1a1a;
  margin-top: 2px;
}

/* ---------- Shopper sign-in (intro chip + code input + banner) ---------- */

/* "Signed in as you@example.com · Sign out" — small, low-contrast,
 * sits at the bottom of the intro CTA stack so it doesn't compete
 * for visual weight with the primary upload buttons. */
.prehook-tryon-modal__signed-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 4px;
  font-size: 12px;
  color: #6b6b6b;
}
.prehook-tryon-modal__signed-in-label {
  /* The email itself can be long — clamp at the container width. */
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prehook-tryon-modal__signed-in-label strong {
  color: #1a1a1a;
  font-weight: 600;
}
.prehook-tryon-modal__signed-in-out {
  appearance: none;
  background: none;
  border: none;
  color: #6b6b6b;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  flex: 0 0 auto;
}
.prehook-tryon-modal__signed-in-out:hover { color: #1a1a1a; }

/* Unverified middle tier — stacked: "Saving your looks to <email>" over a
 * verify CTA. The saved try-ons library is gated behind a verified
 * session, so the CTA is the path to it (it pre-seeds the email). */
.prehook-tryon-modal__email-tier {
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}
.prehook-tryon-modal__email-tier .prehook-tryon-modal__signed-in-label {
  flex: 0 0 auto;
  max-width: 100%;
}
.prehook-tryon-modal__verify-cta {
  font-weight: 600;
  color: #1a1a1a;
}

/* Migration banner — "Welcome back, we restored N try-ons". Shown
 * once after a successful verify. Soft success tint to match the
 * share-thanks state. */
.prehook-tryon-modal__signin-migrated {
  width: 100%;
  margin: 4px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #b9e7c8;
  color: #16793b;
  font-size: 12px;
  text-align: center;
}

/* Code input — same shell as the email input but spaced + monospaced
 * so the 6 digits read as a code, not a sentence. */
.prehook-tryon-modal__code-input {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-align: center;
}

/* ---------- Recent selfies strip (intro screen) ---------- */
/* A horizontal row of round thumbs the shopper can tap to skip the
 * camera-roll step entirely. Hides when the visitor has no saved
 * selfies — fresh-shopper UX is unchanged. */
.prehook-tryon-modal__saved-selfies {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin: 4px 0 2px;
}
.prehook-tryon-modal__saved-selfies-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b6b6b;
}
.prehook-tryon-modal__saved-selfies-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  /* iOS smooth-scroll for the strip. Same pattern as the recent
   * try-ons strip rendered outside the modal. */
  -webkit-overflow-scrolling: touch;
}
.prehook-tryon-modal__saved-selfie {
  appearance: none;
  border: 2px solid transparent;
  background: none;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  /* flex-shrink: 0 keeps the round shape from collapsing as the
   * strip fills up; overflow:auto on the parent handles overflow. */
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.05s;
}
.prehook-tryon-modal__saved-selfie:hover,
.prehook-tryon-modal__saved-selfie:focus-visible {
  border-color: #c89ce6;
}
.prehook-tryon-modal__saved-selfie:active { transform: scale(0.95); }
.prehook-tryon-modal__saved-selfie-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ---------- Preview (step 2 — confirm before submit) ---------- */

.prehook-tryon-modal__preview-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin: 4px 0 6px;
}
.prehook-tryon-modal__preview-cell {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.prehook-tryon-modal__preview-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  border-radius: 12px;
  background: #f3f3f3;
}
.prehook-tryon-modal__preview-img.is-empty {
  background: repeating-linear-gradient(
    45deg,
    #f3f3f3 0 8px,
    #ececec 8px 16px
  );
}
.prehook-tryon-modal__preview-label {
  font-size: 12px;
  color: #6b6b6b;
  text-align: center;
  /* Clamp so a long product title doesn't blow out the row. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Result ---------- */

.prehook-tryon-modal__result {
  position: relative;
  margin: 12px 0 8px;
  border-radius: 16px;
  overflow: hidden;
  background: #f3f3f3;
}
.prehook-tryon-modal__result-img {
  width: 100%;
  display: block;
  height: auto;
}
.prehook-tryon-modal__result-corner {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  border: 2px solid #fff;
}

.prehook-tryon-modal__result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.prehook-tryon-modal__result-product {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: #6b6b6b;
}
.prehook-tryon-modal__result-product strong { color: #1a1a1a; font-size: 14px; }

.prehook-tryon-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prehook-tryon-modal__cta { font-weight: 700; }

.prehook-tryon-modal__feedback {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.prehook-tryon-modal__feedback-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #ececec;
  background: #fff;
  color: #1a1a1a;
  cursor: pointer;
  font-size: 16px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
/* Tooltip-style confirmation that floats above the copy-link button
 * for a moment after the link lands in the clipboard. position:
 * relative on .__feedback-btn anchors it; the absolute placement +
 * translateX centers it on the button. pointer-events:none keeps
 * the toast from intercepting a follow-up click. */
.prehook-tryon-modal__copy-toast {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  background: #1a1a1a;
  color: #fff;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
  z-index: 2;
}
/* Little arrow under the toast pointing at the button. */
.prehook-tryon-modal__copy-toast::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1a1a1a;
}
@media (max-width: 480px) {
  /* Bump to 44px on phones — Apple HIG tap-target minimum. The few
   * extra pixels are recovered from the heart/share row's flex-wrap
   * gracefully. */
  .prehook-tryon-modal__feedback-btn { width: 44px; height: 44px; }
}
.prehook-tryon-modal__feedback-btn:hover { background: #f3f3f3; border-color: #d8d8d8; }
.prehook-tryon-modal__feedback-btn:active { transform: scale(0.95); }
.prehook-tryon-modal__share-btn { font-weight: 700; }

/* Hover/focus tooltips for the result feedback buttons (like, dislike,
 * social share). The bubble floats above the button; works on any
 * .__feedback-btn carrying a data-tooltip. */
.prehook-tryon-modal__feedback-btn[data-tooltip] { position: relative; }
.prehook-tryon-modal__feedback-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #1a1a1a;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  padding: 5px 9px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.prehook-tryon-modal__feedback-btn[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1a1a1a;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease, visibility 0.12s ease;
  z-index: 10;
  pointer-events: none;
}
.prehook-tryon-modal__feedback-btn[data-tooltip]:hover::after,
.prehook-tryon-modal__feedback-btn[data-tooltip]:focus-visible::after,
.prehook-tryon-modal__feedback-btn[data-tooltip]:hover::before,
.prehook-tryon-modal__feedback-btn[data-tooltip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
}
/* Suppress the tooltip while the button is disabled (heart/dislike disable
 * mid-like) so a stuck bubble doesn't linger. */
.prehook-tryon-modal__feedback-btn:disabled[data-tooltip]::after,
.prehook-tryon-modal__feedback-btn:disabled[data-tooltip]::before {
  opacity: 0;
  visibility: hidden;
}
/* Hide the hover tooltip while the copy button shows its "Link copied"
 * toast, so the two bubbles don't overlap in the same spot. */
.prehook-tryon-modal__feedback-btn.is-copied[data-tooltip]::after,
.prehook-tryon-modal__feedback-btn.is-copied[data-tooltip]::before {
  opacity: 0;
  visibility: hidden;
}
/* The share/social buttons sit on the right edge of the 380px card —
 * right-align their tooltips so they don't clip past the card. */
.prehook-tryon-modal__share-btn[data-tooltip]::after { left: auto; right: 0; transform: none; }
.prehook-tryon-modal__share-btn[data-tooltip]::before { left: auto; right: 13px; transform: none; }

/* Inline icon wrapper used by share + heart buttons. The SVG inside
   is sized to 18×18 with currentColor fills, so adjusting the parent
   button's `color` (e.g. heart's red liked state) recolors the
   glyph for free. */
.prehook-tryon-modal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  line-height: 0;
}
.prehook-tryon-modal__icon svg { display: block; }

/* Heart toggle. Default is outline grey; the .is-liked variant
   recolors the icon (via currentColor) and tints the chip. */
.prehook-tryon-modal__heart {
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.05s;
}
.prehook-tryon-modal__heart.is-liked {
  color: #e0245e;
  background: #fdebf2;
  border-color: #f7c4d4;
}
.prehook-tryon-modal__heart.is-liked:hover {
  background: #fbdce8;
  border-color: #f3a9c0;
}
/* ✕ next to the heart — opens the dislike-reason picker. */
.prehook-tryon-modal__dislike {
  color: #6b6b6b;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.05s;
}
.prehook-tryon-modal__dislike:hover {
  color: #1a1a1a;
}
/* Reason picker. Sits in the same slot as the share panel,
 * so it inherits the share-panel chrome (margin, padding,
 * border) — we only need to style the radio rows + textarea. */
.prehook-tryon-modal__dislike-reasons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 4px;
}
.prehook-tryon-modal__dislike-reason {
  display: flex;
  align-items: center;
  gap: 10px;
  /* Vertical padding tuned so each row is ~44px tall — meets the
   * mobile tap-target minimum without looking oversized on desktop. */
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid #e2e2e2;
  background: #fff;
  font-size: 14px;
  color: #1a1a1a;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.prehook-tryon-modal__dislike-reason:hover {
  background: #fafafa;
  border-color: #d5d5d5;
}
.prehook-tryon-modal__dislike-reason.is-selected {
  background: #f4eaff;
  border-color: #c89ce6;
}
.prehook-tryon-modal__dislike-reason input[type="radio"] {
  margin: 0;
  accent-color: #9160cb;
}
.prehook-tryon-modal__dislike-note {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  color: #1a1a1a;
  background: #fff;
  box-sizing: border-box;
}
.prehook-tryon-modal__dislike-note:focus {
  outline: none;
  border-color: #9160cb;
  box-shadow: 0 0 0 3px rgba(145, 96, 203, 0.18);
}
.prehook-tryon-modal__feedback-divider {
  width: 1px;
  height: 22px;
  background: #ececec;
  margin: 0 4px;
}

.prehook-tryon-modal__error {
  font-size: 13px;
  color: #b00020;
  text-align: center;
}

/* ---------- Email collection (soft prompt + hard gate) ---------- */

.prehook-tryon-modal__email-soft,
.prehook-tryon-modal__share-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #ececec;
  border-radius: 12px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Share-with-merchant panel — same shell as the email prompt, with a
   tinted background once the share lands so the success state reads
   distinctly. The incentive code is rendered as a pill the shopper
   can copy. */
.prehook-tryon-modal__share-panel.is-thanks {
  background: #f0fdf4;
  border-color: #b9e7c8;
}
.prehook-tryon-modal__share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.prehook-tryon-modal__share-head strong { font-size: 14px; }
.prehook-tryon-modal__share-sub {
  font-size: 12px;
  color: #6b6b6b;
  margin: 0;
}
.prehook-tryon-modal__share-fineprint {
  font-size: 11px;
  color: #8a8a8a;
  margin: 0;
  line-height: 1.45;
}
.prehook-tryon-modal__share-policy-link {
  color: #6b6b6b;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prehook-tryon-modal__share-policy-link:hover { color: #1a1a1a; }
.prehook-tryon-modal__share-submit { align-self: flex-start; }
.prehook-tryon-modal__share-code {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed #b9e7c8;
}
.prehook-tryon-modal__share-code-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b6b6b;
}
.prehook-tryon-modal__share-code-value {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  color: #16793b;
  cursor: pointer;
}

.prehook-tryon-modal__email-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prehook-tryon-modal__email-head strong { font-size: 14px; }

.prehook-tryon-modal__email-skip {
  appearance: none;
  background: none;
  border: none;
  color: #6b6b6b;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.prehook-tryon-modal__email-sub {
  font-size: 12px;
  color: #6b6b6b;
  margin: 0;
}

.prehook-tryon-modal__email-input {
  appearance: none;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}

.prehook-tryon-modal__email-input:focus {
  outline: 2px solid #1a1a1a;
  outline-offset: 1px;
  border-color: #1a1a1a;
}

.prehook-tryon-modal__marketing-optin {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #6b6b6b;
  font-size: 11px;
  line-height: 1.45;
  cursor: pointer;
}

.prehook-tryon-modal__marketing-check {
  appearance: auto;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--prehook-accent, #1a1a1a);
}

.prehook-tryon-modal__email-submit { width: 100%; }

.prehook-tryon-modal__email-err {
  font-size: 12px;
  color: #b00020;
}

/* ---------- Daily limit reached (friendly, not an error) ---------- */

.prehook-tryon-modal__limit {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 4px 12px;
  gap: 14px;
}

.prehook-tryon-modal__limit-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.prehook-tryon-modal__limit-title {
  font-size: 22px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.prehook-tryon-modal__limit-sub {
  font-size: 14px;
  color: #5a5a5a;
  margin: 0;
  line-height: 1.5;
  max-width: 320px;
}

.prehook-tryon-modal__limit-cta {
  width: 100%;
  margin-top: 6px;
}

@media (max-width: 480px) {
  .prehook-tryon-modal { inset: auto 8px 8px 8px; }
  .prehook-tryon-modal__card { width: auto; }
}

/* ---------- Sheet overlay (share + dislike) ---------- */
/* Renders ABOVE the card so it can darken the result behind it
 * and feel modal instead of inline. Anchored to the modal root
 * (which is fixed-positioned at the same bounds as the card) so
 * the sheet doesn't scroll with card content. */
.prehook-tryon-modal__sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 18, 0.42);
  border-radius: 16px;
  z-index: 5;
  cursor: pointer;
  animation: prehook-tryon-fade-in 140ms ease-out;
}
.prehook-tryon-modal__sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  padding: 14px;
  max-height: calc(100% - 24px);
  overflow: auto;
  /* iOS bounce + better thumb scrolling inside the sheet on phones. */
  -webkit-overflow-scrolling: touch;
  animation: prehook-tryon-sheet-up 200ms ease-out;
}
@media (max-width: 480px) {
  /* Tighter margins on phones — the card already hugs the screen
   * edges at 16px each side, so giving the sheet another 12px would
   * leave the question feeling cramped. */
  .prehook-tryon-modal__sheet { left: 8px; right: 8px; bottom: 8px; padding: 12px; }
}
.prehook-tryon-modal__sheet.is-thanks {
  background: #f0fdf4;
  box-shadow: 0 12px 32px rgba(16, 121, 59, 0.18);
}
@keyframes prehook-tryon-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes prehook-tryon-sheet-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
/* When a share / dislike panel renders inside the sheet, drop its
 * own card chrome — the sheet provides background, border, padding
 * already. Keeps the inner layout flow (gaps, head row, etc).
 * Without this the panel would have a double border-radius and a
 * doubled background tint. */
.prehook-tryon-modal__sheet > .prehook-tryon-modal__share-panel,
.prehook-tryon-modal__sheet > .prehook-tryon-modal__share-panel.is-thanks,
.prehook-tryon-modal__sheet > .prehook-tryon-modal__email-soft {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

/* Phase 5 — recent approved try-ons strip rendered next to the
 * try-on button on the product page (before or after, merchant's
 * choice). Outer wrapper is a vertical stack: optional label on
 * top, horizontally-scrollable strip below. */
.prehook-tryon-recent {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}
.prehook-tryon-recent__label {
  font-family: var(--prehook-recent-label-font-family, inherit);
  font-size: var(--prehook-recent-label-font-size, 13px);
  font-weight: var(--prehook-recent-label-font-weight, 600);
  color: var(--prehook-recent-label-color, inherit);
}
.prehook-tryon-recent__strip {
  display: flex;
  /* wrap for fixed sizes (so overflow goes to a new row);
   * nowrap for size=auto (thumbs shrink to fit one row). The
   * variable is set on the block root by Liquid. */
  flex-wrap: var(--prehook-recent-strip-wrap, wrap);
  gap: 8px;
  padding-bottom: 4px;
  width: 100%;
}
.prehook-tryon-recent__thumb {
  /* Width + flex + aspect + radius + border are all
   * merchant-controlled CSS vars set on the block root by the
   * Liquid template. With size = small/medium/large the flex var
   * is "0 0 auto" so width wins; with size = auto the flex var is
   * "1 1 0" and width is "auto", letting thumbs grow/shrink to
   * fill the row uniformly. */
  flex: var(--prehook-recent-thumb-flex, 0 0 auto);
  width: var(--prehook-recent-thumb-width, 60px);
  /* min-width: 0 is required so flex-shrink can pull a thumb
   * below its content's intrinsic width (otherwise the SVG icon
   * inside would keep the thumb above some implicit minimum and
   * five thumbs in a narrow row would still overflow). */
  min-width: 0;
  aspect-ratio: var(--prehook-recent-thumb-aspect, 3 / 4);
  border-radius: var(--prehook-recent-thumb-radius, 8px);
  border: var(--prehook-recent-thumb-border-width, 1px) solid var(--prehook-recent-thumb-border-color, #DDDDDD);
  overflow: hidden;
  background: #f4f4f4;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.prehook-tryon-recent__thumb:hover,
.prehook-tryon-recent__thumb:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}
.prehook-tryon-recent__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Design-mode preview tiles — neutral background, person icon
 * inside (rendered by Liquid). The merchant's chosen border
 * width/color still applies via the CSS vars above. */
.prehook-tryon-recent__thumb--placeholder {
  background: #f3f4f6;
  color: rgba(0, 0, 0, 0.22);
  cursor: default;
}
.prehook-tryon-recent__thumb--placeholder:hover {
  transform: none;
  box-shadow: none;
}
.prehook-tryon-recent__thumb--placeholder svg {
  width: 60%;
  height: 60%;
  display: block;
}
/* Make sure the strip itself has presence even when the merchant's
 * theme tries to constrain the section width. */
.prehook-tryon-recent--preview {
  min-height: 80px;
}

/* ---------------------------------------------------------------
 * Saved try-ons view
 * ---------------------------------------------------------------
 * Entry button sits in the intro header next to the close ✕. It's a
 * compact icon-only control — small enough that it doesn't compete
 * with the title block but obvious enough that a returning shopper
 * notices it.
 */
.prehook-tryon-modal__saved-entry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 4px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #4a4a4a;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.prehook-tryon-modal__saved-entry:hover,
.prehook-tryon-modal__saved-entry:focus-visible {
  background: #f4eaff;
  border-color: #c89ce6;
  color: #6a1b9a;
}
.prehook-tryon-modal__saved-entry svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Sections wrapper — stacks the "Liked try-ons" bucket above the
 * "All saved" bucket. */
.prehook-tryon-modal__saved-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.prehook-tryon-modal__saved-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prehook-tryon-modal__saved-section-head {
  font-size: 13px;
  font-weight: 600;
  color: #4a4a4a;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
/* Two-column grid — narrow enough to keep the modal compact, wide
 * enough to show a recognizable thumbnail + title side by side. */
.prehook-tryon-modal__saved-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.prehook-tryon-modal__saved-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.prehook-tryon-modal__saved-item:hover,
.prehook-tryon-modal__saved-item:focus-within {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  border-color: #c89ce6;
}
/* The thumb+meta region is now a button that opens the in-widget viewer.
 * Strip the native button chrome so the card looks unchanged. */
.prehook-tryon-modal__saved-open {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  width: 100%;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prehook-tryon-modal__saved-open:focus-visible { outline: none; }
.prehook-tryon-modal__saved-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #f4f4f4;
}
.prehook-tryon-modal__saved-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
}
.prehook-tryon-modal__saved-title {
  font-size: 13px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.25;
  /* Clamp to 2 lines so long titles don't blow out card height. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prehook-tryon-modal__saved-time {
  font-size: 11px;
  color: #777777;
}

/* Add-to-cart footer on each saved try-on card. */
/* Signed-out empty state in the saved view — sign-in prompt. */
.prehook-tryon-modal__saved-signin {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0;
}

.prehook-tryon-modal__saved-actions {
  padding: 0 8px 8px;
}
.prehook-tryon-modal__saved-atc {
  appearance: none;
  width: 100%;
  border: 1px solid #1a1a1a;
  background: #1a1a1a;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.prehook-tryon-modal__saved-atc:hover { background: #000; }
.prehook-tryon-modal__saved-atc:disabled { opacity: 0.65; cursor: default; }

/* In-widget full-size viewer for a single saved try-on (replaces the old
 * open-in-new-tab). The image fills the card width; the card's
 * overflow:auto scrolls it if it's taller than the viewport. */
.prehook-tryon-modal__saved-viewer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0 4px;
  border-radius: 14px;
  overflow: hidden;
  background: #f4f4f4;
}
.prehook-tryon-modal__saved-viewer-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* ---------- T-95: app-embed floating mode ------------------------------ */
/* Used when the embed's placement setting is "floating", and as the
   terminal fallback when auto-placement finds no Add-to-Cart anchor.
   Below the modal's 2147483600 so an open try-on window covers it. */
.prehook-tryon-block--floating {
  position: fixed;
  bottom: 20px;
  margin: 0;
  z-index: 2147483000;
}
.prehook-tryon-block--floating-right { right: 20px; }
.prehook-tryon-block--floating-left  { left: 20px; }
.prehook-tryon-block--floating .prehook-tryon-btn {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
