/* The landing page's hero animation (hero.js), played by the visitor: a customer types a PO email and attaches the PDF,
   they click Send, Casma reads it line by line, they answer one price question, the answer is remembered for that
   customer, and a draft estimate waits in QuickBooks Online. Plain CSS and JS, no library. */
.hero-anim { --bg:#f7f6f2; --card:#ffffff; --soft:#f1efe9; --line:#e7e5e0; --line-strong:#d6d3cd; --ink:#1c1917;
  --ink-2:#44403c; --muted:#57534e; --accent:#0f766e; --accent-ink:#0f5f58; --accent-soft:#e3f0ee;
  --warn-bg:#fef3c7; --warn:#92400e; --ok-bg:#dcfce7; --ok:#15803d;
  flex: 1 1 440px; min-width: 0; font-family: 'IBM Plex Sans', system-ui, sans-serif; color: var(--ink); }
.hero-anim * { box-sizing: border-box; }
.ha-card { background: var(--card); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.04);
  padding: 24px; position: relative; overflow: hidden; }
.ha-view { position: relative; width: 100%; height: 420px; }
.ha-scene { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; opacity: 0; visibility: hidden;
  transform: translateY(8px); transition: opacity .35s, transform .35s, visibility 0s .35s; }
.ha-scene.on { opacity: 1; visibility: visible; transform: none; transition: opacity .35s, transform .35s; }
.ha-mono { font-family: 'IBM Plex Mono', monospace; }
.ha-btn { font: inherit; font-size: 14px; font-weight: 600; border: 0; border-radius: 8px; padding: 10px 18px; background: var(--accent); color: #fff;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; }
.ha-btn:disabled { opacity: .4; cursor: not-allowed; }
.ha-btn:not(:disabled):hover { background: var(--accent-ink); }
.ha-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ha-tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.ha-tag.found { background: var(--ok-bg); color: var(--ok); }
.ha-tag.check { background: var(--warn-bg); color: var(--warn); }
.ha-tag.read { background: var(--accent-soft); color: var(--accent-ink); }
.ha-pop { animation: ha-pop .18s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes ha-pop { from { opacity: 0; transform: scale(.85) translateY(6px); } to { opacity: 1; transform: none; } }

/* 1: the customer writes the email, attaches the PO and sends it */
.ha-mail { border: 1px solid var(--line-strong); border-radius: 12px; display: flex; flex-direction: column; height: 100%; }
.ha-field { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; min-width: 0; }
.ha-field > span:first-child { color: var(--muted); width: 56px; flex: none; }
.ha-body { flex: 1; padding: 14px 16px; font-size: 14px; line-height: 1.6; color: var(--ink-2); white-space: pre-wrap; }
.ha-caret { display: inline-block; width: 2px; height: 1em; background: var(--accent); vertical-align: -2px; animation: ha-blink 1s steps(1) infinite; }
@keyframes ha-blink { 50% { opacity: 0; } }
.ha-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); min-height: 62px; }
.ha-att { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.ha-att b { display: block; font-weight: 600; }
.ha-att small { color: var(--muted); }
.ha-att-icon { width: 24px; height: 28px; border-radius: 4px; color: #fff; font-size: 9px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; background: #b91c1c; flex: none; }
.ha-send { margin-left: auto; align-self: center; }

/* 2: Casma reads it, line by line */
.ha-doc { border: 1px solid var(--line-strong); border-radius: 12px; padding: 18px; position: relative; overflow: hidden; }
.ha-laser { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent); opacity: 0; }
.ha-scene.on .ha-laser { animation: ha-scan 2.6s ease-in-out .2s 1 both; }
@keyframes ha-scan { 0% { top: 0; opacity: 1; } 90% { top: 100%; opacity: 1; } 100% { top: 100%; opacity: 0; } }
.ha-doc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 10px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line); }
.ha-doc-head b { font-size: 15px; }
.ha-src { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 6px; }
.ha-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--soft);
  border-radius: 8px; border: 1px solid transparent; opacity: 0; transform: translateX(-8px);
  transition: opacity .3s, transform .3s, border-color .3s, background .3s; }
.ha-row.in { opacity: 1; transform: none; }
.ha-row.warn { border-color: #f5d48a; background: #fffbeb; }
.ha-row-text { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: var(--ink-2); }
.ha-row .ha-tag { opacity: 0; transition: opacity .3s; }
.ha-row.done .ha-tag { opacity: 1; }

/* 3: the visitor answers the question */
.ha-review { border: 1.5px solid var(--accent); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; }
.ha-review-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.ha-review-head b { font-size: 13px; }
.ha-needs { background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 12px; white-space: nowrap; }
.ha-strip { background: var(--soft); border-radius: 8px; padding: 10px 14px; display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 4px 12px; margin-bottom: 14px; font-size: 12.5px; }
.ha-strip span:last-child { color: var(--muted); }
.ha-q { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.ha-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.ha-opt { font: inherit; color: inherit; text-align: left; border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 12px; background: var(--card);
  cursor: pointer; position: relative; transition: border-color .2s, background .2s; }
.ha-opt:hover { border-color: var(--accent); }
.ha-opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.ha-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ha-opt-title { font-size: 12px; color: var(--muted); font-weight: 600; }
.ha-opt-val { font-size: 20px; font-weight: 700; margin-top: 2px; }
.ha-opt-val small { font-size: 12px; font-weight: 500; color: var(--muted); }
.ha-opt-check { position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff;
  display: none; place-items: center; }
.ha-opt.sel .ha-opt-check { display: grid; }

/* 4: the answer is remembered for that customer */
.ha-mem { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.ha-mem-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.ha-scene.on .ha-mem-icon { animation: ha-pop .5s cubic-bezier(.2,.9,.3,1.4) both; }
.ha-mem-title { font-size: 18px; font-weight: 700; }
.ha-mem-sub { font-size: 14px; color: var(--muted); max-width: 340px; line-height: 1.5; }
.ha-rule { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; border: 1px dashed var(--accent);
  background: var(--accent-soft); color: var(--accent-ink); border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 500; opacity: 0; }
.ha-scene.on .ha-rule { animation: ha-drop .6s cubic-bezier(.2,.9,.3,1.2) .5s both; }
@keyframes ha-drop { from { opacity: 0; transform: translateY(-14px) scale(.95); } to { opacity: 1; transform: none; } }

/* 5: the draft estimate in QuickBooks Online (a plain, generic look) */
.ha-qbo { border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; font-size: 13px; display: flex; flex-direction: column; }
.ha-qbo-bar { display: flex; align-items: center; gap: 10px; background: #2b2f33; color: #fff; padding: 9px 14px; font-size: 12px; }
.ha-qbo-bar b { font-size: 13px; }
.ha-qbo-dots { display: flex; gap: 5px; }
.ha-qbo-dots i { width: 8px; height: 8px; border-radius: 50%; background: #5b6167; }
.ha-qbo-main { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.ha-qbo-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ha-qbo-title { font-size: 18px; font-weight: 700; }
.ha-status { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 4px; background: #e8eaed; color: #3c4043; }
.ha-qbo-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.ha-qbo-meta span { display: block; font-size: 11px; color: var(--muted); }
.ha-qbo table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ha-qbo th { font-size: 11px; color: var(--muted); font-weight: 600; text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line-strong); }
.ha-qbo td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.ha-qbo .r { text-align: right; }
.ha-qbo tr.new td { animation: ha-flash 1.4s ease .3s; }
@keyframes ha-flash { 0%, 100% { background: transparent; } 30% { background: var(--accent-soft); } }
.ha-qbo-total { display: flex; justify-content: flex-end; gap: 16px; font-size: 15px; font-weight: 700; }
.ha-qbo-note { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 6px; padding: 8px 10px; }

.ha-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line); min-height: 48px; }
.ha-dots { display: flex; gap: 6px; flex: none; }
.ha-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); transition: background .3s, width .3s; }
.ha-dot.on { background: var(--accent); width: 20px; border-radius: 4px; }
.ha-hint { font-size: 13px; color: var(--muted); }
.ha-replay { background: var(--soft); color: var(--ink-2); border: 1px solid var(--line); min-height: 32px; padding: 0 12px; border-radius: 6px; font: inherit;
  font-size: 12px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.ha-replay:hover { background: var(--line); }
.ha-replay[hidden] { display: none; }
.ha-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }

@media (max-width: 480px) {
  .ha-card { padding: 16px; }
  .ha-view { height: 470px; }
  .ha-opts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-anim *, .hero-anim *::before, .hero-anim *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
