/* "What you could hand off": six tabs and a stage that plays each hand-off as a small product
   mock-up. Every element is drawn in its finished state. handoff.js adds .handoff__panel--playing,
   which runs each part's entrance from a --d delay, so without JS or with reduced motion the
   finished state is simply what is shown. Uses the tokens from site.css. */

.handoff {
  --handoff-dur: 8s;
  --handoff-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
}

/* Layout. Base = no JS: every caption readable, the first mock-up shown. */
.handoff__tabs { display: none; }
.handoff__panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.handoff__panel ~ .handoff__panel .handoff__stage { display: none; }
.handoff__panel:focus-visible { outline-offset: 6px; border-radius: var(--radius); }

.js .handoff { gap: 0; }
.js .handoff__tabs { display: flex; }
/* Panels share the caption and stage rows (subgrid), so nothing moves when the tab changes */
.js .handoff__panel { grid-area: 2 / 1 / 4 / 2; grid-template-rows: subgrid; gap: 0; visibility: hidden; opacity: 0; transition: opacity 0.3s ease, visibility 0s 0.3s; }
.js .handoff__panel--active { visibility: visible; opacity: 1; transition: opacity 0.4s ease 0.1s; }
.js .handoff__panel ~ .handoff__panel .handoff__stage { display: grid; }

/* Tabs: a scrolling row on phone and tablet, a numbered list on desktop */
.handoff__tabs {
  position: relative;
  gap: 26px;
  margin: 0 calc(var(--gutter) * -1) 24px;
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: inset 0 -1px 0 var(--line);
}
.handoff__tabs::-webkit-scrollbar { display: none; }
.handoff__tab {
  position: relative;
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-height: 46px;
  padding: 10px 0 14px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease;
}
.handoff__tab:hover, .handoff__tab[aria-selected="true"] { color: var(--ink); }
.handoff__tab:focus-visible { outline-offset: -3px; }
.handoff__tab-num { display: none; font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; color: var(--ink-soft); transition: color 0.2s ease; }
.handoff__tab[aria-selected="true"] .handoff__tab-num { color: var(--brand); }
.handoff__tab-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
}
.handoff__tab[aria-selected="true"] .handoff__tab-bar { transform: none; }

.handoff__title { font-size: clamp(22px, 2.1vw, 28px); line-height: 1.12; letter-spacing: -0.02em; }
.js .handoff__caption { padding-bottom: 20px; }
.handoff__text { margin-top: 10px; max-width: 52ch; font-size: 16px; line-height: 1.55; color: var(--ink-soft); }

.handoff__ctrl {
  grid-row: 4;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.handoff__ctrl:hover { color: var(--ink); }
.handoff__ctrl-icon { width: 8px; height: 9px; border: solid currentColor; border-width: 0 2.5px; }
.handoff--stopped .handoff__ctrl-icon { width: 0; height: 0; border: solid transparent; border-width: 5px 0 5px 8px; border-left-color: currentColor; }

/* Stage and window */
.handoff__stage {
  display: grid;
  place-items: center;
  min-height: 440px;
  padding: 14px;
  border-radius: var(--radius);
  background: radial-gradient(120% 90% at 85% 0%, rgba(84, 86, 237, 0.1), rgba(84, 86, 237, 0) 60%), var(--ground-deep);
  overflow: hidden;
}
.handoff__win {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 540px;
  padding: 12px;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(20, 19, 26, 0.04), 0 18px 40px -22px rgba(20, 19, 26, 0.28);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink);
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}
.handoff__win p { margin: 0; }
.handoff__win b { font-weight: 600; }
.handoff__win i, .handoff__win em { font-style: normal; }
.handoff__win-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
  padding: 0 2px 9px;
  border-bottom: 1px solid var(--line);
}
.handoff__win-name { font-weight: 600; font-size: 1.04em; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Shared parts */
.handoff__status { display: grid; justify-items: end; align-items: center; flex: none; color: var(--ink-soft); font-size: 0.92em; white-space: nowrap; }
.handoff__status > * { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 0.45em; }
.handoff__win-head .handoff__status > :last-child, .handoff__ok { color: var(--ink); font-weight: 500; }
.handoff__pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.handoff__tick { position: relative; flex: none; width: 1.2em; height: 1.2em; border-radius: 50%; background: var(--brand); }
.handoff__tick::after {
  content: '';
  position: absolute;
  left: 37%;
  top: 22%;
  width: 24%;
  height: 44%;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.handoff__tag {
  display: inline-flex;
  align-items: center;
  padding: 0.28em 0.6em;
  border-radius: 5px;
  background: var(--ground);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.76em;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}
.handoff__tag--brand { background: var(--brand-tint); color: var(--brand-deep); }
.handoff__flag { padding: 0.2em 0.65em; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--brand); color: var(--brand-deep); font-weight: 500; }
.handoff__avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  background: var(--ground-deep);
  color: var(--ink);
  font-size: 0.74em;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.handoff__time { flex: none; color: var(--ink-soft); font-family: var(--mono); font-size: 0.84em; white-space: nowrap; }
.handoff__btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5em 1.1em;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 0.96em;
  line-height: 1.2;
}
.handoff__btn--ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

/* A card the system has prepared for a person: drafted reply, follow-up, the one exception */
.handoff__draft {
  display: grid;
  gap: 8px;
  padding: 11px 12px 12px;
  border-radius: 12px;
  background: rgba(84, 86, 237, 0.05);
  box-shadow: inset 0 0 0 1px rgba(84, 86, 237, 0.28);
}
.handoff__draft-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-soft); font-size: 0.92em; }
.handoff__draft-text { line-height: 1.5; }
.handoff__draft-foot { display: flex; gap: 8px; padding-top: 2px; }

/* 1. Inbox */
.handoff__lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.handoff__lane { display: flex; flex-direction: column; gap: 5px; min-height: 12.9em; padding: 6px; border-radius: 10px; background: var(--ground); }
.handoff__lane-head {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 3px 3px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.74em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.handoff__lane--you .handoff__lane-head { color: var(--brand-deep); }
.handoff__mail {
  position: relative;
  z-index: 1;
  padding: 0.5em 0.6em 0.55em 0.95em;
  border-radius: 7px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--line), 0 3px 8px -4px rgba(20, 19, 26, 0.22);
  overflow: hidden;
}
.handoff__mail b, .handoff__mail span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handoff__mail span { color: var(--ink-soft); font-size: 0.9em; }
.handoff__mail::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: rgba(20, 19, 26, 0.16); }
.handoff__lane--you .handoff__mail::before { background: var(--brand); }
.handoff__lane--team .handoff__mail::before { background: var(--brand-light); }

/* 2. Enquiries (the channel chips are shared with Reporting) */
.handoff__chans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.handoff__chan {
  padding: 0.55em 0.3em;
  border-radius: 8px;
  background: var(--ground);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.78em;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}
.handoff__enqs { display: grid; gap: 7px; }
.handoff__enq { display: grid; gap: 5px; padding: 10px 11px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.handoff__enq-top { display: flex; align-items: center; gap: 8px; }
.handoff__enq-top .handoff__time { margin-left: auto; }
.handoff__enq-msg { color: var(--ink-soft); }
.handoff__enq-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 1.9em; padding-top: 1px; font-size: 0.94em; }
.handoff__done, .handoff__assign { display: inline-flex; align-items: center; gap: 0.45em; white-space: nowrap; }
.handoff__done { color: var(--brand-deep); font-weight: 500; }
.handoff__assign { padding: 0.2em 0.7em 0.2em 0.25em; border-radius: 999px; background: var(--ground); }
.handoff__assign .handoff__avatar { background: var(--paper); }

/* 3. Meetings: the transcript lies over the result and gives way to it */
.handoff__layers { position: relative; }
.handoff__transcript { position: absolute; inset: 0; display: grid; align-content: start; gap: 12px; padding-top: 4px; opacity: 0; }
.handoff__say { display: flex; align-items: flex-start; gap: 9px; line-height: 1.5; }
.handoff__say .handoff__avatar { margin-top: 0.1em; }
.handoff__mark {
  padding: 0.1em 0;
  background: linear-gradient(rgba(84, 86, 237, 0.2), rgba(84, 86, 237, 0.2)) no-repeat 0 0 / 100% 100%;
  color: inherit;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.handoff__result { display: grid; gap: 10px; }
.handoff__note { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); }
.handoff__acts { display: grid; }
.handoff__act { display: flex; align-items: center; gap: 9px; padding: 0.62em 2px; border-top: 1px solid var(--line); }
.handoff__act:last-child { border-bottom: 1px solid var(--line); }
.handoff__act > span:nth-child(2) { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handoff__act .handoff__time { min-width: 3.9em; text-align: right; }
.handoff__box { flex: none; width: 1.1em; height: 1.1em; border-radius: 4px; box-shadow: inset 0 0 0 1.5px var(--brand); }

/* 4. Reporting */
.handoff__feeds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; height: 16px; margin: -6px 0; }
.handoff__feed { position: relative; justify-self: center; width: 1px; background: rgba(84, 86, 237, 0.35); }
.handoff__feed::after { content: ''; position: absolute; left: -2px; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); opacity: 0; }
.handoff__kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.handoff__kpi { display: grid; gap: 1px; padding: 9px 10px 10px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.handoff__kpi span { color: var(--ink-soft); font-size: 0.86em; white-space: nowrap; }
.handoff__kpi b { font-size: 1.62em; letter-spacing: -0.03em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.handoff__kpi em { color: var(--brand-deep); font-size: 0.86em; font-weight: 500; white-space: nowrap; }
.handoff__chart { display: grid; gap: 8px; padding: 10px 11px 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.handoff__chart-head { color: var(--ink-soft); font-size: 0.86em; }
.handoff__bars { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); align-items: end; gap: 7px; height: 4.6em; }
.handoff__bar { height: var(--h); border-radius: 3px 3px 0 0; background: var(--ground-deep); transform-origin: bottom; }
.handoff__bar--now { background: var(--brand); }
.handoff__changed { display: flex; align-items: flex-start; gap: 9px; line-height: 1.5; }
.handoff__changed .handoff__tag { margin-top: 0.12em; }

/* 5. Approvals */
.handoff__reqs { display: grid; gap: 5px; }
.handoff__req { display: flex; align-items: center; gap: 8px; padding: 0.62em 0.8em; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--line); }
.handoff__req.handoff__dim { opacity: 0.55; }
.handoff__req--flag { box-shadow: inset 0 0 0 1px rgba(84, 86, 237, 0.5); background: rgba(84, 86, 237, 0.05); }
.handoff__req-what { flex: 1; min-width: 0; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handoff__req-what b { margin-right: 0.55em; color: var(--ink); }
.handoff__req-amt { flex: none; font-variant-numeric: tabular-nums; font-weight: 500; }
.handoff__req .handoff__status { min-width: 6.6em; }

/* 6. Onboarding */
.handoff__docs { display: grid; }
.handoff__doc { display: flex; align-items: center; gap: 9px; padding: 0.6em 2px; border-bottom: 1px solid var(--line); }
.handoff__doc:last-child { border-bottom: 0; }
.handoff__doc > span:nth-child(2) { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handoff__file { position: relative; flex: none; width: 1.05em; height: 1.3em; border-radius: 2px; box-shadow: inset 0 0 0 1.5px rgba(20, 19, 26, 0.3); }
.handoff__file::after { content: ''; position: absolute; left: 24%; right: 24%; top: 34%; height: 32%; border: solid rgba(20, 19, 26, 0.3); border-width: 1.5px 0; }
.handoff__missing { display: grid; gap: 2px; padding: 11px 12px 8px; border-radius: 12px; background: var(--ground); }
.handoff__missing-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 4px; color: var(--ink-soft); font-size: 0.92em; }
.handoff__missing-head .handoff__tag--brand { background: rgba(84, 86, 237, 0.14); }
.handoff__client { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 6.6em); align-items: center; gap: 10px; padding: 0.42em 0; }
.handoff__client > span:last-child { color: var(--ink-soft); text-align: right; white-space: nowrap; }
.handoff__dots { display: inline-flex; gap: 4px; }
.handoff__dots i { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(20, 19, 26, 0.25); }
.handoff__dots .handoff__dot--on { background: var(--brand); box-shadow: none; }

/* Parts that are gone by the end of the story */
.handoff__out, .handoff__blip { opacity: 0; }

@media (min-width: 560px) {
  .handoff__stage { min-height: 520px; padding: 28px; }
  .handoff__win { gap: 12px; padding: 16px; font-size: 13.5px; }
  .handoff__lane { padding: 8px; gap: 6px; }
  .handoff__lanes, .handoff__chans, .handoff__kpis, .handoff__feeds { gap: 8px; }
}

@media (min-width: 1100px) {
  .handoff { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); column-gap: clamp(40px, 5vw, 80px); }
  .handoff__panel { display: contents; }
  .handoff__caption { grid-column: 1; }
  .handoff__stage { grid-column: 2; grid-row: 1 / span 6; align-self: start; min-height: 560px; }

  .js .handoff { grid-template-rows: auto 1fr auto; column-gap: clamp(40px, 5vw, 80px); }
  .js .handoff__tabs { grid-area: 1 / 1; flex-direction: column; gap: 0; margin: 0; padding: 0; overflow: visible; box-shadow: none; z-index: 1; }
  .js .handoff__panel { display: grid; grid-area: 1 / 1 / 3 / 3; grid-template-columns: subgrid; grid-template-rows: subgrid; gap: 0 clamp(40px, 5vw, 80px); }
  .js .handoff__caption { grid-area: 2 / 1; align-self: end; padding: 36px 0 0; }
  .js .handoff__stage { grid-area: 1 / 2 / 3 / 3; align-self: stretch; }
  .handoff__ctrl { grid-area: 3 / 2; }
  .handoff__tab { min-height: 54px; padding: 14px 0; font-size: 19px; box-shadow: inset 0 -1px 0 var(--line); }
  .handoff__tab-num { display: block; width: 26px; }
  .handoff__win { max-width: 580px; font-size: 14px; padding: 18px; }
}

/* Motion. Only .handoff__panel--playing (set by handoff.js) animates, and only when motion is allowed. */
@media (prefers-reduced-motion: no-preference) {
  .handoff__tab--running .handoff__tab-bar { animation: handoff-progress var(--handoff-dur) linear both; }
  .handoff__panel--playing .handoff__in { animation: handoff-in 0.6s var(--handoff-ease) var(--d, 0s) both; }
  .handoff__panel--playing .handoff__out { animation: handoff-out 0.4s ease var(--d, 0s) both; }
  .handoff__panel--playing .handoff__blip { animation: handoff-blip 1.4s ease var(--d, 0s) both; }
  .handoff__panel--playing .handoff__dim { animation: handoff-dim 0.6s ease var(--d, 0s) both; }
  .handoff__panel--playing .handoff__write { animation: handoff-write 1s linear var(--d, 0s) both; }
  .handoff__panel--playing .handoff__ping { animation: handoff-ping 1.1s ease var(--d, 0s) both; }
  .handoff__panel--playing .handoff__mark { animation: handoff-mark 0.5s ease var(--d, 0s) both; }
  .handoff__panel--playing .handoff__bar { animation: handoff-grow 0.7s var(--handoff-ease) var(--d, 0s) both; }
  .handoff__panel--playing .handoff__feed::after { animation: handoff-feed 0.9s ease-in var(--d, 0s) 3 both; }
  .handoff__panel--playing .handoff__mail { animation: handoff-sort 3.2s var(--d, 0s) both; }
  .handoff__panel--playing .handoff__mail::before { animation: handoff-fade 0.4s ease calc(var(--d, 0s) + 2.7s) both; }
  .handoff__panel--playing .handoff__pulse { animation: handoff-pulse 1.1s ease-in-out infinite; }
  .handoff--paused .handoff__tab-bar,
  .handoff--paused .handoff__panel *,
  .handoff--paused .handoff__panel *::before,
  .handoff--paused .handoff__panel *::after { animation-play-state: paused; }
}

@keyframes handoff-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes handoff-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes handoff-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-6px); } }
@keyframes handoff-blip { 0% { opacity: 0; transform: translateY(6px); } 22%, 78% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }
@keyframes handoff-dim { from { opacity: 1; } }
@keyframes handoff-fade { from { opacity: 0; } }
@keyframes handoff-write { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes handoff-ping {
  0% { background: var(--ground); color: var(--ink-soft); box-shadow: 0 0 0 0 rgba(84, 86, 237, 0.5); }
  25% { background: var(--brand); color: #fff; box-shadow: 0 0 0 0 rgba(84, 86, 237, 0.5); }
  100% { background: var(--ground); color: var(--ink-soft); box-shadow: 0 0 0 9px rgba(84, 86, 237, 0); }
}
@keyframes handoff-mark { from { background-size: 0% 100%; } }
@keyframes handoff-grow { from { transform: scaleY(0); } }
@keyframes handoff-feed { 0% { opacity: 0; transform: none; } 20%, 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(16px); } }
@keyframes handoff-pulse { 50% { opacity: 0.3; transform: scale(0.8); } }
/* Emails land in a loose pile (offsets are in units of the email's own size), then go to their lane */
@keyframes handoff-sort {
  0% { opacity: 0; transform: translate(var(--x), calc(var(--y) - 16px)) rotate(var(--r)); animation-timing-function: var(--handoff-ease); }
  11% { opacity: 1; transform: translate(var(--x), var(--y)) rotate(var(--r)); }
  60% { opacity: 1; transform: translate(var(--x), var(--y)) rotate(var(--r)); animation-timing-function: cubic-bezier(0.6, 0, 0.2, 1); }
  86%, 100% { opacity: 1; transform: none; }
}
