/* Hartvig, the BaseHeart mascot, at the sidebar logo. He stands in the logo's
   place holding the B over his head; hartvig-mascot.mjs plays the rope-and-catch
   intro in .hartvig-flight above the page. No sound. */
.sidebar .baseheart-brand-switcher.has-hartvig { position: relative; }
.has-hartvig .baseheart-brand-mark > svg { opacity: 0; }
.has-hartvig.hartvig-pending .baseheart-brand-mark > svg { opacity: 1; }
/* Centered on the 44px mark: the button's 9px padding plus half the mark. */
.hartvig-stage {
  position: absolute;
  left: 31px;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 62px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.hartvig-pending > .hartvig-stage,
.hartvig-stage.is-waiting { opacity: 0; }
.hartvig-body { position: absolute; left: 0; top: 14px; width: 48px; height: 48px; }
.hartvig-logo {
  position: absolute;
  left: 15px;
  top: 9px;
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 0 4px rgba(255,49,167,.55)) drop-shadow(0 0 9px rgba(121,58,255,.25));
}
.hartvig-body svg, .hartvig-logo svg,
.hartvig-flight svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sidebar .baseheart-brand-switcher:hover .hartvig-body,
.sidebar .baseheart-brand-switcher:focus-visible .hartvig-body { animation: hartvig-hop .5s cubic-bezier(.3,1.5,.5,1); }
.sidebar .baseheart-brand-switcher:hover .hartvig-logo,
.sidebar .baseheart-brand-switcher:focus-visible .hartvig-logo { animation: hartvig-hop .5s cubic-bezier(.3,1.5,.5,1); }
@keyframes hartvig-hop { 0%,100% { transform: translateY(0); } 45% { transform: translateY(-4px); } }

.hartvig-flight { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; overflow: hidden; }
.hartvig-flight > * { position: absolute; will-change: transform, opacity; }
.hartvig-swing { width: 0; height: 0; transform-origin: 0 0; }
.hartvig-rope {
  position: absolute;
  left: -1px;
  top: 0;
  width: 3px;
  border-radius: 2px;
  /* A twisted tan rope, never pink, so it is never read as one of his arms. */
  background: repeating-linear-gradient(160deg, rgba(138,98,56,.55) 0 1.5px, transparent 1.5px 4.5px), linear-gradient(180deg, #f1dfbd, #c99b62);
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transform-origin: 50% 0;
}
.hartvig-rope::before {
  content: '';
  position: absolute;
  left: -3px;
  top: -3px;
  width: 4px;
  height: 4px;
  border: 2px solid #c99b62;
  border-radius: 50%;
}
.hartvig-hanger { position: absolute; width: 48px; height: 48px; }
.hartvig-rope-svg { left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.hartvig-rope-svg .hartvig-rope-line, .hartvig-rope-svg .hartvig-lasso { filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.hartvig-rope-layer .hartvig-hanger { left: 0; top: 0; }
.hartvig-jumper { width: 48px; height: 48px; transform-origin: 50% 100%; }
.hartvig-flyer { filter: drop-shadow(0 0 5px rgba(255,49,167,.6)) drop-shadow(0 0 12px rgba(121,58,255,.3)); }
.hartvig-spark {
  width: 8px;
  height: 8px;
  background: #ff8cc0;
  clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%);
}
.hartvig-spark.gold { background: #ffd36e; }
.hartvig-dot { width: 4px; height: 4px; border-radius: 50%; background: #ff6fb8; box-shadow: 0 0 6px rgba(255,79,168,.8); }
.hartvig-dot.violet { background: #b98bff; box-shadow: 0 0 6px rgba(150,95,255,.75); }

@media (max-width:720px) {
  .hartvig-stage { left: 29px; transform: translate(-50%, -50%) scale(.9); }
}
@media (prefers-reduced-motion: reduce) {
  .hartvig-flight { display: none; }
  .sidebar .baseheart-brand-switcher:hover .hartvig-body,
  .sidebar .baseheart-brand-switcher:hover .hartvig-logo,
  .sidebar .baseheart-brand-switcher:focus-visible .hartvig-body,
  .sidebar .baseheart-brand-switcher:focus-visible .hartvig-logo { animation: none; }
}

/* While Hartvig visits the Build button the logo goes back to normal. */
.hartvig-away > .hartvig-stage { opacity: 0; }
.has-hartvig.hartvig-away .baseheart-brand-mark > svg { opacity: 1; }

/* Hartvig on the Build button (hartvig-buddy.mjs), with his speech bubble. */
.hartvig-perch-host { position: relative; }
.hartvig-perch {
  position: absolute;
  z-index: 3;
  width: 48px;
  height: 48px;
  pointer-events: none;
  transform-origin: 50% 100%;
}
.hartvig-perch > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hartvig-perch.is-hopping { animation: hartvig-perch-hop .45s cubic-bezier(.3,1.5,.5,1); }
@keyframes hartvig-perch-hop { 0%,100% { transform: translateY(0) scale(1,1); } 40% { transform: translateY(-9px) scale(.96,1.05); } 75% { transform: translateY(0) scale(1.06,.93); } }
.hartvig-bubble {
  position: absolute;
  right: 40px;
  bottom: 38px;
  width: max-content;
  max-width: min(240px, 60vw);
  padding: 7px 11px;
  border: 1px solid rgba(240,68,145,.45);
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(135deg, #2a1a35, #1d1626);
  box-shadow: 0 8px 24px rgba(0,0,0,.35), 0 0 16px rgba(240,68,145,.18);
  color: #f7f3fa;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
  white-space: normal;
  transform-origin: 100% 100%;
  animation: hartvig-bubble-in .35s cubic-bezier(.3,1.4,.5,1);
}
html[dir="rtl"] .hartvig-bubble { direction: rtl; }
@keyframes hartvig-bubble-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
html[data-theme="light"] .hartvig-bubble { background: linear-gradient(135deg, #fff4fa, #f3ecfb); color: #2a1730; border-color: rgba(240,68,145,.5); box-shadow: 0 8px 22px rgba(60,20,60,.14); }
@media (prefers-reduced-motion: reduce) {
  .hartvig-perch.is-hopping, .hartvig-bubble { animation: none; }
}

/* Now and then he changes position at the logo (hartvig-tips.mjs). */
.hartvig-stage.idle-toss .hartvig-logo { animation: hartvig-toss 1.5s cubic-bezier(.3,.7,.4,1); }
@keyframes hartvig-toss {
  0% { transform: translateY(0) rotate(0); }
  45% { transform: translateY(-30px) rotate(200deg); }
  80% { transform: translateY(1px) rotate(360deg); }
  100% { transform: translateY(0) rotate(360deg); }
}
.hartvig-stage.idle-toss .hartvig-body { animation: hartvig-catch 1.5s ease-in-out; }
@keyframes hartvig-catch { 0%,60%,100% { transform: translateY(0); } 72% { transform: translateY(-3px); } 85% { transform: translateY(1px) scale(1.04,.95); } }
.hartvig-stage.idle-hop .hartvig-body,
.hartvig-stage.idle-hop .hartvig-logo { animation: hartvig-double-hop 1.3s cubic-bezier(.3,1.4,.5,1); }
@keyframes hartvig-double-hop { 0%,40%,100% { transform: translateY(0); } 20%,62% { transform: translateY(-6px); } 80% { transform: translateY(0); } }
/* Waving and sitting: the B rests on his head. */
.hartvig-stage.idle-wave .hartvig-logo,
.hartvig-stage.idle-sit .hartvig-logo { transform: translateY(6px) rotate(-8deg); transition: transform .3s ease; }
.hartvig-stage.idle-sit .hartvig-body { transform: translateY(8px); transition: transform .3s ease; }
.hartvig-stage.idle-sit .hartvig-logo { transform: translate(0, 13px) rotate(-8deg); }

/* Studio unfolds smoothly when Hartvig opens it for a tip. */
.hartvig-unfold > .nav-group-panel { animation: hartvig-unfold .38s cubic-bezier(.2,.8,.3,1); transform-origin: top; }
@keyframes hartvig-unfold { from { opacity: 0; transform: scaleY(.6); } to { opacity: 1; transform: scaleY(1); } }

/* His tip about another tool, and his hello, beside the sidebar. */
.hartvig-hello { border-radius: 16px 16px 16px 6px; }
.hartvig-tip-layer { overflow: visible; }
.hartvig-tip {
  position: absolute;
  width: min(300px, calc(100vw - 300px));
  padding: 12px 34px 12px 14px;
  border: 1px solid rgba(240,68,145,.42);
  border-radius: 6px 16px 16px 16px;
  background: linear-gradient(135deg, #261830, #19141f);
  box-shadow: 0 14px 34px rgba(0,0,0,.42), 0 0 22px rgba(240,68,145,.14);
  color: #f4eff8;
  font-size: 13px;
  line-height: 1.45;
  pointer-events: auto;
  opacity: 0;
  transform: translate(-6px, -50%) scale(.94);
  transform-origin: 0 50%;
  transition: opacity .25s ease, transform .3s cubic-bezier(.3,1.3,.5,1);
}
.hartvig-tip.is-open { opacity: 1; transform: translate(0, -50%) scale(1); }
.hartvig-tip-text { margin: 0; }
.hartvig-tip-actions { display: flex; gap: 8px; margin-top: 9px; }
.hartvig-tip .hartvig-tip-show {
  border: 0;
  border-radius: 999px;
  padding: 5px 13px;
  background: linear-gradient(90deg, #f04491, #b14cff) !important;
  color: #fff !important;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.hartvig-tip .hartvig-tip-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #a69fb4;
  font-size: 12px;
  cursor: pointer;
}
.hartvig-tip .hartvig-tip-close:hover, .hartvig-tip .hartvig-tip-close:focus-visible { background: rgba(255,255,255,.08); color: #fff; }
.hartvig-tip-show:focus-visible, .hartvig-tip-close:focus-visible { outline: 2px solid #ff8cc0; outline-offset: 2px; }
.hartvig-tip .hartvig-tip-never { border: 0; background: transparent; color: #a69fb4; font: inherit; font-size: 12px; padding: 5px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.hartvig-tip .hartvig-tip-never:hover, .hartvig-tip .hartvig-tip-never:focus-visible { color: #fff; }
html[data-theme="light"] .hartvig-tip .hartvig-tip-never { color: #6d6275; }
html[data-theme="light"] .hartvig-tip .hartvig-tip-never:hover { color: #2a1730; }
.hartvig-tip-actions { align-items: center; flex-wrap: wrap; }
html[dir="rtl"] .hartvig-tip { direction: rtl; }
html[data-theme="light"] .hartvig-tip { background: linear-gradient(135deg, #fff5fa, #f3edfb); color: #2a1730; box-shadow: 0 12px 28px rgba(60,20,60,.14); }
html[data-theme="light"] .hartvig-tip-close { color: #6d6275; }
@media (prefers-reduced-motion: reduce) {
  .hartvig-tip-layer { display: block; }
  .hartvig-tip { transition: none; }
  .hartvig-unfold > .nav-group-panel, .hartvig-stage[class*="idle-"] * { animation: none !important; }
}

/* "Ask Hartvig" in the search palette (hartvig-ask.mjs). */
.hartvig-ask { display: flex; gap: 10px; align-items: flex-start; align-self: start; margin: 0; padding: 10px 12px; border: 1px solid rgba(240,68,145,.32); border-radius: 14px; background: linear-gradient(135deg, rgba(240,68,145,.10), rgba(177,76,255,.08)); color: #f3eef8; }
.hartvig-ask-avatar { flex: 0 0 auto; width: 38px; height: 38px; }
.hartvig-ask-avatar svg { display: block; width: 100%; height: 100%; }
.hartvig-ask-copy { min-width: 0; flex: 1; }
.hartvig-ask-line { margin: 2px 0 0; font-size: 13px; line-height: 1.45; }
.hartvig-ask-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hartvig-ask-chips:not(:empty) { margin-top: 8px; }
/* !important: the app clears every button's background and border. */
.hartvig-ask .hartvig-ask-chip { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; border: 1px solid rgba(255,255,255,.14) !important; border-radius: 999px; padding: 6px 13px; background: rgba(255,255,255,.05) !important; color: inherit; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.hartvig-ask .hartvig-ask-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hartvig-ask .hartvig-ask-chip:hover { border-color: rgba(240,68,145,.6) !important; background: rgba(240,68,145,.12) !important; }
.hartvig-ask .hartvig-ask-chip.is-sure { padding: 8px 16px; border-color: transparent !important; background: linear-gradient(90deg, #f04491, #b14cff) !important; color: #fff; font-size: 13.5px; box-shadow: 0 6px 18px rgba(240,68,145,.3) !important; }
.hartvig-ask .hartvig-ask-chip:focus-visible { outline: 2px solid #ff8cc0; outline-offset: 2px; }
.hartvig-ask-has .command-empty { display: none; }
html[data-theme="light"] .hartvig-ask { background: linear-gradient(135deg, #fff5fa, #f3edfb); color: #2a1730; }
html[data-theme="light"] .hartvig-ask .hartvig-ask-chip { border-color: rgba(42,23,48,.16) !important; background: rgba(255,255,255,.7) !important; }
html[data-theme="light"] .hartvig-ask .hartvig-ask-chip.is-sure { background: linear-gradient(90deg, #f04491, #b14cff) !important; color: #fff; }
.hartvig-ask[hidden] { display: none; }
#commandDialog .baseheart-command-content:has(> .hartvig-ask:not([hidden])) { grid-template-rows: auto auto auto minmax(0,1fr) auto; }
/* The panel under the search field holds only his picks; what he says is in
   the bubble over his head. Without the side (phone preview) it shows here. */
.hartvig-ask .hartvig-ask-avatar, .hartvig-ask .hartvig-ask-line { display: none; }
.hartvig-ask .hartvig-ask-chips:not(:empty) { margin-top: 0; }
body[data-preview-device="mobile"] .hartvig-ask .hartvig-ask-avatar { display: block; }
body[data-preview-device="mobile"] .hartvig-ask .hartvig-ask-line { display: block; margin-bottom: 8px; }

/* Hartvig in person on the palette's left side, answering in a speech bubble. */
.baseheart-command-sidebar.has-hartvig .baseheart-hub-gem,
.baseheart-command-sidebar.has-hartvig .baseheart-hub-metrics { display: none; }
.baseheart-command-sidebar.has-hartvig .baseheart-hub-brand { padding-top: 0; }
.hartvig-ask-hero { display: grid; justify-items: center; gap: 12px; padding-top: 4px; }
.hartvig-ask-bubble { position: relative; justify-self: stretch; margin: 0; padding: 12px 14px; border: 1px solid rgba(240,68,145,.4); border-radius: 16px; background: #201b25; color: #f4eff8; font-size: 13.5px; line-height: 1.45; text-align: center; overflow-wrap: anywhere; box-shadow: 0 10px 28px rgba(0,0,0,.28); }
.hartvig-ask-bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; margin-left: -6px; border: inherit; border-top: 0; border-left: 0; background: inherit; transform: rotate(45deg); }
.hartvig-ask-figure { display: block; width: 118px; height: 118px; transform-origin: 50% 100%; transition: transform .25s ease, opacity .15s ease; filter: drop-shadow(0 10px 18px rgba(240,68,145,.25)); }
.hartvig-ask-figure svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hartvig-ask-hero.is-listening .hartvig-ask-figure { animation: hartvig-ask-listen .32s ease-in-out infinite alternate; }
.hartvig-ask-hero.is-unsure .hartvig-ask-figure { transform: rotate(-9deg); }
.hartvig-ask-hero.is-sure:not(.is-listening) .hartvig-ask-figure { animation: hartvig-ask-cheer .55s cubic-bezier(.3,.7,.3,1); }
.hartvig-ask-hero.is-away .hartvig-ask-figure { opacity: 0; animation: none; }
@keyframes hartvig-ask-listen { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-4px) rotate(3deg); } }
@keyframes hartvig-ask-cheer { 0% { transform: none; } 25% { transform: scale(1.08,.9); } 60% { transform: translateY(-16px) scale(.95,1.06); } 100% { transform: none; } }
/* The row or chip he lands on gives way under him. */
#commandDialog .hartvig-pressing { transform: scale(.97); border-color: rgba(240,68,145,.7) !important; box-shadow: 0 0 0 3px rgba(240,68,145,.22), inset 3px 0 #ef3f88 !important; transition: transform .12s ease; }
html[data-theme="light"] .hartvig-ask-bubble { background: #fff; color: #2a1730; border-color: rgba(240,68,145,.35); box-shadow: 0 10px 24px rgba(60,20,60,.12); }
@media (max-width:720px) {
  .baseheart-command-sidebar.has-hartvig { grid-template-columns: minmax(0,1fr); }
  .baseheart-command-sidebar.has-hartvig .baseheart-hub-brand { display: none; }
  .hartvig-ask-hero { grid-template-columns: 58px minmax(0,1fr); align-items: center; justify-items: start; gap: 12px; padding-top: 0; }
  .hartvig-ask-figure { grid-row: 1; grid-column: 1; width: 58px; height: 58px; }
  .hartvig-ask-bubble { grid-row: 1; grid-column: 2; padding: 9px 12px; font-size: 13px; text-align: start; }
  .hartvig-ask-bubble::after { left: -7px; top: 50%; bottom: auto; margin: -6px 0 0; border: inherit; border-top: 0; border-right: 0; }
  html[dir="rtl"] .hartvig-ask-bubble::after { left: auto; right: -7px; border: inherit; border-bottom: 0; border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hartvig-ask-figure { transition: none; }
  .hartvig-ask-hero .hartvig-ask-figure { animation: none !important; }
}

/* Late at night (hartvig-mascot.mjs hatNow): under the nightcap he yawns now
   and then, eyes half shut. Hidden without motion. */
.hartvig-yawn-mouth, .hartvig-yawn-lid { transform-box: fill-box; animation: hartvig-yawn 11s ease-in-out infinite; }
.hartvig-yawn-mouth { transform-origin: 50% 0; }
.hartvig-yawn-lid { transform-origin: 50% 0; }
@keyframes hartvig-yawn {
  0%, 78%, 100% { opacity: 0; transform: scaleY(.15); }
  82%, 92% { opacity: 1; transform: scaleY(1); }
  96% { opacity: 0; transform: scaleY(.3); }
}
@media (prefers-reduced-motion: reduce) { .hartvig-yawn-mouth, .hartvig-yawn-lid { animation: none; } }
