/* Home page extras. Loaded after style.css, only on the home page.

   1. The hand-drawn horizon line across the top, with the escaped "Birthday Boy" balloon.
      Three traced SVG pieces sit side by side in .ahl. Only the middle piece (.ahl-b) stretches,
      so the balloon keeps its size at any screen width.
   2. The rat line above the footer (.ahf): the rat on the left plus a stretchy hand-drawn line.
   3. The chat monkey (.ahb). Its behaviour is in js/monkey.js.
   4. The balloon you can grab, and the rat who's happy to get it. Behaviour in js/balloon.js (desktop only).
*/

/* 1. Horizon line with the balloon ------------------------------------------------------------ */
.ahl {
  display: flex;
  align-items: flex-start;
  column-gap: 36px;
  width: 100%;
  height: 150px;
  margin-bottom: -70px;
  overflow: hidden;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  color: inherit;
}
.ahl svg {
  height: 100%;
  fill: currentColor;
}
.ahl-a {
  display: block;
  flex: 0 0 auto;
  width: auto;
}
.ahl-b {
  display: block;
  flex: 1 1 0%;
  min-width: 0;
}
.ahl-c {
  display: block;
  flex: 0 0 auto;
  width: auto;
}
@media (max-width: 991px) {
  .ahl {
    height: 130px;
    column-gap: 26px;
    margin-bottom: -50px;
  }
}
@media (max-width: 767px) {
  .ahl {
    height: 108px;
    column-gap: 18px;
    margin-bottom: -28px;
  }
  .ahl-c {
    display: none;
  }
}
@media (max-width: 479px) {
  .ahl {
    height: 88px;
    column-gap: 12px;
    margin-bottom: -8px;
  }
}

/* 2. Rat line above the footer ---------------------------------------------------------------- */
.ahf-wrap {
  display: flow-root; /* keeps the rat line's margins inside this box, so the spacing below it matches the Webflow version */
}
.ahf {
  display: flex;
  align-items: stretch;
  width: auto;
  height: 100px;
  margin: -56px calc(50% - 50vw) 12px;
  color: inherit;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.ahf svg {
  display: block;
  height: 100%;
  fill: currentColor;
}
.ahf-rat {
  flex: 0 0 auto;
  width: auto;
}
.ahf-run {
  flex: 1 1 0%;
  min-width: 0;
}
@media (max-width: 991px) {
  .ahf {
    height: 86px;
    margin-top: -48px;
  }
}
@media (max-width: 767px) {
  .ahf {
    height: 74px;
    margin-top: -40px;
    margin-bottom: 10px;
  }
}
@media (max-width: 479px) {
  .ahf {
    height: 62px;
    margin-top: -34px;
    margin-bottom: 8px;
  }
}

/* 3. Chat monkey ------------------------------------------------------------------------------ */
/* He sits loose on the page, no card. On wide screens he sits in the empty right-hand margin beside the
   work (the work column is 1100px wide); where there's no margin he goes small in the bottom-right corner.
   He fades out once the footer comes into view (js/monkey.js adds .is-away), unless you're mid-chat.
   The frames in images/site/monkey/ are cropped to the drawing, so the picture runs his full width. */
.wf-bot {
  --ahb-w: 120px;
  max-width: none !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  inset: auto 16px 16px auto !important;
  transition:
    opacity 0.45s ease,
    visibility 0.45s;
}
.wf-bot.is-away {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
@media (min-width: 1400px) {
  .wf-bot {
    --ahb-w: clamp(110px, calc((100vw - 1100px) / 2 - 40px), 190px);
    inset: auto calc((100vw - 1100px) / 4 - var(--ahb-w) / 2) 24px auto !important;
  }
}
.ahb {
  --ahb-ink: currentColor;
  position: relative;
  container-type: inline-size;
  width: var(--ahb-w);
  max-width: calc(100vw - 24px);
  padding: 6px;
  background: var(--page-bg, #fff);
  border-radius: 12px; /* soft rounded edge for when he sits over the work, no border, no shadow */
  transition: width 0.28s ease;
  font-family: "Space Mono", "Courier New", monospace;
  color: inherit;
  text-align: center;
  line-height: 1.45;
}
.ahb.is-open {
  width: 300px;
  padding: 16px 10px 10px;
}
.ahb-stage {
  position: relative;
  display: block;
  width: 100%;
}
.ahb-scene {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 470;
  cursor: pointer;
  margin: 0 auto;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.ahb-h {
  font-family: "Hand 1 Latin", "Courier New", monospace;
  font-size: calc(var(--ahb-w) * 0.106); /* scales with his width so it always fits on one line */
  line-height: 1.15;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  margin: 5px 0 1px;
}
.ahb-sub {
  font-size: max(8px, calc(var(--ahb-w) * 0.046));
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  margin: 0;
  opacity: 0.5;
}
.ahb-tap {
  display: none;
}
@media (hover: none) {
  .ahb-click {
    display: none;
  }
  .ahb-tap {
    display: inline;
  }
}
.ahb.is-open .ahb-h,
.ahb.is-open .ahb-sub {
  display: none;
}
.ahb-close {
  position: absolute;
  top: -2px;
  right: 0;
  z-index: 2;
  display: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: 18px/26px "Space Mono", "Courier New", monospace;
  cursor: pointer;
  opacity: 0.5;
}
.ahb-close:hover,
.ahb-close:focus-visible {
  opacity: 1;
}
.ahb.is-open .ahb-close {
  display: block;
}
.ahb-bubble {
  position: relative;
  margin: 0 0 8px;
  border: 1.5px solid var(--ahb-ink);
  border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
  background: #fff;
  color: #000;
  padding: 9px 12px;
  font-size: 11px;
  line-height: 1.5;
  text-align: left;
  max-height: min(170px, 34vh);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 2px 0 var(--ahb-ink);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: none;
  display: none;
  overscroll-behavior: contain;
}
.ahb-bubble.is-on {
  display: block;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.ahb-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: #fff;
  transform: rotate(45deg);
  border-right: 1.5px solid var(--ahb-ink);
  border-bottom: 1.5px solid var(--ahb-ink);
}
.ahb-form {
  display: none;
  gap: 6px;
  margin-top: 8px;
}
.ahb.is-open .ahb-form {
  display: flex;
}
.ahb-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 8px 11px;
  font: inherit;
  font-size: 11px;
  color: #000;
  background: #fff;
  border: 1.5px solid var(--ahb-ink);
  border-radius: 15px 225px 15px 255px/255px 15px 225px 15px;
  box-shadow: 2px 2px 0 var(--ahb-ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.ahb-input::placeholder {
  color: #9a9a9a;
}
.ahb-send {
  flex: 0 0 auto;
  padding: 8px 12px;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  color: #fff;
  background: #000;
  border: 1.5px solid var(--ahb-ink);
  border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
  box-shadow: 2px 2px 0 var(--ahb-ink);
  transition:
    transform 0.12s,
    box-shadow 0.12s;
}
.ahb-send:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ahb-ink);
}
.ahb-send[disabled] {
  opacity: 0.55;
  cursor: default;
}
@media (max-width: 767px) {
  .wf-bot {
    --ahb-w: 100px;
    inset: auto 10px 10px auto !important;
  }
  .ahb.is-open {
    width: calc(100vw - 20px);
  }
  .ahb-bubble {
    max-height: 32vh;
  }
  .ahb-input {
    font-size: 16px; /* 16px or more stops phones zooming in when you tap the box */
    padding: 9px 12px;
  }
  .ahb-send {
    padding: 9px 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wf-bot,
  .ahb,
  .ahb-bubble {
    transition: none;
  }
}

/* 4. The balloon ------------------------------------------------------------------------------ */
/* js/balloon.js adds .has-balloon on desktop. Then the header shows .ahl-live (the line with the
   balloon cut out, patched behind it) and the balloon itself is drawn on a canvas over the page.
   Phones and tablets never get .has-balloon, so they keep the original drawing (.ahl-drawn). */
.ahl-live {
  display: none;
}
.has-balloon .ahl-drawn {
  display: none;
}
.has-balloon .ahl-live {
  display: inline;
}
.ahl-shadow {
  transition: opacity 0.6s ease;
}
.balloon-away .ahl-shadow {
  opacity: 0;
}
.bln-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  pointer-events: none;
}
.bln-hover,
.bln-hover * {
  cursor: grab !important;
}
.bln-drag,
.bln-drag * {
  cursor: grabbing !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}
/* The rat: while he's holding the balloon his eyes go happy and his frown turns up into a smile.
   Take it off him and he's back to the frown. */
.rat-joy,
.rat-eyes,
.rat-sad {
  transition: opacity 0.15s;
}
.rat-joy {
  opacity: 0;
}
.rat-happy .rat-joy {
  opacity: 1;
}
.rat-happy .rat-eyes,
.rat-happy .rat-sad {
  opacity: 0;
}

