/* Guided first-book journey (docs/guided-onboarding-2026-11-06.md).
   A rose-gold thread runs through three real milestones. Motion only shows
   progress that already happened; it never delays the next action. */
[data-onboarding-step], [data-auth-journey], [data-email-journey], [data-app-journey] { width: 100%; min-width: 0; }
.onboarding-journey { --journey-progress: 0; position: relative; width: min(100%, 420px); margin: 0 auto 1.25rem; color: var(--text-secondary, #b7b7bc); font: var(--type-small); animation: journey-arrive .45s cubic-bezier(.2,.8,.2,1) both; }
.onboarding-journey ol { position: relative; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); list-style: none; padding: 0; margin: 0; }
.onboarding-journey li { display: grid; justify-items: center; gap: .35rem; min-width: 0; text-align: center; }
.journey-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; transition: color .4s ease; }
.journey-track { position: absolute; left: 16.667%; right: 16.667%; top: 12px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.1); }
.journey-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--journey-progress) * 100%); border-radius: inherit; background: linear-gradient(90deg,#b9776a,#efbda8 70%,#ffe3d4); box-shadow: 0 0 12px rgba(239,189,168,.55); transition: width .9s cubic-bezier(.65,0,.35,1) .1s; }
.journey-fill::after { content: ""; position: absolute; right: -3px; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: #fff3ea; box-shadow: 0 0 10px 3px rgba(255,214,190,.75); transform: translateY(-50%); opacity: 0; }
.onboarding-journey.is-advancing .journey-fill::after { animation: journey-spark 1.1s ease-out .1s; }
.journey-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid #5d5459; background: #19141a; color: #c9bec5; font-weight: 600; transition: background .35s, border-color .35s, color .35s, box-shadow .35s; }
.journey-dot svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 16; stroke-dashoffset: 0; }
.onboarding-journey .is-current { color: #f8e2d6; }
.is-current .journey-dot { background: #efbda8; border-color: #efbda8; color: #241b17; box-shadow: 0 0 0 5px rgba(239,189,168,.12); animation: journey-breathe 2.8s ease-in-out infinite; }
.is-complete .journey-dot { background: linear-gradient(140deg,#f4c9b4,#c98877); border-color: transparent; color: #241b17; }
.is-complete .journey-label { color: #e6cfc4; }
.is-fresh .journey-dot { animation: journey-pop .6s cubic-bezier(.3,1.6,.5,1) .55s both; }
.is-fresh .journey-dot svg { stroke-dashoffset: 16; animation: journey-check .45s ease-out .8s forwards; }
@keyframes journey-arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes journey-breathe { 0%,100% { box-shadow: 0 0 0 5px rgba(239,189,168,.12); } 50% { box-shadow: 0 0 0 8px rgba(239,189,168,.04); } }
@keyframes journey-pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
@keyframes journey-check { to { stroke-dashoffset: 0; } }
@keyframes journey-spark { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }

/* Only the live journey (the dialog or app step) morphs between pages. */
.landing-auth-modal[open] .onboarding-journey, [data-app-journey] .onboarding-journey { view-transition-name: iyb-journey; }

/* Fanned covers: the book people came for, in motion. */
.journey-books { position: relative; display: block; width: 168px; height: 128px; margin: 0 auto .4rem; pointer-events: none; }
.journey-books img { position: absolute; bottom: 0; left: 50%; width: 76px; height: auto; aspect-ratio: 2/3; border-radius: 4px 7px 7px 4px; object-fit: cover; box-shadow: 0 18px 30px -14px rgba(0,0,0,.85), inset 3px 0 0 rgba(255,255,255,.08); transform-origin: 50% 100%; animation: journey-fan .9s cubic-bezier(.2,.9,.25,1.15) both, journey-float 6s ease-in-out 1s infinite; }
.journey-books img:nth-child(1) { --fan: translateX(-112%) rotate(-12deg); animation-delay: .05s, 1.2s; }
.journey-books img:nth-child(2) { --fan: translateX(-50%) translateY(-10px) rotate(0deg); z-index: 1; width: 84px; animation-delay: .12s, 1s; }
.journey-books img:nth-child(3) { --fan: translateX(12%) rotate(12deg); animation-delay: .19s, 1.4s; }
@keyframes journey-fan { from { opacity: 0; transform: translateX(-50%) translateY(18px) rotate(0deg) scale(.9); } to { opacity: 1; transform: var(--fan); } }
@keyframes journey-float { 0%,100% { transform: var(--fan); } 50% { transform: var(--fan) translateY(-4px); } }

/* Two readable covers, with the same identity from the homepage to the trial.
   Keep titles still and apart; these are examples, not a generated customer book. */
.journey-books.cover-concept-pair { --pair-cover-width: 76px; }
.journey-books.cover-concept-pair img:nth-child(n) { width: var(--pair-cover-width); animation: none; opacity: 1; transform: var(--fan); }
.journey-books.cover-concept-pair > img:first-child,
.journey-books.cover-concept-pair > picture:first-child img { --fan: translateX(-108%) rotate(-4deg); }
.journey-books.cover-concept-pair > img:nth-child(2),
.journey-books.cover-concept-pair > picture:nth-child(2) img { --fan: translateX(8%) rotate(4deg); }
.landing-auth-modal .journey-books.cover-concept-pair { --pair-cover-width: 62px; }
.signup-trial-art.journey-books.cover-concept-pair { --pair-cover-width: 82px; }
@media (max-width:1099px) { .landing-page .hero-books.cover-concept-pair { --pair-cover-width: 96px; width: 220px; height: 150px; } }
@media (max-width:700px) { .signup-trial-art.journey-books.cover-concept-pair { --pair-cover-width: 66px; } }
@media (max-height:620px) { .signup-trial-art.journey-books.cover-concept-pair { --pair-cover-width: 48px; } }
@media (max-width:700px) and (max-height:620px) { .landing-page .hero-books.cover-concept-pair { --pair-cover-width: 58px; width: 136px; height: 92px; } }

/* Recovery nudge: one next action, in warm yellow. */
.onboarding-nudge { color: #ffe4a1; background: rgba(220,169,51,.08); border-left: 3px solid #dca953; border-radius: 8px; padding: .75rem 1rem; font: var(--type-small); }
.onboarding-nudge[hidden], [data-app-journey][hidden] { display: none; }
.journey-resume { max-width: 680px; margin: 1rem auto; display: flex; align-items: center; gap: 1rem; justify-content: space-between; }
.journey-resume a { color: #ffe4a1; white-space: nowrap; font-weight: 600; }
.journey-resume a::after { content: " \2192"; }

/* Signup dialog: covers, one promise, one field. */
.landing-page [data-journey-preview] { margin-top: 1.1rem; }
.landing-page [data-journey-preview] .onboarding-journey { margin-bottom: 0; opacity: .9; }
.landing-auth-modal .journey-books { height: 104px; width: 150px; margin-bottom: .2rem; }
.landing-auth-modal .journey-books img { width: 62px; }
.landing-auth-modal .journey-books img:nth-child(2) { width: 70px; }
.landing-auth-head [data-auth-journey] { margin-bottom: .9rem; }
.landing-auth-modal.is-account-ready #landingAuthHeading, .landing-auth-modal.is-account-ready .journey-books, .journey-books[hidden] { display: none; }
.landing-auth-form .btn, .signup-card .btn { font-weight: 700; }
.landing-auth-modal.is-signup-success .landing-auth-head { display: none; }
.landing-auth-modal .form-field-stack[hidden], .landing-auth-modal [data-auth-journey][hidden] { display: none; }
.email-typo-hint { margin: .45rem 0 0; color: #ffe4a1; font: var(--type-small); text-align: left; }
.email-typo-hint[hidden] { display: none; }
.email-typo-hint button { background: none; border: 0; padding: 0; color: #efbda8; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.journey-handoff { display: grid; gap: .9rem; justify-items: center; text-align: center; padding: .5rem 0 1rem; animation: journey-arrive .35s ease-out both; }
.journey-handoff h2 { font: var(--type-title); margin: 0; }
.journey-handoff p { margin: 0; color: var(--text-secondary); font: var(--type-small); }
.journey-handoff-bar { width: min(100%, 220px); height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.journey-handoff-bar span { display: block; height: 100%; width: 40%; border-radius: inherit; background: linear-gradient(90deg,transparent,#efbda8,transparent); animation: journey-handoff 1.1s ease-in-out infinite; }
@keyframes journey-handoff { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.email-signup-wait { text-align: center; display: grid; gap: .8rem; animation: journey-arrive .3s ease-out; }
.email-signup-wait h2 { font: var(--type-title); margin: 0; }
.email-signup-wait p { margin: 0; overflow-wrap: anywhere; }
.email-signup-wait small { color: var(--text-secondary); font: var(--type-small); }
.email-signup-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }
.email-signup-actions button { background: none; border: 0; color: #efbda8; font: var(--type-small); cursor: pointer; min-height: 44px; }
.email-signup-actions button:disabled { opacity: .5; cursor: default; }
.email-signup-wait .status:empty { display: none; }
#signupForm[hidden], #emailSignupPending[hidden] { display: none; }

/* App: the free-trial step and the first book. */
.signup-trial-art.journey-books { width: 196px; height: 138px; margin: 0 auto 4px; }
.signup-trial-art.journey-books img { top: auto; right: auto; bottom: 0; left: 50%; width: 82px; height: auto; }
.signup-trial-art.journey-books img:nth-child(2) { width: 92px; }
@media (max-width:700px) { .signup-trial-art.journey-books { width: 164px; height: 112px; } .signup-trial-art.journey-books img { width: 66px; } .signup-trial-art.journey-books img:nth-child(2) { width: 74px; } }
@media (max-height:620px) { .signup-trial-art.journey-books { width: 120px; height: 82px; } .signup-trial-art.journey-books img { width: 48px; } .signup-trial-art.journey-books img:nth-child(2) { width: 54px; } }
.app-signup-trial [data-app-journey] { margin-top: .75rem; }
/* Pretrial accounts have no billing to manage. The verified trial's focused
   writer keeps Account and its cancellation controls available. */
.app-signup-trial #accountDashboard { display: none; }
.app-signup-trial .app-shell { min-height: 100svh; }
.app-first-book-start #generatorForm, .signup-trial-entry { animation: journey-arrive .45s cubic-bezier(.2,.8,.2,1) both; }
.signup-trial-entry #signupTrialStatus:not(:empty) { color: #ffe4a1; background: rgba(220,169,51,.08); border-left: 3px solid #dca953; border-radius: 8px; padding: .65rem .8rem; }
.signup-trial-entry .signup-trial-assurance { color: var(--text-secondary); font: var(--type-small); margin: 0; }
.signup-trial-entry #signupTrialRefresh { min-height: 44px; }
.app-signup-trial .account-dashboard-head-balance { display: none; }
.billing-action-note { color: var(--text-secondary); font: var(--type-small); }
.journey-celebrate { position: relative; }
.journey-celebrate::before { content: ""; position: absolute; inset: -12px; border-radius: 24px; pointer-events: none; background: radial-gradient(60% 50% at 50% 0%, rgba(239,189,168,.22), transparent 70%); animation: journey-glow 1.8s ease-out both; }
@keyframes journey-glow { from { opacity: 0; transform: scale(.96); } 30% { opacity: 1; } to { opacity: 0; transform: scale(1.02); } }
/* On phones the help button shrinks to its avatar during the journey, so it
   never sits on top of a step's one action. Its accessible name stays. */
@media (max-width:700px) {
  body:is(.app-signup-trial, .app-first-book-start) .companion-launcher { padding: 4px; min-height: 0; }
  body:is(.app-signup-trial, .app-first-book-start) .companion-launcher > span:not([data-avatar]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* The pretrial footer float can cover renewal terms on short phones. Use the
     free header slot beside the centered logo, keeping help available. */
  body.app-signup-trial .author-companion:has(.companion-panel[hidden]) { top: 6px; left: 16px; right: auto; bottom: auto; }
  body:is(.app-signup-trial, .app-first-book-start) main { padding-bottom: 72px; }
}

/* Checkout loading screen: the seconds before Lemon's form appears. */
.checkout-loader { position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; padding: 16px; background: rgba(8,6,9,.74); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s ease; }
.checkout-loader.is-visible { opacity: 1; }
.checkout-loader-card { width: min(100%, 360px); padding: 28px 24px 24px; border: 1px solid rgba(224,174,155,.18); border-radius: 22px; background: linear-gradient(180deg,#1f191c,#140e11); box-shadow: 0 28px 70px rgba(0,0,0,.5); display: grid; gap: 10px; justify-items: center; text-align: center; color: var(--text-primary, #f3f3f3); }
.checkout-loader-card strong { font: var(--type-title); }
.checkout-loader-card p { margin: 0; min-height: 1.6em; font: var(--type-body); color: #f4ddd1; }
.checkout-loader-card small { font: var(--type-small); color: var(--text-secondary, #b7b7bc); }
.checkout-loader-bar { width: 100%; height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.checkout-loader-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#b9776a,#efbda8); transition: width 9s cubic-bezier(.1,.6,.3,1); }
.checkout-loader.is-visible .checkout-loader-bar span { width: 92%; }
.checkout-loader-book { position: relative; width: 72px; height: 48px; margin-bottom: 6px; perspective: 320px; }
.checkout-loader-book::before { content: ""; position: absolute; inset: 6px 0 0; border-radius: 4px; background: linear-gradient(90deg,#efbda8 0 49%,#9b5f52 49% 51%,#efbda8 51%); opacity: .3; }
.checkout-loader-book span { position: absolute; top: 6px; left: 50%; width: 46%; height: 40px; border-radius: 0 4px 4px 0; background: linear-gradient(90deg,#f8e9e0,#efbda8); transform-origin: left center; animation: checkout-page 1.9s ease-in-out infinite; }
.checkout-loader-book span:nth-child(2) { animation-delay: .32s; }
.checkout-loader-book span:nth-child(3) { animation-delay: .64s; }
@keyframes checkout-page { 0% { transform: rotateY(0); } 45%, 100% { transform: rotateY(-180deg); } }
@media (prefers-reduced-motion: reduce) { .checkout-loader, .checkout-loader-bar span { transition: none; } .checkout-loader-book span { animation: none; } .checkout-loader.is-visible .checkout-loader-bar span { width: 60%; } }

/* Admin report */
.onboarding-metric-bar { display: block; height: 4px; border-radius: 4px; background: #d59d8b; margin-top: .4rem; }
.admin-report-controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.admin-report-controls label { display: grid; gap: .25rem; min-width: 0; }
.admin-report-controls select { font-size: 16px; max-width: 100%; }
#onboardingReportSection, #onboardingReportBody { min-width: 0; max-width: 100%; }
#onboardingReportSection .admin-chart-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
#onboardingReportSection .admin-overview-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%,220px),1fr)); }
#onboardingReportSection .admin-metric-card { min-width: 0; overflow-wrap: anywhere; }
.onboarding-funnel { display: grid; gap: .55rem; margin: 1rem 0 1.25rem; padding: 0; list-style: none; }
.onboarding-funnel li { display: grid; grid-template-columns: minmax(0,11rem) minmax(0,1fr) minmax(0,7.5rem); gap: .75rem; align-items: center; }
.onboarding-funnel .funnel-name { font-weight: 600; overflow-wrap: anywhere; }
.onboarding-funnel .funnel-bar { position: relative; height: 26px; border-radius: 6px; background: rgba(255,255,255,.05); overflow: hidden; }
.onboarding-funnel .funnel-bar span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg,#b9776a,#efbda8); }
.onboarding-funnel .funnel-bar b { position: relative; z-index: 1; display: block; padding: 0 .55rem; line-height: 26px; color: #fff; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.onboarding-funnel .funnel-rate { font: var(--type-small); color: var(--text-secondary); }
.onboarding-funnel li.is-leak .funnel-rate { color: #ffcf7a; font-weight: 600; }
.onboarding-funnel li.is-leak .funnel-bar span { background: linear-gradient(90deg,#9c5f2c,#dca953); }
.onboarding-funnel-title { margin: 1.25rem 0 0; font: var(--type-title); }
@media (max-width:600px) { .onboarding-funnel li { grid-template-columns: minmax(0,1fr) minmax(0,5.5rem); } .onboarding-funnel .funnel-bar { grid-column: 1 / -1; grid-row: 2; } }

@media (max-width:700px) {
  .onboarding-journey { margin-bottom: .9rem; }
  .app-signup-trial .signup-trial-entry { padding-top: .4rem; }
  .journey-resume { margin: .75rem; }
}
@media (max-width:360px) { .onboarding-journey { font-size: .74rem; } .journey-dot { width: 24px; height: 24px; } .journey-track { top: 11px; } }
@media (max-width:360px) and (max-height:700px) {
 .landing-page .onboarding-journey { margin-bottom: .25rem; }
 body.landing-page.landing-prompt-first .hero-risk-reversal { margin-top: 12px; }
}
@media (prefers-reduced-motion:reduce) {
  .onboarding-journey, .journey-fill, .journey-dot, .journey-label, .journey-books img, .email-signup-wait, .signup-trial-entry, .app-first-book-start #generatorForm, .journey-handoff, .journey-celebrate::before, .journey-handoff-bar span { animation: none !important; transition: none !important; }
  .is-fresh .journey-dot svg { stroke-dashoffset: 0; }
  .journey-books img { transform: var(--fan); opacity: 1; }
}
