/* Quality pass — responsive, accessible and resilient presentation layer. */

:root {
  --surface-glass: rgba(255, 255, 255, .82);
  --surface-blue: rgba(234, 244, 252, .78);
  --focus-ring: #ffd365;
}

body {
  background:
    radial-gradient(circle at 15% 0, rgba(143, 199, 232, .34), transparent 34%),
    linear-gradient(180deg, #e8f5fc 0%, #f8fcff 52%, #edf7fd 100%);
}

.shell {
  border: 1px solid rgba(255, 255, 255, .9);
  background:
    radial-gradient(circle at 100% 0, rgba(143, 199, 232, .18), transparent 30%),
    #fff;
}

.wizard-progress {
  gap: 7px;
  padding-top: 14px;
}

.wizard-progress span {
  height: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(18, 59, 113, .08);
}

.wizard-progress span.is-active {
  background: linear-gradient(90deg, var(--ana-blue), #55a3d4);
  box-shadow: 0 2px 8px rgba(29, 93, 166, .22);
}

.step-back {
  min-height: 38px;
  padding: 6px 10px;
  margin-inline-start: -10px;
  border-radius: 12px;
  font-weight: 750;
}

.step-back:hover { background: var(--ana-blue-pale); }

.step-title {
  justify-content: flex-start;
  margin-top: 14px;
  padding: 0;
  background: transparent;
  color: var(--ana-blue-deep);
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 950;
  line-height: 1.4;
  letter-spacing: -.025em;
}

.step-subtitle {
  max-width: 360px;
  margin-top: 4px;
  color: #58677c;
  font-size: 13px;
  font-weight: 560;
  line-height: 1.8;
}

.step-eyebrow {
  color: var(--ana-blue);
  font-weight: 850;
}

.field label {
  color: var(--ana-blue-deep);
  font-size: 13px;
  font-weight: 850;
}

.field input[type="text"] {
  min-height: 54px;
  border: 1px solid #cfdfed;
  border-radius: 16px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 6px 20px rgba(18, 59, 113, .06);
  font-size: 16px;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.field input[type="text"]:focus {
  border-color: var(--ana-blue-mid);
  box-shadow: 0 0 0 4px rgba(46, 117, 182, .12), 0 8px 24px rgba(18, 59, 113, .08);
  transform: translateY(-1px);
}

.btn {
  min-height: 50px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 900;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #1d66ad, #0f477f);
  box-shadow: 0 10px 24px rgba(18, 59, 113, .2);
}

.btn:not(:disabled):active { transform: translateY(1px) scale(.985); }

.recorder,
.playback-card,
.auto-mix-status,
.inline-consent,
.mix-note {
  border-color: rgba(143, 199, 232, .46);
  background: var(--surface-glass);
  box-shadow: 0 10px 30px rgba(18, 59, 113, .08);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.recorder-ring {
  box-shadow: 0 16px 36px rgba(18, 59, 113, .12);
}

.recorder-hint,
.rerecord-note,
.mix-note,
.inline-consent .privacy-note {
  font-size: 12px;
}

.suggestion-item {
  min-height: 34px;
  font-size: 12px;
  line-height: 1.55;
}

.checkbox-field label {
  cursor: pointer;
  text-wrap: pretty;
}

.review-actions {
  position: sticky;
  z-index: 12;
  bottom: -1px;
  margin: 12px -4px -8px;
  padding: 10px 4px max(8px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.96) 24%);
}

.loading-view {
  width: min(100%, 360px);
  margin: auto;
  padding: 28px 22px;
  border: 1px solid rgba(143, 199, 232, .4);
  border-radius: 28px;
  background: rgba(255, 255, 255, .8);
  box-shadow: 0 20px 55px rgba(18, 59, 113, .11);
}

.loading-view > p {
  color: #58677c;
  font-size: 13px;
  line-height: 1.8;
}

.final-success-copy p { text-wrap: pretty; }

.final-success-actions {
  margin-top: auto;
  padding-top: 14px;
}

.state-scene .state-text { max-width: 320px; font-size: 13px; line-height: 1.8; }

/* One stage contains the matching transparent render and live mesh.
   Absolute layers prevent the old two-child stacking bug on wizard steps. */
.product-model-slot--loading,
.product-model-slot--error { position: relative; }
.product-model-slot::before { content: none; }
.ana-product-stage {
  position: absolute;
  inset: 0;
  display: block;
  isolation: isolate;
  pointer-events: none;
}
.ana-product-stage .ana-product-poster,
.ana-product-stage model-viewer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  --poster-color: transparent;
  transition: opacity .28s ease;
}
.ana-product-stage .ana-product-poster {
  opacity: 1;
  filter: drop-shadow(0 7px 5px rgba(35,26,14,.25));
}
.ana-product-stage model-viewer { opacity: 0; }
.ana-product-stage[data-ready="true"] .ana-product-poster { opacity: 0; }
.ana-product-stage[data-ready="true"] model-viewer { opacity: 1; }
.ana-product-stage model-viewer::part(default-progress-bar) { display: none; }
.portrait-product-stage {
  inset: auto;
  z-index: 5;
  left: 32%;
  bottom: 22%;
  width: 36%;
  height: 21%;
}
.postcard-portrait:not(.is-product-reveal) .portrait-product-stage,
.creator-intro-card:not(.is-product-reveal) .product-model-slot--intro { opacity: 0; }
.postcard-portrait.is-in-view.is-product-reveal .portrait-product-stage,
.creator-intro-card.is-in-view.is-product-reveal .product-model-slot--intro {
  animation: creator-stage-rise .5s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes creator-stage-rise {
  from { opacity: 0; transform: translateY(12px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.scene-retry, .scene-continue {
  pointer-events: auto;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 14px;
  padding: 8px 16px;
  color: #123b71;
  background: #ffe4a0;
  font: inherit;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.scene-continue { display: none; background: #fff; }
.has-asset-error .scene-continue { display: block; }
.scene-retry[hidden] { display: none; }
.portrait-curtain:has(.scene-retry:not([hidden])) { gap: 9px; }
/* Long personal names remain inside the postcard. */
.portrait-from strong, .portrait-to span { overflow-wrap: anywhere; }
.auto-mix-copy b { white-space: nowrap; }
.btn:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #c28200; outline-offset: 3px; }
.creator-intro-copy > p { display: none; }
.creator-intro-card { container-type: inline-size; }
.creator-intro-copy > h1 { font-size: clamp(19px, 6cqw, 27px); }

@media (min-width: 760px) {
  .creator-intro-card { width: min(100%, 430px, calc(56.25dvh - 36px)); }
}

.portrait-play-label {
  width: min(108px, 27vw);
  font-size: 11px;
  line-height: 1.55;
  white-space: normal;
  text-wrap: balance;
}

.postcard-portrait .portrait-play {
  width: 74px;
  height: 74px;
  box-shadow: 0 0 0 7px rgba(255,255,255,.19), 0 16px 34px rgba(2,25,54,.4), inset 0 2px rgba(255,255,255,.85);
}

@media (max-width: 759px) {
  html,
  body,
  .page {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
  }

  .shell {
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
  }

  .wizard-step.is-active:not(.creator-intro-step) {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(29, 93, 166, .28) transparent;
    -webkit-overflow-scrolling: touch;
  }

  .wizard-step.is-active:not(.creator-intro-step)::after {
    content: "";
    display: block;
    flex: 0 0 max(8px, env(safe-area-inset-bottom));
  }

  .brand-wave { height: 24px; }

  .brand-footer {
    min-height: 34px;
    padding: 4px 12px max(6px, env(safe-area-inset-bottom));
  }

  .brand-footer img { height: 17px; }
}

@media (max-height: 700px) and (max-width: 759px) {
  .wizard-progress { padding-top: 8px; }
  .wizard-step.is-active:not(.creator-intro-step) { padding-top: 7px; }
  .step-back { min-height: 32px; margin-bottom: 0; padding-block: 3px; }
  .step-title { margin-top: 7px; font-size: 21px; }
  .step-subtitle { margin-top: 2px; font-size: 12px; line-height: 1.65; }
  .product-model-slot--compact { top: 34px; }
  .recorder { margin-top: 7px; }
  .inline-consent { margin-top: 10px; padding: 12px; }
  .review-actions { margin-top: 7px; }
  .loading-view { padding-block: 18px; }
}

@media (max-height: 590px) and (max-width: 759px) {
  .brand-wave { display: none; }
  .brand-footer { min-height: 28px; font-size: 10px; }
  .product-model-slot--compact { width: 52px; height: 44px; }
  .product-model-slot--compact + .step-title { padding-left: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .postcard-portrait *, .postcard-portrait *::before, .postcard-portrait *::after,
  .ana-product-stage *, .product-model-slot { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
/* The standalone preview scrolls normally, including short landscape screens. */
body:has(.preview-shell) { height: auto; overflow: auto; }

@media (orientation: landscape) and (max-height: 550px) {
  html, body, .page { height: auto; min-height: 100%; overflow: auto; }
  .shell { height: auto; max-height: none; min-height: calc(100dvh - 24px); }
  .page { padding: 12px; }
  .creator-intro-card { width: min(100%, 330px); }
  .creator-intro-copy > h1 { font-size: 21px; }
  .creator-intro-copy > span { display: none; }
  .wizard-step.is-active:not(.creator-intro-step) { max-height: calc(100dvh - 100px); overflow-y: auto; }
}

.postcard-portrait { container-type: inline-size; }
.portrait-from strong.is-long-name { font-size: clamp(14px, 4.5cqw, 18px); line-height: 1.5; }
.portrait-to .is-long-name { font-size: 14px; }

/* Keep the campaign reminder visible on small phones and landscape screens. */
.creator-intro-copy > span.creator-reminder {
  display: block;
  font-size: clamp(11px, 3.5cqw, 13px);
  line-height: 1.6;
  margin-top: 3px;
  color: #fff3d3;
}
.wizard-step[data-step="3"] .recording-prompts {
  flex: 0 0 auto;
  margin-top: 10px;
}
.wizard-step[data-step="3"] .suggestion-item {
  font-size: 11px;
  line-height: 1.6;
  padding: 6px;
}

/* A personal dedication, with an optional recipient rather than another task. */
.details-step .step-title { max-width: 360px; font-size: clamp(22px, 5.8vw, 27px); }
.details-step .step-subtitle { margin-bottom: 4px; }
.details-step #detailsForm { gap: 16px; margin-top: 18px; }
.details-step .field { margin-top: 0; }
.details-step .field label { display: flex; align-items: center; gap: 8px; }
.details-step .field-optional {
  padding: 2px 8px;
  border-radius: 20px;
  background: #e9f1f8;
  color: #4d6178;
  font-size: 10px;
  font-weight: 600;
}
.details-step .field-hint { margin: 7px 4px 0; color: #53647a; font-size: 11px; line-height: 1.8; }
.details-step .dedication-preview {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e6d9b8;
  border-radius: 20px;
  background: linear-gradient(120deg, #fffdf6, #fff8e9);
  box-shadow: 0 5px 16px rgba(98, 75, 30, .04);
}
.dedication-seal {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  height: 42px;
  border: 1px solid #dfc995;
  border-radius: 50%;
  color: #94631d;
  background: #fff7e1;
  font-family: sans-serif;
  font-size: 30px;
  line-height: 1;
}
.dedication-copy { min-width: 0; }
.dedication-caption { color: #756344; font-size: 10px; }
.dedication-copy p { margin: 4px 0 0; color: #294764; font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
.dedication-copy bdi { color: #173a60; font-weight: 850; }
.details-step #detailsForm > .step-spacer { min-height: 0; }
.details-step #detailsForm > .btn { flex: 0 0 auto; gap: 12px; }
@media (max-height: 700px) and (max-width: 759px) {
  .details-step .step-title { font-size: 21px; }
  .details-step #detailsForm { gap: 12px; margin-top: 12px; }
  .details-step .field input { min-height: 48px; padding-block: 10px; }
  .details-step .dedication-preview { padding: 12px; border-radius: 16px; }
}
