/* Robot Kitchen guided-help launcher. Same-origin only. Marketing pages. */
/* The launcher and panel are mounted on <html>, outside <body>, so they
   cannot inherit body's font or line-height: set them here. */
.rk-help-launcher,
.rk-help-panel {
  font-family: var(--font, "Inter", "Noto Sans TC", system-ui, -apple-system, sans-serif);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html[lang^="zh"] .rk-help-launcher,
html[lang^="zh"] .rk-help-panel {
  font-family: "Noto Sans TC", "Inter", system-ui, -apple-system, sans-serif;
  line-height: 1.7;
}
.rk-help-panel button,
.rk-help-panel input,
.rk-help-panel textarea {
  font-family: inherit;
}

.rk-help-launcher {
  position: fixed;
  /* Topmost layer: above header (40), grain (50), cookie bar and US
     accent (60), search (70), demo-quote modal (9990) and all content. */
  z-index: 2147483000;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  width: auto;
  height: 60px;
  min-width: 60px;
  min-height: 60px;
  margin: 0;
  margin-bottom: var(--rk-dock, 0px);
  padding: 0 0.7rem 0 0.3rem;
  border: 1px solid rgba(10, 186, 181, 0.38);
  border-radius: 16px;
  background-color: #000;
  color: #0abab5;
  box-shadow: 0 0 4px rgba(10, 186, 181, 0.16);
  cursor: pointer;
  touch-action: manipulation;
  appearance: none;
  -webkit-appearance: none;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  animation: rk-help-frame 3.6s ease-in-out infinite;
  /* Own compositing layer so iOS Safari repaints it pinned to the
     viewport during momentum scroll and at the footer bounce. */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.rk-help-launcher-icon,
.rk-help-launcher img {
  background-color: #000;
}

.rk-help-launcher img {
  width: 50px;
  height: 50px;
  display: block;
  object-fit: contain;
}

.rk-help-launcher-label {
  color: #0abab5;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

@keyframes rk-help-frame {
  0%,
  100% {
    border-color: rgba(10, 186, 181, 0.32);
    box-shadow: 0 0 3px rgba(10, 186, 181, 0.14);
  }
  50% {
    border-color: rgba(10, 186, 181, 0.62);
    box-shadow: 0 0 6px rgba(10, 186, 181, 0.28);
  }
}

.rk-help-launcher:hover,
.rk-help-launcher:active {
  background-color: #000;
}

.rk-help-launcher:focus-visible,
.rk-help-panel :focus-visible {
  outline: 2px solid #0abab5;
  outline-offset: 2px;
}

.rk-help-panel {
  position: fixed;
  z-index: 2147483000;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(60px + 14px + max(16px, env(safe-area-inset-bottom, 0px)));
  width: min(23.5rem, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-height: min(
    26rem,
    calc(
      100dvh - 60px - 14px - max(16px, env(safe-area-inset-bottom, 0px)) -
        max(16px, env(safe-area-inset-top, 0px)) - 7.25rem
    )
  );
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f5f5f5;
  background: #070707;
  color-scheme: dark;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.rk-help-panel[hidden] {
  display: none !important;
}

.rk-help-panel.is-open {
  animation: rk-help-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rk-help-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rk-help-head {
  position: relative;
  flex: 0 0 auto;
  padding: 1rem 3rem 0.85rem 1.05rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rk-help-heading {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.rk-help-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  background: #000;
}

.rk-help-mark img {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
}

.rk-help-titles {
  min-width: 0;
}

.rk-help-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.rk-help-note {
  margin: 0.35rem 0 0;
  color: #9a9a9a;
  font-size: 0.8rem;
  line-height: 1.4;
}

.rk-help-close {
  position: absolute;
  top: 0.45rem;
  right: 0.35rem;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #d0d0d0;
  cursor: pointer;
  touch-action: manipulation;
}

.rk-help-close svg {
  width: 16px;
  height: 16px;
  display: block;
}

.rk-help-close:hover {
  color: #0abab5;
}

.rk-help-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem 1rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(10, 186, 181, 0.55) transparent;
}

.rk-help-section-label {
  margin: 0.2rem 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #8d8d8d;
}

.rk-help-faqs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rk-help-faq-q {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: #f5f5f5;
  font-size: 0.9rem;
  line-height: 1.35;
  cursor: pointer;
  touch-action: manipulation;
}

.rk-help-faq-q[aria-expanded="true"] {
  border-color: rgba(10, 186, 181, 0.45);
}

.rk-help-faq-a {
  margin: 0;
  padding: 0.35rem 0.15rem 0.55rem;
  color: #a3a3a3;
  font-size: 0.84rem;
  line-height: 1.55;
}

.rk-help-faq-a p {
  margin: 0.45rem 0 0;
}

.rk-help-faq-a p:first-child {
  margin-top: 0.15rem;
}

.rk-help-pair {
  margin: 0.65rem 0 0;
}

.rk-help-pair strong {
  display: block;
  color: #f5f5f5;
  font-weight: 500;
  font-size: 0.84rem;
}

.rk-help-pair span {
  display: block;
}

.rk-help-next {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0 0.35rem;
}

.rk-help-next a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f5f5f5;
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.3;
  touch-action: manipulation;
}

.rk-help-next a:hover {
  border-color: rgba(10, 186, 181, 0.7);
  color: #f5f5f5;
}

.rk-help-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rk-help-intro {
  margin: 0;
  color: #a3a3a3;
  font-size: 0.84rem;
  line-height: 1.5;
}

.rk-help-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.rk-help-field label {
  font-size: 0.78rem;
  color: #a3a3a3;
}

.rk-help-field .rk-help-req {
  color: #a3a3a3;
}

.rk-help-panel input,
.rk-help-panel textarea {
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #0c0c0c;
  color: #f5f5f5;
  font-size: 16px;
  line-height: 1.4;
}

.rk-help-panel textarea {
  resize: vertical;
  min-height: 5.5rem;
}

.rk-help-panel input::placeholder,
.rk-help-panel textarea::placeholder {
  color: #858585;
}

.rk-help-send {
  align-self: flex-start;
  min-height: 44px;
  margin: 0.15rem 0 0;
  padding: 0.55rem 1.05rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
}

.rk-help-send:disabled {
  opacity: 0.6;
  cursor: progress;
}

.rk-help-status {
  margin: 0.15rem 0 0;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.rk-help-status--ok {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #a3a3a3;
}

.rk-help-status--err {
  border: 1px solid rgba(220, 80, 80, 0.45);
  background: rgba(220, 80, 80, 0.08);
  color: #f0b4b4;
}

.rk-help-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

body.rk-help-on {
  padding-bottom: calc(72px + max(16px, env(safe-area-inset-bottom, 0px)));
}

@media (max-width: 420px) {
  .rk-help-launcher-label {
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rk-help-panel.is-open {
    animation: none;
  }

  .rk-help-launcher {
    animation: none;
    border-color: rgba(10, 186, 181, 0.45);
    box-shadow: 0 0 4px rgba(10, 186, 181, 0.18);
  }

  .rk-help-launcher,
  .rk-help-panel,
  .rk-help-faq-q,
  .rk-help-send,
  .rk-help-close,
  .rk-help-next a {
    transition: none;
  }
}

@media (forced-colors: active) {
  .rk-help-launcher,
  .rk-help-panel,
  .rk-help-faq-q,
  .rk-help-close,
  .rk-help-next a {
    border: 1px solid CanvasText;
  }
}

@media print {
  .rk-help-launcher,
  .rk-help-panel {
    display: none !important;
  }
}

/* 2026-11-10: keep the last lines of the page clear of the fixed "Ask me" pill. */
body.rk-help-on .site-footer { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
/* 2026-11-13: on mobile the pill docks beside .footer-brand, so the extra
   clearance under the footer links is no longer needed. */
@media (max-width: 640px) {
  body.rk-help-on .site-footer { padding-bottom: 2.25rem; }
}

/* Mobile: icon-only round launcher so it does not cover hero CTAs. Desktop pill is unchanged. */
@media (max-width: 640px) {
  /* Mobile keeps the full pill (pig + "Ask me" / "問我"), just compact, so it
     fits beside the hero VETERAN-OWNED badge and never covers hero buttons. */
  .rk-help-launcher {
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 0.62rem 0 0.2rem;
    gap: 0.1rem;
    border-radius: 14px;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  .rk-help-launcher-label {
    font-size: 0.86rem;
  }
  .rk-help-launcher img {
    width: 38px;
    height: 38px;
  }
  .rk-help-panel {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(44px + 12px + max(12px, env(safe-area-inset-bottom, 0px)));
  }
}

/* 2026-11-12 iOS Safari root cause: body { overflow-x: hidden } makes
   body's computed overflow-y "auto", which iOS Safari can treat as a
   scroll container that traps position:fixed (the launcher sticks to the
   page and slides under the footer). overflow-x: clip hides sideways
   overflow without creating a scroll container. The launcher and panel
   are also mounted on <html> (not <body>) by rk-help.js, and no ancestor
   (html) carries transform / filter / contain / will-change. */
@supports (overflow-x: clip) {
  body.rk-help-on {
    overflow-x: clip;
  }
}
html {
  transform: none;
  filter: none;
  contain: none;
}

/* Homepage (desktop and mobile): rk-help.js lifts the launcher to line up
   with the hero VETERAN-OWNED badge at the top of the page (scroll-linked,
   no easing so it never lags the scroll). */
.rk-help-launcher.is-following {
  will-change: transform;
}

/* 2026-11-18: on phones, hide the launcher until JS has measured the
   VETERAN-OWNED badge and set --rk-glide-d / .rk-glide-css, so the first
   visible frame is already at the badge (not a snap up from bottom-right).
   Desktop (>=900px) is unchanged — this rule does not apply there. */
@media (max-width: 899px) {
  .rk-help-launcher:not(.rk-glide-ready),
  .rk-help-tail:not(.rk-glide-ready) {
    visibility: hidden;
    opacity: 0;
  }
}


/* 2026-11-13: mobile footer dock. --rk-dock lifts the parked launcher so
   it stays parallel with the footer "Robot Kitchen" brand row and does
   not cover Cookie settings. Animated on the scroll timeline where
   supported; rk-help.js writes the same variable as a fallback. */
@property --rk-dock {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@keyframes rk-help-footer-dock {
  from { --rk-dock: 0px; }
  to { --rk-dock: var(--rk-footer-lift, 0px); }
}

/* 2026-11-13 iPhone glide fix. Where the browser supports scroll-driven
   animations (Safari 26+, Chrome 115+), the glide from the VETERAN-OWNED
   badge down to bottom-right runs as a CSS animation on the root scroll
   timeline, so it moves in the same frame as the scroll (no main-thread
   transform writes that iOS only applies after the gesture settles).
   rk-help.js sets --rk-glide-d (px between the badge-aligned start and the
   parked spot) and adds .rk-glide-css; elsewhere it writes the transform. */
@keyframes rk-help-glide {
  from {
    transform: translate3d(0, calc(-1 * var(--rk-glide-d, 0px)), 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@supports (animation-timeline: scroll()) {
  .rk-help-launcher.rk-glide-css {
    animation-name: rk-help-frame, rk-help-glide;
    animation-duration: 3.6s, 1ms;
    animation-timing-function: ease-in-out, linear;
    animation-iteration-count: infinite, 1;
    animation-fill-mode: none, both;
    animation-timeline: auto, scroll(root block);
    animation-range: normal, 0px var(--rk-glide-d, 0px);
    will-change: transform;
  }
  .rk-help-tail.rk-glide-css {
    animation-name: rk-help-glide;
    animation-duration: 1ms;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: scroll(root block);
    animation-range: 0px var(--rk-glide-d, 0px);
  }
  @media (prefers-reduced-motion: reduce) {
    .rk-help-launcher.rk-glide-css {
      animation-name: rk-help-glide;
      animation-duration: 1ms;
      animation-iteration-count: 1;
      animation-fill-mode: both;
      animation-timeline: scroll(root block);
      animation-range: 0px var(--rk-glide-d, 0px);
    }
  }
  .rk-help-launcher.rk-footer-dock-css,
  .rk-help-tail.rk-footer-dock-css {
    animation-name: rk-help-footer-dock;
    animation-duration: 1ms;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: scroll(root block);
    animation-range: var(--rk-footer-from, 0px) var(--rk-footer-to, 0px);
  }
  .rk-help-launcher.rk-glide-css.rk-footer-dock-css {
    animation-name: rk-help-frame, rk-help-glide, rk-help-footer-dock;
    animation-duration: 3.6s, 1ms, 1ms;
    animation-timing-function: ease-in-out, linear, linear;
    animation-iteration-count: infinite, 1, 1;
    animation-fill-mode: none, both, both;
    animation-timeline: auto, scroll(root block), scroll(root block);
    animation-range: normal, 0px var(--rk-glide-d, 0px), var(--rk-footer-from, 0px) var(--rk-footer-to, 0px);
  }
  .rk-help-tail.rk-glide-css.rk-footer-dock-css {
    animation-name: rk-help-glide, rk-help-footer-dock;
    animation-duration: 1ms, 1ms;
    animation-timing-function: linear, linear;
    animation-fill-mode: both, both;
    animation-timeline: scroll(root block), scroll(root block);
    animation-range: 0px var(--rk-glide-d, 0px), var(--rk-footer-from, 0px) var(--rk-footer-to, 0px);
  }
  @media (prefers-reduced-motion: reduce) {
    .rk-help-launcher.rk-glide-css.rk-footer-dock-css {
      animation-name: rk-help-glide, rk-help-footer-dock;
      animation-duration: 1ms, 1ms;
      animation-iteration-count: 1, 1;
      animation-fill-mode: both, both;
      animation-timeline: scroll(root block), scroll(root block);
      animation-range: 0px var(--rk-glide-d, 0px), var(--rk-footer-from, 0px) var(--rk-footer-to, 0px);
    }
  }
}

/* Luma-style stardust comet tail (IJen 2026-11-13: 想要 Rk 小豬往下移的時候
   可以拖這長尾). A glowing Tiffany / cyan ribbon with a white core and
   twinkling star motes trails above the pig while it glides down. It is
   decoration only: no pointer events, sits under the launcher so the pig
   and "Ask me" / "問我" stay crisp, and fades to 0 at the top and parked. */
.rk-help-tail {
  position: fixed;
  z-index: 2147482999;
  right: 16px;
  bottom: 46px;
  width: 120px;
  height: 250px;
  margin: 0;
  margin-bottom: var(--rk-dock, 0px);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: var(--rk-tail, 0);
  transition: opacity 0.16s ease-out;
  overflow: visible;
  contain: layout style;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.rk-help-tail:not(.is-on) .rk-help-tail-svg * {
  animation-play-state: paused;
}
/* 2026-11-17: when the bubble stops, the tail is gone at once (no ghost). */
.rk-help-tail:not(.is-on) {
  opacity: 0 !important;
  visibility: hidden;
  transition: opacity 0.1s linear, visibility 0s linear 0.1s;
}

.rk-help-tail-inner {
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
  transform: scaleY(var(--rk-tail-stretch, 1));
  transition: transform 0.25s ease-out;
  filter: drop-shadow(0 0 5px rgba(107, 247, 255, 0.9)) drop-shadow(0 0 16px rgba(10, 186, 181, 0.7));
}

.rk-help-tail-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.rk-help-tail-glow {
  opacity: 0.85;
  animation: rk-help-tail-breathe 1.6s ease-in-out infinite;
}

.rk-help-tail-plasma {
  animation: rk-help-tail-breathe 1.1s ease-in-out infinite reverse;
}

.rk-help-tail-core {
  opacity: 0.95;
  animation: rk-help-tail-core 0.9s ease-in-out infinite;
}

.rk-help-tail-head {
  animation: rk-help-tail-breathe 1.3s ease-in-out infinite;
}

.rk-help-tail-mote {
  fill: #ffffff;
  transform-box: fill-box;
  transform-origin: center;
  animation: rk-help-tail-twinkle 1.7s ease-in-out infinite;
}

.rk-help-tail-dot {
  fill: #c9fdff;
  animation: rk-help-tail-dot 1.25s ease-in-out infinite;
}

@keyframes rk-help-tail-breathe {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

@keyframes rk-help-tail-core {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

@keyframes rk-help-tail-twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.55) rotate(0deg); }
  45% { opacity: 1; transform: scale(1.15) rotate(22deg); }
  70% { opacity: 0.6; transform: scale(0.8) rotate(35deg); }
}

@keyframes rk-help-tail-dot {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.95; }
}

@media (max-width: 640px) {
  .rk-help-tail {
    height: 200px;
  }
}

@media (prefers-reduced-motion: reduce), (forced-colors: active) {
  .rk-help-tail {
    display: none !important;
  }
}

@media print {
  .rk-help-tail {
    display: none !important;
  }
}

/* 2026-11-17 Leave a message: free preview request */
.rk-help-intro--q {
  color: #e8fffe;
  font-weight: 600;
}
.rk-help-intro--soft {
  opacity: 0.78;
  font-size: 0.86em;
}
.rk-help-turnstile {
  margin: 0.5rem 0 0.75rem;
  min-height: 65px;
}
.rk-help-turnstile[hidden] {
  display: none;
}

/* 2026-11-18 (IJen, Ask me on every page): phones only. On marketing pages
   without the hero badge the pig starts beside the page's top line
   ([data-rk-pig-anchor="pad"]); keep that line's text clear of the pill.
   Desktop (>=641px) is untouched. */
@media (max-width: 640px) {
  body.rk-help-on [data-rk-pig-anchor="pad"] {
    padding-right: 112px;
  }
}
/* Tablet widths (641–899px) use the larger pill, which is taller than the
   eyebrow line, so the page title right under it also keeps clear. */
@media (min-width: 641px) and (max-width: 899px) {
  body.rk-help-on [data-rk-pig-anchor="pad"],
  body.rk-help-on [data-rk-pig-anchor="pad"] + h1 {
    padding-right: 140px;
  }
}
