/* The job board (Careers). A straight-faced open roles list. As each row scrolls in,
   a small Pea hops in beside it and a rubber stamp thunks FILLED over the Apply button.
   The last row (Chief Pea Grower) has no Pea: only the stamp lands, so it reads as a person's job.
   Last beat: the sign flips from Hiring to Not hiring. The caption lives in the bar,
   under "Open roles", so the punchline is on screen while the board plays. */

.anim-jobs { --jobs-pea: 76px; --jobs-st: 240px; }
.anim-jobs .jobs__frame { max-width: 1040px; padding: 8px clamp(18px, 3vw, 34px) 10px; text-align: left; }

/* The bar along the top: title, two static filter labels, the sign */
.anim-jobs .jobs__bar { display: flex; align-items: center; gap: 14px; padding: 20px 0 18px; border-bottom: 1px solid var(--line); }
.anim-jobs .jobs__titles { display: grid; gap: 7px; flex: 1 1 auto; min-width: 0; }
.anim-jobs .jobs__title { margin: 0; font: 800 clamp(24px, 2.6vw, 30px)/1 var(--display); letter-spacing: -.035em; color: var(--ink); }
.anim-jobs .jobs__filters { display: flex; gap: 22px; margin-left: auto; margin-right: 10px; }
.anim-jobs .jobs__filters span { font: 600 14px/1 var(--body); color: var(--muted); white-space: nowrap; }
.anim-jobs .jobs__sign { position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 14px 8px 12px; border-radius: 999px; background: var(--pea-soft); color: var(--pea); font: 700 14px/1 var(--body); white-space: nowrap; transition: background .3s ease, color .3s ease; }
.anim-jobs .jobs__sign i { width: 8px; height: 8px; border-radius: 50%; background: var(--pea-hi); box-shadow: 0 0 0 4px rgba(111, 161, 74, .22); }
.anim-jobs .jobs__sign-off { display: none; }
.anim-jobs.is-ready.is-playing .jobs__sign i { animation: jobs-blink 1.4s ease-in-out infinite; }
.anim-jobs.is-done .jobs__sign, .anim-jobs:not(.is-ready) .jobs__sign { background: var(--brass-soft); color: var(--brass); }
.anim-jobs.is-done .jobs__sign i, .anim-jobs:not(.is-ready) .jobs__sign i { background: var(--brass); box-shadow: 0 0 0 4px rgba(138, 101, 38, .16); animation: none; }
.anim-jobs.is-done .jobs__sign-on, .anim-jobs:not(.is-ready) .jobs__sign-on { display: none; }
.anim-jobs.is-done .jobs__sign-off, .anim-jobs:not(.is-ready) .jobs__sign-off { display: inline; }
.anim-jobs.is-flip .jobs__sign { animation: jobs-sign .55s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes jobs-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes jobs-sign { 0% { transform: scale(.7) rotate(-6deg); } 60% { transform: scale(1.08) rotate(2deg); } 100% { transform: none; } }

/* The table */
.anim-jobs .jobs__head, .anim-jobs .jobs__row { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 1fr) var(--jobs-st); align-items: center; column-gap: 20px; }
.anim-jobs .jobs__meta { display: contents; }
.anim-jobs .jobs__head { padding: 16px 0 12px; font: 700 12px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.anim-jobs .jobs__list { margin: 0; padding: 0; list-style: none; }
.anim-jobs .jobs__row { position: relative; min-height: 94px; padding: 10px 0; border-top: 1px solid var(--line); }
.anim-jobs .jobs__role { font: 700 clamp(17px, 1.6vw, 19.5px)/1.2 var(--body); color: var(--ink); }
.anim-jobs .jobs__team, .anim-jobs .jobs__loc { font-size: 16px; color: var(--muted); }

/* The status cell: Apply underneath, Pea and the stamp on top */
.anim-jobs .jobs__st { position: relative; display: flex; align-items: center; justify-content: flex-end; height: var(--jobs-pea); }
.anim-jobs .jobs__apply { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px 10px 18px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line); font: 700 15px/1 var(--body); color: var(--ink); transition: opacity .25s ease .08s; }
.anim-jobs .jobs__apply svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.anim-jobs .jobs__pea { position: absolute; right: 136px; bottom: -8px; width: auto; height: var(--jobs-pea); opacity: 0; transform-origin: 50% 100%; filter: drop-shadow(0 8px 8px rgba(34, 56, 26, .18)); }
.anim-jobs .jobs__stamp { position: absolute; right: 5px; top: 50%; display: grid; justify-items: center; gap: 3px; min-width: 112px; margin-top: -26px; padding: 7px 12px 6px; border: 3px solid currentColor; border-radius: 9px; background: rgba(251, 252, 248, .9); color: var(--pea); text-transform: uppercase; opacity: 0; transform: rotate(-8deg);
  box-shadow: inset 0 0 0 2px rgba(251, 252, 248, .9), inset 0 0 0 3.5px currentColor;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='80'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.2 0 0 0 2.75'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='80'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.2 0 0 0 2.75'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"); }
.anim-jobs .jobs__stamp b { font: 800 22px/1 var(--display); letter-spacing: .1em; padding-left: .1em; }
.anim-jobs .jobs__stamp small { font: 800 11px/1.15 var(--body); letter-spacing: .12em; text-align: center; }
.anim-jobs .jobs__row--chief .jobs__stamp small { max-width: 13em; }
.anim-jobs .jobs__row--chief .jobs__stamp { margin-top: -31px; }
.anim-jobs .jobs__row--chief { min-height: 104px; }
/* The ink burst when a stamp lands */
.anim-jobs .jobs__st::after { content: ""; position: absolute; right: 40px; top: 50%; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%; border: 2px solid var(--pea-hi); opacity: 0; pointer-events: none; }

/* Without the script (or before it runs), show the board finished */
.anim-jobs:not(.is-ready) .jobs__pea { opacity: 1; }
.anim-jobs:not(.is-ready) .jobs__stamp { opacity: 1; }
.anim-jobs:not(.is-ready) .jobs__apply { opacity: 0; }

/* A row as it gets filled */
.anim-jobs .jobs__row.is-pea .jobs__pea { animation: jobs-pea .48s cubic-bezier(.3, 1.5, .5, 1) both; }
.anim-jobs .jobs__row.is-stamp .jobs__pea { animation: jobs-pea-hit .62s cubic-bezier(.3, 1.2, .5, 1) both; opacity: 1; }
.anim-jobs .jobs__row.is-stamp .jobs__stamp { animation: jobs-stamp .34s cubic-bezier(.55, 0, .75, .4) both; }
.anim-jobs .jobs__row.is-stamp .jobs__apply { opacity: 0; }
.anim-jobs .jobs__row.is-stamp { animation: jobs-thud .3s ease-out .24s both; }
.anim-jobs .jobs__row.is-stamp .jobs__st::after { animation: jobs-ring .5s ease-out .26s both; }
.anim-jobs .jobs__row.is-filled .jobs__pea, .anim-jobs .jobs__row.is-filled .jobs__stamp { opacity: 1; }

@keyframes jobs-pea {
  0% { opacity: 0; transform: translateY(34%) scale(.5); }
  55% { opacity: 1; transform: translateY(-6%) scale(.96, 1.06); }
  80% { transform: scale(1.04, .96); }
  100% { opacity: 1; transform: none; }
}
@keyframes jobs-pea-hit {
  0% { opacity: 1; transform: none; }
  30% { transform: translateY(-14%) rotate(-7deg) scale(.97, 1.04); }
  42% { transform: translateY(2%) scale(1.06, .93); }
  70% { transform: translateY(-9%) scale(.98, 1.03); }
  100% { opacity: 1; transform: none; }
}
@keyframes jobs-stamp {
  0% { opacity: 0; transform: translateY(-30px) scale(2.3) rotate(-20deg); }
  70% { opacity: 1; transform: scale(.93) rotate(-7deg); }
  100% { opacity: 1; transform: scale(1) rotate(-8deg); }
}
@keyframes jobs-thud { 0% { transform: translateY(0); } 30% { transform: translateY(2.5px); } 100% { transform: none; } }
@keyframes jobs-ring { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(2.6); } }

/* Gentler moves when the computer asks for reduced motion: it still plays, just softer */
.anim-jobs.is-gentle .jobs__row.is-pea .jobs__pea { animation: jobs-soft-pea .5s ease-out both; }
.anim-jobs.is-gentle .jobs__row.is-stamp .jobs__pea { animation: none; opacity: 1; }
.anim-jobs.is-gentle .jobs__row.is-stamp .jobs__stamp { animation: jobs-soft-stamp .4s ease-out both; }
.anim-jobs.is-gentle .jobs__row.is-stamp, .anim-jobs.is-gentle .jobs__row.is-stamp .jobs__st::after { animation: none; }
.anim-jobs.is-gentle.is-flip .jobs__sign { animation: none; }
@keyframes jobs-soft-pea { from { opacity: 0; transform: translateY(10%); } to { opacity: 1; transform: none; } }
@keyframes jobs-soft-stamp { from { opacity: 0; transform: scale(1.25) rotate(-8deg); } to { opacity: 1; transform: rotate(-8deg); } }

/* The control row shows from the first frame (the sound button lives there);
   only Watch again waits until the board has finished. The sound button stays centred
   under the board and Watch again appears beside it, so nothing jumps */
.anim-jobs .anim-ctl { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 44px; }
.anim-jobs .anim-ctl .snd-btn { grid-column: 2; grid-row: 1; }
.anim-jobs .anim-ctl [data-jobs-again] { grid-column: 3; grid-row: 1; justify-self: start; white-space: nowrap; }
.anim-jobs .anim-ctl > :only-child { grid-column: 2; }
.anim-jobs.is-ready [data-jobs-again] { visibility: hidden; }
.anim-jobs.is-played [data-jobs-again] { visibility: visible; animation: jobs-ctl .4s ease-out both; }
@keyframes jobs-ctl { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* The caption, under "Open roles" in the bar */
.anim-jobs .jobs__cap { min-height: 1.45em; margin: 0; text-align: left; font: 600 14px/1.45 var(--body); color: var(--muted); }
.anim-jobs.is-done .jobs__cap, .anim-jobs:not(.is-ready) .jobs__cap { color: var(--pea); font-weight: 700; }

/* Tablet */
@media (max-width: 900px) {
  .anim-jobs { --jobs-st: 210px; }
  .anim-jobs .jobs__filters { display: none; }
  .anim-jobs .jobs__sign { margin-left: auto; }
}

/* Phone: role on top, team and location under it, Pea and the stamp on the right */
@media (max-width: 640px) {
  .anim-jobs { --jobs-pea: 56px; --jobs-st: 142px; }
  .anim-jobs .jobs__frame { margin-top: 28px; padding: 2px 16px 6px; border-radius: 22px; }
  .anim-jobs .jobs__bar { padding: 16px 0 14px; gap: 10px; }
  .anim-jobs .jobs__title { font-size: 22px; }
  .anim-jobs .jobs__sign { padding: 7px 11px 7px 10px; font-size: 13px; }
  .anim-jobs .jobs__head { display: none; }
  .anim-jobs .jobs__row { grid-template-columns: minmax(0, 1fr); align-content: center; min-height: 84px; padding: 12px calc(var(--jobs-st) + 8px) 12px 0; }
  .anim-jobs .jobs__row:first-child { border-top: 0; }
  .anim-jobs .jobs__role { grid-column: 1; grid-row: 1; font-size: 16.5px; }
  .anim-jobs .jobs__meta { grid-column: 1; grid-row: 2; display: block; margin-top: 3px; font-size: 14px; line-height: 1.35; }
  .anim-jobs .jobs__team, .anim-jobs .jobs__loc { font-size: 14px; white-space: nowrap; }
  .anim-jobs .jobs__team::after { content: " \00b7"; }
  .anim-jobs .jobs__st { position: absolute; right: 0; top: 50%; width: var(--jobs-st); margin-top: calc(var(--jobs-pea) / -2); }
  .anim-jobs .jobs__apply { padding: 8px 12px 8px 14px; font-size: 13.5px; }
  .anim-jobs .jobs__pea { right: 93px; bottom: -4px; }
  .anim-jobs .jobs__row--chief { min-height: 96px; }
  .anim-jobs .jobs__row--guard .jobs__pea { right: 108px; }
  .anim-jobs .jobs__stamp { min-width: 86px; margin-top: -21px; padding: 5px 8px 4px; border-width: 2.5px; border-radius: 8px; }
  .anim-jobs .jobs__stamp b { font-size: 16.5px; }
  .anim-jobs .jobs__stamp small { font-size: 10px; letter-spacing: .08em; }
  /* the last row has no Pea, so its stamp can take the room: the small line runs to two lines */
  .anim-jobs .jobs__row--chief .jobs__stamp { margin-top: -28px; }
  .anim-jobs .jobs__row--chief .jobs__stamp small { max-width: 10.5em; }
  .anim-jobs .jobs__st::after { right: 28px; }
  .anim-jobs .jobs__bar { align-items: flex-start; }
  .anim-jobs .jobs__sign { margin-top: -2px; }
  .anim-jobs .jobs__cap { min-height: 2.9em; }
  /* no room for both beside a centred sound button: the sound button sits alone in the
     middle while the board plays, and the pair centres together once Watch again joins it */
  .anim-jobs .anim-ctl { display: flex; }
  .anim-jobs.is-ready:not(.is-played) [data-jobs-again] { display: none; }
}
