/* Max's help (assets/home/maxhelp.js): the panel the corner Max opens.
   Desktop: a chat-style panel in the bottom right corner, where the launcher
   sits (he steps away while it is open, as in the app). Phones: a bottom sheet.
   Max is transparent video (max.css), so he floats on the panel's solid dark
   ground; nothing here expects a black disc behind him. */
.mh {
  --mh-grad: linear-gradient(135deg, #7427c8 0%, #8f3cfa 45%, #e43ffb 100%);
  --mh-ground: #16121f;
  position: fixed; z-index: 80; right: var(--ml-right, 22px); bottom: var(--ml-bottom, 22px);
  width: min(400px, calc(100vw - 2 * var(--ml-right, 22px))); max-height: min(660px, calc(100vh - var(--ml-bottom, 22px) - 24px));
  display: flex; flex-direction: column;
  border: 1px solid transparent; border-radius: var(--r-lg, 20px);
  background:
    radial-gradient(120% 70% at 12% 0%, rgb(143 60 250 / .16), rgb(143 60 250 / 0) 62%) padding-box,
    linear-gradient(var(--mh-ground), var(--mh-ground)) padding-box,
    var(--mh-grad) border-box;
  box-shadow: 0 30px 80px -24px rgb(0 0 0 / .8), 0 12px 40px -18px rgb(228 63 251 / .28);
  color: var(--sc-ink); font-family: var(--sc-font-text); font-size: 16px; line-height: 1.5;
  text-align: left;
}
.mh[hidden] { display: none; }
.mh:focus { outline: none; }
.mh__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.mh__grab { display: none; }
.mh__close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: var(--sc-ink-soft);
  transition: background-color 160ms, color 160ms;
}
.mh__close svg { width: 18px; height: 18px; }
.mh__close:hover { background: rgb(243 240 250 / .08); color: var(--sc-ink); }
.mh__scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 8px; }

/* Max and his words */
.mh__head { display: flex; align-items: flex-start; gap: 12px; padding-right: 30px; }
.mh__max { flex: none; display: block; width: 88px; height: 88px; --max-zoom: 1.5; /* he is drawn small inside his clip's frame */ }
.mh__say { margin: 4px 0 0; min-height: 3em; font-size: 1.04rem; line-height: 1.45; font-weight: 500; color: var(--warm-ink, #f7efe6); text-wrap: pretty; }
.mh__say .mh__txt { cursor: default; }
.mh__txt.is-typing::after { content: ""; display: inline-block; width: .45em; height: .45em; margin-left: .2em; border-radius: 50%; background: #e43ffb; box-shadow: 0 0 8px #e43ffb; vertical-align: .1em; animation: mh-tick 700ms ease-in-out infinite; }
@keyframes mh-tick { 50% { opacity: .25; transform: scale(.7); } }

/* ask */
.mh__ask {
  display: flex; align-items: center; gap: 6px; margin: 14px 0 0; padding: 4px 4px 4px 16px;
  background: #1d1927; border: 1px solid var(--line-strong); border-radius: 999px;
  transition: border-color 200ms, box-shadow 300ms;
}
.mh__ask:focus-within { border-color: var(--sc-accent); box-shadow: 0 0 0 4px rgb(143 60 250 / .18); }
.mh__ask input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--sc-ink);
  font: inherit; font-size: 16px; line-height: 1.3; padding: 9px 0;
}
.mh__ask input::placeholder { color: #8a83a0; }
.mh__go {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--line-strong); color: #fff; transition: background 200ms;
}
.mh__go.is-ready { background: linear-gradient(135deg, var(--sc-accent), #e43ffb); }
.mh__go svg { width: 18px; height: 18px; }

/* body: chips, an answer */
.mh__body { margin-top: 14px; }
.mh__label { margin: 0 0 8px; font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--sc-ink-soft); }
.mh__chips { display: flex; flex-wrap: wrap; gap: 7px; }
.mh__chip {
  display: inline-flex; align-items: center; min-height: 38px; padding: 7px 14px; border-radius: 999px; line-height: 1.2; text-align: left;
  border: 1px solid var(--line-strong); background: #1d1927; color: var(--sc-ink);
  font: inherit; font-size: .92rem; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: border-color 160ms, background-color 160ms;
}
.mh__chip--ghost { background: transparent; color: var(--sc-ink-soft); }
.mh__chip--go { border-color: rgb(228 63 251 / .55); }
@media (hover: hover) and (pointer: fine) { .mh__chip:hover { border-color: var(--violet-text); } }
.mh__chip:focus-visible, .mh__close:focus-visible, .mh__go:focus-visible, .mh__foot a:focus-visible, .mh__ans a:focus-visible, .mh__links a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.mh__ans h3 { margin: 0 0 4px; font-size: 1.02rem; font-weight: 600; line-height: 1.3; color: var(--sc-ink); }
.mh__where { margin: 0 0 10px; font-size: .78rem; color: var(--sc-ink-soft); }
.mh__ans ol, .mh__ans ul { margin: 0 0 12px; padding: 0 0 0 1.3em; }
.mh__ans li { margin: 0 0 6px; font-size: .95rem; line-height: 1.45; color: var(--sc-ink); }
.mh__ans ol li::marker { color: var(--violet-text); font-weight: 600; }
.mh__ans dl { margin: 0 0 12px; }
.mh__ans dt { font-size: .93rem; font-weight: 600; color: var(--sc-ink); }
.mh__ans dd { margin: 0 0 8px; font-size: .92rem; line-height: 1.45; color: var(--sc-ink-soft); }
.mh__tips { list-style: none; padding: 10px 12px !important; border-radius: 12px; background: rgb(143 60 250 / .09); border: 1px solid rgb(143 60 250 / .22); }
.mh__tips li { color: var(--sc-ink-soft); font-size: .9rem; }
.mh__tips li:last-child { margin-bottom: 0; }
.mh__cta {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 16px; margin: 0 0 14px;
  border-radius: 999px; background: linear-gradient(135deg, var(--sc-accent), #e43ffb); color: #fff;
  font-weight: 600; font-size: .95rem; text-decoration: none;
}
.mh__links { display: flex; flex-direction: column; gap: 8px; margin: 0 0 6px; }
.mh__links a { color: var(--violet-text); font-weight: 600; text-decoration: none; }
.mh__links a:hover { text-decoration: underline; }
.mh__more { margin-top: 10px; }

/* the footer link, always there */
.mh__foot { flex: none; padding: 12px 18px 14px; border-top: 1px solid var(--line); }
.mh__foot a { color: var(--violet-text); font-weight: 600; font-size: .95rem; text-decoration: none; }
.mh__foot a:hover { text-decoration: underline; }

.mh-scrim { position: fixed; inset: 0; z-index: 79; background: rgb(8 6 12 / .62); }
.mh-scrim[hidden] { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .mh.is-in { animation: mh-pop 220ms cubic-bezier(.22, 1, .36, 1) both; transform-origin: 100% 100%; }
  .mh__fade { animation: mh-fade 320ms ease both; }
  .mh-scrim.is-in { animation: mh-fade 220ms ease both; }
}
@keyframes mh-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes mh-fade { from { opacity: 0; } }

/* phones: a bottom sheet */
@media (max-width: 860px) {
  .mh {
    top: auto; left: 0; right: 0; bottom: 0;
    width: auto; max-height: 85vh; max-height: 85dvh;
    border-radius: 20px 20px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mh__grab { display: block; flex: none; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 999px; background: var(--line-strong); }
  .mh__close { top: 12px; right: 12px; width: 40px; height: 40px; background: rgb(243 240 250 / .06); }
  .mh__scroll { padding-top: 10px; }
  .mh__chip { min-height: 44px; }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .mh.is-in { animation: mh-up 300ms cubic-bezier(.22, 1, .36, 1) both; }
}
@keyframes mh-up { from { transform: translateY(100%); } }

/* An answer that opens with one button or step: its name is bold, then where it lives */
.mh__txt strong { font-weight: 700; }
.mh__part { margin: 0 0 6px; font-size: .84rem; font-weight: 600; color: var(--sc-ink-soft); }
.mh__what { margin: 0 0 12px; font-size: .92rem; line-height: 1.45; color: var(--sc-ink-soft); }
