@font-face {
  font-family: Geist;
  src: url('/assets/geist-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

.chapter-review {
  background: #e3e6d6;
  font-family: Geist, var(--body);
}

.episode-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.05rem 2.5rem;
  margin-block: 1.3rem clamp(1.6rem, 3.5vw, 2.8rem);
}

.episode-intro .chapter-copy { margin: 0; }

.episode-instructions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 1.1rem;
  font-size: .83rem;
}

.scroll-hint { display: inline-flex; align-items: center; gap: .48rem; color: #344737; font-weight: 600; }
.scroll-hint span {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid #96a189;
  border-radius: 50%;
}

.take-over {
  min-height: 44px;
  padding-inline: .2rem;
  border: 0;
  background: transparent;
  color: #455849;
  font-weight: 540;
  text-decoration: underline;
  text-underline-offset: .23em;
}

.take-over:hover { color: #172f21; text-decoration-thickness: 2px; }
.chapter-review[data-manual] .scroll-hint { display: none; }

.episode {
  --desk-line: #c8c7b4;
  --panel: #f7f3e7;
  --olive: #405e47;
  --spring: cubic-bezier(.2, .78, .24, 1);
  --stage-pad: clamp(.85rem, 2.8vw, 2.25rem);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) clamp(2.5rem, 5vw, 4.3rem) minmax(0, 1fr);
  align-items: start;
  isolation: isolate;
  padding: var(--stage-pad);
  border: 1px solid #536354;
  background:
    linear-gradient(115deg, #768c681c, transparent 39%),
    radial-gradient(ellipse at 55% 38%, #405344, transparent 65%), #23352a;
}

.episode::before {
  position: absolute;
  z-index: -1;
  inset: .45rem;
  content: "";
  pointer-events: none;
  border: 1px solid #93aa8a31;
}

.episode-defs { position: absolute; width: 0; height: 0; }

.episode-steps {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.42rem, 1.5vw, 1.2rem);
  margin: 0 0 clamp(1rem, 2.2vw, 1.55rem);
  padding: 0;
  list-style: none;
}

.episode-steps li {
  display: flex;
  align-items: center;
  gap: .48rem;
  min-width: 0;
  padding-bottom: .66rem;
  border-bottom: 1px solid #81937980;
  color: #c4d0bc;
  font: 500 clamp(.63rem, 1.2vw, .72rem)/1.2 var(--label);
  transition: color .22s, border-color .22s;
}

.episode-steps li::before {
  content: "";
  flex: none;
  width: .4rem;
  height: .4rem;
  border: 1px solid #b0bda395;
  border-radius: 50%;
}

.episode-steps li[aria-current="step"] { border-color: #c9df9c; color: #f1f5d9; }
.episode-steps li[aria-current="step"]::before { background: #d5e9ae; box-shadow: 0 0 0 3px #c9df9c32; }
.episode-steps li:has(~ [aria-current="step"]) { border-color: #9baa82; }
.episode-steps li:has(~ [aria-current="step"])::before { background: #9baa82; }

.desk {
  min-width: 0;
  border: 1px solid #e5dbc5;
  background: linear-gradient(145deg, #fffcf04a, transparent 64%), var(--panel);
  box-shadow: 0 8px 28px #13241b52;
}

.desk-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .35rem .9rem;
  padding: 1.05rem clamp(1rem, 2.2vw, 1.65rem);
  border-bottom: 1px solid var(--desk-line);
  color: #283a2d;
  font: 2.1rem/1 var(--serif);
}

.desk-heading small, .step-kind, .record-summary dt {
  font: 500 .7rem/1.35 var(--label);
  text-transform: uppercase;
  letter-spacing: .055em;
  color: #526350;
}

.desk-heading small { align-self: center; font-size: .66rem; }
.desk[data-state="received"] .desk-heading small { color: #264b33; }
.desk[data-state="failed"] .desk-heading small { color: #854624; }

.desk-steps { list-style: none; padding: 0 clamp(1rem, 2.2vw, 1.65rem); margin: 0; }
.desk-steps li { padding: clamp(1.05rem, 2vw, 1.45rem) 0; }
.desk-steps li + li { border-top: 1px solid var(--desk-line); }
.step-kind { display: block; margin-bottom: .62rem; }

.desk-steps p, .manager-body p {
  margin: .55rem 0;
  font-size: .9375rem;
  line-height: 1.5;
}

.desk-steps .manager-request {
  margin-bottom: 0;
  max-width: 28ch;
  font: 400 clamp(1.49rem, 2.35vw, 1.9rem)/1.07 var(--serif);
  color: #2b3c2e;
}

.desk-actions { display: flex; gap: .55rem; flex-wrap: wrap; margin-top: .8rem; }

.desk-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: .67rem;
  min-height: 44px;
  padding: .52rem .83rem;
  border: 1px solid #334e3a;
  border-radius: 3px;
  color: #fbf6e7;
  background: #334e3a;
  font-family: inherit;
  font-size: .86rem;
  font-weight: 560;
  line-height: 1.25;
  transition: background-color .17s, color .17s, border-color .17s;
}

.desk-button:hover:not(:disabled), .desk-button[data-demo-hover] { background: #44654d; }
.desk-button.secondary { background: transparent; color: #283e30; border-color: #939e87; }
.desk-button.secondary:hover:not(:disabled) { background: #e8ecdf; }
.desk-button:disabled { cursor: default; }
.desk-button:disabled:not([data-chosen]) { opacity: .53; }
.desk-button[data-chosen] { box-shadow: inset 0 0 0 1px currentColor; }
.lookup { animation: note-in .4s var(--spring) both; }
.exception { margin-top: 1.25rem; animation: note-in .35s var(--spring) both; }

.source-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .45rem;
  margin-top: .85rem;
  padding: .55rem .6rem .55rem .83rem;
  border-left: 2px solid #789071;
  background: #e7ebdd;
  color: #263a2c;
}

.source-line small, .source-line strong { display: block; line-height: 1.3; }
.source-line small { margin-bottom: .32rem; color: #415747; font-size: .76rem; }
.source-line strong { font-size: .91rem; font-weight: 630; }
.exception .source-line { margin: 0; background: #eee5ce; border-color: #a78950; }
.exception .source-line small { color: #72592c; }

.context-orbit {
  --orbit-accent: #365641;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 .42rem 0 0;
  border: 0;
  border-radius: 99rem 0 0 99rem;
  color: var(--orbit-accent);
  background: transparent;
  font-size: .8rem;
  font-weight: 650;
}

.exception .context-orbit { --orbit-accent: #7b5a22; }
.context-orbit:disabled { cursor: default; opacity: .67; }
.context-orbit .orbit-icon, .intake-orbit {
  width: clamp(2.8rem, 4.2vw, 3.3rem);
  height: clamp(2.8rem, 4.2vw, 3.3rem);
  flex: none;
  overflow: visible;
  border: 1px solid #829780;
  border-radius: 50%;
  background: #faf7ea;
  transition: color .2s, background-color .2s, border-color .2s, transform .3s var(--spring);
}

.exception .context-orbit .orbit-icon { border-color: #a98e52; }
.orbit-icon { display: block; }
.orbit-ring { fill: none; stroke: currentColor; stroke-width: 1.05; }
.orbit-core, .orbit-satellite { fill: currentColor; }
.context-orbit:not(:disabled):hover .orbit-icon,
.context-orbit[data-demo-hover] .orbit-icon,
.context-orbit[aria-expanded="true"] .orbit-icon {
  background: var(--orbit-accent);
  border-color: var(--orbit-accent);
  color: #fcf5df;
}

.context-orbit[aria-expanded="true"] .orbit-icon { transform: rotate(15deg); }
.lookup .context-orbit:not(:disabled) .orbit-icon { animation: orbit-appear .58s var(--spring) both; }
.lookup .context-orbit[aria-expanded="true"] .orbit-icon { animation: none; }

@keyframes orbit-appear {
  from { opacity: 0; rotate: -48deg; scale: .62; }
  to { opacity: 1; rotate: 0deg; scale: 1; }
}

.context-question {
  position: relative;
  margin-top: .65rem;
  padding: .85rem 1.05rem 1.05rem;
  border: 1px solid #a6ac94;
  background: #fdf9ea;
  box-shadow: 0 5px 16px #24392a13;
  transform-origin: var(--orbit-anchor, 83%) 0;
  animation: note-in .36s var(--spring) both;
}

.context-question:not(.next-run)::before {
  position: absolute;
  top: -.34rem;
  left: calc(var(--orbit-anchor, 83%) - .3rem);
  width: .6rem;
  aspect-ratio: 1;
  border: 1px solid #a6ac94;
  border-width: 1px 0 0 1px;
  background: inherit;
  content: "";
  rotate: 45deg;
}

.desk-steps .context-question>p:first-child {
  margin: .13rem 0 0;
  font: 400 clamp(1.52rem, 2.25vw, 1.85rem)/1.09 var(--serif);
}

@keyframes note-in {
  from { opacity: 0; transform: translateY(-.45rem) scale(.976); }
  to { opacity: 1; transform: none; }
}

.sheet { overflow: auto; margin-top: .65rem; border: 1px solid var(--desk-line); }
.sheet table { width: 100%; border-collapse: collapse; text-align: left; font-size: .84rem; }
.sheet th, .sheet td { padding: .52rem .62rem; border: 1px solid #d8d6c6; }
.sheet thead { background: #e7eada; }
.sheet tbody th { font-weight: 600; white-space: nowrap; }
.sheet.flash tbody tr:first-child td { animation: sheet-ink .7s ease-out; }
@keyframes sheet-ink { from { background: #d5e2a3; } to { background: transparent; } }

.handoff {
  display: grid;
  place-items: center;
  margin-top: 9.25rem;
  min-height: 1.85rem;
  background: linear-gradient(#abbf9870, #abbf9870) center / 100% 1px no-repeat;
  color: #e7edcc;
}

.handoff span {
  display: grid;
  place-items: center;
  width: 1.85rem;
  aspect-ratio: 1;
  border: 1px solid #8a9f82;
  border-radius: 50%;
  background: #354b3c;
  line-height: 1;
}

.episode:has(.manager-desk[data-state="sending"]) .handoff span {
  animation: arrival-ring .65s var(--spring) reverse;
  border-color: #cfdfa2;
}

.manager-body { padding: 0 clamp(1rem, 2.2vw, 1.65rem) 1.2rem; }

.intake {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: .8rem;
  min-height: 17.3rem;
  padding: 1.2rem .5rem;
  text-align: center;
}

.intake-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 5.2rem;
  height: 5.2rem;
  color: var(--olive);
  border-color: #a3b099;
  background: #f2f1e3;
  box-shadow: 0 0 0 .44rem #edeee1, 0 0 0 calc(.44rem + 1px) #d5dbc9;
}

.intake-orbit::before {
  position: absolute;
  inset: -.8rem;
  border: 1px solid #86977a35;
  border-radius: inherit;
  content: "";
}

.intake-orbit .orbit-icon { width: 75%; height: 75%; }
.intake-orbit::after {
  position: absolute;
  inset: -1px;
  border: 1px solid currentColor;
  border-radius: inherit;
  content: "";
  opacity: 0;
}

.manager-body .episode-status { max-width: 28ch; margin: .35rem 0; color: #52604f; font-size: .88rem; }
.manager-desk[data-state="sending"] .intake-orbit { box-shadow: 0 0 0 .44rem #e5ebcb, 0 0 0 calc(.44rem + 1px) #a6b78b; }
.manager-desk[data-state="received"] .intake { display: flex; min-height: 0; padding: .9rem 0 .75rem; text-align: left; }
.manager-desk[data-state="received"] .intake-orbit { width: 2.45rem; height: 2.45rem; color: #fff8d9; background: #4c6746; box-shadow: none; }
.manager-desk[data-state="received"] .intake-orbit::before { display: none; }
.manager-desk[data-state="received"] .intake-orbit::after { animation: arrival-ring .65s var(--spring); }
.manager-desk[data-state="received"] .episode-status { max-width: none; }
@keyframes arrival-ring { from { opacity: .8; scale: 1; } to { opacity: 0; scale: 1.65; } }

.record-summary { margin: .25rem 0 1rem; }
.record-summary>div {
  display: grid;
  grid-template-columns: minmax(5.8rem, .78fr) minmax(0, 1.22fr);
  align-items: baseline;
  gap: .55rem;
  padding: .67rem 0;
  border-top: 1px solid var(--desk-line);
  animation: record-in .36s var(--spring) both;
  animation-delay: calc(var(--row, 0) * 53ms);
}
.record-summary>div:nth-child(2) { --row: 1; }
.record-summary>div:nth-child(3) { --row: 2; }
.record-summary>div:nth-child(4) { --row: 3; }
@keyframes record-in { from { opacity: 0; translate: -.44rem 0; } to { opacity: 1; translate: 0 0; } }
.record-summary dd { margin: 0; font-size: .92rem; line-height: 1.42; }
.manager-body .manager-next { padding: .72rem .85rem; border-left: 2px solid #7a926e; background: #e7ebdc; font-size: .88rem; }
.manager-body .next-run { margin-top: 1rem; }
.demo-controls { justify-content: flex-end; }
.utility-button { min-height: 44px; border: 0; background: transparent; text-decoration: underline; text-underline-offset: .2em; font-size: .81rem; color: #4b594a; }
.employee-receipt { display: inline-block; margin-top: .8rem; font-size: .81rem; font-weight: 570; }

.motion-layer { position: absolute; z-index: 2; inset: 0; overflow: clip; pointer-events: none; }
.motion-trace { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; overflow: visible; }
.motion-trace path { stroke: #c7db89; stroke-width: 2; stroke-linecap: round; filter: drop-shadow(0 1px 1px #283d2c); opacity: 0; }
.motion-trace[data-warm] path { stroke: #eac377; }

.motion-packet, .motion-cursor, .motion-ripple { position: absolute; top: 0; left: 0; }
.motion-packet {
  display: flex;
  align-items: center;
  gap: .38rem;
  padding: .39rem .67rem;
  border: 1px solid #e5efba;
  border-radius: 99rem;
  background: #3c583e;
  color: #fff7d9;
  font-size: .77rem;
  font-weight: 620;
  white-space: nowrap;
  box-shadow: 0 3px 11px #25372b66;
}
.motion-packet::before { content: ""; width: .37rem; aspect-ratio: 1; border-radius: 50%; background: #dbecaa; }
.motion-packet[data-warm] { background: #654b24; border-color: #efcc83; }
.motion-packet[data-warm]::before { background: #efcc83; }
.motion-cursor { width: 1.65rem; height: 1.85rem; color: #23382c; filter: drop-shadow(0 2px 2px #202a2066); }
.motion-cursor svg { display: block; width: 100%; height: 100%; fill: currentColor; stroke: #fff9e9; stroke-width: 1.6; stroke-linejoin: round; }
.motion-ripple { width: 2rem; aspect-ratio: 1; border: 2px solid #f1f2bc; border-radius: 50%; box-shadow: 0 0 0 1px #496747; }

.scenario-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin: 1.5rem 0 1rem; }
.scenario-picker button { display: flex; align-items: baseline; gap: .65rem; min-height: 60px; padding: .9rem; border: 1px solid #96a189; background: transparent; text-align: left; font: .72rem var(--label); }
.scenario-picker button span { font: 500 .86rem/1.35 Geist, var(--body); }
.scenario-picker button[aria-pressed="true"] { background: #334e3a; color: #fff8e7; border-color: #334e3a; }
.sheet caption { text-align: left; padding: .55rem .65rem; font-size: .76rem; color: #526350; }
.sheet tbody th { white-space: normal; }
.desk-steps .optional-note, .demo-note { font-size: .8rem; line-height: 1.55; color: #526350; }
.demo-note { max-width: 85ch; margin: 1rem 0 0; }
#answer-form { margin-top: 1rem; }
#answer-form label { display: block; font-size: .85rem; margin-bottom: .4rem; }
#answer-text { display: block; width: 100%; resize: vertical; padding: .7rem; margin-bottom: .6rem; border: 1px solid #939e87; background: #fffcf3; color: #283e30; font: inherit; }
.record-summary dd { overflow-wrap: anywhere; }
.chapter-work h2 { max-width: 17ch; }
.product-questions { max-width: 51rem; margin: 2.3rem 0; }
.product-questions details { border-top: 1px solid var(--rule); padding: 1.2rem 0; }
.product-questions details:last-child { border-bottom: 1px solid var(--rule); }
.product-questions summary { font: 400 clamp(1.55rem, 2.5vw, 2rem)/1.2 var(--serif); }
.product-questions p { max-width: 66ch; color: var(--muted); margin: 1rem 0 .2rem; }
@media (max-width: 880px) {
  .scenario-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 39rem; margin-inline: auto; }
  .episode { grid-template-columns: minmax(0, 1fr); max-width: 39rem; margin-inline: auto; }
  .handoff { margin-top: 0; min-height: 3.3rem; background-size: 1px 100%; }
  .handoff span { rotate: 90deg; }
  .intake { min-height: 12rem; }
}

@media (max-width: 395px) {
  .chapter-review { padding-inline: .85rem; }
  .episode { --stage-pad: .65rem; }
  .desk-heading, .desk-steps { padding-inline: .85rem; }
  .manager-body { padding-inline: .85rem; }
  .source-line { padding-left: .5rem; }
  .context-orbit { gap: .22rem; padding-right: .11rem; font-size: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .chapter-review *, .chapter-review *::before, .chapter-review *::after { animation: none !important; transition: none !important; }
  .motion-layer { display: none; }
}
