/* MOFE home page, piece 3: the three job sections.
   Dub's anatomy (label, H2, lead, button; then a band holding a visual and three feature columns),
   drawn in MOFE's grammar: the job's inbox and the client's rules on the left, MOFE's hub and its
   activity in the middle, the result on a paper stack and the system it lands in on the right, and
   the job's character travelling inbox -> MOFE -> result as the columns take turns. */

.job {
  --sh: 290px; /* the result stack's height; jobs.js sets it to the tallest card */
  --tint: var(--c-tint-blue);
  --tag0: var(--c-stuck);
  border-bottom: 1px solid var(--line);
}

.job--slip {
  --tint: var(--c-tint-pink);
}

.job--sheet {
  --tint: var(--c-tint-lilac);
}

/* The head: label, title, lead, one outlined button */
.job-head {
  padding-block: var(--space-96) var(--space-56);
}

.job-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 var(--space-16);
  font-size: var(--text-14);
  font-weight: 500;
  color: var(--c-ink);
}

.job-chip {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-input);
  background: var(--tint);
  box-shadow: inset 0 0 0 1px rgb(23 23 23 / 0.14);
}

.job-chip svg {
  width: 12px;
  height: 12px;
  overflow: visible;
  --paper: var(--tint);
  --ow: 5;
  --dw: 4;
  --mw: 5;
  --tag: transparent;
  --flat: 0;
  --smile: 0;
}

.job-lead {
  max-width: 620px;
  margin-top: var(--space-16);
}

.job-btn {
  margin-top: var(--space-32);
}

/* The band: a quiet grey panel inside the page column */
.job-band {
  border-top: 1px solid var(--line);
}

.job-band-in {
  max-width: var(--rules);
  margin-inline: auto;
  overflow: clip;
  padding: 92px var(--gutter) 0;
  background: var(--c-paper-2);
}

/* The visual */
.job-visual {
  position: relative;
  width: 1040px;
  height: calc(var(--sh) + 144px);
  margin-inline: auto;
}

.job-visual::before {
  content: "";
  position: absolute;
  inset: -56px -48px -8px;
  background-image: radial-gradient(rgb(0 0 0 / 0.08) 1px, transparent 1.3px);
  background-size: 16px 16px;
  -webkit-mask-image: radial-gradient(ellipse 58% 60% at 50% 45%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 58% 60% at 50% 45%, #000 30%, transparent 100%);
  pointer-events: none;
}

.jv-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.job-visual .ui {
  left: auto;
  top: auto;
  width: auto;
}

/* The job's inbox: the email being handled in the job's tint; the last rows dissolve */
.job-visual .jv-src {
  position: absolute;
  left: 0;
  top: 40px;
  width: 340px;
  height: var(--sh);
  overflow: hidden;
  z-index: 2;
  -webkit-mask-image: linear-gradient(#000 55%, transparent 88%);
  mask-image: linear-gradient(#000 55%, transparent 88%);
}

.jv-src .mail-row.is-hot {
  background: var(--tint);
}

/* The client's own rules, laid over the foot of the inbox */
.job-visual .jv-rules {
  position: absolute;
  left: 28px;
  top: calc(40px + var(--sh) - 16px);
  width: 236px;
  z-index: 3;
  transform: rotate(-2deg);
}

.jv-rule-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jv-rule-list li {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--c-paper-2);
  font-size: 12px;
  color: var(--c-slate);
}

/* MOFE in the middle: the hub, and what it has done today */
.jv-mid {
  position: absolute;
  left: 380px;
  top: 40px;
  width: 220px;
  height: var(--sh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 3;
}

.jv-mid::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 96px;
  bottom: 20px;
  width: 1px;
  background: var(--c-smoke);
}

.jv-hub {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  width: 96px;
  height: 96px;
  border-radius: 16px;
  background: var(--c-black);
  color: var(--c-paper);
}

.jv-hub svg {
  width: 40px;
  height: 40px;
  fill: currentColor;
}

.jv-hub b {
  font: 500 11px / 1 var(--font-mono);
  letter-spacing: 0.08em;
}

.jv-hub .hub-live {
  top: 10px;
  right: 10px;
}

.jv-hub .hub-live,
.jv-hub .hub-live::after {
  background: var(--c-paper);
}

.job-visual .jv-log {
  position: relative;
  flex: none;
  width: 220px;
  padding: 10px 12px 12px;
}

.jv-log .ui-head {
  min-height: 0;
  margin-bottom: 6px;
}

.jv-lines {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jv-line {
  display: grid;
  grid-template-columns: 12px 36px minmax(0, 1fr);
  align-items: start;
  gap: 4px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--c-silver);
  transition: color 0.3s var(--ease);
}

.jv-line time {
  font: 500 10.5px / 1.5 var(--font-mono);
}

.jv-tick {
  width: 12px;
  height: 12px;
  margin-top: 1px;
  color: var(--c-ok);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.jv-line.is-done {
  color: var(--c-steel);
}

.jv-line.is-done .jv-tick {
  opacity: 1;
}

.jv-line.is-now {
  color: var(--c-ink);
  font-weight: 500;
}

.jv-line.is-now time {
  color: var(--c-ink);
}

/* The result, on a paper stack: one card per column, crossfading */
.jv-stack {
  position: absolute;
  left: 640px;
  top: 40px;
  width: 400px;
  min-height: 272px; /* room for MOFE's hub and activity card beside it */
  display: grid;
  z-index: 2;
}

.jv-stack::before,
.jv-stack::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  -webkit-mask-image: linear-gradient(#000 40%, transparent 100%);
  mask-image: linear-gradient(#000 40%, transparent 100%);
}

.jv-stack::before {
  transform: translate(12px, 10px) rotate(2deg);
}

.jv-stack::after {
  transform: translate(-8px, 14px) rotate(-1.4deg);
}

/* All cards share one grid cell, so the stack is as tall as its tallest card */
.job-visual .jv-card {
  position: relative;
  grid-area: 1 / 1;
  z-index: 1;
}

.jv-card {
  opacity: 0;
  visibility: hidden;
  filter: blur(4px);
  transition: opacity 0.3s var(--ease), filter 0.3s var(--ease), visibility 0s linear 0.3s;
}

.jv-card.is-on {
  opacity: 1;
  visibility: visible;
  filter: none;
  transition-delay: 0s;
}

/* The system the work lands in: lights green when it has landed */
.jv-sys {
  position: absolute;
  left: 360px;
  top: calc(var(--sh) - 34px);
  z-index: 4;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.jv-sys svg {
  width: 22px;
  height: 22px;
  color: var(--c-ink);
}

.jv-sys b {
  font: 500 9px / 1 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--c-steel);
}

.jv-sys {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ease) 0.3s, transform 0.4s var(--ease) 0.3s;
}

.jv-sys-ok {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-ok);
}

.job[data-active="2"] .jv-sys {
  opacity: 1;
  transform: none;
}

/* Inside the result cards */
.jv-list {
  display: grid;
  margin: 14px -14px 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.jv-list li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.jv-list li:last-child {
  border-bottom: 0;
}

.jv-list span {
  color: var(--c-steel);
}

.jv-list time {
  font: 500 10.5px var(--font-mono);
  color: var(--c-fog);
}

.jv-list li.jv-hot,
.jv-hot td,
.jv-card .cal-event.jv-hot {
  background: var(--tint);
}

.jv-card .cal-event.jv-hot {
  border-left-color: var(--c-ink);
}

.jv-card .ui-body.jv-hot {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-input);
  background: var(--tint);
}

.jv-pdf p.jv-hot {
  margin: 0 -6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--tint);
  color: var(--c-ink);
}

.jv-card .ui-to.jv-cc {
  color: var(--c-steel);
  font-weight: 400;
}

.jv-fine.jv-fine--top {
  margin: 0 0 8px;
}

.jv-old {
  color: var(--c-fog);
}

/* The tracker row MOFE has just changed, shown above the diary */
.jv-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  font-size: 12px;
}

.jv-strip .mono {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--c-fog);
}

.jv-newv {
  font-weight: 600;
  color: var(--c-ink);
}

.jv-pdf {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--c-paper-2);
  font-size: 12px;
  color: var(--c-slate);
}

.jv-pdf p {
  margin: 0;
}

.jv-pdf .jv-pdf-h {
  margin-bottom: 2px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--c-ink);
}

.jv-pdf-from {
  color: var(--c-fog);
}

.jv-fine {
  margin-top: 12px;
  color: var(--c-fog);
}

.jv-gap {
  margin-top: 12px;
}

.jv-sent {
  display: flex;
  margin-top: 12px;
}

.jv-card .ui-note {
  margin-top: 14px;
}

.jv-card .cal-event {
  margin-top: 12px;
}

.jv-card .ui-to + .ui-to {
  margin-top: 2px;
  color: var(--c-ink);
  font-weight: 500;
}

/* The job's character: stuck on the inbox, being handled above MOFE, then perched on the result */
.job--env {
  --ax: 150px;
  --ay: -59px;
  --hx: 266px;
  --bx: 706px;
}

.job--slip {
  --ax: 180px;
  --ay: -77px;
  --hx: 257px;
  --bx: 718px;
}

.job--sheet {
  --ax: 160px;
  --ay: -71px;
  --hx: 266px;
  --bx: 716px;
}

.jv-char {
  position: absolute;
  z-index: 6;
  overflow: visible;
  left: var(--ax);
  top: var(--ay);
  --tag: var(--tag0);
  --flat: 1;
  --smile: 0;
  transform: rotate(-7deg);
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.job--env .jv-char {
  width: 148px;
  height: 118px;
  --paper: var(--c-tint-blue);
  --ow: 0.61;
  --dw: 0.41;
  --mw: 0.57;
}

.job--slip .jv-char {
  width: 106px;
  height: 135px;
  --paper: var(--c-tint-pink);
  --ow: 0.62;
  --dw: 0.42;
  --mw: 0.58;
}

.job--sheet .jv-char {
  width: 128px;
  height: 128px;
  --paper: var(--c-tint-lilac);
  --ow: 0.61;
  --dw: 0.41;
  --mw: 0.57;
}

.job[data-active="1"] .jv-char {
  --tag: var(--c-watch);
  transform: translate(var(--hx), -16px) rotate(-3deg);
}

/* Phones use one still copy of the character per stage */
.jv-ph {
  display: none;
}

.job[data-active="2"] .jv-char {
  --tag: var(--c-ok);
  --flat: 0;
  --smile: 1;
  transform: translateX(var(--bx)) rotate(0deg);
}

/* Feature columns: three, divided by hairlines; the active one drives the visual */
.job-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 1040px;
  margin: var(--space-40) auto 0;
}

.job-col {
  position: relative;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 0 24px var(--space-48);
  border-left: 1px solid var(--line);
}

.job-col::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 0;
  width: 1px;
  height: calc(100% - var(--space-48) + 8px);
  background: var(--c-ink);
  transform: scaleY(0);
  transform-origin: top;
}

.job-col.is-active::before {
  animation: col-fill 5.5s linear forwards;
}

.job.is-paused .job-col.is-active::before {
  animation-play-state: paused;
}

@keyframes col-fill {
  to {
    transform: scaleY(1);
  }
}

.job-col-pick {
  display: grid;
  gap: 8px;
  justify-items: start;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.job-col-pick:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 6px;
  border-radius: 4px;
}

.job-col-ic {
  width: 16px;
  height: 16px;
  margin-bottom: 4px;
  color: var(--c-silver);
  fill: none;
  transition: color 0.25s var(--ease);
}

.job-col-title {
  font-size: var(--text-18);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--c-fog);
  transition: color 0.25s var(--ease);
}

@media (min-width: 768px) {
  .job-col-title {
    font-size: var(--text-20); /* the lead's size from here up */
  }
}

.job-col-body {
  font-size: var(--text-16);
  line-height: 1.5;
  color: var(--c-silver);
  transition: color 0.25s var(--ease);
}

.job-col-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-self: start;
  font-size: var(--text-14);
  font-weight: 500;
  color: var(--c-silver);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

.job-col-pick:hover .job-col-title,
.job-col-pick:hover .job-col-ic {
  color: var(--c-steel);
}

.job-col.is-active .job-col-ic,
.job-col.is-active .job-col-title {
  color: var(--c-ink);
}

.job-col.is-active .job-col-body {
  color: var(--c-steel);
}

.job-col.is-active .job-col-link {
  color: var(--c-accent);
}

/* Frozen frames (?t=): the bar shows how far through its turn the column is */
.is-still .job-col.is-active::before {
  animation: none;
  transform: scaleY(var(--p, 0.5));
}

.is-still .jv-char,
.is-still .jv-ph,
.is-still .jv-sys,
.is-still .jv-card,
.is-still .jv-line,
.is-still .jv-tick,
.is-still .jv-sys-ok {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .job-col.is-active::before {
    animation: none;
    transform: scaleY(1);
  }
  .jv-char,
  .jv-card,
  .jv-line,
  .jv-tick,
  .jv-sys-ok {
    transition: none;
  }
}

/* Below the visual's width: the picture stacks, inbox, MOFE, result */
@media (max-width: 1079px) {
  .job-head {
    padding-block: var(--space-64) var(--space-40);
  }
  .job-visual {
    width: auto;
    max-width: 480px;
    height: auto;
    display: flex;
    flex-direction: column;
  }
  .jv-links,
  .job-visual .flow,
  .jv-char {
    display: none;
  }
  .jv-sys {
    left: auto;
    right: -4px;
    top: auto;
    bottom: -46px;
  }
  .job-visual .jv-rules {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    margin: -32px 28px 0;
  }
  .job-visual .jv-src {
    position: relative;
    top: auto;
    width: auto;
    height: 250px;
  }
  .jv-mid {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    padding: 96px 0 88px;
  }
  .jv-mid::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--c-smoke);
  }
  .jv-hub {
    width: 80px;
    height: 80px;
  }
  .jv-hub svg {
    width: 34px;
    height: 34px;
  }
  .job-visual .jv-log {
    width: 100%;
    max-width: 300px;
  }
  .jv-stack {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    margin: 0 8px 40px;
    z-index: 4;
  }
  .jv-ph {
    display: block;
    position: absolute;
    z-index: 6;
    right: 8px;
    overflow: visible;
    opacity: 0;
    transition: opacity 0.3s var(--ease);
    --flat: 1;
    --smile: 0;
  }
  .jv-ph.is-on {
    opacity: 1;
  }
  .jv-ph--0 {
    --tag: var(--c-stuck);
    transform: rotate(-7deg);
  }
  .jv-ph--1 {
    right: auto;
    left: 50%;
    --tag: var(--c-watch);
    transform: translateX(-50%) rotate(-3deg);
  }
  .jv-ph--2 {
    --tag: var(--c-ok);
    --flat: 0;
    --smile: 1;
  }
  .job--env .jv-ph {
    width: 112px;
    height: 89px;
    --paper: var(--c-tint-blue);
    --ow: 0.8;
    --dw: 0.54;
    --mw: 0.75;
  }
  .job--slip .jv-ph {
    width: 80px;
    height: 102px;
    --paper: var(--c-tint-pink);
    --ow: 0.83;
    --dw: 0.55;
    --mw: 0.77;
  }
  .job--sheet .jv-ph {
    width: 96px;
    height: 96px;
    --paper: var(--c-tint-lilac);
    --ow: 0.81;
    --dw: 0.54;
    --mw: 0.76;
  }
  .job--env .jv-ph--0,
  .job--env .jv-ph--2 {
    top: -76px;
  }
  .job--slip .jv-ph--0,
  .job--slip .jv-ph--2 {
    top: -88px;
  }
  .job--sheet .jv-ph--0,
  .job--sheet .jv-ph--2 {
    top: -82px;
  }
  .job--env .jv-ph--1 {
    top: 20px;
  }
  .job--slip .jv-ph--1 {
    top: 6px;
  }
  .job--sheet .jv-ph--1 {
    top: 11px;
  }
  .job-cols {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin-top: var(--space-32);
    padding-bottom: var(--space-24);
  }
  .job-col {
    gap: 8px;
    padding: 16px 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .job-col::before {
    left: 0;
    top: -1px;
    width: 100%;
    height: 1px;
    transform: scaleX(0);
    transform-origin: left;
  }
  .job-col.is-active::before {
    animation-name: col-fill-x;
  }
  .is-still .job-col.is-active::before {
    transform: scaleX(var(--p, 0.5));
  }
  .job-col-ic {
    display: none;
  }
  .job-col:not(.is-active) .job-col-body,
  .job-col:not(.is-active) .job-col-link {
    display: none;
  }
}

@keyframes col-fill-x {
  to {
    transform: scaleX(1);
  }
}
