/* MOFE home page, piece 1: the hero. Copy on the left; MOFE's world on the paper stack on the
   right (below the copy on phones). Tokens come from ../DESIGN_SYSTEM/tokens.css. */

.hero {
  position: relative;
  border-bottom: 1px solid var(--line);
}

.hero-split {
  display: grid;
  gap: var(--space-48);
  padding-block: var(--space-40) var(--space-64);
}

@media (min-width: 1024px) {
  .hero-split {
    grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
    align-items: start;
    gap: 48px;
    padding-block: 44px 64px;
  }
}

.hero-copy {
  display: grid;
  justify-items: start;
  text-align: left;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 12px / 1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}

.eyebrow-mark {
  width: 22px;
  height: 22px;
  fill: var(--c-accent);
}

.hero-h1 {
  margin-top: var(--space-20);
  font-size: clamp(2.5rem, 0.9rem + 5.4vw, 4.5rem); /* 40px on phones, 72px on desktop */
}

.hero-lead {
  max-width: 30em;
  margin-top: var(--space-20);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
  margin-top: var(--space-32);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-14);
  font-weight: 500;
  color: var(--c-accent);
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hero-hiring {
  margin-top: var(--space-24);
}

.hero-points {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: var(--space-40) 0 0;
  padding: var(--space-20) 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.hero-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-14);
  color: var(--text-2);
}

.hero-points svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--c-ink);
}

@media (max-width: 479px) {
  .hero-actions {
    width: 100%;
  }
  .hero-actions .btn {
    flex: 1 1 100%;
  }
}

/* The paper stack: MOFE's signature shape, a sheet on sheets slightly askew ---------- */

.paper-stack {
  position: relative;
  isolation: isolate;
}

.sheet {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.sheet--b1,
.sheet--b2 {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--c-paper-2);
}

.sheet--b1 {
  transform: translate(10px, 10px) rotate(1.4deg);
}

.sheet--b1,
.sheet--b2,
.world {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 72px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 72px), transparent);
}

.sheet--b2 {
  transform: translate(-8px, 16px) rotate(-1.8deg);
}

/* MOFE's world --------------------------------------------------------------------- */

.world {
  position: relative;
  height: 700px;
  margin: 0;
  /* a faint ruled ground, like a ledger page */
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgb(0 0 0 / 0.035) 27px 28px);
  background-position: 0 13px;
}

.world-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  pointer-events: none;
}

.w-in,
.w-hub,
.w-out {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.w-in,
.w-hub {
  left: 10%;
}

.w-in {
  top: 96px;
}

.w-hub {
  top: 262px;
}

.w-out {
  top: 506px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  justify-items: center;
  padding-inline: 8px;
}

.world .tile,
.world .hub {
  top: auto;
  left: auto;
}

.world .tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--c-ink);
}

.world .tile svg {
  width: 24px;
  height: 24px;
}

.world .tile b {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  font: 500 12px / 1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--c-steel);
}

.world .tile--in b {
  top: auto;
  bottom: calc(100% + 8px);
}

/* The inbox's waiting count, one number visible at a time */
.w-count i {
  position: absolute;
  top: -9px;
  right: -9px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--c-mist);
  color: var(--c-steel);
  font: 500 11px / 18px var(--font-mono);
  font-style: normal;
  text-align: center;
  opacity: 0;
}

.world .hub {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  z-index: 5;
  width: 96px;
  height: 96px;
  border: 1px solid var(--c-black);
  border-radius: 16px;
  background: var(--c-black);
  color: var(--c-paper);
  outline: 0 solid transparent;
}

.world .hub svg {
  width: 40px;
  height: 40px;
  fill: currentColor;
}

.world .hub b {
  font: 500 11px / 1 var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--c-paper);
}

.world .hub-live {
  top: 9px;
  right: 9px;
}

.world .hub-live,
.world .hub-live::after {
  background: var(--c-paper);
}

/* Items pass under the inbox and MOFE's hub, so neither is ever covered */
.world .tile--in {
  z-index: 5;
}

/* A system shows a green status dot once its item has landed */
.tile-ok {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--c-paper);
  border-radius: 50%;
  background: var(--c-ok);
  opacity: 0;
}

.world.is-done .tile-ok {
  opacity: 1;
}

/* The parcel: the item travelling from the inbox down to MOFE */
.w-parcel {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  width: 12px;
  height: 9px;
  border-radius: 2px;
  background: var(--c-accent);
  offset-path: var(--path, none);
  offset-anchor: center;
  offset-rotate: 0deg;
  opacity: 0;
}

/* Counters and the stuck chip: several states in one place, one shown at a time */
.w-tick {
  display: inline-grid;
}

.w-tick > i {
  grid-area: 1 / 1;
  font-style: normal;
  opacity: 0;
}

.w-tick > i:last-child {
  opacity: 1;
}

.w-tray {
  position: absolute;
  left: 18px;
  top: 30px;
  z-index: 3;
  width: calc(55% - 30px - 22px - 18px);
  height: 196px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--c-paper-2);
}

.w-tray-title {
  position: absolute;
  top: 10px;
  left: 12px;
  font: 500 10px / 1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-fog);
}

/* the tray's front lip is its own layer, in front of the cast, so items sit inside the tray */
.w-tray-lip {
  position: absolute;
  left: 18px;
  top: 194px;
  width: calc(55% - 30px - 22px - 18px);
  z-index: 5;
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  background: var(--surface);
}

.w-tray-lip .w-tick {
  display: inline-grid;
}

/* the empty tray, designed: a tick and a plain line */
.w-tray-empty {
  position: absolute;
  inset: 0 0 32px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--c-ink);
}

.w-tray-empty svg {
  width: 26px;
  height: 26px;
  padding: 5px;
  border: 1px solid var(--c-smoke);
  border-radius: 50%;
  background: var(--surface);
  color: var(--c-ok);
}

.w-tray-empty b {
  font-weight: 500;
}

.world .char {
  z-index: 4;
}

.w-stuck > i {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 10.5px / 1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--c-ink);
}

.w-stuck .dot {
  width: 7px;
  height: 7px;
}

/* Beside MOFE: who approves, and the rules it follows */
.w-side {
  top: 236px;
  width: 200px;
  padding: 10px 12px 12px;
}

.w-approve {
  left: calc(55% - 48px - 22px - 200px);
  transform: rotate(-1.5deg);
}

.w-rules {
  left: calc(55% + 48px + 22px);
  transform: rotate(1.2deg);
}

/* The inbox as it arrives: four new emails, each read as MOFE picks it up */
.w-mail {
  top: 34px;
  left: calc(55% + 30px + 22px);
  width: calc(45% - 30px - 22px - 14px);
  padding: 10px 12px 10px;
  transform: rotate(1.6deg);
}

.w-mail .ui-head {
  display: flex;
  margin-bottom: 4px;
}

.w-mail-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.w-mail-list li {
  display: grid;
  grid-template-columns: 6px 1fr auto;
  column-gap: 8px;
  align-items: center;
  padding: 5px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.3;
}

.w-mail-list b {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.w-mail-list span {
  color: var(--c-steel);
  white-space: nowrap;
}

.w-unread {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-ink);
  opacity: 0;
}

.w-side .ui-head {
  display: flex;
  margin-bottom: 6px;
}

.w-items {
  display: grid;
}

.w-item {
  grid-area: 1 / 1;
  display: grid;
  gap: 4px;
  font-size: 12.5px;
  opacity: 0;
}

.w-item:last-child {
  opacity: 1;
}

.w-item b {
  font-weight: 500;
}

/* the approval states fade on their own timeline (world.js), so both stay renderable */
.w-item .swap > * {
  visibility: visible;
}

.w-item .swap span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--c-ink);
}

.w-rule-list {
  display: grid;
  gap: 0;
  margin: 0 -6px;
  padding: 0;
  list-style: none;
}

.w-rule-list li {
  padding: 3px 6px;
  border-radius: var(--radius-input);
  font-size: 12.5px;
  color: var(--c-ink);
}

/* MOFE's log of today's work, under the copy (after the world on phones) */
.hero-log {
  position: relative;
  left: auto;
  top: auto;
  width: 100%;
  margin: var(--space-40) 0 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), rgb(0 0 0 / 0.25));
  mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), rgb(0 0 0 / 0.25));
}

.w-log .ui-head {
  display: flex;
}

.w-log .log li {
  grid-template-columns: 8px 40px 1fr 14px;
  color: var(--c-ink);
}

.log-time {
  font: 500 11px var(--font-mono);
  color: inherit;
}

.log-earlier {
  display: block !important;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font: 500 10px / 1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-fog);
}

.log-old {
  color: var(--c-steel);
}

.w-log .log li time {
  color: inherit;
}

.log-check {
  width: 14px;
  height: 14px;
  color: var(--c-ok);
}

.log-chip {
  width: 8px;
  height: 8px;
  border: 1px solid rgb(0 0 0 / 0.12);
  border-radius: 2px;
  align-self: center;
}

.log-chip--blue {
  background: var(--c-tint-blue);
}

.log-chip--pink {
  background: var(--c-tint-pink);
}

.log-chip--lilac {
  background: var(--c-tint-lilac);
}

.log-chip--cream {
  background: var(--c-tint-cream);
}

/* The cast in the world: hidden without JavaScript (they need their routes) */
.world .char {
  display: none;
  z-index: 4;
  --ow: 0.79;
  --dw: 0.53;
  --mw: 0.74;
}

.js .world .char {
  display: block;
}

.world .char--envelope {
  width: 114px;
  height: 91px;
  --paper: var(--c-tint-blue);
}

.world .char--slip {
  width: 84px;
  height: 106px;
  --paper: var(--c-tint-pink);
}

.world .char--sheet {
  width: 99px;
  height: 99px;
  --paper: var(--c-tint-lilac);
}

.world .char--cal {
  width: 99px;
  height: 114px;
  --paper: var(--c-tint-cream);
}

/* Reduced motion: the finished state, every item landed */
.world.is-done .w-log li {
  color: var(--c-ink);
}

/* Phones: copy first, then the world, sized for a narrow screen ------------------- */

@media (max-width: 760px) {
  .hero-split {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding-block: var(--space-16) var(--space-56);
  }
  .hero-copy {
    display: contents;
  }
  .hero-copy > * {
    order: 0;
  }
  .hero-stack {
    order: 1;
    align-self: stretch;
    margin-top: var(--space-32);
  }
  /* phones: the scene comes straight after the buttons; the hiring link and the log follow it */
  .hero-hiring {
    order: 2;
    margin-top: var(--space-32);
  }
  .hero-log {
    order: 3;
    margin-top: var(--space-24);
  }
  .hero-points {
    margin-top: var(--space-32);
  }
  .sheet--b1 {
    transform: translate(4px, 8px) rotate(1deg);
  }
  .sheet--b2 {
    transform: translate(-3px, 12px) rotate(-1.2deg);
  }
  .world {
    height: 640px;
  }
  .w-tray {
    left: 10px;
    top: 14px;
    width: auto;
    right: 10px;
    height: 138px;
  }
  .w-tray-lip {
    left: 10px;
    right: 10px;
    top: 124px;
    width: auto;
    height: 28px;
  }
  .w-in,
  .w-hub {
    left: 0;
  }
  /* the tray is above the inbox on phones, so its label sits beside it */
  .world .tile--in b {
    top: 50%;
    bottom: auto;
    left: calc(100% + 10px);
    transform: translateY(-50%);
  }
  .w-in {
    top: 186px;
  }
  .w-hub {
    top: 290px;
  }
  .w-out {
    top: 540px;
    padding-inline: 0;
  }
  .world .tile {
    width: 48px;
    height: 48px;
  }
  .world .tile svg {
    width: 20px;
    height: 20px;
  }
  .world .tile b {
    font-size: 10.5px;
    letter-spacing: 0.03em;
  }
  .world .hub {
    width: 80px;
    height: 80px;
    gap: 6px;
  }
  .w-mail {
    display: none;
  }
  .w-stuck > i {
    font-size: 10px;
  }
  .world .hub svg {
    width: 32px;
    height: 32px;
  }
  .w-side {
    top: 272px;
    width: 124px;
    padding: 8px 9px 10px;
  }
  .w-approve {
    left: calc(50% - 40px - 6px - 124px);
    width: 124px;
  }
  .w-rules {
    left: calc(50% + 40px + 6px);
    width: 124px;
  }
  .w-rule-list {
    gap: 0;
  }
  .w-rule-list li {
    padding-block: 3px;
  }
  .w-side .ui-src svg {
    display: none;
  }
  .w-side .ui-meta {
    display: none;
  }
  .w-item,
  .w-rule-list li {
    font-size: 11px;
  }
  .w-item .swap span {
    font-size: 10.5px;
  }
  .world .char {
    --ow: 1.07;
    --dw: 0.71;
    --mw: 1;
  }
  .world .char--envelope {
    width: 84px;
    height: 67px;
  }
  .world .char--slip {
    width: 62px;
    height: 78px;
  }
  .world .char--sheet {
    width: 73px;
    height: 73px;
  }
  .world .char--cal {
    width: 73px;
    height: 84px;
  }
}
