/* Order flow + after-payment page: the homepage design on paper.
   Load after tokens.css. Class names and ids are the ones order.js and
   the order-flow test rely on; restyle freely, rename never. */

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.04em; line-height: 1.1; }
em { font-style: italic; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #9a762d;
  outline-offset: 4px;
}

.eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 0.19em; text-transform: uppercase; line-height: 1.7; }
.flow-inner { max-width: 1000px; margin: 0 auto; }

/* ---------- Header ---------- */
.flow-header {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 24px 4.5%; border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--serif); font-size: 20px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; text-decoration: none; white-space: nowrap;
}
.wordmark-dot { color: var(--brass-deep); }
.flow-header-meta { display: flex; align-items: center; gap: 28px; font-size: 13px; color: var(--muted); }
.flow-header-meta span { display: inline-flex; align-items: center; gap: 8px; }
.flow-header-meta a { text-decoration: none; }
.flow-header-meta a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Band: step tracker + each step's title ---------- */
.flow-track { background: var(--band); padding: 36px 4.5% 0; }
.progress-bar { display: flex; gap: 6px; }
.progress-dot {
  flex: 1; display: flex; align-items: baseline; gap: 10px;
  border-top: 1px solid #17191826; padding-top: 12px; color: #8a8b82;
  transition: color 0.3s, border-color 0.3s;
}
.progress-num { font-family: var(--serif); font-size: 15px; min-width: 14px; }
.progress-label { font-size: 10px; font-weight: 600; letter-spacing: 0.19em; text-transform: uppercase; }
.progress-dot.completed { border-top-color: #8a6d2f88; color: var(--muted); }
.progress-dot.completed .progress-num { color: var(--brass-deep); }
.progress-dot.active { border-top: 2px solid var(--ink); padding-top: 11px; color: var(--ink); }
.progress-line { display: none; }

.step-band { background: var(--band); border-bottom: 1px solid var(--line); padding: 44px 4.5% 52px; }
.step-header .eyebrow { color: var(--brass-deep); }
.step-header h1, .step-header h2 { font-size: 56px; margin-top: 14px; }
.step-header h1 em, .step-header h2 em { color: var(--brass-deep); }
.step-header p { margin-top: 16px; color: #4f524c; font-size: 17px; max-width: 720px; }
.step-body { padding: 52px 4.5% 80px; }

/* Steps: only the active one shows. Its text rises in gently; the band
   colour stays put so it never seams against the step tracker. */
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.wizard-step.active .step-header, .success-page .step-header,
.wizard-step.active .step-body > .flow-inner, .success-page .step-body > .flow-inner { animation: flow-rise 0.6s var(--ease) both; }
.wizard-step.active .step-body > .flow-inner, .success-page .step-body > .flow-inner { animation-delay: 0.08s; }
@keyframes flow-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons (the homepage's) ---------- */
.btn {
  min-height: 54px; display: inline-flex; align-items: center; justify-content: space-between; gap: 28px;
  padding: 14px 25px; font: 500 15px/1.4 var(--sans); border: 1px solid transparent; border-radius: 0;
  text-decoration: none; cursor: pointer; transition: background 0.2s, color 0.2s, opacity 0.2s;
}
.btn-primary { background: var(--brass); color: #111413; }
.btn-primary:hover:not(:disabled) { background: #cfb77e; }
.btn-secondary { background: transparent; color: var(--ink); border-color: #8a8b82; }
.btn-secondary:hover:not(:disabled) { background: #eae6dc; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-lg { width: 100%; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--line); }
#step2 .wizard-nav { border-top: 0; padding-top: 0; } /* the last section's rule already closes the list */
.step-hint { margin-top: 12px; min-height: 1.6em; text-align: right; font-size: 13px; color: var(--muted); }

/* ---------- Step 1: plans + contact ---------- */
.tier-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.tier-cards.single-plan { grid-template-columns: minmax(0, 520px); justify-content: center; }
.tier-card {
  position: relative; background: var(--card); border: 1px solid var(--line); padding: 30px;
  cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s;
}
.tier-card:hover { border-color: #a9a69c; }
.tier-card.selected { border: 1.5px solid var(--ink); padding: 29.5px; box-shadow: 0 18px 40px -28px #17191866; }
.tier-card.selected::after {
  content: "Selected"; position: absolute; top: -1px; right: -1px; background: var(--ink); color: var(--paper);
  padding: 6px 12px; font-size: 10px; font-weight: 600; letter-spacing: 0.19em; text-transform: uppercase;
}
.tier-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tier-heading .eyebrow { color: var(--muted); }
.tier-heading h3 { font-size: 34px; margin-top: 10px; }
.price { font-family: var(--serif); font-size: 34px; line-height: 1.2; letter-spacing: -0.03em; white-space: nowrap; }
.price span { display: block; margin-top: 6px; font: 11px var(--sans); letter-spacing: 0; text-align: right; color: var(--muted); }
.tier-desc { margin-top: 18px; font-size: 14px; color: var(--muted); line-height: 1.7; }
.tier-details { list-style: none; padding: 0; margin-top: 16px; font-size: 13px; color: #4f524c; line-height: 2; }
.tier-details li::before { content: "—"; margin-right: 9px; color: #8d7950; }
.change-plan-link {
  display: block; margin: 18px auto 0; background: none; border: 0; padding: 4px; cursor: pointer;
  font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
.change-plan-link:hover { color: var(--ink); }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 36px; padding-top: 34px; border-top: 1px solid var(--line); }
.input-group label, .parsed-field label {
  display: block; margin-bottom: 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
}
.input-group input, .parsed-field input, .parsed-field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink);
  font: 16px/1.5 var(--sans); padding: 14px 16px; transition: border-color 0.2s;
}
.input-group input { height: 54px; }
.input-group input::placeholder { color: #9a9b93; }
.input-group input:focus, .parsed-field input:focus, .parsed-field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px #b69b6240; }
.input-group input.input-error { border-color: var(--error); box-shadow: 0 0 0 3px #9b2c2c22; }

/* ---------- Step 2: uploads, presenter, voice ---------- */
.upload-zone {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 22px; align-items: center;
  padding: 26px 0; border-bottom: 1px solid var(--line); cursor: pointer; position: relative;
}
.upload-zone.first { border-top: 1px solid var(--line); }
.upload-icon {
  width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid var(--line);
  background: var(--card); font-size: 22px; color: var(--ink);
}
.upload-text h3 { font-size: 24px; }
.upload-text p { margin-top: 2px; font-size: 14px; color: var(--muted); }
.upload-action { display: flex; justify-content: flex-end; }
.upload-cta { display: inline-flex; align-items: center; gap: 10px; border: 1px dashed #a9a69c; padding: 12px 18px; font-size: 14px; }
.upload-zone:hover .upload-cta { border-color: var(--ink); background: #fff; }
.file-name {
  display: none; align-items: center; gap: 10px; max-width: 320px; border: 1px solid var(--line); background: #fff;
  padding: 10px 14px; font-size: 14px; overflow-wrap: anywhere;
}
.file-name::before {
  content: ""; flex: none; width: 16px; height: 16px; background: var(--ok);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.upload-zone.has-file .upload-cta { display: none; }
.upload-zone.has-file .file-name { display: inline-flex; }
/* Hidden but reachable with Tab: keyboard users open the picker from it. */
.upload-zone input[type="file"] { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; }
.upload-zone:has(input[type="file"]:focus-visible) { outline: 3px solid #9a762d; outline-offset: 4px; }
.zone-error { grid-column: 1 / -1; color: var(--error); font-size: 14px; }

.presenter-section { display: none; padding: 28px 0; border-bottom: 1px solid var(--line); }
.presenter-section.visible { display: block; }
.presenter-section h3 { font-size: 24px; }
.presenter-section > p { margin-top: 4px; font-size: 14px; color: var(--muted); }
.avatar-grid { display: none; }
.avatar-grid.visible { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 22px; }
.avatar-card { background: var(--card); border: 1px solid var(--line); cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; }
.avatar-card:hover { border-color: #a9a69c; }
.avatar-card.selected { border: 1.5px solid var(--ink); box-shadow: 0 0 0 3px #b69b6255; }
.avatar-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.avatar-meta { padding: 12px 12px 14px; }
.avatar-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.avatar-fit { margin-top: 4px; font-size: 11px; line-height: 1.4; color: var(--muted); }
.avatar-category { display: inline-block; margin-top: 8px; font-size: 9px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass-deep); }
.avatar-loading { padding: 36px; text-align: center; color: var(--muted); font-size: 14px; }

.voice-section { display: grid; grid-template-columns: 56px 1fr; gap: 0 22px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.voice-section > .upload-icon { grid-row: span 4; }
.voice-section h3 { font-size: 24px; }
.voice-section > p { margin-top: 2px; font-size: 14px; color: var(--muted); }
.voice-options { display: inline-flex; flex-wrap: wrap; margin-top: 18px; border: 1px solid var(--line); justify-self: start; }
.voice-option { display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px; cursor: pointer; font-size: 14px; background: #fff; }
.voice-option + .voice-option { border-left: 1px solid var(--line); }
.voice-option:hover { background: #f1eee6; }
.voice-option.selected { background: var(--ink); color: var(--paper); }
.voice-option .opt-desc { display: none; }
.recorder-ui { display: none; margin-top: 18px; }
.recorder-ui.visible { display: block; }
.passage-label { display: flex; align-items: center; gap: 8px; color: var(--brass-deep); }
.passage-help { margin: 6px 0 12px; font-size: 14px; color: var(--muted); }
.passage {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--brass); padding: 22px 26px;
  font-family: var(--serif); font-size: 19px; line-height: 1.6; letter-spacing: -0.01em;
}
.passage-tip { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 13px; color: var(--muted); }
.passage-tip .i { color: var(--brass-deep); margin-top: 3px; }
.recorder-controls { display: flex; align-items: center; gap: 20px; margin-top: 22px; flex-wrap: wrap; }
.record-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--ink); cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 0 0 8px #b69b6233; transition: box-shadow 0.3s;
}
.record-btn .dot { width: 22px; height: 22px; border-radius: 50%; background: #c0392b; transition: border-radius 0.2s, width 0.2s, height 0.2s; }
.record-btn.recording .dot { width: 18px; height: 18px; border-radius: 3px; }
.record-btn.recording { animation: flow-pulse 1.6s ease-in-out infinite; }
@keyframes flow-pulse { 0%, 100% { box-shadow: 0 0 0 8px #b69b6233; } 50% { box-shadow: 0 0 0 14px #b69b6211; } }
.record-time { font-family: var(--serif); font-size: 32px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.record-status { font-size: 14px; color: var(--muted); }
.audio-playback { margin-top: 16px; }
.audio-playback audio { width: 100%; }
#uploadAudioUI .upload-zone { padding: 0; border: 0; grid-template-columns: 1fr auto; }

/* ---------- Step 3 + 4: review cards, fields, script ---------- */
.review-card { background: var(--card); border: 1px solid var(--line); padding: 28px 30px; margin-bottom: 20px; }
.review-card > h3 { font: 600 11px/1.7 var(--sans); letter-spacing: 0.19em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.parsed-resume > .review-card:first-child { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.parsed-resume > .review-card:first-child > h3 { grid-column: 1 / -1; }
.parsed-field { margin-bottom: 16px; }
.parsed-field textarea { min-height: 96px; resize: vertical; }
.experience-entry { display: grid; grid-template-columns: 1.2fr 1.2fr 0.8fr; gap: 0 20px; padding-top: 18px; margin-top: 4px; border-top: 1px solid var(--line); }
.experience-entry > .parsed-field:nth-child(4) { grid-column: 1 / -1; } /* the bullet points get the full width */
.experience-entry:first-of-type { border-top: 0; padding-top: 0; }
.script-note { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 20px; font-size: 14px; color: var(--muted); }
.script-note .i { color: var(--brass-deep); margin-top: 3px; }
#scriptEditor { min-height: 300px; font-size: 16.5px; line-height: 1.75; padding: 24px 28px; }
.script-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 4px; }
#scriptWordCount { font-size: 14px; color: var(--muted); }
.word-count-warn { color: #8a5a00 !important; font-weight: 600; }
#regenerateScriptBtn { min-height: 44px; padding: 10px 18px; }

/* ---------- Step 5: checkout ---------- */
.checkout-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 28px; align-items: start; }
.order-card .eyebrow, .total-card .eyebrow { color: var(--muted); }
.review-card > .order-plan { font: 400 28px/1.15 var(--serif); letter-spacing: -0.03em; text-transform: none; color: var(--ink); margin: 8px 0 14px; }
.review-field { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.review-field .label { color: var(--muted); }
.review-field .value { text-align: right; overflow-wrap: anywhere; }
.includes { list-style: none; padding: 0; margin-top: 22px; display: grid; gap: 10px; font-size: 15px; }
.includes li { display: flex; gap: 12px; align-items: center; }
.includes li::before {
  content: ""; flex: none; width: 17px; height: 17px; background: var(--brass);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.total-card { position: sticky; top: 20px; }
.total { font-family: var(--serif); font-size: 46px; letter-spacing: -0.03em; line-height: 1.2; }
.total-note, .checkout-trust { font-size: 13px; color: var(--muted); }
.total-card .btn-lg { margin-top: 22px; }
.checkout-trust { margin-top: 12px; }

/* ---------- Messages + loading ---------- */
.wizard-error {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px;
  background: #fbf1ef; border: 1px solid #e6c9c3; border-left: 3px solid var(--error); padding: 14px 16px; font-size: 15px;
}
.wizard-error-dismiss { flex: none; display: grid; place-items: center; width: 32px; height: 32px; background: none; border: 0; cursor: pointer; color: var(--muted); }
.wizard-error-dismiss:hover { color: var(--ink); }
.wizard-error .btn { min-height: 40px; padding: 8px 16px; }
.loading-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999; background: #f6f3ecf2;
  align-items: center; justify-content: center; flex-direction: column; gap: 18px; text-align: center; padding: 24px;
}
.loading-overlay.visible { display: flex; }
.spinner { width: 44px; height: 44px; border: 2px solid var(--line); border-top-color: var(--brass-deep); border-radius: 50%; animation: flow-spin 0.9s linear infinite; }
.avatar-loading .spinner { margin: 0 auto 12px; width: 32px; height: 32px; }
@keyframes flow-spin { to { transform: rotate(360deg); } }
.loading-text { font-family: var(--serif); font-size: 30px; letter-spacing: -0.03em; }
.loading-sub { font-size: 15px; color: var(--muted); }

/* ---------- After-payment page ---------- */
.done-mark { display: inline-grid; place-items: center; width: 58px; height: 58px; border: 1.5px solid var(--brass-deep); border-radius: 50%; color: var(--brass-deep); font-size: 26px; margin-bottom: 22px; }
.timeline { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.timeline li { border-top: 1px solid var(--line); padding: 22px 26px 0 0; }
.timeline .upload-icon { margin-bottom: 18px; }
.timeline .eyebrow { color: var(--brass-deep); }
.timeline h3 { font-size: 24px; }
.timeline p { margin-top: 4px; font-size: 15px; color: var(--muted); }
.next-title { font-family: var(--sans); color: var(--muted); margin-bottom: 20px; }
.success-note { margin-top: 44px; font-size: 14px; color: var(--muted); }
.success-note a { color: var(--ink); text-underline-offset: 3px; }

/* ---------- Terms + privacy ---------- */
.legal > * { max-width: 720px; } /* a readable line, aligned with the title above */
.legal h2 { font-size: 28px; margin: 44px 0 12px; }
.legal > :first-child { margin-top: 0; }
.legal p, .legal li { font-size: 16px; line-height: 1.75; color: #3d403b; }
.legal p + p, .legal p + ul, .legal ul + p { margin-top: 12px; }
.legal ul { padding-left: 1.25em; display: grid; gap: 8px; }
.legal li::marker { color: var(--brass-deep); }
.legal a { color: var(--ink); text-underline-offset: 3px; }
.legal strong { color: var(--ink); font-weight: 600; }

/* ---------- Phone ---------- */
@media (max-width: 720px) {
  .flow-header { padding: 18px 20px; }
  .wordmark { font-size: 16px; }
  .flow-header-meta .hide-sm { display: none; }
  .flow-track { padding: 26px 20px 0; }
  .progress-label { display: none; }
  .step-band { padding: 26px 20px 34px; }
  .step-header h1, .step-header h2 { font-size: 38px; }
  .legal h2 { font-size: 24px; }
  .timeline li { padding: 22px 0 28px; }
  .step-header p { font-size: 15px; }
  .step-body { padding: 32px 20px 56px; }
  .tier-cards, .input-row, .checkout-grid, .timeline { grid-template-columns: 1fr; }
  .tier-card { padding: 24px; }
  .tier-card.selected { padding: 23.5px; }
  .tier-heading h3 { font-size: 30px; }
  .upload-zone { grid-template-columns: 48px 1fr; }
  .upload-action { grid-column: 1 / -1; justify-content: flex-start; }
  .upload-icon { width: 48px; height: 48px; }
  .voice-section { grid-template-columns: 48px 1fr; gap: 0 16px; }
  .voice-section > .upload-icon { grid-row: span 2; }
  .voice-section > h3, .voice-section > p { grid-column: 2; }
  .voice-section > :not(.upload-icon):not(h3):not(p) { grid-column: 1 / -1; }
  .passage { font-size: 17px; padding: 18px 20px; }
  .avatar-grid.visible { grid-template-columns: repeat(2, 1fr); }
  .parsed-resume > .review-card:first-child, .experience-entry { grid-template-columns: 1fr; }
  .review-card { padding: 22px 20px; }
  .total-card { position: static; }
  .wizard-nav .btn { gap: 16px; padding: 14px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .wizard-step.active .step-header, .wizard-step.active .step-body > .flow-inner,
  .success-page .step-header, .success-page .step-body > .flow-inner,
  .record-btn.recording, .spinner { animation: none; }
  .btn, .tier-card, .avatar-card, .progress-dot { transition: none; }
}
