/* ============================================================================
   PROTOTYPE: hero sequence, rebuilt (Codex review, 2026-11-11).

   The resting frame explains the product on its own: the deal in Attio, the
   room as the foyai mark (a room in plan, door swung open at the bottom
   right), what foyai drafted inside it, the publish step beside the door,
   and the buyer's activity running back up to the deal, 72 → 78.

   Base styles ARE the final frame. Motion runs only while .is-play is set
   (added by the inline script after the figure, never for reduced motion),
   so no-JS and reduced-motion visitors get the finished picture.

   Every position derives from --w (stage width) and --f (the room's size), so
   phones get the same composition, re-proportioned rather than scaled down.
   ============================================================================ */

.fseq {
  --w: 420px;
  --f: 332px;
  --fx: calc((var(--w) - var(--f)) / 2);       /* room left */
  --fy: 170px;                                  /* room top */
  --door: calc(var(--f) * 9 / 16);              /* left jamb of the door, from the room's left */
  --half: calc(var(--f) / 2);
  --col: calc((var(--w) - 12px) / 2);           /* pipeline column width */
  --rx: calc(var(--fx) + var(--f) + (var(--w) - var(--fx) - var(--f)) / 2); /* return line x */
  --ev: calc(var(--fy) + var(--f) + 22px);      /* buyer events top */
  --ev2y: 50px;                                 /* second event's midline, from --ev */

  position: relative;
  margin: 48px 0 0;
  width: var(--w);
  max-width: 100%;
}
@media (max-width: 480px) {
  .fseq { --w: calc(100vw - 48px); --f: calc(var(--w) - 36px); --fy: 168px; margin-top: 40px; }
}

.fseq-stage { position: relative; width: var(--w); height: calc(var(--ev) + 74px); }

/* Labels: short mono annotations, sentence case. */
.fseq-k {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink-60);
}
.fseq-n { color: var(--seal-600); font-family: var(--font-display); font-weight: 600; font-size: 14px; flex: none; }
.fseq-k--top { position: absolute; top: 0; left: 0; }

/* ── 01 · the pipeline ─────────────────────────────────────────────────── */
.fseq-board { position: absolute; top: 24px; left: 0; width: var(--w); height: 126px; }
.fseq-col {
  position: absolute;
  top: 0;
  width: var(--col);
  height: 126px;
  padding: 8px 9px;
  background: rgba(16,16,20,.035);
  border: 1px solid transparent;
}
.fseq-col--from { left: 0; }
.fseq-col--to { right: 0; }
.fseq-col-h { font-size: 12.5px; font-weight: 500; color: var(--ink-60); }

.fseq-deal {
  position: absolute;
  top: 30px;
  right: 8px;
  width: calc(var(--col) - 16px);
  padding: 8px 10px 9px;
  background: #FFFFFF;
  border: 1px solid var(--ink-line-strong);
  will-change: transform;
}
.fseq-deal-top { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink-100); }
.fseq-deal-top b { font-weight: 600; }
.fseq-logo { width: 13px; height: auto; flex: none; }
.fseq-deal-sub { font-size: 12.5px; color: var(--ink-60); margin-top: 1px; }
.fseq-eng {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--ink-line);
  font-size: 12px;
  color: var(--ink-60);
}
.fseq-eng-v {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  color: var(--seal-700);
  background: var(--seal-100);
  padding: 1px 6px;
}
.fseq-up { color: var(--sage); }
.fseq-cursor { position: absolute; right: 22px; top: 18px; opacity: 0; pointer-events: none; }

/* The way in: from the dropped card down into the room's top edge. */
.fseq-link {
  position: absolute;
  left: calc(var(--fx) + var(--f) - 44px);
  top: 150px;
  width: 1px;
  height: calc(var(--fy) - 150px);
  background: var(--ink-40);
  transform-origin: top;
}

/* ── The room: the foyai mark, in plan ─────────────────────────────────── */
.fseq-room {
  position: absolute;
  left: var(--fx);
  top: var(--fy);
  width: var(--f);
  height: var(--f);
  overflow: visible;
}
.fseq-room-fill { fill: var(--seal-100); opacity: .7; }
.fseq-room-ink  { fill: var(--ink-100); opacity: 0; }
.fseq-room-line {
  fill: none;
  stroke: var(--ink-100);
  stroke-width: 1.5;
  stroke-linejoin: miter;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.fseq-room-door {
  fill: none;
  stroke: var(--ink-100);
  stroke-width: 1.5;
  stroke-linecap: butt;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.fseq-room-plan { fill: none; stroke: var(--ink-40); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0; }

/* ── 02 · what foyai drafted: along the top wall, inside ───────────────── */
.fseq-draft {
  position: absolute;
  left: calc(var(--fx) + 16px);
  top: calc(var(--fy) + 16px);
  width: calc(var(--f) - 32px);
  padding: 10px 14px 6px;
  background: #FFFFFF;
  border: 1px solid var(--ink-line-strong);
}
.fseq-draft .fseq-k { margin-bottom: 6px; color: var(--ink-80); }
.fseq-mark {
  width: 12px;
  height: 12px;
  flex: none;
  align-self: center;
  background: var(--ink-100);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M0,0 H16 V16 H13 V13 H9 V16 H0 Z M3,3 H13 V13 A4,4 0 0 0 9,9 V13 H3 Z' fill='%23000'/%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 16 16'%3E%3Cpath fill-rule='evenodd' d='M0,0 H16 V16 H13 V13 H9 V16 H0 Z M3,3 H13 V13 A4,4 0 0 0 9,9 V13 H3 Z' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
}
.fseq-rows li {
  display: grid;
  grid-template-columns: 1fr auto 14px;
  align-items: baseline;
  gap: 10px;
  height: 26px;
  align-content: center;
  border-top: 1px solid var(--ink-line);
  font-size: 14px;
  color: var(--ink-100);
}
.fseq-src { font-family: var(--font-sans); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink-60); }
.fseq-tick { font-style: normal; font-weight: 600; color: var(--sage); text-align: right; }

/* ── 03 · you publish: at the threshold, beside the door ───────────────── */
.fseq-publish {
  position: absolute;
  left: calc(var(--fx) + 16px);
  top: calc(var(--fy) + var(--f) - 16px - 76px);
  width: calc(var(--door) - 32px);
}
.fseq-publish .fseq-k { margin-bottom: 10px; color: var(--ink-80); }
.fseq-btn {
  display: inline-grid;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 14px;
  background: var(--blueprint-surface);
  color: #FFFFFF;
}
.fseq-btn .fseq-new::after { content: " ✓"; }

/* ── 04 · the buyer's activity, back to the deal ───────────────────────── */
.fseq-events { position: absolute; left: var(--fx); top: var(--ev); width: var(--f); }
.fseq-events .fseq-k { margin-bottom: 6px; color: var(--ink-80); }
.fseq-ev {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-100);
}
.fseq-ev::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  align-self: center;
  background: var(--seal-600);
}
.fseq-ev2::after {           /* leader from the last event into the return line */
  content: "";
  flex: 1;
  align-self: center;
  min-width: 12px;
  margin-left: 4px;
  border-top: 1px solid var(--seal-600);
  opacity: .55;
}
.fseq-ev small { font-size: 12px; color: var(--ink-60); font-family: var(--font-sans); }

/* The return: out through the door, up the outside of the room, into the deal card. */
.fseq-return {
  position: absolute;
  left: var(--rx);
  top: 150px;
  width: 1px;
  height: calc(var(--ev) + var(--ev2y) - 150px);
  background: var(--seal-600);
  opacity: .55;
  transform-origin: bottom;
}
.fseq-return::before {          /* arrowhead into the card */
  content: "";
  position: absolute;
  left: -3.5px;
  top: -1px;
  border: 4px solid transparent;
  border-bottom: 6px solid var(--seal-600);
  border-top: 0;
}
.fseq-return-h {
  position: absolute;
  left: calc(var(--fx) + var(--f));
  top: calc(var(--ev) + var(--ev2y));
  width: calc(var(--rx) - var(--fx) - var(--f));
  height: 1px;
  background: var(--seal-600);
  opacity: .55;
}
.fseq-dot {
  position: absolute;
  left: -3px;
  top: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--seal-600);
  opacity: 0;
}

/* Replay */
.fseq-replay {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  font: 500 12px/1 var(--font-sans);
  color: var(--ink-60);
  cursor: pointer;
}
.fseq:not(.is-play) .fseq-replay { display: none; }
.fseq-replay:hover { color: var(--ink-100); }
.fseq-replay:focus-visible { outline: 2px solid var(--ink-100); outline-offset: 3px; }

/* State swaps share one grid cell, so nothing reflows. */
.fseq-swap { display: inline-grid; }
.fseq-swap > span { grid-area: 1 / 1; }
.fseq-old { opacity: 0; }

/* Phones: the room is a full square now, so all four rows fit. */
@media (max-width: 480px) {
  .fseq-rows li { height: 24px; font-size: 13.5px; }
}

/* ── Choreography: ~7s, once, then still ───────────────────────────────── */
@keyframes fseq-show { from { opacity: 0; } to { opacity: 1; } }
@keyframes fseq-hide { from { opacity: 1; } to { opacity: 0; } }
@keyframes fseq-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fseq-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fseq-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fseq-plan { 0% { opacity: 0; } 30%, 70% { opacity: 1; } 100% { opacity: 0; } }
/* The mark lands as the logo, alone and solid, then opens up as the room in plan. */
@keyframes fseq-ink  { 0% { opacity: 0; } 25%, 62% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fseq-fill { from { opacity: 0; } to { opacity: .7; } }
@keyframes fseq-tick { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes fseq-drag {
  0%   { transform: translateX(calc(-1 * (var(--col) + 12px))); box-shadow: none; }
  18%  { transform: translate(calc(-1 * (var(--col) + 12px) + 2px), -4px) rotate(-2deg) scale(1.03); box-shadow: 0 16px 28px -14px rgba(16,16,20,.35); }
  80%  { transform: translate(-3px, -5px) rotate(-1deg) scale(1.03); box-shadow: 0 16px 28px -14px rgba(16,16,20,.35); }
  100% { transform: none; box-shadow: none; }
}
@keyframes fseq-cursor {
  0%   { opacity: 0; transform: translate(10px, 12px); }   /* the card carries the drag */
  10%  { opacity: 1; transform: none; }
  22%  { opacity: 1; transform: scale(.88); }
  85%  { opacity: 1; transform: scale(.88); }
  100% { opacity: 0; transform: translate(6px, 8px); }
}
@keyframes fseq-target {
  0%, 100% { background: rgba(16,16,20,.035); border-color: transparent; }
  30%, 70% { background: rgba(16,16,20,.07); border-color: var(--ink-line-strong); }
}
@keyframes fseq-travel { 0% { opacity: 0; top: 100%; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; top: 0; } }
@keyframes fseq-flash { 0%, 100% { background: var(--seal-100); } 35% { background: var(--seal-200); } }

.fseq.is-play .fseq-k--top        { animation: fseq-show .35s ease both; }
.fseq.is-play .fseq-col           { animation: fseq-show .35s ease both; }
.fseq.is-play .fseq-col--to       { animation: fseq-show .35s ease both, fseq-target .9s ease .55s both; }
.fseq.is-play .fseq-deal          { animation: fseq-drag .85s cubic-bezier(.45,.05,.3,1) .45s both; }
.fseq.is-play .fseq-cursor        { animation: fseq-cursor 1.1s ease .3s both; }
.fseq.is-play .fseq-room-plan     { animation: fseq-plan 1.6s ease 0s both; }
.fseq.is-play .fseq-link          { animation: fseq-grow .3s var(--ease-enter) 1.3s both; }
.fseq.is-play .fseq-room-line     { animation: fseq-draw .55s cubic-bezier(.55,0,.25,1) 1.5s both; }
.fseq.is-play .fseq-room-ink      { animation: fseq-ink 1.15s ease-out 1.95s both; }
.fseq.is-play .fseq-room-fill     { animation: fseq-fill .6s ease-out 2.55s both; }
.fseq.is-play .fseq-room-door     { animation: fseq-draw .45s cubic-bezier(.55,0,.25,1) 2.85s both; }
.fseq.is-play .fseq-draft         { animation: fseq-rise .4s var(--ease-enter) 3.1s both; }
.fseq.is-play .fseq-rows li:nth-child(1) .fseq-tick { animation: fseq-tick .2s ease 3.25s both; }
.fseq.is-play .fseq-rows li:nth-child(2) .fseq-tick { animation: fseq-tick .2s ease 3.37s both; }
.fseq.is-play .fseq-rows li:nth-child(3) .fseq-tick { animation: fseq-tick .2s ease 3.49s both; }
.fseq.is-play .fseq-rows li:nth-child(4) .fseq-tick { animation: fseq-tick .2s ease 3.61s both; }
.fseq.is-play .fseq-publish       { animation: fseq-rise .35s var(--ease-enter) 4.3s both; }
.fseq.is-play .fseq-btn .fseq-old { animation: fseq-hide .2s ease 4.95s both; }
.fseq.is-play .fseq-btn .fseq-new { animation: fseq-show .2s ease 4.95s both; }
.fseq.is-play .fseq-events > .fseq-k { animation: fseq-rise .35s var(--ease-enter) 5.3s both; }
.fseq.is-play .fseq-ev1           { animation: fseq-rise .35s var(--ease-enter) 5.45s both; }
.fseq.is-play .fseq-ev2           { animation: fseq-rise .35s var(--ease-enter) 6.05s both; }
.fseq.is-play .fseq-ev2::after    { animation: fseq-show .2s ease 6.15s both; }
.fseq.is-play .fseq-return-h      { animation: fseq-show .2s ease 6.2s both; }
.fseq.is-play .fseq-return        { animation: fseq-grow .55s var(--ease-enter) 6.25s both; }
.fseq.is-play .fseq-dot           { animation: fseq-travel .55s var(--ease-enter) 6.25s both; }
.fseq.is-play .fseq-eng .fseq-old { animation: fseq-hide .2s ease 6.8s both; }
.fseq.is-play .fseq-eng .fseq-new { animation: fseq-show .2s ease 6.8s both; }
.fseq.is-play .fseq-eng-v         { animation: fseq-flash .8s ease 6.8s both; }
.fseq.is-play .fseq-replay        { animation: fseq-show .3s ease 7.4s both; }

/* Held on the first frame until the figure scrolls into view. */
.fseq.is-wait *, .fseq.is-wait *::before, .fseq.is-wait *::after { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  .fseq *, .fseq *::before, .fseq *::after { animation: none !important; }
}

/* ── Hero layout: wider product column; stacked below 1200px ──────────── */
@media (min-width: 1200px) {
  html.arch .hero-section--home .hero-inner {
    grid-template-columns: minmax(0, 1fr) 420px;
    column-gap: 48px;
  }
  html.arch .hero-section--home .hero-inner > .fseq { grid-column: 2; grid-row: 1 / span 4; align-self: start; margin: 2px 0 0; }
}
