/* /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;
}

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: 'Petrona', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  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;
}
.qr-url-hint {
  margin-top: 16px;
  word-break: break-all;
}

/* ── iOS Safari long-press callout (ADR-007) ──────────────────────── */
.ios-safari-callout { display: none; }
html.is-ios-safari .ios-safari-callout {
  display: block;
  margin-top: 18px;
  padding: 14px 16px;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  border-radius: 14px;
  text-align: left;
}
html.is-ios-safari .ios-safari-callout p {
  font-size: 14px;
  color: #1E1B4B;
  line-height: 1.55;
  margin: 0;
}
html.is-ios-safari .ios-safari-callout strong { color: #1A1A1A; }

.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%; }
}
