/* /preview page styles (M2). Standalone — no Tailwind dependency. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  color: #1A1A1A;
  background: #F7F7F8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  /* Block horizontal scroll. Static layout audits clean at every
     common iPhone width (320–430), but iOS Safari sometimes allows
     touch-driven horizontal pan when child renderers (color swatch
     chrome, autocomplete chips, native input affordances) momentarily
     render past the intrinsic box. `overflow-x: clip` confines them
     without creating a scroll container. */
  overflow-x: clip;
}

h1, h2, h3 {
  font-family: 'Petrona', Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.18;
}

a { color: #1447E6; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ───────────────────────────────────────────────────────── */
.topbar {
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
  padding: 16px 24px;
  display: flex;
  align-items: center;
}
.brand { display: inline-flex; align-items: center; }
.wordmark {
  font-family: 'Fraunces', Georgia, serif;
  font-variation-settings: 'opsz' 9, 'WONK' 0;
  font-feature-settings: 'ss01' 1;
  font-size: 22px;
  color: #1A1A1A;
  letter-spacing: -0.01em;
}

/* ── State containers ─────────────────────────────────────────────── */
.preview-state {
  display: block;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}
.preview-state[hidden] { display: none; }

.preview-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.preview-card h1 {
  font-size: clamp(22px, 3.5vw, 30px);
  margin-bottom: 12px;
  color: #1A1A1A;
}

.preview-card p {
  font-size: 16px;
  color: #4B5563;
  line-height: 1.6;
}

.muted { color: #6B7280; }
.small { font-size: 13px; }

/* Loading spinner */
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid #E5E7EB;
  border-top-color: #1447E6;
  margin: 24px auto 0;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* CTAs */
.cta-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  align-items: center;
  justify-content: center;
}
@media (min-width: 480px) {
  .cta-row { flex-direction: row; }
}
.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 980px;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.18s, transform 0.12s;
  text-decoration: none;
}
.btn-primary {
  background: #1447E6;
  color: #FFFFFF;
}
.btn-primary:hover { background: #0F3AC4; transform: translateY(-1px); text-decoration: none; }
.btn-secondary {
  background: #FFFFFF;
  color: #1447E6;
  border: 1px solid #D1D5DB;
}
.btn-secondary:hover { background: #F7F7F8; text-decoration: none; }

/* ── Active state — full width ────────────────────────────────────── */
#preview-active {
  max-width: 1200px;
  padding: 32px 20px 80px;
}

.hero {
  text-align: center;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(26px, 4vw, 36px);
  margin-bottom: 8px;
}
.hero p { font-size: 16px; margin-bottom: 4px; }
.reassurance {
  font-size: 14px;
  color: #6B7280;
  margin-top: 6px;
}

/* ── Two-column layout (S-18) ─────────────────────────────────────── */
.preview-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 1024px) {
  .preview-columns {
    grid-template-columns: 420px 1fr;
    align-items: start;
  }
}

/* ── Form column ──────────────────────────────────────────────────── */
.form-shell {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  padding: 24px 22px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

#preview-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4B5563;
  margin: 16px 0 6px;
}
#preview-form label:first-child { margin-top: 0; }
.field-hint {
  font-weight: 400;
  color: #9CA3AF;
}

#preview-form input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #D1D5DB;
  font-size: 15px;
  font-family: inherit;
  color: #1A1A1A;
  background: #FFFFFF;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#preview-form input[type="text"]:focus {
  outline: none;
  border-color: #1447E6;
  box-shadow: 0 0 0 3px rgba(20, 71, 230, 0.18);
}

/* ── Brand colour row ─────────────────────────────────────────────── */
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-picker {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  padding: 2px;
  cursor: pointer;
  background: transparent;
}
.color-hex {
  font-size: 13px;
  font-family: monospace;
  color: #4B5563;
}

/* ── Upload zones ─────────────────────────────────────────────────── */
.upload-zone {
  position: relative;
  border: 2px dashed #D1D5DB;
  border-radius: 14px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.upload-zone:hover,
.upload-zone:focus,
.upload-zone.dragover {
  border-color: #1447E6;
  background: #EEF2FF;
  outline: none;
}

.upload-placeholder {
  font-size: 13px;
  color: #6B7280;
  line-height: 1.5;
}
.upload-placeholder small { color: #9CA3AF; }

.upload-preview {
  display: none;
  max-width: 100%;
  max-height: 120px;
  border-radius: 8px;
  object-fit: contain;
}
.upload-preview--cover {
  max-height: 80px;
  width: 100%;
  object-fit: cover;
}
.upload-preview.visible { display: block; }

.upload-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #E5E7EB;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: #1447E6;
  transition: width 0.2s;
}

.upload-error {
  font-size: 13px;
  color: #DC2626;
  margin-top: 6px;
  text-align: left;
}
.upload-error:not([hidden]) { display: block; }

/* ── Right column: dynamic QR (the user's phone is the preview) ──── */
.preview-right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 1024px) {
  .preview-right-col {
    align-self: start;
    position: sticky;
    top: 32px;
  }
}

/* ── QR section ───────────────────────────────────────────────────── */
.qr-shell {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  padding: 24px 22px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.qr-heading {
  font-size: 13px;
  font-weight: 700;
  color: #1A1A1A;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
#preview-qr-link {
  display: inline-block;
  padding: 14px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
}
#preview-qr-link:hover { text-decoration: none; }
#preview-qr-img {
  display: block;
  width: 200px;
  height: 200px;
  background: #FFFFFF;
}

/* ── iOS Safari copy swap helpers ─────────────────────────────────── */
/* Pair `.hide-on-ios-safari` (default visible) with `.show-on-ios-safari`
   (default hidden) on twin elements to surface long-press copy when the
   visitor is on Safari iOS — they can't "scan with their iPhone" because
   they ARE on the iPhone. `display: revert` returns the element to its
   natural display (block <p>, inline <span>, etc.) so one rule covers
   both shapes. */
.show-on-ios-safari { display: none; }
html.is-ios-safari .show-on-ios-safari { display: revert; }
html.is-ios-safari .hide-on-ios-safari { display: none; }

/* ── QR shell instruction (per-device) ──────────────────────────────
   Three twin variants — desktop, touch (Android etc), and iOS Safari.
   Selection uses pointer/hover media queries plus the `is-ios-safari`
   pre-paint UA class. The `.is-ios-safari` rules carry higher specificity
   than the media-query selectors, so they override on touch iOS Safari. */
.qr-instruction {
  font-size: 14px;
  font-weight: 500;
  color: #1A1A1A;
  line-height: 1.5;
  margin-bottom: 16px;
}
.qr-instruction strong { font-weight: 700; }

.qr-instruction--desktop,
.qr-instruction--touch,
.qr-instruction--ios-safari { display: none; }

@media (hover: hover) and (pointer: fine) {
  .qr-instruction--desktop { display: revert; }
}
@media (hover: none), (pointer: coarse) {
  .qr-instruction--touch { display: revert; }
}
html.is-ios-safari .qr-instruction--desktop,
html.is-ios-safari .qr-instruction--touch { display: none; }
html.is-ios-safari .qr-instruction--ios-safari { display: revert; }

.text-link { color: #1447E6; }

/* ── Save CTA in QR shell (M3) ─────────────────────────────────────── */
.save-cta {
  margin-top: 24px;
  width: 100%;
  display: block;
}

/* ── Claim form (M3 / S-21) ──────────────────────────────────────── */
.claim-shell {
  margin: 32px auto 0;
  max-width: 520px;
  padding: 0 4px;
}
.claim-shell h2 {
  font-size: clamp(20px, 3vw, 26px);
  margin-bottom: 8px;
  text-align: center;
}
.claim-shell > p.muted {
  font-size: 15px;
  text-align: center;
  margin-bottom: 18px;
}

#preview-claim-form label,
#claim-signin-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4B5563;
  margin: 16px 0 6px;
}
#preview-claim-form label:first-child,
#claim-signin-form label:first-child { margin-top: 0; }

#preview-claim-form input,
#claim-signin-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #D1D5DB;
  font-size: 15px;
  font-family: inherit;
  color: #1A1A1A;
  background: #FFFFFF;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#preview-claim-form input:focus,
#claim-signin-form input:focus {
  outline: none;
  border-color: #1447E6;
  box-shadow: 0 0 0 3px rgba(20, 71, 230, 0.18);
}

.form-error {
  font-size: 14px;
  color: #DC2626;
  margin-top: 12px;
  line-height: 1.5;
}
.form-error:not([hidden]) { display: block; }

.cta-primary {
  display: inline-block;
  margin-top: 18px;
  padding: 14px 22px;
  border-radius: 980px;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: #1447E6;
  color: #FFFFFF;
  text-decoration: none;
  width: 100%;
  text-align: center;
  transition: background 0.18s, transform 0.12s;
}
.cta-primary:hover { background: #0F3AC4; transform: translateY(-1px); text-decoration: none; }
.cta-primary:disabled {
  background: #93A4D6;
  cursor: not-allowed;
  transform: none;
}

#preview-claim-success p { font-size: 15px; line-height: 1.6; margin-top: 10px; }
#preview-claim-success .muted.small { margin-top: 14px; text-align: center; }

.signin-fallback {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #E5E7EB;
}
.signin-fallback h3 {
  font-size: 17px;
  margin-bottom: 8px;
}
#claim-signin-orphan-notice {
  margin-top: 14px;
  padding: 10px 12px;
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  border-radius: 10px;
  color: #78350F;
}

@media (pointer: coarse) and (hover: none) {
  #preview-active { max-width: 100%; }
}

/* ── Stock-images confirm dialog ────────────────────────────────────── */
/* iOS Safari ignores user-agent <dialog> centering for showModal(), so
   we pin it explicitly via fixed positioning + transform. */
.stock-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  border: none;
  border-radius: 16px;
  padding: 28px 28px 24px;
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  font-family: 'Outfit', sans-serif;
  color: #1A1A1A;
}
.stock-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.stock-dialog h3 {
  font-family: 'Petrona', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px;
  line-height: 1.25;
}
.stock-dialog p {
  margin: 0 0 20px;
  line-height: 1.5;
}
.stock-dialog-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.stock-dialog-actions .btn-primary,
.stock-dialog-actions .btn-secondary {
  flex: 1 1 auto;
  min-width: 140px;
}

/* ── Book-a-demo enquiry modal (mirror of landing #mv-modal) ────────── */
#mv-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#mv-modal[hidden] { display: none; }
#mv-modal .mv-modal-card {
  background: #FFFFFF;
  border-radius: 20px;
  max-width: 480px;
  width: 100%;
  padding: 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  font-family: 'Outfit', sans-serif;
  color: #1A1A1A;
}
.mv-modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: #6B7280;
  line-height: 0;
  z-index: 2;
}
#mv-modal h3 {
  font-family: 'Petrona', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: #1A1A1A;
  margin: 0 0 8px;
}
#mv-modal .mv-modal-body {
  font-size: 15px;
  color: #6B7280;
  margin: 0 0 20px;
  line-height: 1.5;
}
#mv-modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#mv-modal-form input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #E5E5E5;
  font-size: 15px;
  font-family: inherit;
  color: #1A1A1A;
}
#mv-modal-form input.mv-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
#mv-submit {
  margin-top: 4px;
  padding: 14px 20px;
  border-radius: 980px;
  border: none;
  background: #1447E6;
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
#mv-submit:hover { background: #0F3AC4; }
#mv-submit:disabled { opacity: 0.6; cursor: default; }
#mv-error {
  color: #B91C1C;
  font-size: 13px;
  margin: 4px 0 0;
}
#mv-success { text-align: center; padding: 12px 0; }
#mv-success .mv-success-title {
  font-size: 16px;
  color: #1A1A1A;
  font-weight: 600;
  margin: 0 0 6px;
}
#mv-success .mv-success-body {
  font-size: 14px;
  color: #6B7280;
  margin: 0;
}
