/* H&H Cart Recovery: signup surfaces (modal, slide-in, bar, inline, add-to-cart).
   Tokens: black #1A1A1A, yellow #FEDD00, white, gray #F7F7F7. Yellow is never
   used as text on a light background. */

.hhcr-root {
  --hhcr-accent: #FEDD00;
  --hhcr-bg: #1A1A1A;
  --hhcr-text: #FFFFFF;
  --hhcr-muted: rgba(255, 255, 255, 0.74);
  --hhcr-field-bg: #FFFFFF;
  --hhcr-btn-bg: var(--hhcr-accent);
  --hhcr-btn-text: #1A1A1A;
  --hhcr-close-bg: rgba(255, 255, 255, 0.12);
  --hhcr-error: #FFB4AB;
  --hhcr-code-border: var(--hhcr-accent);
  font-family: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--hhcr-text);
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}
.hhcr-root *, .hhcr-root *::before, .hhcr-root *::after { box-sizing: border-box; }

.hhcr-theme-light {
  --hhcr-bg: #FFFFFF;
  --hhcr-text: #1A1A1A;
  --hhcr-muted: #555555;
  --hhcr-field-bg: #F7F7F7;
  --hhcr-close-bg: rgba(0, 0, 0, 0.06);
  --hhcr-error: #B3261E;
  --hhcr-code-border: #1A1A1A;
}
.hhcr-theme-yellow {
  --hhcr-bg: #FEDD00;
  --hhcr-text: #1A1A1A;
  --hhcr-muted: rgba(26, 26, 26, 0.74);
  --hhcr-field-bg: #FFFFFF;
  --hhcr-btn-bg: #1A1A1A;
  --hhcr-btn-text: #FFFFFF;
  --hhcr-close-bg: rgba(0, 0, 0, 0.1);
  --hhcr-error: #8F1D14;
  --hhcr-code-border: #1A1A1A;
}

.hhcr-root :focus-visible { outline: 3px solid var(--hhcr-accent); outline-offset: 2px; }
.hhcr-theme-yellow :focus-visible { outline-color: #1A1A1A; }

/*
 * Stacking against the floating widgets that share the bottom of the screen.
 * Measured on the live store: hh-chat's launcher sits at 999995 (the old checkout
 * plugin's side cart and cart chip, at 999997-999999, are gone). Our surfaces sat
 * at 99990, so the launcher landed on top of them - invisible on desktop where the
 * slide-in is a 380px card in the corner, obvious on mobile where it becomes a
 * full-width sheet at bottom:0 and the button sits right on it.
 *
 * So: sit above the launcher, and belt and braces, hide it while a surface is
 * showing (see the rule at the end of this file) - the launcher
 * competing tap targets over a form is worse than either one alone.
 */

/* Modal */
.hhcr-modal {
  position: fixed;
  inset: 0;
  z-index: 999996;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  transition: opacity 0.22s ease;
}
.hhcr-modal.hhcr-enter { opacity: 0; }
.hhcr-modal.hhcr-enter .hhcr-dialog { transform: translateY(16px) scale(0.98); }
.hhcr-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--hhcr-bg);
  color: var(--hhcr-text);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hhcr-size-lg .hhcr-dialog { max-width: 680px; }
.hhcr-layout-split .hhcr-dialog { flex-direction: row; max-width: 780px; }
.hhcr-layout-split.hhcr-size-lg .hhcr-dialog { max-width: 920px; }
.hhcr-layout-split .hhcr-media { flex: 0 0 42%; min-height: 340px; background: #2A2A2A center / cover no-repeat; }
.hhcr-layout-split.hhcr-img-right .hhcr-media { order: 2; }
.hhcr-layout-stack .hhcr-media { height: 200px; background: #2A2A2A center / cover no-repeat; }
.hhcr-layout-compact .hhcr-media { display: none; }

/* Card content */
.hhcr-body { flex: 1 1 auto; min-width: 0; padding: 40px 36px 32px; }
.hhcr-eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hhcr-accent);
}
.hhcr-theme-light .hhcr-eyebrow { color: var(--hhcr-muted); }
.hhcr-theme-yellow .hhcr-eyebrow { color: var(--hhcr-text); }
.hhcr-headline {
  margin: 0 0 12px;
  font-family: Oswald, Impact, 'Arial Narrow', Arial, sans-serif;
  font-weight: 600;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: inherit;
}
.hhcr-text { margin: 0 0 20px; font-size: 17px; color: var(--hhcr-muted); }
.hhcr-form { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.hhcr-input {
  width: 100%;
  height: 50px;
  margin: 0;
  padding: 0 16px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--hhcr-field-bg);
  color: #1A1A1A;
  font: inherit;
  font-size: 16px;
  outline: 0;
  box-shadow: none;
}
.hhcr-input::placeholder { color: #767676; }
.hhcr-input:focus { border-color: var(--hhcr-accent); }
.hhcr-theme-yellow .hhcr-input:focus { border-color: #1A1A1A; }
.hhcr-btn {
  height: 52px;
  margin: 0;
  padding: 0 24px;
  border: 0;
  border-radius: 10px;
  background: var(--hhcr-btn-bg);
  color: var(--hhcr-btn-text);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.hhcr-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.hhcr-btn:disabled, .hhcr-btn.is-busy { opacity: 0.7; cursor: progress; transform: none; }
.hhcr-footnote { margin: 16px 0 0; font-size: 12px; line-height: 1.45; color: var(--hhcr-muted); }
.hhcr-dismiss {
  display: block;
  margin: 14px auto 0;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--hhcr-muted);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}
.hhcr-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--hhcr-close-bg);
  color: inherit;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.hhcr-close:hover { filter: brightness(1.3); }
/* Stacked light/yellow cards put the close button over the photo, so it needs its own light disc */
.hhcr-layout-stack.hhcr-theme-light .hhcr-close, .hhcr-layout-stack.hhcr-theme-yellow .hhcr-close { background: rgba(255, 255, 255, 0.88); color: #1A1A1A; }
.hhcr-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.hhcr-error { margin: 0; font-size: 14px; font-weight: 600; color: var(--hhcr-error); }
.hhcr-vehicle { margin: 0; font-size: 14px; color: var(--hhcr-muted); }
.hhcr-topics { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--hhcr-muted); }
.hhcr-topics label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.hhcr-topics input { width: 16px; height: 16px; margin: 0; accent-color: var(--hhcr-accent); }

/* Success state */
.hhcr-success .hhcr-continue {
  position: static;
  width: 100%;
  height: 52px;
  margin-top: 8px;
  padding: 0 24px;
  border-radius: 10px;
  background: var(--hhcr-btn-bg);
  color: var(--hhcr-btn-text);
  font-size: 17px;
  line-height: 1;
}
.hhcr-offer-label { margin: 8px 0 6px; font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hhcr-muted); }
.hhcr-code {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 6px 6px 6px 18px;
  border: 2px dashed var(--hhcr-code-border);
  border-radius: 12px;
}
.hhcr-code-text {
  flex: 1;
  font-family: Oswald, Impact, 'Arial Narrow', Arial, sans-serif;
  font-size: 26px;
  letter-spacing: 0.08em;
  user-select: all;
}
.hhcr-copy {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--hhcr-btn-bg);
  color: var(--hhcr-btn-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Slide-in: bottom-left, clear of hh-chat's launcher; the side-cart button and quote widget own bottom-right.
   --hh-viewport-bottom is the theme's measure of the browser toolbar on a phone; nothing pinned to the
   bottom edge uses a bare bottom value. */
.hhcr-slide_in {
  position: fixed;
  left: 20px;
  bottom: calc(96px + var(--hh-viewport-bottom, 0px));
  z-index: 999996;
  width: min(380px, calc(100vw - 40px));
  background: var(--hhcr-bg);
  color: var(--hhcr-text);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.hhcr-slide_in.hhcr-pos-bottom-right { left: auto; right: 20px; }
.hhcr-slide_in.hhcr-enter { opacity: 0; transform: translateY(20px); }
.hhcr-slide_in .hhcr-body { padding: 28px 24px 22px; }
.hhcr-slide_in .hhcr-headline { font-size: 24px; padding-right: 28px; }
.hhcr-slide_in .hhcr-text { margin-bottom: 14px; font-size: 15px; }
.hhcr-slide_in .hhcr-input, .hhcr-slide_in .hhcr-btn { height: 46px; }
.hhcr-slide_in .hhcr-close { background: var(--hhcr-close-bg); }

/* Bar: in-flow and sticky at the top of body, or fixed to the bottom */
.hhcr-bar {
  position: sticky;
  top: 0;
  z-index: 9990;
  background: var(--hhcr-bg);
  color: var(--hhcr-text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.hhcr-bar.hhcr-static { position: relative; }
.hhcr-bar.hhcr-pos-bottom { position: fixed; top: auto; right: 0; bottom: var(--hh-viewport-bottom, 0px); left: 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25); }
/* One thing owns the bottom edge at a time: while a bottom bar or a phone slide-in is up, the theme's
   call bar steps aside, as it does for the sticky add-to-cart. */
html.hhcr-bottom-owned .mobile-cta-bar { display: none !important; }
.hhcr-bar.hhcr-enter { opacity: 0; transform: translateY(-8px); }
.hhcr-bar.hhcr-pos-bottom.hhcr-enter { transform: translateY(8px); }
.hhcr-bar .hhcr-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 22px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 56px 12px 20px;
}
.hhcr-bar .hhcr-headline { margin: 0; font-size: 20px; }
.hhcr-bar .hhcr-form { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.hhcr-bar .hhcr-input { width: 260px; height: 42px; }
.hhcr-bar .hhcr-btn { height: 42px; font-size: 15px; }
.hhcr-bar .hhcr-error { flex-basis: 100%; text-align: center; }
.hhcr-bar .hhcr-close { top: 50%; right: 10px; transform: translateY(-50%); }
.hhcr-bar .hhcr-success { display: flex; align-items: center; gap: 16px; }
.hhcr-bar .hhcr-success .hhcr-text { margin: 0; }

/* Inline (shortcode) */
.hhcr-inline { margin: 0 auto; }
.hhcr-inline .hhcr-root {
  position: relative;
  overflow: hidden;
  background: var(--hhcr-bg);
  color: var(--hhcr-text);
  border-radius: 16px;
  transition: opacity 0.22s ease;
}
.hhcr-inline .hhcr-theme-light { border: 1px solid #E5E5E5; }
.hhcr-inline .hhcr-root.hhcr-enter { opacity: 0; }
.hhcr-inline .hhcr-body { padding: 32px 28px; }
.hhcr-inline .hhcr-headline { font-size: 28px; }
.hhcr-inline .hhcr-form { flex-direction: row; flex-wrap: wrap; }
.hhcr-inline .hhcr-input { flex: 1 1 220px; width: auto; }
.hhcr-inline .hhcr-btn { flex: 0 0 auto; }
.hhcr-inline .hhcr-error, .hhcr-inline .hhcr-topics, .hhcr-inline .hhcr-vehicle { flex-basis: 100%; }
.hhcr-inline .hhcr-layout-split { display: flex; }
.hhcr-inline .hhcr-layout-split .hhcr-media { flex: 0 0 38%; min-height: 240px; background: #2A2A2A center / cover no-repeat; }
.hhcr-inline .hhcr-layout-stack .hhcr-media { height: 180px; }

/* Admin preview of an inline surface on the live site */
.hhcr-preview-mount { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; max-width: none; margin: 0; padding: 24px; background: rgba(0, 0, 0, 0.5); }
.hhcr-preview-mount .hhcr-root { width: 100%; max-width: 720px; }

/* Mobile: modal and slide-in become bottom sheets */
@media (max-width: 640px) {
  .hhcr-modal { align-items: flex-end; padding: 0; }
  .hhcr-dialog, .hhcr-layout-split .hhcr-dialog, .hhcr-size-lg .hhcr-dialog {
    flex-direction: column;
    width: 100%;
    max-width: none;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }
  .hhcr-dialog::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: rgba(128, 128, 128, 0.45);
  }
  .hhcr-modal.hhcr-enter .hhcr-dialog { transform: translateY(40px); }
  .hhcr-layout-split .hhcr-media { flex: 0 0 170px; min-height: 0; }
  .hhcr-layout-split.hhcr-img-right .hhcr-media { order: 0; }
  .hhcr-body { padding: 34px 22px 28px; }
  .hhcr-headline { font-size: 28px; }
  .hhcr-slide_in, .hhcr-slide_in.hhcr-pos-bottom-right {
    right: 0;
    bottom: var(--hh-viewport-bottom, 0px);
    left: 0;
    width: auto;
    border-radius: 20px 20px 0 0;
    /* Clear of the home indicator on a phone, and of nothing at all on a browser
       that does not report an inset. */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .hhcr-bar .hhcr-body { gap: 8px; padding: 12px 48px 12px 14px; }
  .hhcr-bar .hhcr-headline { font-size: 17px; }
  .hhcr-bar .hhcr-form { width: 100%; flex-wrap: nowrap; }
  .hhcr-bar .hhcr-input { flex: 1 1 auto; width: auto; min-width: 0; }
  .hhcr-bar .hhcr-btn { flex: 0 0 auto; }
  .hhcr-bar .hhcr-error { flex-basis: auto; }
  .hhcr-bar .hhcr-close { top: 8px; transform: none; }
  .hhcr-inline .hhcr-layout-split { display: block; }
  .hhcr-inline .hhcr-layout-split .hhcr-media { min-height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  .hhcr-root, .hhcr-dialog, .hhcr-btn { transition: none; }
}

/* Form-only inline mount: the host page owns the heading, background and spacing. */
.hhcr-inline .hhcr-form-only { background: transparent; border: 0; box-shadow: none; border-radius: 0; }
.hhcr-inline .hhcr-form-only .hhcr-body { padding: 0; }
.hhcr-inline .hhcr-form-only .hhcr-form { flex-wrap: nowrap; gap: 10px; }
.hhcr-inline .hhcr-form-only .hhcr-input { flex: 1 1 auto; min-height: 56px; font-size: 16px; padding: 0 18px; border-radius: 6px; }
.hhcr-inline .hhcr-form-only .hhcr-btn { min-height: 56px; padding: 0 28px; font-size: 16px; border-radius: 6px; white-space: nowrap; }
.hhcr-inline .hhcr-form-only .hhcr-footnote { margin-top: 12px; font-size: 12px; line-height: 1.5; color: rgba(255, 255, 255, 0.55); }
.hhcr-inline .hhcr-form-only .hhcr-success .hhcr-headline { font-size: 24px; }
@media (max-width: 640px) {
  .hhcr-inline .hhcr-form-only .hhcr-form { flex-wrap: wrap; }
  .hhcr-inline .hhcr-form-only .hhcr-btn { flex: 1 1 100%; }
}

/*
 * While a surface owns the bottom of the screen the floating buttons stand down.
 * hh-chat hides its own proactive bubble on this class (widget.css); its launcher
 * and CheckoutWC's cart button are hidden here because neither plugin should have
 * to know about ours, and so is the theme's #mobile-cta-bar: on a phone the sheet
 * is full width at the bottom and that bar sits in the same 78px, so its buttons
 * came out from under the fine print. They all come straight back on close.
 */
html.hhcr-surface-open #hhtdc-widget-container,
html.hhcr-surface-open #mobile-cta-bar {
  display: none !important;
}
