/* LintelWorks hero animation: "Under the beam".
   The beam never moves. Work moves beneath it. All classes are hx- prefixed.
   Layout switches on the width of the slot (container query), not the viewport. */

/* reserve the footprint before the script mounts (wide: 420px, stacked: 522px) */
[data-anim="hero"] { min-height: 420px; }
@media (max-width: 499.98px) { [data-anim="hero"] { min-height: 522px; } }

.hx {
  container: hx / inline-size;
  position: relative;
  width: 100%;
  max-width: 640px;
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
}
.hx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the structure: one beam, two posts, the ground ---------- */
.hx-stage {
  --n: 0;            /* how many pieces of work have passed under the beam */
  --rh: 48px;        /* row height */
  --down: 170px;     /* how far the phone sits below its raised position */
  position: relative;
  height: 376px;
  overflow: hidden;
}
.hx-beam { position: absolute; z-index: 4; left: 0; right: 0; top: 0; height: 16px; background: var(--beam); border-radius: 1px; }
.hx-post { position: absolute; z-index: 3; top: 16px; bottom: 0; width: 8px; background: var(--beam); }
.hx-post-l { left: 72px; }
.hx-post-r { right: 8px; }
.hx-ground { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; height: 2px; background: var(--beam); }
.hx-open { position: absolute; z-index: 1; left: 80px; right: 16px; top: 16px; bottom: 2px; background: var(--surface); overflow: hidden; }

/* ---------- work: three line shapes that travel ---------- */
.hx-item {
  --x: -44px;
  --y: calc(36px + var(--i) * var(--rh));
  position: absolute; z-index: 2; left: 0; top: 0; width: 32px; height: 32px;
  opacity: 0;
  transform: translate(var(--x), var(--y));
  transition: transform 400ms var(--ease), opacity 240ms var(--ease);
}
.hx-item[data-s="q"] { --x: 20px; opacity: 1; }
.hx-item[data-s="in"] { --x: 100px; opacity: 1; }
.hx-item svg, .hx-badge svg, .hx-ctl svg, .hx-a2 svg, .hx-n2 svg {
  display: block; width: 100%; height: 100%; max-width: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.hx-item svg { color: var(--ink); }
.hx-item .hx-fill { fill: var(--surface); }

/* ---------- the list that comes out the other side ---------- */
.hx-rows { position: absolute; left: 12px; right: 12px; top: 12px; }
.hx-row {
  --slot: var(--i);
  position: absolute; left: 0; right: 0; top: 0; height: var(--rh);
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px 0 52px;
  border-bottom: 1px solid var(--line);
  transform: translateY(calc(var(--slot) * var(--rh)));
  clip-path: inset(0 100% 0 0);
  transition: transform 400ms var(--ease), clip-path 400ms var(--ease), background-color 240ms var(--ease);
}
.hx-row[data-s="show"], .hx-row[data-s="go"], .hx-row[data-s="ask"] { clip-path: inset(0 0 0 0); }
.hx-row[data-s="ask"] { background-color: var(--ask-tint); }
.hx-row[data-s="go"].hx-row-yours { background-color: var(--go-tint); }
.hx-t { flex: 1; min-width: 0; display: grid; gap: 1px; }
.hx-t1 { font: 600 14px/18px var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-t2 { font: 400 13px/17px var(--font-body); color: var(--ink-2); display: flex; align-items: baseline; gap: 8px; white-space: nowrap; transition: color 240ms var(--ease); }
.hx-fig { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--ink); }
.hx-st { padding-left: 8px; border-left: 1px solid var(--line); }
.hx-row[data-s="ask"] .hx-st { color: var(--ask-ink); font-weight: 600; border-left-color: var(--ask); }
.hx-row[data-s="go"] .hx-st { color: var(--go); font-weight: 600; }

.hx-badge {
  position: relative; flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--go); color: #fff;
  opacity: 0; transform: scale(0.7);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease), background-color 240ms var(--ease), color 240ms var(--ease);
}
.hx-badge svg { position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; stroke-width: 2.2; transition: opacity 150ms var(--ease); }
.hx-row[data-s="go"] .hx-badge, .hx-row[data-s="ask"] .hx-badge { opacity: 1; transform: none; }
.hx-row[data-s="ask"] .hx-badge { background: var(--ask); color: var(--ink); }
.hx-hand { opacity: 0; stroke-width: 1.8 !important; }
.hx-row[data-s="ask"] .hx-hand { opacity: 1; }
.hx-tick path { stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset 240ms var(--ease) 80ms; }
.hx-row[data-s="go"] .hx-tick path, .hx-approve[data-s="done"] .hx-tick path, .hx-note[data-s="sent"] .hx-tick path { stroke-dashoffset: 0; }

/* ---------- the phone and its one approval card ---------- */
.hx-phone {
  position: absolute; left: 50%; top: 166px; width: 256px; height: 280px; margin-left: -128px;
  padding: 16px 8px 0;
  background: var(--surface);
  border: 2px solid var(--ink); border-bottom: 0; border-radius: 22px 22px 0 0;
  transform: translateY(var(--down));   /* at rest the top of the phone waits at the ground line */
  transition: transform 400ms var(--ease);
}
.hx-phone::before { content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
.hx-phone[data-s="up"] { transform: none; }
.hx-clearing .hx-phone[data-s="up"] { transform: translateY(var(--down)); }
.hx-card {
  display: grid; gap: 0;
  padding: 9px 12px 8px;
  background: var(--ask-tint);
  border-top: 5px solid var(--ask); border-radius: 1px 1px 4px 4px;
  visibility: hidden; transition: visibility 0s linear 400ms;
}
.hx-phone[data-s="up"] .hx-card { visibility: visible; transition-delay: 0s; }
.hx-q { font: 600 14px/19px var(--font-body); color: var(--ink); margin: 0; }
.hx-amt { font: 500 22px/28px var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--ink); margin: 2px 0 8px; }
.hx-approve {
  position: relative; display: grid; place-items: center;
  width: 100%; min-height: 48px; margin: 0; padding: 0 16px;
  font: 600 16px/1.2 var(--font-body); color: var(--ink);
  background: var(--ask); border: 1px solid var(--ask); border-radius: var(--radius);
  cursor: pointer; touch-action: manipulation;
  -webkit-appearance: none; appearance: none;
  transition: transform 150ms var(--ease), background-color 240ms var(--ease), border-color 150ms var(--ease), color 240ms var(--ease), box-shadow 150ms var(--ease);
}
.hx-approve:hover { border-color: var(--ask-ink); }
.hx-approve:focus-visible { outline: 3px solid var(--beam); outline-offset: 2px; }
.hx-approve:active, .hx-approve[data-s="press"] { transform: translateY(1px) scale(0.985); box-shadow: inset 0 0 0 99px rgba(22, 32, 27, 0.1); }
.hx-approve[data-s="done"] { background: var(--go); border-color: var(--go); color: #fff; cursor: default; transform: none; box-shadow: none; }
.hx-a1, .hx-a2 { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 8px; transition: opacity 150ms var(--ease); }
.hx-a2 { opacity: 0; }
.hx-a2 svg { width: 20px; height: 20px; stroke-width: 2.2; }
.hx-approve[data-s="done"] .hx-a1 { opacity: 0; }
.hx-approve[data-s="done"] .hx-a2 { opacity: 1; }

/* the touch ring that presses the button when the visitor does not */
.hx-ring {
  position: absolute; left: 82%; top: 54%; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border: 2px solid var(--ink); border-radius: 50%;
  background: rgba(22, 32, 27, 0.1);
  opacity: 0; transform: scale(1.45); pointer-events: none;
  transition: transform 240ms var(--ease), opacity 240ms var(--ease);
}
.hx-ring[data-s="on"] { opacity: 1; transform: scale(1); }
.hx-ring[data-s="press"] { opacity: 1; transform: scale(0.8); transition-duration: 150ms; }

.hx-note { display: grid; margin: 6px 0 0; font: 400 13px/18px var(--font-body); }
.hx-n1, .hx-n2 { grid-area: 1 / 1; white-space: nowrap; transition: opacity 240ms var(--ease); }
.hx-n1 { color: var(--ask-ink); }
.hx-n2 { display: inline-flex; align-items: center; gap: 6px; color: var(--go); font-weight: 600; opacity: 0; }
.hx-n2 svg { width: 16px; height: 16px; stroke-width: 2.2; flex: none; }
.hx-note[data-s="sent"] .hx-n1 { opacity: 0; }
.hx-note[data-s="sent"] .hx-n2 { opacity: 1; }

/* ---------- control bar: example marker, pause/play, replay ---------- */
.hx-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 44px; }
.hx-tag { font: 600 13px/1.3 var(--font-body); color: var(--ink-2); border: 1px dashed var(--ink-2); border-radius: 4px; padding: 2px 8px; }
.hx-ctls { display: flex; gap: 4px; margin-right: -10px; }
.hx-ctl {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; margin: 0; padding: 0 10px;
  font: 600 14px/1 var(--font-body); color: var(--ink-2);
  background: none; border: 0; border-radius: 4px; cursor: pointer; touch-action: manipulation;
  -webkit-appearance: none; appearance: none;
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}
.hx-ctl:hover { color: var(--ink); background-color: rgba(24, 55, 44, 0.07); }
.hx-ctl svg { width: 18px; height: 18px; flex: none; }
.hx-ctl[hidden] { display: none; }
.hx-static .hx-ctls { display: none; }

/* ---------- loop housekeeping ---------- */
.hx-clearing .hx-item, .hx-clearing .hx-row { opacity: 0; transition: opacity 240ms var(--ease); }
.hx-snap *, .hx-static * { transition: none !important; }

/* ---------- stacked layout: work drops down under the beam ---------- */
@container hx (max-width: 459.98px) {
  .hx-stage { --rh: 56px; --down: 198px; height: 474px; }
  .hx-beam { top: 48px; height: 14px; }
  .hx-post { top: 62px; width: 6px; }
  .hx-post-l { left: 6px; }
  .hx-post-r { right: 6px; }
  .hx-open { left: 12px; right: 12px; top: 62px; }
  .hx-rows { left: 8px; right: 8px; top: 10px; }
  /* the queue rides in along the top from the right and steps left as each piece drops */
  .hx-item { --x: calc(100cqw + 12px); --y: 8px; }
  .hx-item[data-s="q"] { --x: calc(28px + max(0, var(--i) - var(--n)) * 48px); }
  .hx-item[data-s="in"] { --x: 28px; --y: calc(84px + max(0, var(--n) - 1 - var(--i)) * var(--rh)); }
  /* newest work lands directly under the beam; earlier rows step down */
  .hx-row { --slot: max(0, var(--n) - 1 - var(--i)); }
  .hx-phone { left: 8px; right: 8px; top: 190px; width: auto; height: 320px; margin-left: 0; }
  .hx-card { padding: 12px 14px 10px; }
  .hx-q { font-size: 15px; line-height: 20px; }
  .hx-amt { font-size: 24px; line-height: 30px; margin: 4px 0 10px; }
  .hx-approve { min-height: 52px; font-size: 17px; }
  .hx-note { margin-top: 8px; }
  .hx-bar { height: 48px; }
  .hx-ctl { min-height: 44px; }
}
